Examples of GraphResult


Examples of lupos.datastructures.queryresult.GraphResult

  }

  @Override
  public QueryResult process(final Dataset dataset) {
    // Leitet ein GraphResult mit den Triple-Fakten weiter
    final GraphResult result = new GraphResult();
    for (final Triple triple : this.facts) {
      result.addGraphResultTriple(triple);
    }
//    for (final OperatorIDTuple oid : this.succeedingOperators)
//      ((Operator) oid.getOperator()).processAll(result, oid.getId());
    return result;
  }
View Full Code Here

Examples of lupos.datastructures.queryresult.GraphResult

    final CollectRIFResult cr = this.getCollectedResults(true);
    final RuleResult result = new RuleResult();
    if(this.evaluator instanceof BasicIndexQueryEvaluator){
      for(final QueryResult qr: cr.getQueryResults()){
        if(qr instanceof GraphResult){
          final GraphResult gr = (GraphResult) qr;
          for(final Triple t: gr.getGraphResultTriples()){
            final Collection<Indices> ci = ((BasicIndexQueryEvaluator)this.evaluator).getDataset().getDefaultGraphIndices();
            for (final Indices indices : ci) {
              indices.add(t);
            }
          }
        } else if(qr instanceof RuleResult){
          final RuleResult rr = (RuleResult) qr;
          for(final Predicate predicate: rr.getPredicateResults()){
            if(rif_error.equals(predicate.getName())){
              result.getPredicateResults().add(predicate);
            }
          }
        }
      }
    } else if (this.evaluator instanceof StreamQueryEvaluator) {
      String s = "";
      for(final QueryResult qr: cr.getQueryResults()){
        if(qr instanceof GraphResult){
          final GraphResult gr = (GraphResult) qr;
          // TODO duplicated triple elimination!
          for(final Triple t: gr.getGraphResultTriples()){
            if(!t.getSubject().isBlank() && !t.getSubject().isURI()){
              System.out.println("Warning: The subject of the inferred triple "+t+" is neither an uri nor a blank node and thus the triple will be ignored!");
            } else if(!t.getPredicate().isURI()){
              System.out.println("Warning: The predicate of the inferred triple "+t+" is not an uri and thus the triple will be ignored!");
            } else {
View Full Code Here

Examples of lupos.datastructures.queryresult.GraphResult

  @Override
  public QueryResult process(QueryResult bindings, final int operandID) {
    if(bindings instanceof QueryResultDebug)
      bindings=((QueryResultDebug)bindings).getOriginalQueryResult();
    if (bindings instanceof GraphResult) {
      final GraphResult gr = (GraphResult) bindings;
      for (final Triple t : gr.getGraphResultTriples()) {
        if (cu == null || cu.size() == 0) {
          final Collection<Indices> ci = dataset.getDefaultGraphIndices();
          for (final Indices indices : ci) {
            indices.remove(t);
          }
View Full Code Here

Examples of org.openrdf.result.GraphResult

    client.setLimit(1);
    if (cached != null && (cached.isAbsent() || !cached.isSizeAvailable())) {
      // Only calculate if cached value is old
      client.ifNoneMatch(cached.getETag());
    }
    GraphResult result = client.get(subj, pred, obj, includeInferred, contexts);
    int maxAge = client.getMaxAge();
    if (result == null) {
      assert cached != null : "Server did not return a size value";
      cached.refreshed(now, maxAge);
    }
    else {
      cached = new CachedSize(result.hasNext(), client.getETag());
      cached.refreshed(now, maxAge);
      cachedSizes.put(pattern, cached);
    }
    containsFreshValues |= maxAge > 0;
    return cached.isAbsent();
View Full Code Here

Examples of org.openrdf.result.GraphResult

      return new ModelNamespaceResult(this, new EmptyCursor<Statement>());
    }

    flush();
    StatementClient statements = client.statements();
    GraphResult result = statements.get(subj, pred, obj, inf, ctx);
    return new ModelResultImpl(new GraphQueryResultCursor(result));
  }
View Full Code Here

Examples of org.openrdf.result.GraphResult

      return repository.hasStatement(subj, pred, obj, includeInferred, contexts);
    }
    flush();
    StatementClient statements = client.statements();
    statements.setLimit(1);
    GraphResult result = statements.get(subj, pred, obj, includeInferred, contexts);
    try {
      return result.hasNext();
    }
    finally {
      result.close();
    }
  }
View Full Code Here

Examples of org.openrdf.result.GraphResult

      writeln("Evaluating query...");
      long startTime = System.nanoTime();

      Collection<Namespace> namespaces = con.getNamespaces().addTo(new ArrayList<Namespace>());

      GraphResult queryResult = con.prepareGraphQuery(ql, queryString).evaluate();

      try {
        int resultCount = 0;

        while (queryResult.hasNext()) {
          Statement st = queryResult.next();
          resultCount++;

          write(getStringRepForValue(st.getSubject(), namespaces));
          write("   ");
          write(getStringRepForValue(st.getPredicate(), namespaces));
          write("   ");
          write(getStringRepForValue(st.getObject(), namespaces));
          writeln();
        }

        long endTime = System.nanoTime();
        writeln(resultCount + " results (" + (endTime - startTime) / 1000000 + " ms)");
      }
      finally {
        queryResult.close();
      }
    }
    finally {
      con.close();
    }
View Full Code Here

Examples of org.openrdf.result.GraphResult

  }

  public <H extends RDFHandler> H evaluate(H handler)
    throws StoreException, RDFHandlerException
  {
    GraphResult queryResult = evaluate();
    QueryResultUtil.report(queryResult, handler);
    return handler;
  }
View Full Code Here

Examples of org.openrdf.result.GraphResult

      // Graph queryGraph = RepositoryUtil.asGraph(queryResult);
      // Graph expectedGraph = readExpectedTupleQueryResult();
      // compareGraphs(queryGraph, expectedGraph);
    }
    else if (query instanceof GraphQuery) {
      GraphResult gqr = ((GraphQuery)query).evaluate();
      Set<Statement> queryResult = gqr.asSet();

      Set<Statement> expectedResult = readExpectedGraphQueryResult();

      compareGraphs(queryResult, expectedResult);
    }
View Full Code Here

Examples of org.openrdf.result.GraphResult

          con.add(url(graphName), base(graphName), RDFFormat.forFileName(graphName), new URIImpl(
              graphName));
        }

        // Evaluate the query on the query data
        GraphResult result = con.prepareGraphQuery(getQueryLanguage(), query).evaluate();
        try {
          actualStatements = result.asList();
        }
        finally {
          result.close();
        }
      }
      finally {
        con.close();
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.