Cygwin上的tdbloader:Gettging FileNotFoundException:d:\ cygdrive \ d \ .... \ node2id.idn

时间:2012-06-13 06:28:26

标签: java jena

我是Jena / TDB的新手。我想要做的就是使用tdb脚本或java api从一些示例rdf,N3等文件加载数据。 我试图在Cygwin上使用tbdloader来加载数据(tdb-0.9.0,在Windows XP上使用IBM Java 1.6)。以下是我运行的命令:

$ export TDBROOT=/cygdrive/d/Project/Store_DB/jena-tdb-0.9.0-incubating
$ export PATH=$TDBROOT/bin:$PATH

我还在{em> tdbloader脚本中更改了 classpath ,如tdbloader on Cygwin: java.lang.NoClassDefFoundError所述:

exec java $JVM_ARGS $SOCKS -cp "PATH_OF_JAR_FILES" "tdb.$TDB_CMD" $TDB_SPEC "$@"

因此,当我运行$ tdbloader --help时,它会正确显示帮助。 但是当我跑步时

$ tdbloader --loc /cygdrive/d/Project/Store_DB/data1

OR

$ tdbloader --loc /cygdrive/d/Project/Store_DB/data1 test.rdf

我遇到以下异常:

        com.hp.hpl.jena.tdb.base.file.FileException: Failed to open: d:\cygdrive\d\Project\Store_DB\data1\node2id.idn (mode=rw)
        at com.hp.hpl.jena.tdb.base.file.ChannelManager.open$(ChannelManager.java:83)
        at com.hp.hpl.jena.tdb.base.file.ChannelManager.openref$(ChannelManager.java:58)
        at com.hp.hpl.jena.tdb.base.file.ChannelManager.acquire(ChannelManager.java:47)
        at com.hp.hpl.jena.tdb.base.file.FileBase.<init>(FileBase.java:57)
        at com.hp.hpl.jena.tdb.base.file.FileBase.<init>(FileBase.java:46)
        at com.hp.hpl.jena.tdb.base.file.FileBase.create(FileBase.java:41)
        at com.hp.hpl.jena.tdb.base.file.BlockAccessBase.<init>(BlockAccessBase.java:46)
        at com.hp.hpl.jena.tdb.base.block.BlockMgrFactory.createStdFile(BlockMgrFactory.java:98)
        at com.hp.hpl.jena.tdb.base.block.BlockMgrFactory.createFile(BlockMgrFactory.java:82)
        at com.hp.hpl.jena.tdb.base.block.BlockMgrFactory.create(BlockMgrFactory.java:58)
        at com.hp.hpl.jena.tdb.setup.Builder$BlockMgrBuilderStd.buildBlockMgr(Builder.java:196)
        at com.hp.hpl.jena.tdb.setup.Builder$RangeIndexBuilderStd.createBPTree(Builder.java:165)
        at com.hp.hpl.jena.tdb.setup.Builder$RangeIndexBuilderStd.buildRangeIndex(Builder.java:134)
        at com.hp.hpl.jena.tdb.setup.Builder$IndexBuilderStd.buildIndex(Builder.java:112)
        at com.hp.hpl.jena.tdb.setup.Builder$NodeTableBuilderStd.buildNodeTable(Builder.java:85)
        at com.hp.hpl.jena.tdb.setup.DatasetBuilderStd$NodeTableBuilderRecorder.buildNodeTable(DatasetBuilderStd.java:389)
        at com.hp.hpl.jena.tdb.setup.DatasetBuilderStd.makeNodeTable(DatasetBuilderStd.java:300)
        at com.hp.hpl.jena.tdb.setup.DatasetBuilderStd._build(DatasetBuilderStd.java:167)
        at com.hp.hpl.jena.tdb.setup.DatasetBuilderStd.build(DatasetBuilderStd.java:157)
        at com.hp.hpl.jena.tdb.setup.DatasetBuilderStd.build(DatasetBuilderStd.java:70)
        at com.hp.hpl.jena.tdb.StoreConnection.make(StoreConnection.java:132)
        at com.hp.hpl.jena.tdb.transaction.DatasetGraphTransaction.<init>(DatasetGraphTransaction.java:46)
        at com.hp.hpl.jena.tdb.sys.TDBMakerTxn._create(TDBMakerTxn.java:50)
        at com.hp.hpl.jena.tdb.sys.TDBMakerTxn.createDatasetGraph(TDBMakerTxn.java:38)
        at com.hp.hpl.jena.tdb.TDBFactory._createDatasetGraph(TDBFactory.java:166)
        at com.hp.hpl.jena.tdb.TDBFactory.createDatasetGraph(TDBFactory.java:74)
        at com.hp.hpl.jena.tdb.TDBFactory.createDataset(TDBFactory.java:53)
        at tdb.cmdline.ModTDBDataset.createDataset(ModTDBDataset.java:95)
        at arq.cmdline.ModDataset.getDataset(ModDataset.java:34)
        at tdb.cmdline.CmdTDB.getDataset(CmdTDB.java:137)
        at tdb.cmdline.CmdTDB.getDatasetGraph(CmdTDB.java:126)
        at tdb.cmdline.CmdTDB.getDatasetGraphTDB(CmdTDB.java:131)
        at tdb.tdbloader.loadQuads(tdbloader.java:163)
        at tdb.tdbloader.exec(tdbloader.java:122)
        at arq.cmdline.CmdMain.mainMethod(CmdMain.java:97)
        at arq.cmdline.CmdMain.mainRun(CmdMain.java:59)
        at arq.cmdline.CmdMain.mainRun(CmdMain.java:46)
        at tdb.tdbloader.main(tdbloader.java:53)
Caused by: java.io.FileNotFoundException: d:\cygdrive\d\Project\Store_DB\data1\node2id.idn (The system cannot find the path specified.)
        at java.io.RandomAccessFile.open(Native Method)
        at java.io.RandomAccessFile.<init>(RandomAccessFile.java:222)
        at java.io.RandomAccessFile.<init>(RandomAccessFile.java:107)
        at com.hp.hpl.jena.tdb.base.file.ChannelManager.open$(ChannelManager.java:80)
        ... 37 more

我不确定 node2id.idn 文件是什么,为什么期待呢?

1 个答案:

答案 0 :(得分:1)

文件node2id.idn是TDB的内部索引文件之一。这不是您必须为自己创建或管理的东西。我刚刚在cygwin上试过tdbloader,它对我来说很合适。我可以想到两个基本的可能性:

  • 您的磁盘已满
  • TDB索引已损坏

如果这是您加载到其他emtpy TDB中的第一个文件,则第二种可能性不太可能。如果要加载到非空TDB中,请尝试删除TDB图像并重新开始。请注意,TDB本身不管理并发写入:如果有多个进程写入单个TDB映像,则必须在应用程序级别处理锁定,或使用TDB的transactions

当然,最后的可能性是你的磁盘是不稳定的。您可能想在另一台计算机上试用您的代码。

如果这些建议都没有帮助,请将完整的最小测试用例发送到Jena用户列表。