use of org.eclipse.rdf4j.query.impl.ListBindingSet in project rdf4j by eclipse.
the class SPARQLTSVCustomTest method testSES2126QuotedLiteralIntegerAsStringExplicitType.
/**
* Only Literals with the XML Schema numeric types should be simplified.
* <p>
* NOTE: This will fail when using RDF-1.1, as the datatype {@link XMLSchema#STRING} is implied and hence
* is not generally represented.
*
* @throws Exception
*/
@Ignore("This test does not work with RDF-1.1")
@Test
public void testSES2126QuotedLiteralIntegerAsStringExplicitType() throws Exception {
List<String> bindingNames = Arrays.asList("test");
TupleQueryResult tqr = new IteratingTupleQueryResult(bindingNames, Arrays.asList(new ListBindingSet(bindingNames, SimpleValueFactory.getInstance().createLiteral("1", XMLSchema.STRING))));
String result = writeTupleResult(tqr);
assertEquals("?test\n\"1\"^^<http://www.w3.org/2001/XMLSchema#string>\n", result);
}
use of org.eclipse.rdf4j.query.impl.ListBindingSet in project rdf4j by eclipse.
the class TupleExprBuilder method visit.
@Override
public BindingSet visit(ASTBindingSet node, Object data) throws VisitorException {
@SuppressWarnings("unchecked") List<Var> vars = (List<Var>) data;
List<String> names = new ArrayList<String>(vars.size());
for (Var var : vars) {
names.add(var.getName());
}
int numberOfBindingValues = node.jjtGetNumChildren();
if (numberOfBindingValues != vars.size()) {
throw new VisitorException("number of values in bindingset does not match variables in BINDINGS clause");
}
Value[] values = new Value[numberOfBindingValues];
for (int i = 0; i < numberOfBindingValues; i++) {
ValueExpr ve = (ValueExpr) node.jjtGetChild(i).jjtAccept(this, null);
if (ve != null) {
Value v = getValueForExpr(ve);
values[i] = v;
}
}
BindingSet result = new ListBindingSet(names, values);
return result;
}
use of org.eclipse.rdf4j.query.impl.ListBindingSet in project rdf4j by eclipse.
the class QueryResultsTest method testBNodeBindingSet3.
@Test
public void testBNodeBindingSet3() throws QueryEvaluationException {
tqr1.append(new ListBindingSet(twoBindingNames, foo, bnode1));
tqr1.append(new ListBindingSet(twoBindingNames, foo, bnode2));
tqr2.append(new ListBindingSet(twoBindingNames, foo, bnode1));
tqr2.append(new ListBindingSet(twoBindingNames, foo, bnode1));
assertFalse(QueryResults.equals(tqr1, tqr2));
}
use of org.eclipse.rdf4j.query.impl.ListBindingSet in project rdf4j by eclipse.
the class QueryResultsTest method testBNodeBindingSet6.
@Test
public void testBNodeBindingSet6() throws QueryEvaluationException {
tqr3.append(new ListBindingSet(threeBindingNames, foo, bnode2, bnode1));
tqr1.append(new ListBindingSet(twoBindingNames, foo, bnode2));
assertFalse(QueryResults.equals(tqr3, tqr1));
}
use of org.eclipse.rdf4j.query.impl.ListBindingSet in project rdf4j by eclipse.
the class QueryResultsTest method testNonBNodeBindingSet2.
@Test
public void testNonBNodeBindingSet2() throws QueryEvaluationException {
tqr1.append(new ListBindingSet(twoBindingNames, foo, lit1));
tqr2.append(new ListBindingSet(twoBindingNames, foo, lit2));
assertFalse(QueryResults.equals(tqr1, tqr2));
}
Aggregations