Package com.hp.hpl.jena.sparql.syntax

Examples of com.hp.hpl.jena.sparql.syntax.ElementGroup


        return NodeTransformLib.transformQuads(bnodesToVariables, quads) ;
    }
   
    protected Element elementFromQuads(List<Quad> quads)
    {
        ElementGroup el = new ElementGroup() ;
        ElementTriplesBlock x = new ElementTriplesBlock() ;
        // Maybe empty??
        el.addElement(x) ;
        Node g = Quad.defaultGraphNodeGenerated ;
       
        for ( Quad q : quads )
        {
            if ( q.getGraph() != g )
            {
                g = q.getGraph() ;
                x = new ElementTriplesBlock() ;
                if ( g == null || g == Quad.defaultGraphNodeGenerated )
                    el.addElement(x) ;
                else
                {
                    ElementNamedGraph eng = new ElementNamedGraph(g, x) ;
                    el.addElement(eng) ;
                }
            }
            x.addTriple(q.asTriple()) ;
        }
        return el ;
View Full Code Here


        elementBGP.addTriple(t) ;
       
        // Regular expression for  regex(?hiddenVar, "pattern", "i")
        Expr regex = new E_Regex(new ExprVar(var2.getName()), pattern, "i") ;
       
        ElementGroup elementGroup = new ElementGroup() ;
        elementGroup.addElement(elementBGP) ;
        elementGroup.addElement(new ElementFilter(regex)) ;
        // Compile it.
        // The better design is to build the Op structure programmatically,
        Op op = Algebra.compile(elementGroup) ;
        op = Algebra.optimize(op, execCxt.getContext()) ;
        return QC.execute(op, input, execCxt) ;
View Full Code Here

        elementBGP.addTriple(t) ;
       
        // Regular expression for  regex(?hiddenVar, "pattern", "i")
        Expr regex = new E_Regex(new ExprVar(var2.getName()), pattern, "i") ;
       
        ElementGroup elementGroup = new ElementGroup() ;
        elementGroup.addElement(elementBGP) ;
        elementGroup.addElement(new ElementFilter(regex)) ;
        // Compile it.
        // The better design is to build the Op structure programmatically,
        Op op = Algebra.compile(elementGroup) ;
        op = Algebra.optimize(op, execCxt.getContext()) ;
        return QC.execute(op, input, execCxt) ;
View Full Code Here

        return NodeTransformLib.transformQuads(bnodesToVariables, quads) ;
    }
   
    protected Element elementFromQuads(List<Quad> quads)
    {
        ElementGroup el = new ElementGroup() ;
        ElementTriplesBlock x = new ElementTriplesBlock() ;
        // Maybe empty??
        el.addElement(x) ;
        Node g = Quad.defaultGraphNodeGenerated ;
       
        for ( Quad q : quads )
        {
            if ( q.getGraph() != g )
            {
                g = q.getGraph() ;
                x = new ElementTriplesBlock() ;
                if ( g == null || g == Quad.defaultGraphNodeGenerated )
                    el.addElement(x) ;
                else
                {
                    ElementNamedGraph eng = new ElementNamedGraph(g, x) ;
                    el.addElement(eng) ;
                }
            }
            x.addTriple(q.asTriple()) ;
        }
        return el ;
View Full Code Here

            throw new QueryExecException("Attempt to get a DESCRIBE result from a "+labelForQuery(query)+" query") ;
        //Was: query.setQueryResultStar(true) ; but why?
        query.setResultVars() ;
        // If there was no WhereClause, use an empty pattern (one solution, no columns).
        if ( query.getQueryPattern() == null )
            query.setQueryPattern(new ElementGroup()) ;
       
        Set<RDFNode> set = new HashSet<RDFNode>() ;

        //May return null (no query pattern)
        ResultSet qRes = execResultSet() ;
View Full Code Here

            throw new QueryExecException("Attempt to get a DESCRIBE result from a "+labelForQuery(query)+" query") ;
        //Was: query.setQueryResultStar(true) ; but why?
        query.setResultVars() ;
        // If there was no WhereClause, use an empty pattern (one solution, no columns).
        if ( query.getQueryPattern() == null )
            query.setQueryPattern(new ElementGroup()) ;
       
        Set<RDFNode> set = new HashSet<RDFNode>() ;

        //May return null (no query pattern)
        ResultSet qRes = execResultSet() ;
View Full Code Here

    if( !(pattern instanceof ElementGroup) )
      throw new UnsupportedQueryException( "ElementGroup was expected, but found '"
          + pattern.getClass() + "'." );

    final ElementGroup elementGroup = (ElementGroup) pattern;

    final List<Element> elements = elementGroup.getElements();
    final Element first = elements.get( 0 );
    if (elements.size() != 1 || (!(first instanceof ElementTriplesBlock) && !(first instanceof ElementPathBlock)))
      throw new UnsupportedQueryException("Complex query patterns are not supported yet.");

    List<Triple> triples;
View Full Code Here

         */
        public ComponentQuery addMigrationPath(String sourceMimetype, String targetMimetype) {
            if ((sourceMimetype != null && !sourceMimetype.isEmpty())
                || (targetMimetype != null && !targetMimetype.isEmpty())) {
                Node node = NodeFactory.createAnon();
                ElementGroup group = new ElementGroup();
                group.addTriplePattern(new Triple(wfNode, NodeFactory.createURI(ONTOLOGY_IRI + "migrates"), node));
                group.addTriplePattern(new Triple(node, NodeFactory.createURI(TYPE_IRI), NodeFactory
                    .createURI(ONTOLOGY_IRI + "MigrationPath")));
                if (sourceMimetype != null && !sourceMimetype.isEmpty()) {
                    group.addTriplePattern(new Triple(node, NodeFactory.createURI(ONTOLOGY_IRI + "sourceMimetype"),
                        NodeFactory.createLiteral(sourceMimetype)));
                }
                if (targetMimetype != null && !targetMimetype.isEmpty()) {
                    group.addTriplePattern(new Triple(node, NodeFactory.createURI(ONTOLOGY_IRI + "targetMimetype"),
                        NodeFactory.createLiteral(targetMimetype)));
                }
                query.addElement(group);
            }
            return this;
View Full Code Here

         *            the mimetypes
         * @return this query
         */
        public ComponentQuery addHandlesMimetype(String... mimetypes) {
            if (mimetypes != null && mimetypes.length > 0) {
                ElementGroup elements = new ElementGroup();
                Set<String> mimeset = new HashSet<String>();
                Collections.addAll(mimeset, mimetypes);
                for (String mimetype : mimeset) {
                    if (mimetype != null) {
                        elements.addTriplePattern(new Triple(wfNode, NodeFactory.createURI(ONTOLOGY_IRI
                            + "handlesMimetype"), NodeFactory.createLiteral(mimetype)));
                    }
                }
                handlesMimetypes.addElement(elements);
            }
View Full Code Here

         * @return this query
         */
        public ComponentQuery addHandlesMimetypes(String leftMimetype, String rightMimetype) {
            if (leftMimetype != null && !leftMimetype.isEmpty() && rightMimetype != null && !rightMimetype.isEmpty()) {
                Node node = NodeFactory.createAnon();
                ElementGroup group = new ElementGroup();
                group.addTriplePattern(new Triple(wfNode, NodeFactory.createURI(ONTOLOGY_IRI + "handlesMimetypes"),
                    node));
                group.addTriplePattern(new Triple(node, NodeFactory.createURI(TYPE_IRI), NodeFactory
                    .createURI(ONTOLOGY_IRI + "AcceptedMimetypes")));
                group.addTriplePattern(new Triple(node, NodeFactory.createURI(ONTOLOGY_IRI + "handlesLeftMimetype"),
                    NodeFactory.createLiteral(leftMimetype)));
                group.addTriplePattern(new Triple(node, NodeFactory.createURI(ONTOLOGY_IRI + "handlesRightMimetype"),
                    NodeFactory.createLiteral(rightMimetype)));

                handlesMimetypes.addElement(group);
            }
            return this;
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sparql.syntax.ElementGroup

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.