Uploaded image for project: 'Blazegraph (by SYSTAP)'
  1. Blazegraph (by SYSTAP)
  2. BLZG-1155

hasStatements can overestimate and ignores includeInferred (REST API)




      The current implementation of com.bigdata.rdf.sail.webapp.client.RemoteRepository.hasStatements() relies on the REST API ESTCARD method, which in turn is based on the fast-range count mechanism in the backend database. This fast range count is exact when the namespace uses unisolated updated. However, it can be an overestimate when the namespace uses fully isolated read/write connections (buffered transactions).

      In order to fix this we need to lift the hasStatements() method onto the REST API so the backend database can make the decision to use a fast range count or getStatements() LIMIT 1. Also, the code currently ignores the includeInferred boolean. In order to filter out materialized inferences, we would have to use getStatements() LIMIT 1 with an access path filter. The AbstractTripleStore hasStatements() implementation already does all of this. By lifting hasStatements() into the REST API we can simply leverage the existing code.

      In fact, the REST API today only supports unisolated updates so this is not currently an urgent issue.

      The new method will be

      GET Request-URI ?HASSTMT((&[s|p|o|c]=(uri|literal))+|(includeInferred=(true|false)?)

      The response is an XML document as follows.

      <data result="true|false" milliseconds="elapsed"/>

      - where result is either "true" or "false"; and
      - where elapsed is the elapsed time in milliseconds for the request.

      The semantics are to report true iff at least one statement exists at the end point at satisfies the given triple/quad pattern.

      The includeInferred option will default to true. When true, inferred statements are considered. When false, only explicit statements are specified.

      Note that the server can optimize this request in a number of fashions.

      TODO Test suite. We might already have coverage indirectly, but we should have our own direct tests of the new REST API method.




            bryanthompson bryanthompson
            bryanthompson bryanthompson
            0 Vote for this issue
            2 Start watching this issue