Hello Greg, I can understand that this is a bit misleading, but the methods you used just work for VALUES clause "outside" of the query pattern:
|String ||queryString ||= ||"PREFIX dc: <http://purl.org/dc/elements/1.1/> ||\n||"||||||+ ||"PREFIX : <http://example.org/book/> ||\n||"||||||+ ||"PREFIX ns: <http://example.org/ns#> ||\n||"||||||+ ||"||\n||"||||||+ ||"SELECT ?book ?title ?price||\n||"||||||+ ||"{||\n||"||||||+ ||" ||\n||"||||||+ ||" ?book dc:title ?title ;||\n||"||||||+ ||" ns:price ?price .||\n||"||||||+ ||"}||||+ VALUES ?book { :book1 :book3 }"||; | I don't know if there is any convenient method, but the VALUES clause in query is inside an ElementGroup which contains a list of Element objects, with the VALUES clause being of type ElementData: check this code |ElementWalker.walk(query.getQueryPattern(), new ElementVisitorBase() {||||||||||@Override||||public void visit(ElementData el) {||||System.out.println(el||);||||}||||||||||});| If the VALUES clause is always in first position, it might work with |List<Var> valueVars = ((ElementData)((ElementGroup)query.getQueryPattern()).get(||0||)).getVars();| if not, you have to iterate over all elements and check which one is the VALUES element. Maybe one of the devs knows a better solution indeed ... Kind regards, Lorenz > System.out.println("values_block"); > String queryString = "PREFIX dc: > <http://purl.org/dc/elements/1.1/> \n" > + "PREFIX : <http://example.org/book/> \n" > + "PREFIX ns: <http://example.org/ns#> \n" > + "\n" > + "SELECT ?book ?title ?price\n" > + "{\n" > + " VALUES ?book { :book1 :book3 }\n" > + " ?book dc:title ?title ;\n" > + " ns:price ?price .\n" > + "}"; > Query query = QueryFactory.create(queryString); > > boolean result = query.hasValues(); > boolean expResult = true; > > System.out.println(query.toString()); > System.out.println("Vars: " + query.getValuesVariables()); > System.out.println("Exp: " + expResult); > System.out.println("Res: " + result); -- Lorenz Bühmann AKSW group, University of Leipzig Group: http://aksw.org - semantic web research center