On 20/05/14 08:15, Joakim Soderberg wrote:
Hi,

I create a dataset with a unnamed default model and a named model

mDataset = TDBFactory.createDataset(tdbDirectory);

mDefaultModel = mDataset.getDefaultModel();
mDefaultModel = FileManager.get().loadModel(coreOntologyFile);


Model rtmodel = FileManager.get().loadModel("ontology/data1221.rdf");
if (mDataset.containsNamedModel("r1221"))
{
mDataset.getNamedModel("r1221");
} else {
         mDataset.getDataSet().addNamedModel("rt1221", rtmodel);
}



 From what I read, passing a dataset and not specifying "FROM NAMED" in the
sparql query, should query both the unnamed model and named model, but it
only queries the default data set, e.g.


QueryExecution qe1 = QueryExecutionFactory.create( "SELECT * WHERE { ?s ?p
?o }", mDataset );

only returns data from the defaultmodel, unless if I explicitly pass the
named model

QueryExecution qe1 = QueryExecutionFactory.create( "SELECT * WHERE { ?s ?p
?o }", mDataset.getNamedModel("r1221") );

then I get triples from the named model. Adding FROM NAMED <e1221>

"SELECT * FROM NAMED <r1221> WHERE { ?s ?p ?o> }", mDataset

PS <r12221> is not the getNamedModel("r1221")

<r1221> gets resolved against the base URI which is possible file:///YourCurrentDirectory/

so <r1221> does not find the NamedModel("r1221")


Does not help. Has anyone had the same problem?

best
J


Reply via email to