Package org.openrdf.query.algebra

Examples of org.openrdf.query.algebra.QueryModel


   *         If the specified query language is not supported.
   */
  public static TupleQueryModel parseTupleQuery(QueryLanguage ql, String query, String baseURI)
    throws MalformedQueryException, UnsupportedQueryLanguageException
  {
    QueryModel q = parseQuery(ql, query, baseURI);

    if (q instanceof TupleQueryModel) {
      return (TupleQueryModel)q;
    }

View Full Code Here


   *         If the specified query language is not supported.
   */
  public static GraphQueryModel parseGraphQuery(QueryLanguage ql, String query, String baseURI)
    throws MalformedQueryException, UnsupportedQueryLanguageException
  {
    QueryModel q = parseQuery(ql, query, baseURI);

    if (q instanceof GraphQueryModel) {
      return (GraphQueryModel)q;
    }

View Full Code Here

   *         If the specified query language is not supported.
   */
  public static BooleanQueryModel parseBooleanQuery(QueryLanguage ql, String query, String baseURI)
    throws MalformedQueryException, UnsupportedQueryLanguageException
  {
    QueryModel q = parseQuery(ql, query, baseURI);

    if (q instanceof BooleanQueryModel) {
      return (BooleanQueryModel)q;
    }

View Full Code Here

  }

  private void evaluateQuery(QueryLanguage ql, String queryString) {
    try {
      queryString = addQueryPrefixes(ql, queryString);
      QueryModel query = QueryParserUtil.parseQuery(ql, queryString, null);
      if (query instanceof TupleQueryModel) {
        evaluateTupleQuery(ql, queryString);
      }
      else if (query instanceof GraphQueryModel) {
        evaluateGraphQuery(ql, queryString);
View Full Code Here

  }

  public SailQuery prepareQuery(QueryLanguage ql, String queryString, String baseURI)
    throws MalformedQueryException
  {
    QueryModel parsedQuery = QueryParserUtil.parseQuery(ql, queryString, baseURI);

    if (parsedQuery instanceof TupleQueryModel) {
      return new SailTupleQuery((TupleQueryModel)parsedQuery, this);
    }
    else if (parsedQuery instanceof GraphQueryModel) {
      return new SailGraphQuery((GraphQueryModel)parsedQuery, this);
    }
    else if (parsedQuery instanceof BooleanQueryModel) {
      return new SailBooleanQuery((BooleanQueryModel)parsedQuery, this);
    }
    else {
      throw new RuntimeException("Unexpected query type: " + parsedQuery.getClass());
    }
  }
View Full Code Here

      // TODO: check use of unbound variables?

      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);
View Full Code Here

      Map<String, String> prefixes = PrefixDeclProcessor.process(qc);
      WildcardProjectionProcessor.process(qc);
      BlankNodeVarProcessor.process(qc);
      TupleExpr tupleExpr = buildQueryModel(qc);

      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) {
        query = new BooleanQueryModel(tupleExpr);
      }
      else if (queryNode instanceof ASTDescribeQuery) {
        query = new GraphQueryModel(tupleExpr, prefixes);
      }
      else {
        throw new RuntimeException("Unexpected query type: " + queryNode.getClass());
      }

      // Handle dataset declaration
      Dataset dataset = DatasetDeclProcessor.process(qc);
      if (dataset != null) {
        query.setDefaultGraphs(dataset.getDefaultGraphs());
        query.setNamedGraphs(dataset.getNamedGraphs());
      }

      return query;
    }
    catch (ParseException e) {
View Full Code Here

  {
    Cursor<BindingSet> result = expr.evaluate(dataset, bindings, includeInferred);
    if (result != null) {
      return result;
    }
    QueryModel query = createQueryModel(expr);
    TripleSource source = new RepositoryTripleSource(expr.getOwner());
    EvaluationStrategyImpl eval = new FederationStrategy(executor, source, query, includeInferred);
    return eval.evaluate(query, bindings);
  }
View Full Code Here

  public TupleExpr optimize(QueryModel query, BindingSet bindings, EvaluationStrategy strategy)
    throws StoreException
  {
    // Clone the tuple expression to allow for more aggressive optimisations
    QueryModel tupleExpr = query.clone();

    coreOptimizations(strategy, tupleExpr, bindings);

    rdbmsOptimizations(tupleExpr, bindings);
View Full Code Here

TOP

Related Classes of org.openrdf.query.algebra.QueryModel

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.