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

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


    //        DatasetGraph dg = execCxt.getDataset() ;
    //        if ( ! ( dg instanceof DatasetGraphTDB ) )
    //            throw new InternalErrorException("Not a TDB backed dataset in quad pattern execution") ;
       
        DatasetGraphTDB ds = (DatasetGraphTDB)execCxt.getDataset() ;
        BasicPattern bgp = quadPattern.getBasicPattern() ;
        Node gn = quadPattern.getGraphNode() ;
        return optimizeExecuteQuads(ds, input, gn, bgp, null, execCxt) ;
    }
View Full Code Here


            // substituted as part of evaluation.
           
            if ( ! peek.hasNext() )
                throw new ARQInternalErrorException("Peek iterator is already empty") ;
            BasicPattern pattern2 = Substitute.substitute(pattern, peek.peek() ) ;
            // Calculate the reordering based on the substituted pattern.
            ReorderProc proc = transform.reorderIndexes(pattern2) ;
            // Then reorder original patten
            pattern = proc.reorder(pattern) ;
        }
View Full Code Here

        {
            Graph g = execCxt.getActiveGraph() ;
           
            if ( g instanceof GraphTDB )
            {
                BasicPattern bgp = opBGP.getPattern() ;
                Explain.explain("Execute", bgp, execCxt.getContext()) ;
                // Triple-backed (but may be named as explicit default graph).
                return SolverLib.execute((GraphTDB)g, bgp, input, filter, execCxt) ;
            }
            Log.warn(this, "Non-GraphTDB passed to OpExecutorPlainTDB") ;
View Full Code Here

           
            if ( execCxt.getDataset() instanceof DatasetGraphTDB )
            {
                DatasetGraphTDB ds = (DatasetGraphTDB)execCxt.getDataset() ;
                Explain.explain("Execute", opQuadPattern.getPattern(), execCxt.getContext()) ;
                BasicPattern bgp = opQuadPattern.getBasicPattern() ;
                return SolverLib.execute(ds, gn, bgp, input, filter, execCxt) ;
            }
            // Maybe a TDB named graph inside a non-TDB dataset.
            Graph g = execCxt.getActiveGraph() ;
            if ( g instanceof GraphTDB )
            {
                if ( g instanceof GraphTriplesTDB )
                {
                    // Triples graph from TDB (which is the default graph of the dataset),
                    // used a named graph in a composite dataset.
                    BasicPattern bgp = opQuadPattern.getBasicPattern() ;
                    Explain.explain("Execute", bgp, execCxt.getContext()) ;
                    return SolverLib.execute((GraphTDB)g, bgp, input, filter, execCxt) ;
                }
               
                if ( g instanceof GraphNamedTDB )
View Full Code Here

        final Node o = (m.getMatchObject()==null)    ? Var.alloc("o")   :  m.getMatchObject() ;

        Triple triple = new Triple(s, p ,o) ;
       
        // Evaluate as an algebra expression
        BasicPattern pattern = new BasicPattern() ;
        pattern.add(triple) ;
        Op op = new OpQuadPattern(graphNode, pattern) ;
        Plan plan = QueryEngineSDB.getFactory().create(op, datasetStore, BindingRoot.create(), null) ;
       
        QueryIterator qIter = plan.iterator() ;
       
View Full Code Here

    ExprList eLst = filter.getExprs();
    Assert.assertEquals( 1, eLst.size());
    Assert.assertTrue( "Should have been a SecuredFunction", eLst.get(0) instanceof SecuredFunction);
    op = filter.getSubOp();
    Assert.assertTrue( "Should have been a OpBGP", op instanceof OpBGP);
    BasicPattern basicPattern = ((OpBGP)op).getPattern();
    Assert.assertEquals( 3, basicPattern.size() );
   
    Triple t = basicPattern.get(0);
    Assert.assertEqualsNodeFactory.createVariable("foo"), t.getSubject());
    Assert.assertEquals( RDF.type.asNode(), t.getPredicate());
    Assert.assertEquals( NodeFactory.createURI( "http://example.com/class"), t.getObject());
   
    t = basicPattern.get(1);
    Assert.assertEqualsNodeFactory.createVariable("foo"), t.getSubject());
    Assert.assertTrue( "Should have been blank", t.getPredicate().isBlank());
    Assert.assertEquals( NodeFactory.createVariable("bar"), t.getObject())
   
    t = basicPattern.get(2);
    Assert.assertEquals( NodeFactory.createVariable("bar"), t.getSubject() );
    Assert.assertTrue( "Should have been blank", t.getPredicate().isBlank());
    Assert.assertEquals( NodeFactory.createVariable("baz"), t.getObject())
  }
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 Op0 copy()                       { return new OpQuadBlock(quads) ; }

    public List<OpQuadPattern> convert()    {
        List<OpQuadPattern> x = new ArrayList<>() ;
        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

        }

        for (Triple triple : pattern) {
            OpQuadPattern opQuad = getQuads(op);
            if (opQuad == null) {
                opQuad = new OpQuadPattern(graphNode, new BasicPattern());
                op = OpSequence.create(op, opQuad);
            }

            opQuad.getBasicPattern().add(triple);
            // Update variables in scope.
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.