use of org.eclipse.rdf4j.query.algebra.Service in project rdf4j by eclipse.
the class TupleExprBuilder method visit.
@Override
public Object visit(ASTServiceGraphPattern node, Object data) throws VisitorException {
GraphPattern parentGP = graphPattern;
ValueExpr serviceRef = (ValueExpr) node.jjtGetChild(0).jjtAccept(this, null);
graphPattern = new GraphPattern(parentGP);
node.jjtGetChild(1).jjtAccept(this, null);
TupleExpr serviceExpr = graphPattern.buildTupleExpr();
if (serviceExpr instanceof SingletonSet)
// do not add an empty service block
return null;
String serviceExpressionString = node.getPatternString();
parentGP.addRequiredTE(new Service(mapValueExprToVar(serviceRef), serviceExpr, serviceExpressionString, node.getPrefixDeclarations(), node.getBaseURI(), node.isSilent()));
graphPattern = parentGP;
return null;
}
use of org.eclipse.rdf4j.query.algebra.Service in project rdf4j by eclipse.
the class TupleExprBuilderTest method testServiceGraphPatternChopping.
@Test
public void testServiceGraphPatternChopping() throws Exception {
// just for construction
Service service = new Service(null, new SingletonSet(), "", null, null, false);
service.setExpressionString("SERVICE <a> { ?s ?p ?o }");
assertEquals("?s ?p ?o", service.getServiceExpressionString());
service.setExpressionString("SERVICE <a> {?s ?p ?o}");
assertEquals("?s ?p ?o", service.getServiceExpressionString());
}
Aggregations