【问题标题】:Error SDB connection in JenaJena 中的错误 SDB 连接
【发布时间】:2012-03-26 09:38:28
【问题描述】:

我尝试使用 SDB 将 Jena 与 Oracle 数据库连接,但是当我编译代码时出现错误,我不知道这意味着什么:

线程 "main" org.openjena.riot.RiotException 中的异常:代码:SCHEME 中的 11/LOWERCASE_PREFERRED:此组件中首选小写

我使用的 sdb.ttl 文件:

@prefix rdfs:     <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rdf:      <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ja:       <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix sdb:      <http://jena.hpl.hp.com/2007/sdb#> .

<#store> rdf:type sdb:Store ;
sdb:layout         "layout2/hash" ;
sdb:connection     <#conn> ;
<#conn> rdf:type sdb:SDBConnection ;

sdb:sdbType        "oracle" ;
sdb:sdbHost        "localhost" ;
sdb:sdbName        "XE" ;       # Oracle SID
sdb:driver         "oracle.jdbc.driver.OracleDriver" ;

# With OracleXE, it can be useful to use the user/password
# to give multiple stores in the same installation.
sdb:sdbUser        "m" ;
sdb:sdbPassword    "w" ;
.

我使用 SDB 的 Jena 类:

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.rdf.model.StmtIterator;
import com.hp.hpl.jena.sdb.SDBFactory;
import com.hp.hpl.jena.sdb.Store;


public class semantyka {

    public static void main(String [] argv)
    {
        Store store = SDBFactory.connectStore("D:\\pobrane\\SDB-1.3.4\\Store\\sdb.ttl") ;
        Model model = SDBFactory.connectDefaultModel(store) ;

        StmtIterator sIter = model.listStatements() ;
        for ( ; sIter.hasNext() ; )
        {
            Statement stmt = sIter.nextStatement() ;
            System.out.println(stmt) ;
        }
        sIter.close() ;
        store.close() ;
    }
}

出了什么问题,我该如何解决?

【问题讨论】:

  • 好的,我找到了answear。而不是"D:\\pobrane\\SDB-1.3.4\\Store\\sdb.ttl",应该是"file:///D:\\pobrane\\SDB-1.3.4\\Store\\sdb.ttl"

标签: java path jena


【解决方案1】:

来自Texicans 评论above

代替

"D:\\pobrane\\SDB-1.3.4\\Store\\sdb.ttl"

应该是

"file:///D:\\pobrane\\SDB-1.3.4\\Store\\sdb.ttl"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多