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

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, Node.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


       
        // Better
        // Build a SPARQL algebra expression
        Var var2 = createNewVar() ;                     // Hidden variable
       
        BasicPattern bp = new BasicPattern() ;
        Triple t = new Triple(nodeVar, RDFS.label.asNode(), var2) ;
        bp.add(t) ;
        OpBGP op = new OpBGP(bp) ;
       
        Expr regex = new E_Regex(new ExprVar(var2.getName()), pattern, "i") ;
        Op filter = OpFilter.filter(regex, op) ;
View Full Code Here

            // List ...
            List<Node> list = args.getArgList() ;
            if ( list.size() == 0 )
                return RDF.Nodes.nil ;
            BasicPattern bgp = new BasicPattern() ;
            Node head = GraphList.listToTriples(list, bgp) ;
            currentGroup().addElement(process(bgp)) ;
            return head ;
        }
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

    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

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

        return Tags.tagTriple ;
    }

    public boolean equivalent(OpBGP opBGP)
    {
        BasicPattern bgp = opBGP.getPattern() ;
        if ( bgp.size() != 1 ) return false ;
        Triple t = bgp.get(0) ;
        return triple.equals(t)
    }
View Full Code Here

    public static boolean isBGP(Op op)
    {
        return (op instanceof OpBGP ) ;
    }

    public OpBGP() { this(new BasicPattern()) ; }
View Full Code Here

   
    // ---- All the cases
   
    protected QueryIterator execute(OpBGP opBGP, QueryIterator input)
    {
        BasicPattern pattern = opBGP.getPattern() ;
        return StageBuilder.execute(pattern, input, execCxt) ;
    }
View Full Code Here

    }
   
    private static BasicPattern buildBGP(ItemList list)
    {
        // Skips the tag.
        BasicPattern triples = new BasicPattern() ;
        for ( int i = 1 ; i < list.size() ; i++ )
        {
            Item item = list.get(i) ;
            if ( ! item.isList() )
                BuilderLib.broken(item, "Not a triple structure") ;
            Triple t = BuilderGraph.buildTriple(item.getList()) ;
            triples.add(t) ;
        }
        return triples ;
    }
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.