javascript - antoniogarrote/rdfstore-js reusing blank node -


i using rdfstore in nodejs , cannot figure out how reuse blank nodes. need use blank node more once.

here code:

graph.add(rdf.createtriple(    new rdf.api.blanknode(id);    rdf.createnamednode(predicate)    rdf.createblanknode() ); 

id taken entered blanknode "_:30" => "30"

i have checked created blank node , correct (with correct id). when db has wrong one. seems using counter give him exact node.

edit 1

i have checked created triple , looks want it. problem must somewhere in adding triple graph/storing triple.

thanks help,

michal.

the reason simple: each call rdfstore.store.insert creates sparql insert statement. , each separate sparql statement has own set of unique blank nodes.

that said, solution our problem collect triples add in array , add them in 1 go.

var triples = []; [...] store.insert(store.rdf.creategraph(triples),    graph,    function(success, cnt) {     if(success) console.log(cnt + ' triples added.');   }); 

i hope helps.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -