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

hasStatements can overestimate and ignores includeInferred (REST API)

    Details

      Description

      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.

        Activity

        Hide
        bryanthompson bryanthompson added a comment -

        I have added BigdataSailConnection.hasStatement() that is optimized to use a fast range count whenever possible.

        I have overridden BigdataSailRepositoryhasStatement() to use this new method. This will provide a nice performance optimization for the common use cases.

        I have added a HASTMT method to QueryServlet (doHasStmt) for both GET and POST code paths.

        I have documented the return format on this ticket.

        Show
        bryanthompson bryanthompson added a comment - I have added BigdataSailConnection.hasStatement() that is optimized to use a fast range count whenever possible. I have overridden BigdataSailRepositoryhasStatement() to use this new method. This will provide a nice performance optimization for the common use cases. I have added a HASTMT method to QueryServlet (doHasStmt) for both GET and POST code paths. I have documented the return format on this ticket.
        Hide
        bryanthompson bryanthompson added a comment -

        Resolved in the TICKET_1156 branch.

        See BLZG-1195.

        Show
        bryanthompson bryanthompson added a comment - Resolved in the TICKET_1156 branch. See BLZG-1195 .

          People

          • Assignee:
            bryanthompson bryanthompson
            Reporter:
            bryanthompson bryanthompson
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: