use of org.apache.jena.sparql.pfunction.PropFuncArg in project jena by apache.
the class listIndex method execObjectList.
@Override
protected QueryIterator execObjectList(Binding binding, Var listVar, Node predicate, List<Node> objectArgs, ExecutionContext execCxt) {
if (objectArgs.size() != 2)
throw new ExprEvalException("ListIndex : object not a list of length 2");
Node indexNode = objectArgs.get(0);
Node memberNode = objectArgs.get(1);
final Collection<Node> x;
if (!Var.isVar(memberNode))
// If memberNode is defined, find lists containing it.
x = GraphList.listFromMember(new GNode(execCxt.getActiveGraph(), memberNode));
else
// Hard. Subject unbound, no fixed member. Find every list and use BFI.
x = GraphList.findAllLists(execCxt.getActiveGraph());
return super.allLists(binding, x, listVar, predicate, new PropFuncArg(objectArgs, null), execCxt);
}
use of org.apache.jena.sparql.pfunction.PropFuncArg in project jena by apache.
the class OpPropFunc method equalTo.
@Override
public boolean equalTo(Op other, NodeIsomorphismMap labelMap) {
if (!(other instanceof OpPropFunc))
return false;
OpPropFunc procFunc = (OpPropFunc) other;
if (!this.getProperty().equals(procFunc.getProperty()))
return false;
PropFuncArg s1 = getSubjectArgs();
PropFuncArg s2 = procFunc.getSubjectArgs();
s1.equals(s2);
if (!isomorphic(getSubjectArgs(), procFunc.getSubjectArgs(), labelMap))
return false;
if (!isomorphic(getObjectArgs(), procFunc.getObjectArgs(), labelMap))
return false;
return getSubOp().equalTo(procFunc.getSubOp(), labelMap);
}
use of org.apache.jena.sparql.pfunction.PropFuncArg in project jena by apache.
the class OpRewriter method visit.
@Override
public void visit(OpPropFunc opPropFunc) {
opPropFunc.getSubOp().visit(this);
Op op = pop();
Node uri = changeNode(opPropFunc.getProperty());
PropFuncArg args1 = rewrite(opPropFunc.getSubjectArgs());
PropFuncArg args2 = rewrite(opPropFunc.getObjectArgs());
push(new OpPropFunc(uri, args1, args2, op));
}
use of org.apache.jena.sparql.pfunction.PropFuncArg in project jena by apache.
the class WithinBoxGeomPFTest method testCheckSecondFilter.
/**
* Test of checkSecondFilter method, of class WithinBoxGeomPF.
*/
@Test
public void testCheckSecondFilter() {
WithinBoxGeomPF instance = new WithinBoxGeomPF();
// Property Function
Node predicate = NodeFactory.createURI(SpatialExtension.WITHIN_BOX_GEOM_PROP);
// Geometry and Envelope parameters
float lat = 1;
float lon = 1;
float latMin = 0;
float lonMin = 0;
float latMax = 2;
float lonMax = 2;
Literal geometry = ConvertLatLonBox.toLiteral(latMin, lonMin, latMax, lonMax);
Literal targetGeometry = ConvertLatLon.toLiteral(lat, lon);
List<Node> objectNodes = Arrays.asList(geometry.asNode());
PropFuncArg object = new PropFuncArg(objectNodes);
// Function arguments
SpatialArguments spatialArguments = instance.extractObjectArguments(predicate, object, SpatialIndexTestData.WGS_84_SRS_INFO);
GeometryWrapper targetGeometryWrapper = GeometryWrapper.extract(targetGeometry);
// Test arguments
boolean expResult = true;
boolean result = instance.checkSecondFilter(spatialArguments, targetGeometryWrapper);
assertEquals(expResult, result);
}
use of org.apache.jena.sparql.pfunction.PropFuncArg in project jena by apache.
the class WithinBoxGeomPFTest method testCheckSecondFilter_fail.
/**
* Test of checkSecondFilter method, of class WithinBoxGeomPF.
*/
@Test
public void testCheckSecondFilter_fail() {
WithinBoxGeomPF instance = new WithinBoxGeomPF();
// Property Function
Node predicate = NodeFactory.createURI(SpatialExtension.WITHIN_BOX_GEOM_PROP);
// Geometry and Envelope parameters
float lat = 5;
float lon = 5;
float latMin = 0;
float lonMin = 0;
float latMax = 2;
float lonMax = 2;
Literal geometry = ConvertLatLonBox.toLiteral(latMin, lonMin, latMax, lonMax);
Literal targetGeometry = ConvertLatLon.toLiteral(lat, lon);
List<Node> objectNodes = Arrays.asList(geometry.asNode());
PropFuncArg object = new PropFuncArg(objectNodes);
// Function arguments
SpatialArguments spatialArguments = instance.extractObjectArguments(predicate, object, SpatialIndexTestData.WGS_84_SRS_INFO);
GeometryWrapper targetGeometryWrapper = GeometryWrapper.extract(targetGeometry);
// Test arguments
boolean expResult = false;
boolean result = instance.checkSecondFilter(spatialArguments, targetGeometryWrapper);
assertEquals(expResult, result);
}
Aggregations