Examples of BasicPattern


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

        String pattern = args[0] ;
        String statsFile = args[1] ;
       
        Op op = SSE.readOp(pattern) ;

        BasicPattern bgp ;
        if ( op instanceof OpQuadPattern ) {
            bgp = ((OpQuadPattern)op).getBasicPattern() ;
        } else if ( op instanceof OpBGP ) {
            bgp = ((OpBGP)op).getPattern() ;
        }
        else {
            System.err.println("Not a quad or triple pattern") ;
            System.exit(2) ;
            bgp = null ;
        }
       
        ReorderTransformation reorder = chooseReorder(statsFile) ;
        //ReorderTransformation reorder = ReorderLib.fixed() ;
        BasicPattern bgp2 = reorder.reorder(bgp) ;
    
        System.out.println() ;
       
        print(bgp) ;
        System.out.println() ;
View Full Code Here

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

public class AlgebraExec
{
    public static void main (String[] argv)
    {
        String BASE = "http://example/" ;
        BasicPattern bp = new BasicPattern() ;
        Var var_x = Var.alloc("x") ;
        Var var_z = Var.alloc("z") ;
       
        // ---- Build expression
        bp.add(new Triple(var_x, NodeFactory.createURI(BASE+"p"), var_z)) ;
        Op op = new OpBGP(bp) ;
        //Expr expr = ExprUtils.parse("?z < 2 ") ;
        Expr expr = new E_LessThan(new ExprVar(var_z), NodeValue.makeNodeInteger(2)) ;
        op = OpFilter.filter(expr, op) ;
View Full Code Here

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

        {
            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) ;
                GraphTDB gtdb = (GraphTDB)g ;
                Node gn = decideGraphNode(gtdb.getGraphName(), execCxt) ;
View Full Code Here

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

           
            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 )
            {
                // 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()) ;
                // Don't pass in G -- gn may be different.
                return SolverLib.execute(((GraphTDB)g).getDSG(), gn, bgp, input, filter, execCxt) ;
            }
            Log.warn(this, "Non-DatasetGraphTDB passed to OpExecutorPlainTDB") ;
View Full Code Here

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

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

            // 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

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

        Op op = insertAnyFilter$(exprs, patternVarsScope, null) ;
       
        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

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

  /**
   * Transforms BGPs with the reordering
   */
  @Override
  public Op transform(OpBGP opBGP) {
    BasicPattern pattern = opBGP.getPattern();
    if ( pattern.size() < 2 )
        return opBGP ;
    BasicPattern pattern2 = reorder.reorder(pattern);
    return new OpBGP(pattern2);
  }
View Full Code Here

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

  /**
   * Transforms Quad Patterns with the reordering
   */
  @Override
  public Op transform(OpQuadPattern opQuadPattern) {
    BasicPattern pattern = opQuadPattern.getBasicPattern();
        if ( pattern.size() < 2 )
            return opQuadPattern ;
    BasicPattern pattern2 = reorder.reorder(pattern);
    return new OpQuadPattern(opQuadPattern.getGraphNode(), pattern2);
  }
View Full Code Here

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

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
TOP
Copyright © 2018 www.massapi.com. 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.