Greg Albiston
2018-11-07 18:26:31 UTC
Hello,
I'm trying to retrieve the VALUES variable names of a Query parsed from
a string.
When I run the below test the result is false when I was expecting true.
The query is from the SPARQL 1.1 standard.
Can the VALUES variable names be retrieved from another method?
Apologies if I've missed something,
Greg
@Test
public void testValues_block() {
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);
assertEquals(expResult, result);
}
I'm trying to retrieve the VALUES variable names of a Query parsed from
a string.
When I run the below test the result is false when I was expecting true.
The query is from the SPARQL 1.1 standard.
Can the VALUES variable names be retrieved from another method?
Apologies if I've missed something,
Greg
@Test
public void testValues_block() {
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);
assertEquals(expResult, result);
}