2016-06-13 15 views
1

Ich experimentiere mit Blazegraph, um Graph-Algorithmen auf ConceptNet zu starten, aber zuerst muss ich die Daten importieren. Die Daten werden Schreiben Sie einmal, lesen Sie viele, so brauche ich keine Art von inkrementellen Schreiben.Laden von Tripeln in Blazegraph mit dem Bulk Data Loader

Ich installierte Blazegraph 2.1.1 aus seiner .deb-Datei. Ich habe auch blazegraph.jar heruntergeladen, damit ich Anweisungen folgen konnte, die das Ausführen von Befehlen auf blazegraph.jar beinhalten.

Die Datei assoc.nt ist im N-Triples-Format mit etwa 25 Millionen Kanten. Hier sind einige von Anfang an:

</c/af/a_foei_tog/r> </r/SenseOf> </c/af/a_foei_tog> . 
</c/af/a_foei_tog/r> </r/Synonym> </c/af/jammer> . 
</c/af/a_foei_tog/r> </r/Synonym> </c/af/ongelukkig> . 
</c/af/a_foei_tog/r> </r/RelatedTo> </c/fr/malheureusement> . 
</c/af/a_foe%C4%B1_tog/r> </r/SenseOf> </c/af/a_foe%C4%B1_tog> . 
</c/af/a_foe%C4%B1_tog/r> </r/Synonym> </c/af/jammer> . 
</c/af/a_foe%C4%B1_tog/r> </r/Synonym> </c/af/ongelukk%C4%B1g> . 
</c/af/a_foe%C4%B1_tog/r> </r/RelatedTo> </c/fr/malheureusement> . 
</c/af/a_ja_a/r> </r/SenseOf> </c/af/a_ja_a> . 
</c/af/a_ja_a/r> </r/Synonym> </c/af/seker> . 
</c/af/a_ja_a/r> </r/Synonym> </c/af/sekerlik> . 

Ich habe fastload.properties vom Blazegraph samples on GitHub, änderte aber dann das Ende:

  • ich com.bigdata.journal.AbstractJournal.file=blazegraph.jnl hinzugefügt, weil sonst wäre es mir sagen, dass Eigentum fehlte.

  • änderte ich die bufferModeDiskRW-Disk, weil someone's property file darauf hingewiesen, dass dies würde mir Write-Once-Read-Many-Semantik, das ist genau, was ich will.

Hier ist meine letzte fastload.properties:

# This configuration turns off incremental inference for load and retract, so 
# you must explicitly force these operations if you want to compute the closure 
# of the knowledge base. Forcing the closure requires punching through the SAIL 
# layer. Of course, if you are not using inference then this configuration is 
# just the ticket and is quite fast. 

# set the initial and maximum extent of the journal 
com.bigdata.journal.AbstractJournal.initialExtent=209715200 
com.bigdata.journal.AbstractJournal.maximumExtent=209715200 

# turn off automatic inference in the SAIL 
com.bigdata.rdf.sail.truthMaintenance=false 

# don't store justification chains, meaning retraction requires full manual 
# re-closure of the database 
com.bigdata.rdf.store.AbstractTripleStore.justify=false 

# turn off the statement identifiers feature for provenance 
com.bigdata.rdf.store.AbstractTripleStore.statementIdentifiers=false 

# turn off the free text index 
com.bigdata.rdf.store.AbstractTripleStore.textIndex=false 

com.bigdata.journal.AbstractJournal.bufferMode=Disk 
com.bigdata.journal.AbstractJournal.file=blazegraph.jnl 

Ich lief der Befehl:

java -cp blazegraph.jar com.bigdata.rdf.store.DataLoader -namespace conceptnet fastload.properties ~/conceptnet5/data/assoc/assoc.nt 

Es die CPU für ein paar Minuten zentrifugiert, scheint aber letztlich nichts hinzugefügt zu haben. Hier ist die Ausgabe, die ich bekam:

WARN : ServiceProviderHook.java:171: Running. 
INFO: com.bigdata.util.config.LogUtil: Configure: jar:file:/home/rspeer/src/blazegraph/blazegraph.jar!/log4j.properties 

BlazeGraph(TM) Graph Engine 

        Flexible 
        Reliable 
        Affordable 
     Web-Scale Computing for the Enterprise 

Copyright SYSTAP, LLC DBA Blazegraph 2006-2016. All rights reserved. 

[my hostname appeared here] 
Mon Jun 13 13:36:05 EDT 2016 
Linux/3.13.0-83-generic amd64 
Intel(R) Xeon(R) CPU E5-2640 v2 @ 2.00GHz Family 6 Model 62 Stepping 4, GenuineIntel #CPU=4 
Oracle Corporation 1.8.0_74 
freeMemory=1002354744 
buildVersion=2.1.1 
gitCommit=90d9e8232969a8afdc830e856643e5416bb50d0a 

Dependency   License                 
ICU    http://source.icu-project.org/repos/icu/icu/trunk/license.html   
bigdata-ganglia http://www.apache.org/licenses/LICENSE-2.0.html       
blueprints-core https://github.com/tinkerpop/blueprints/blob/master/LICENSE.txt   
colt    http://acs.lbl.gov/software/colt/license.html       
commons-codec  http://www.apache.org/licenses/LICENSE-2.0.html       
commons-fileupload http://www.apache.org/licenses/LICENSE-2.0.html       
commons-io   http://www.apache.org/licenses/LICENSE-2.0.html       
commons-logging http://www.apache.org/licenses/LICENSE-2.0.html       
dsiutils   http://www.gnu.org/licenses/lgpl-2.1.html        
fastutil   http://www.apache.org/licenses/LICENSE-2.0.html       
flot    http://www.opensource.org/licenses/mit-license.php      
high-scale-lib  http://creativecommons.org/licenses/publicdomain       
httpclient   http://www.apache.org/licenses/LICENSE-2.0.html       
httpclient-cache http://www.apache.org/licenses/LICENSE-2.0.html       
httpcore   http://www.apache.org/licenses/LICENSE-2.0.html       
httpmime   http://www.apache.org/licenses/LICENSE-2.0.html       
jackson-core  http://www.apache.org/licenses/LICENSE-2.0.html       
jetty    http://www.apache.org/licenses/LICENSE-2.0.html       
jquery    https://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt    
jsonld    https://raw.githubusercontent.com/jsonld-java/jsonld-java/master/LICENCE 
log4j    http://www.apache.org/licenses/LICENSE-2.0.html       
lucene    http://www.apache.org/licenses/LICENSE-2.0.html       
nanohttp   http://elonen.iki.fi/code/nanohttpd/#license        
rexster-core  https://github.com/tinkerpop/rexster/blob/master/LICENSE.txt    
river    http://www.apache.org/licenses/LICENSE-2.0.html       
semargl   https://github.com/levkhomich/semargl/blob/master/LICENSE    
servlet-api  http://www.apache.org/licenses/LICENSE-2.0.html       
sesame    http://www.openrdf.org/download.jsp          
slf4j    http://www.slf4j.org/license.html          
zookeeper   http://www.apache.org/licenses/LICENSE-2.0.html       

Reading properties: fastload.properties 
Will load from: /home/rspeer/conceptnet5/data/assoc/assoc.nt 
Journal file: blazegraph.jnl 
Load: 0 stmts added in 171.173 secs, rate= 0, commitLatency=0ms, {failSet=0,goodSet=1} 
Total elapsed=172015ms 

Antwort

2

Ich glaube, ich habe eine Antwort auf das Problem gefunden, das ich begegnete.

Wenn Blazegraph N-Triples-Daten importiert, werden relative URIs übersprungen. Die Tatsache, dass meine URIs relativ waren, war mein Fehler; es scheint, dass nur absolute URIs in N-Triples erlaubt sind, aber es wäre schön für Blazegraph gewesen, mir das zu sagen, anstatt stillschweigend zu versagen.

Ich Präfix alle meine URIs mit http:// und einem Domain-Namen, und jetzt wird es Daten geladen. Hier ist, was meine Daten jetzt aussieht:

<http://api.conceptnet.io/c/af/a_foei_tog/r> <http://api.conceptnet.io/r/SenseOf> <http://api.conceptnet.io/c/af/a_foei_tog> . 
<http://api.conceptnet.io/c/af/a_foei_tog/r> <http://api.conceptnet.io/r/Synonym> <http://api.conceptnet.io/c/af/jammer> . 
<http://api.conceptnet.io/c/af/a_foei_tog/r> <http://api.conceptnet.io/r/Synonym> <http://api.conceptnet.io/c/af/ongelukkig> . 
<http://api.conceptnet.io/c/af/a_foei_tog/r> <http://api.conceptnet.io/r/RelatedTo> <http://api.conceptnet.io/c/fr/malheureusement> . 
<http://api.conceptnet.io/c/af/a_foe%C4%B1_tog/r> <http://api.conceptnet.io/r/SenseOf> <http://api.conceptnet.io/c/af/a_foe%C4%B1_tog> . 
<http://api.conceptnet.io/c/af/a_foe%C4%B1_tog/r> <http://api.conceptnet.io/r/Synonym> <http://api.conceptnet.io/c/af/jammer> . 
<http://api.conceptnet.io/c/af/a_foe%C4%B1_tog/r> <http://api.conceptnet.io/r/Synonym> <http://api.conceptnet.io/c/af/ongelukk%C4%B1g> . 
<http://api.conceptnet.io/c/af/a_foe%C4%B1_tog/r> <http://api.conceptnet.io/r/RelatedTo> <http://api.conceptnet.io/c/fr/malheureusement> . 
<http://api.conceptnet.io/c/af/a_ja_a/r> <http://api.conceptnet.io/r/SenseOf> <http://api.conceptnet.io/c/af/a_ja_a> . 
<http://api.conceptnet.io/c/af/a_ja_a/r> <http://api.conceptnet.io/r/Synonym> <http://api.conceptnet.io/c/af/seker> . 

ich einigen alarmierenden Ausgang bekam, dass es schien, um anzuzeigen, nahm zwischen 1 und 10 Sekunden, um jeden „record“ zu laden, aber ich denke, diese Warnungen irreführend, weil sie nur zeigten, bis in den Momenten, wenn deutlich verlangsamt Laden:

WARN : AbstractBTree.java:3758: wrote: name=kb.spo.OSP, 1 records (#nodes=1, #leaves=0) in 14582ms : addrRoot=22869767568228938 
WARN : AbstractBTree.java:3758: wrote: name=kb.spo.POS, 1 records (#nodes=1, #leaves=0) in 14582ms : addrRoot=22869765391385095 
WARN : AbstractBTree.java:3758: wrote: name=kb.spo.OSP, 9 records (#nodes=5, #leaves=4) in 10690ms : addrRoot=25508598331212042 
WARN : AbstractBTree.java:3758: wrote: name=kb.spo.POS, 1 records (#nodes=1, #leaves=0) in 9335ms : addrRoot=38702680415142364 
WARN : AbstractBTree.java:3758: wrote: name=kb.spo.POS, 9 records (#nodes=6, #leaves=3) in 6932ms : addrRoot=63331668311671368 
WARN : AbstractBTree.java:3758: wrote: name=kb.spo.POS, 1 records (#nodes=1, #leaves=0) in 11326ms : addrRoot=80044185196954272 

Trotz der Warnungen, lud es 25 Millionen Kanten in etwa 8 Minuten, was nicht schlecht ist.