Thursday, 15 May 2014

java - How to do multiple add operation apache jena tdb -



java - How to do multiple add operation apache jena tdb -

i have serialize specific properties (about 10 film's properties) set of 1500 entity dbpedia. each entity run sparql query in order retrieve them , after that, each resultset store info in tdb dataset using default apache jena tdb api. create single statement each property , add together them using code:

public void addsolution(querysolution currsolution, string subjecturi) { if(iswritemode) { resource currresource = datasetmodel.createresource(subjecturi); property prop = datasetmodel.createproperty(currsolution.getresource("?prop").tostring()); statement stat = datasetmodel.createstatement(currresource, prop, currsolution.get("?value").tostring()); datasetmodel.add(stat); } }

how can in order execute multiple add together operations on single dataset? what's strategy should use?

edit:

i'm able execute code without errors, no files created tdbfactory. why happens? think need joshua taylor's help

it sounds query running on remote dbpedia endpoint. assuming that's right can couple of things.

firstly wrap update in transaction:

dataset.begin(readwrite.write); seek { (querysolution currsolution: results) { addsolution(...); } dataset.commit(); } { dataset.end(); }

secondly, might able save work using construct model back, rather having loop through results. i'm not clear what's going on subjecturi, however, might simple as:

construct { <subjecturi> ?prop ?value } ... existing query body ...

java sparql jena semantic-web tdb

No comments:

Post a Comment