Search in sources :

Example 1 with OpPropFunc

use of org.apache.jena.sparql.algebra.op.OpPropFunc in project jena by apache.

the class PropertyFunctionGenerator method makeStages.

private static Op makeStages(BasicPattern triples, Map<Triple, PropertyFunctionInstance> pfInvocations) {
    // Step 3 : Make the operation expression.
    //   For each property function, insert the implementation 
    //   For each block of non-property function triples, make a BGP.
    Op op = null;
    BasicPattern pattern = null;
    for (Triple t : triples) {
        if (pfInvocations.containsKey(t)) {
            op = flush(pattern, op);
            pattern = null;
            PropertyFunctionInstance pfi = pfInvocations.get(t);
            OpPropFunc opPF = new OpPropFunc(t.getPredicate(), pfi.getSubjectArgList(), pfi.getObjectArgList(), op);
            op = opPF;
            continue;
        }
        // Regular triples - make sure there is a basic pattern in progress. 
        if (pattern == null)
            pattern = new BasicPattern();
        pattern.add(t);
    }
    op = flush(pattern, op);
    return op;
}
Also used : Triple(org.apache.jena.graph.Triple) BasicPattern(org.apache.jena.sparql.core.BasicPattern) OpPropFunc(org.apache.jena.sparql.algebra.op.OpPropFunc)

Aggregations

Triple (org.apache.jena.graph.Triple)1 OpPropFunc (org.apache.jena.sparql.algebra.op.OpPropFunc)1 BasicPattern (org.apache.jena.sparql.core.BasicPattern)1