Package com.hp.hpl.jena.sparql.core

Examples of com.hp.hpl.jena.sparql.core.BasicPattern


        if ( opQuad.isEmpty() )
            return TableFactory.createUnit() ;
       
        ExecutionContext cxt = evaluator.getExecContext() ;
        DatasetGraph ds = cxt.getDataset() ;
        BasicPattern pattern = opQuad.getBasicPattern() ;
       
        if ( ! opQuad.getGraphNode().isVariable() )
        {
            if ( ! opQuad.getGraphNode().isURI() )
            { throw new ARQInternalErrorException("Not a URI or variable: "+opQuad.getGraphNode()) ;}
View Full Code Here


    public Op0 copy()                       { return new OpQuadBlock(quads) ; }

    public List<OpQuadPattern> convert()    {
        List<OpQuadPattern> x = new ArrayList<OpQuadPattern>() ;
        Node gn = null ;
        BasicPattern bgp = null ;
       
        for ( Quad q : quads ) {
            if ( gn == null || ! gn.equals(q.getGraph()) ) {
                if ( gn != null )
                    x.add(new OpQuadPattern(gn, bgp)) ;
                gn = q.getGraph() ;
                bgp = new BasicPattern() ;
            }
            bgp.add(q.asTriple());
        }
        x.add(new OpQuadPattern(gn, bgp)) ;
        return x ;
    }
View Full Code Here

            return  OpTable.empty() ;
       
        if ( quads.size() == 1 )
        {
            Quad q = quads.get(0) ;
            BasicPattern bgp = new BasicPattern() ;
            bgp.add(q.asTriple()) ;
            return new OpQuadPattern(q.getGraph(), bgp) ;
        }

        List<OpQuadPattern> x = convert() ;
        OpSequence ops = OpSequence.create() ;
View Full Code Here

public class PathLib
{
    /** Convert any paths of exactly one predicate to a triple pattern */
    public static Op pathToTriples(PathBlock pattern)
    {
        BasicPattern bp = null ;
        Op op = null ;

        for ( TriplePath tp : pattern )
        {
            if ( tp.isTriple() )
            {
                if ( bp == null )
                    bp = new BasicPattern() ;
                bp.add(tp.asTriple()) ;
                continue ;
            }
            // Path form.
            op = flush(bp, op) ;
            bp = null ;
View Full Code Here

    public OpQuadPattern asQuadPattern()
    {
        if ( opQuadPattern == null )
        {
            BasicPattern bp = new BasicPattern() ;
            bp.add(getQuad().asTriple()) ;
            opQuadPattern = new OpQuadPattern(quad.getGraph(),bp) ;
        }
        return opQuadPattern ;
    }
View Full Code Here

    }
   
    /** Do a node->node conversion of a BGP - return original BGP for "no change" */
    public static BasicPattern transform(NodeTransform nodeTransform, BasicPattern pattern
    {
        BasicPattern bgp2 = new BasicPattern() ;
        boolean changed = false ;
        for ( Triple triple : pattern )
        {
            Triple t2 = transform(nodeTransform, triple) ;
            bgp2.add(t2) ;
            if ( t2 != triple )
                changed = true ;
        }
        if ( ! changed )
            return pattern ;
View Full Code Here

        return OpFilter.filter(exprList2, subOp) ;
    }       
   
    @Override public Op transform(OpBGP opBGP)
    {
        BasicPattern bgp2 = NodeTransformLib.transform(transform, opBGP.getPattern()) ;
        if ( bgp2 == opBGP.getPattern())
            return super.transform(opBGP) ;
        return new OpBGP(bgp2) ;
    }
View Full Code Here

    }
   
    @Override public Op transform(OpQuadPattern opQuadPattern)
    {
        // The internal representation is (graph, BGP)
        BasicPattern bgp2 = NodeTransformLib.transform(transform, opQuadPattern.getBasicPattern()) ;
        Node g2 = opQuadPattern.getGraphNode() ;
        g2 = transform.convert(g2) ;
       
        if ( g2 == opQuadPattern.getGraphNode() && bgp2 == opQuadPattern.getBasicPattern() )
            return super.transform(opQuadPattern) ;
View Full Code Here

        //    (but leave the property function triple in-place as a marker)
        // 3/ For remaining triples, put into basic graph patterns,
        //    and string together the procedure calls and BGPs.
       
        List<Triple> propertyFunctionTriples = new ArrayList<Triple>() ;    // Property functions seen
        BasicPattern triples = new BasicPattern(pattern) // A copy of all triples (later, it is mutated)
       
        // Find the triples invoking property functions, and those not.
        findPropertyFunctions(context, pattern, registry, propertyFunctionTriples) ;
       
        if ( propertyFunctionTriples.size() == 0 )
View Full Code Here

   
    public final OpBGP asBGP()
    {
        if ( opBGP == null )
        {
            BasicPattern bp = new BasicPattern() ;
            bp.add(getTriple()) ;
            opBGP = new OpBGP(bp) ;
        }
        return opBGP ;
    }       
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sparql.core.BasicPattern

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.