Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryExecution create(Query query, Model model) return no result with named model #75

Open
AlexTo opened this issue Sep 19, 2018 · 0 comments

Comments

@AlexTo
Copy link

AlexTo commented Sep 19, 2018

I'm having strange behaviour with QueryExecution create(Query query, Model model)

I created a named model and add triples to it as follows

Dataset ds = dg.toDataset();
ds.addNamedModel("urn:x-arq:LearningRecord", ModelFactory.createDefaultModel());
Model model = ds.getNamedModel("urn:x-arq:LearningRecord");
\\ read triples into model

Now, using Mark Logic query console, I can confirm that urn:x-arq:LearningRecord has been created with triples in it.
But now if I query with QueryExecutionFactory like this

QueryExecution qexec = QueryExecutionFactory.create(query, dg.toDataset().getNamedModel("urn:x-arq:LearningRecord"));
ResultSet resultSet = qexec.execSelect();

then resultSet.hasNext() is false
But if I query without getNamedModel like this

QueryExecution qexec = QueryExecutionFactory.create(query, dg.toDataset());
ResultSet resultSet = qexec.execSelect();

then I can retrieve expected results. From IntelliJ debugger, I can also see that urn:x-arq:LearningRecord is part of the DatasetGraph

untitled

Is it possible to query triples in a specific named model? seems like the query will return triples from the union of all models.

FYI, Jena or Virtuoso doesn't have such issue.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant