Package org.openrdf.query.parser

Examples of org.openrdf.query.parser.TupleQueryModel


    URI bar = factory.createURI("http://www.foo.example/bar");

    SailConnection con = store.getConnection();
    con.addStatement(foo, RDF.TYPE, bar);

    TupleQueryModel query = QueryParserUtil.parseTupleQuery(QueryLanguage.SERQL,
        "SELECT X, P, Y FROM {X} P {Y}", null);

    Cursor<? extends BindingSet> iter = con.evaluate(query,
        EmptyBindingSet.getInstance(), false);
View Full Code Here


  public void prepare()
    throws StoreException
  {
    assert preparedQuery == null;

    TupleQueryModel model = new TupleQueryModel(getArg());
    String encodedQuery = new QueryModelSerializer().writeQueryModel(model, "");

    try {
      preparedQuery = owner.prepareTupleQuery(LANGUAGE, encodedQuery);
      bindingNames = getBindingNames();
View Full Code Here

  }

  public SailTupleQuery prepareTupleQuery(QueryLanguage ql, String queryString, String baseURI)
    throws MalformedQueryException
  {
    TupleQueryModel parsedQuery = QueryParserUtil.parseTupleQuery(ql, queryString, baseURI);
    return new SailTupleQuery(parsedQuery, this);
  }
View Full Code Here

  }

  public TupleResult evaluate()
    throws StoreException
  {
    TupleQueryModel query = getParsedQuery();

    if (getOffset() > 0 || getLimit() >= 0) {
      query.setArg(new Slice(query.getArg(), getOffset(), getLimit()));
    }

    Cursor<? extends BindingSet> bindingsIter = evaluate(query);

    return new TupleResultImpl(new ArrayList<String>(query.getBindingNames()), bindingsIter);
  }
View Full Code Here

      TupleExpr tupleExpr = QueryModelBuilder.buildQueryModel(qc, new ValueFactoryImpl());

      ASTQuery queryNode = qc.getQuery();
      QueryModel query;
      if (queryNode instanceof ASTTupleQuery) {
        query = new TupleQueryModel(tupleExpr);
      }
      else if (queryNode instanceof ASTGraphQuery) {
        query = new GraphQueryModel(tupleExpr, namespaces);
      }
      else {
View Full Code Here

      QueryModel query;

      ASTQuery queryNode = qc.getQuery();
      if (queryNode instanceof ASTSelectQuery) {
        query = new TupleQueryModel(tupleExpr);
      }
      else if (queryNode instanceof ASTConstructQuery) {
        query = new GraphQueryModel(tupleExpr, prefixes);
      }
      else if (queryNode instanceof ASTAskQuery) {
View Full Code Here

    EvaluationStrategyImpl eval = new FederationStrategy(executor, source, query, includeInferred);
    return eval.evaluate(query, bindings);
  }

  private QueryModel createQueryModel(OwnedTupleExpr expr) {
    TupleQueryModel query = new TupleQueryModel(expr.getArg());
    if (dataset != null) {
      query.setDefaultGraphs(dataset.getDefaultGraphs());
      query.setNamedGraphs(dataset.getNamedGraphs());
    }
    return query;
  }
View Full Code Here

    }
    finally {
      stIter.close();
    }

    TupleQueryModel tupleQuery = QueryParserUtil.parseTupleQuery(QueryLanguage.SERQL,
        "SELECT S, P, O FROM {S} P {O} WHERE P = <" + pred.stringValue() + ">", null);

    Cursor<? extends BindingSet> iter;
    iter = con.evaluate(tupleQuery, EmptyBindingSet.getInstance(), false);
View Full Code Here

    con.addStatement(picasso, RDF.TYPE, painter);
    con.addStatement(guernica, RDF.TYPE, painting);
    con.addStatement(picasso, paints, guernica);
    con.commit();

    TupleQueryModel tupleQuery = QueryParserUtil.parseTupleQuery(QueryLanguage.SERQL,
        "SELECT C FROM {} rdf:type {C}", null);

    Cursor<? extends BindingSet> iter;
    iter = con.evaluate(tupleQuery, EmptyBindingSet.getInstance(), false);
View Full Code Here

    con.addStatement(picasso, RDF.TYPE, painter, context1);
    con.addStatement(guernica, RDF.TYPE, painting, context1);
    con.addStatement(picasso, paints, guernica, context1);
    con.commit();

    TupleQueryModel tupleQuery = QueryParserUtil.parseTupleQuery(QueryLanguage.SERQL,
        "select X from {X} rdf:type {Y} rdf:type {rdfs:Class}", null);

    MapBindingSet bindings = new MapBindingSet(1);

    Cursor<? extends BindingSet> iter;
View Full Code Here

TOP

Related Classes of org.openrdf.query.parser.TupleQueryModel

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.