From: Blom, J.J.C. (Jaap) <jb...@cr...> - 2010-06-18 15:04:02
|
Hi, I'm working on NG4J 0.9.3 and have the following code: Node graph1 = Node.createURI("http://graph1"); Node graph2 = Node.createURI("http://graph2"); Node start = Node.createURI("http://start"); Node predicate1 = Node.createURI("http://predicate1"); Node predicate2 = Node.createURI("http://predicate2"); Node result1 = Node.createLiteral("expected result"); Node result2 = Node.createLiteral("not expected result"); NamedGraphSet ngs = new NamedGraphSetImpl(); ngs.addQuad(new Quad(graph1, start, predicate1, Node.createAnon(new AnonId("blank")))); ngs.addQuad(new Quad(graph1, Node.createAnon(new AnonId("blank")), predicate2, result1)); ngs.addQuad(new Quad(graph2, Node.createAnon(new AnonId("blank")), predicate2, result2));//*/ String query = "Select ?target Where\n" + "{\n" + " <" + start.getURI() + "> <" + predicate1.getURI() + "> ?b .\n" + " ?b <" + predicate2.getURI() + "> ?target\n" + "}"; System.out.println(query); Query sparqlQuery = QueryFactory.create(query); QueryExecution qe = QueryExecutionFactory.create(sparqlQuery, new NamedGraphDataset(ngs)); ResultSet results = qe.execSelect(); while(results.hasNext()) { System.out.println(results.next()); } System.out.println("done"); This gives the following result: Select $target Where { <http://start> <http://predicate1> ?b . ?b <http://predicate2> $target } ( ?target = "expected result" ) ( ?target = "not expected result" ) done I didn't expect the "not expected result", since it is linked to a blank node in another graph. Granted the blank nodes have the same label, but RDF states that blank nodes in different graphs are not linked by their label. Am I correct in this one and if so is this a NG4J error or a Jena/ARQ error? Greetings, Jaap Blom ________________________________ http://www.croon.nl/disclaimer http://www.croon.nl/inkoopvoorwaarden Kamer van Koophandel Rotterdam nr. / Chamber of Commerce Rotterdam no.: 24002312 |