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

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


    query.generateQueryStats();
    return query;
  }
 
  private void generateQueryStats() {
    Element queryElement = getQueryPattern();
    visitor = new SparqlElementVisitor();
    if (queryElement == null) return;
    queryElement.visit(visitor);
    visitor.cleanPossibles();
  }
View Full Code Here


        {
            out.print("WHERE") ;
            out.incIndent(BLOCK_INDENT) ;
            out.newline() ;
           
            Element el = query.getQueryPattern() ;

            fmtElement.visitAsGroup(el) ;
            //el.visit(fmtElement) ;
            out.decIndent(BLOCK_INDENT) ;
            out.newline() ;
View Full Code Here

    {
        GraphStore gStore = getEmptyGraphStore() ;
        defaultGraphData(gStore, graph1) ;
        UpdateModify insert = new UpdateModify() ;
        insert.getInsertAcc().addTriple(SSE.parseTriple("(?s <http://example/p> 1066)")) ;
        Element element = QueryFactory.createElement("{ ?s <http://example/p> 2007 }" ) ;
        insert.setElement(element) ;
        UpdateAction.execute(insert, gStore) ;
        assertTrue(graphContains(gStore.getDefaultGraph(), triple2)) ;
    }
View Full Code Here

        GraphStore gStore = getEmptyGraphStore() ;
        defaultGraphData(gStore, data2()) ;
        namedGraphData(gStore, graphIRI, data1()) ;
       
        UpdateModify modify = new UpdateModify() ;
        Element element = QueryFactory.createElement("{ ?s <http://example/p> ?o }" ) ;
        modify.setElement(element) ;
        modify.getDeleteAcc().addQuad(SSE.parseQuad("(<http://example/graph> ?s <http://example/p> 2007 )")) ;
        UpdateAction.execute(modify, gStore) ;

        assertTrue("Not empty", graphEmpty(gStore.getGraph(graphIRI))) ;
View Full Code Here

        GraphStore gStore = getEmptyGraphStore() ;
        defaultGraphData(gStore, data2()) ;
        namedGraphData(gStore, graphIRI, Factory.createDefaultGraph()) ;
       
        UpdateModify modify = new UpdateModify() ;
        Element element = QueryFactory.createElement("{ ?s <http://example/p> ?o }" ) ;
        modify.setElement(element) ;
        modify.getInsertAcc().addQuad(new Quad(graphIRI, triple1)) ;
        modify.getDeleteAcc().addTriple(SSE.parseTriple("(?s <http://example/p> ?o)")) ;
        modify.getDeleteAcc().addQuad(SSE.parseQuad("(<http://example/graph> ?s <http://example/p> ?o)")) ;
        UpdateAction.execute(modify, gStore) ;
View Full Code Here

       
        defaultGraphData(gStore, data(t)) ;
        namedGraphData(gStore, graphIRI, data(t));
       
        UpdateModify modify = new UpdateModify() ;
        Element element = QueryFactory.createElement("{ ?s <http://example/p> ?o }" ) ;
        modify.setElement(element) ;
        modify.getInsertAcc().addQuad(new Quad(graphIRI, triple1)) ;
        modify.getDeleteAcc().addTriple(SSE.parseTriple("(?s <http://example/p> ?o)")) ;
        modify.getDeleteAcc().addQuad(SSE.parseQuad("(<http://example/graph> ?s <http://example/p> ?o)")) ;
        UpdateAction.execute(modify, gStore) ;
View Full Code Here

        // Convert bNodes to named variables first.
//        if ( false )
//            // Removed from SPARQL
//            quads = convertBNodesToVariables(quads) ;
        // Convert quads to a pattern.
        Element el = elementFromQuads(quads) ;
       
        // Decided to serialize the bindings, but could also have decided to
        // serialize the quads after applying the template instead.
       
        ThresholdPolicy<Binding> policy = ThresholdPolicyFactory.policyFromContext(graphStore.getContext());
View Full Code Here

                out.ensureStartOfLine() ;
                out.print("USING NAMED ") ;
                output(x) ;
            }
            
            Element el = update.getWherePattern() ;
            out.ensureStartOfLine() ;
            out.print("WHERE") ;
            out.incIndent(BLOCK_INDENT) ;
            out.newline() ;
View Full Code Here

    if( sparql.isDescribeType() )
      throw new UnsupportedQueryException(
          "DESCRIBE queries cannot be answered with PelletQueryEngine" );

    final Element pattern = sparql.getQueryPattern();

    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;
    if (first instanceof ElementPathBlock) {
View Full Code Here

TOP

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

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.