@Test public void testConstructQuery() throws Exception { String text = "PREFIX foaf: <" + FOAF.NAMESPACE + ">\n" + "CONSTRUCT {\n" + " ?y foaf:knows ?x .\n" + " ?y <urn:knows> ?x .\n" + " ?x <urn:knows> ?y .\n" + "} WHERE {\n" + " ?x a foaf:Person .\n" + " ?y a foaf:Person .\n" + " ?x foaf:knows ?y .\n" + "}"; ParsedQuery query = new SPARQLParser().parseQuery(text, null); AntecedentVisitor visitor = new AntecedentVisitor(); query.getTupleExpr().visit(visitor); Set<StatementPattern> expected = Sets.newHashSet( new StatementPattern(new Var("x"), c(RDF.TYPE), c(FOAF.PERSON)), new StatementPattern(new Var("y"), c(RDF.TYPE), c(FOAF.PERSON)), new StatementPattern(new Var("x"), c(FOAF.KNOWS), new Var("y"))); Assert.assertEquals(expected, visitor.getAntecedents()); }
public Set<StatementPattern> getAntecedents() { return antecedentStatementPatterns; }
AntecedentVisitor extends AbstractQueryModelVisitor<RuntimeException> { public Set<StatementPattern> getAntecedents() { return antecedentStatementPatterns; } }
AntecedentVisitor extends AbstractQueryModelVisitor<RuntimeException> { public Set<StatementPattern> getAntecedents() { return antecedentStatementPatterns; }  }
AntecedentVisitor extends AbstractQueryModelVisitor<RuntimeException> { public Set<StatementPattern> getAntecedents() { return antecedentStatementPatterns; }  Set<StatementPattern> getAntecedents(); @Override void meet(StatementPattern sp); }
AntecedentVisitor extends AbstractQueryModelVisitor<RuntimeException> { public Set<StatementPattern> getAntecedents() { return antecedentStatementPatterns; }  Set<StatementPattern> getAntecedents(); @Override void meet(StatementPattern sp);  }