Search code examples
blazegraph

How to load quads using the bulk loader?


I have a file data.nq containing the following lines:

<http://example.org/a> <http://example.org/b> <http://example.org/c> .
<http://example.org/d> <http://example.org/e> <http://example.org/f> <http://example.org/g> .

In the same directory, there is blazegraph.jar (using version 2.1.0) and a file p.properties with the following content:

com.bigdata.btree.BTree.branchingFactor=512
com.bigdata.btree.writeRetentionQueue.capacity=4000
com.bigdata.journal.AbstractJournal.bufferMode=DiskRW
com.bigdata.journal.AbstractJournal.file=blazegraph.jnl
com.bigdata.journal.AbstractJournal.initialExtent=209715200
com.bigdata.journal.AbstractJournal.maximumExtent=209715200
com.bigdata.namespace.kb.spo.com.bigdata.btree.BTree.branchingFactor=1024
com.bigdata.rdf.sail.truthMaintenance=false
com.bigdata.rdf.store.AbstractTripleStore.axiomsClass=com.bigdata.rdf.axioms.NoAxioms
com.bigdata.rdf.store.AbstractTripleStore.justify=false
com.bigdata.rdf.store.AbstractTripleStore.quads=true
com.bigdata.rdf.store.AbstractTripleStore.statementIdentifiers=false
com.bigdata.rdf.store.AbstractTripleStore.textIndex=false
com.bigdata.rdf.store.DataLoader.commit=Incremental
com.bigdata.service.AbstractTransactionService.minReleaseAge=1

Then, I run the bulk loader with the following command:

java -cp blazegraph.jar com.bigdata.rdf.store.DataLoader p.properties data.nq

However, I get the following error:

Reading properties: p.properties
Will load from: data.nq
Journal file: blazegraph.jnl
ERROR: SPORelation.java:2303: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: context not bound: < TermId(1U), TermId(2U), TermId(3U) : Expli
cit >
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: context not bound: < TermId(1U), TermId(2U), TermId(3U) : Explicit >
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:188)
    at com.bigdata.rdf.spo.SPORelation.logFuture(SPORelation.java:2298)
    at com.bigdata.rdf.spo.SPORelation.insert(SPORelation.java:2253)
    at com.bigdata.rdf.store.AbstractTripleStore.addStatements(AbstractTripleStore.java:4392)
    at com.bigdata.rdf.rio.StatementBuffer$Batch.writeSPOs(StatementBuffer.java:2126)
    at com.bigdata.rdf.rio.StatementBuffer$Batch.addStatements(StatementBuffer.java:1975)
    at com.bigdata.rdf.rio.StatementBuffer$Batch.writeNow(StatementBuffer.java:1860)
    at com.bigdata.rdf.rio.StatementBuffer$Batch.access$1000(StatementBuffer.java:1654)
    at com.bigdata.rdf.rio.StatementBuffer$DrainQueueCallable.call(StatementBuffer.java:818)
    at com.bigdata.rdf.rio.StatementBuffer$DrainQueueCallable.call(StatementBuffer.java:794)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at com.bigdata.util.concurrent.LatchedExecutor$1.run(LatchedExecutor.java:121)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: context not bound: < TermId(1U), TermId(2U), TermId(3U) : Explicit >
    at com.bigdata.rdf.spo.SPOIndexWriter.call(SPOIndexWriter.java:266)
    at com.bigdata.rdf.spo.SPOIndexWriter.call(SPOIndexWriter.java:68)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    ... 3 more
ERROR: Banner.java:160: Uncaught exception in thread
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: context not bound: < TermId(1U), TermId(2U), TermId(3U) : Explicit >
    at com.bigdata.rdf.rio.StatementBuffer.flush(StatementBuffer.java:954)
    at com.bigdata.rdf.rio.PresortRioLoader.success(PresortRioLoader.java:108)
    at com.bigdata.rdf.rio.BasicRioLoader.loadRdf2(BasicRioLoader.java:251)
    at com.bigdata.rdf.rio.BasicRioLoader.loadRdf(BasicRioLoader.java:176)
    at com.bigdata.rdf.store.DataLoader.loadData4_ParserErrors_Not_Trapped(DataLoader.java:1595)
    at com.bigdata.rdf.store.DataLoader.loadFiles(DataLoader.java:1359)
    at com.bigdata.rdf.store.DataLoader.main(DataLoader.java:2085)
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: context not bound: < TermId(1U), TermId(2U), TermId(3U) : Explicit >
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:188)
    at com.bigdata.rdf.rio.StatementBuffer.flush(StatementBuffer.java:940)
    ... 6 more
Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: context not bound: < TermId(1U), TermId(2U), TermId(3U) : Explicit >
    at com.bigdata.rdf.spo.SPORelation.insert(SPORelation.java:2272)
    at com.bigdata.rdf.store.AbstractTripleStore.addStatements(AbstractTripleStore.java:4392)
    at com.bigdata.rdf.rio.StatementBuffer$Batch.writeSPOs(StatementBuffer.java:2126)
    at com.bigdata.rdf.rio.StatementBuffer$Batch.addStatements(StatementBuffer.java:1975)
    at com.bigdata.rdf.rio.StatementBuffer$Batch.writeNow(StatementBuffer.java:1860)
    at com.bigdata.rdf.rio.StatementBuffer$Batch.access$1000(StatementBuffer.java:1654)
    at com.bigdata.rdf.rio.StatementBuffer$DrainQueueCallable.call(StatementBuffer.java:818)
    at com.bigdata.rdf.rio.StatementBuffer$DrainQueueCallable.call(StatementBuffer.java:794)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at com.bigdata.util.concurrent.LatchedExecutor$1.run(LatchedExecutor.java:121)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: context not bound: < TermId(1U), TermId(2U), TermId(3U) : Explicit >
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:188)
    at com.bigdata.rdf.spo.SPORelation.logFuture(SPORelation.java:2298)
    at com.bigdata.rdf.spo.SPORelation.insert(SPORelation.java:2253)
    ... 12 more
Caused by: java.lang.IllegalArgumentException: context not bound: < TermId(1U), TermId(2U), TermId(3U) : Explicit >
    at com.bigdata.rdf.spo.SPOIndexWriter.call(SPOIndexWriter.java:266)
    at com.bigdata.rdf.spo.SPOIndexWriter.call(SPOIndexWriter.java:68)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    ... 3 more

I do the same, but setting the quads mode off. That is, setting the following property in p.properties:

com.bigdata.rdf.store.AbstractTripleStore.quads=false

In this case I get no error, but also no named graphs in the dataset.

How can I load quads using the bulk loader?

Update: I found an explanation for this error in the Blazegraph documentation. It says that I have to set the property defaultGraph in the properties file. Thus, I have added the following line to the properties file:

defaultGraph=http://example.org

However, I got the same error.


Solution

  • It is required to add defaultGraph as an option in the command line, not in the properties file.

    $ java -cp blazegraph.jar com.bigdata.rdf.store.DataLoader -defaultGraph http://example.org p.properties data.nq
    

    (Thanks to people that help me to answer this question in the Blazegraph mailing list).