Package org.openrdf.http.client

Examples of org.openrdf.http.client.StatementClient


      Resource... contexts)
    throws StoreException
  {
    StatementPattern pattern = new StatementPattern(subj, pred, obj, includeInferred, contexts);
    CachedSize cached = cachedSizes.get(pattern);
    StatementClient client = this.client.statements();
    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


    if (noMatch(subj, pred, obj, inf, ctx)) {
      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

    if (cachable(subj, pred, obj, contexts)) {
      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

    if (repository.isReadOnly()) {
      throw new RepositoryReadOnlyException();
    }
    // Send bytes directly to the server
    flush();
    StatementClient httpClient = client.statements();
    if (inputStreamOrReader instanceof InputStream) {
      httpClient.upload(((InputStream)inputStreamOrReader), baseURI, dataFormat, false, contexts);
    }
    else if (inputStreamOrReader instanceof Reader) {
      httpClient.upload(((Reader)inputStreamOrReader), baseURI, dataFormat, false, contexts);
    }
    else {
      throw new IllegalArgumentException("inputStreamOrReader must be an InputStream or a Reader, is a: "
          + inputStreamOrReader.getClass());
    }
View Full Code Here

TOP

Related Classes of org.openrdf.http.client.StatementClient

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.