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

Loading quads data into a triple store should strip out the context

    Details

      Description

      We should allow the operation and just silently strip off the named graph when loading the data.

      This needs to be addressed in the RDF parser (the StatementBuffer class). There is probably a separate code path for handling SPARQL UPDATE (INSERT DATA, DELETE DATA).

      See below for the original ticket reporting.

      Steps to reproduce:
      git clone git://git.code.sf.net/p/bigdata/git bigdata-git
      cd bigdata-git
      ant start-bigdata


      - Go to http://localhost:9999/bigdata/#update
      - Pick example data from http://www.w3.org/TR/n-quads/ (e.g. Example 2):

      <http://example.org/#spiderman> <http://www.perceive.net/schemas/relationship/enemyOf> <http://example.org/#green-goblin> <http://example.org/graphs/spiderman> .
      


      - Use any way you like to feed the example data: specify path to file, use LOAD <file:/whatever-path.nq> SPARQL UPDATE statement, or just put the example data in-place.
      - Select N-Quads format from dropdown list if needed, press Update button.

      The outcome is

      ERROR: INSERT-WITH-BODY: baseURI=http://localhost:9999/bigdata/namespace/kb/sparql, context-uri=[]
      java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: context bound, but not quads or sids: < TermId(5U), TermId(7U), TermId(4U), TermId(6U) : Explicit >
      	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
      	at java.util.concurrent.FutureTask.get(FutureTask.java:188)
      	at com.bigdata.rdf.sail.webapp.InsertServlet.doPostWithBody(InsertServlet.java:203)
      	at com.bigdata.rdf.sail.webapp.InsertServlet.doPost(InsertServlet.java:119)
      	at com.bigdata.rdf.sail.webapp.RESTServlet.doPost(RESTServlet.java:272)
      	at com.bigdata.rdf.sail.webapp.MultiTenancyServlet.doPost(MultiTenancyServlet.java:144)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:738)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:551)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:568)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1111)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:478)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1045)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:199)
      	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:109)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
      	at org.eclipse.jetty.server.Server.handle(Server.java:462)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:279)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:232)
      	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:534)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: context bound, but not quads or sids: < TermId(5U), TermId(7U), TermId(4U), TermId(6U) : Explicit >
      	at com.bigdata.rdf.spo.SPORelation.insert(SPORelation.java:2236)
      	at com.bigdata.rdf.store.AbstractTripleStore.addStatements(AbstractTripleStore.java:4013)
      	at com.bigdata.rdf.rio.StatementBuffer.writeSPOs(StatementBuffer.java:1157)
      	at com.bigdata.rdf.rio.StatementBuffer.addStatements(StatementBuffer.java:1021)
      	at com.bigdata.rdf.rio.StatementBuffer.incrementalWrite(StatementBuffer.java:859)
      	at com.bigdata.rdf.rio.StatementBuffer.flush(StatementBuffer.java:426)
      	at com.bigdata.rdf.sail.BigdataSail$BigdataSailConnection.flushStatementBuffers(BigdataSail.java:3448)
      	at com.bigdata.rdf.sail.BigdataSail$BigdataSailConnection.commit2(BigdataSail.java:3235)
      	at com.bigdata.rdf.sail.BigdataSailRepositoryConnection.commit2(BigdataSailRepositoryConnection.java:272)
      	at com.bigdata.rdf.sail.BigdataSailRepositoryConnection.commit(BigdataSailRepositoryConnection.java:291)
      	at com.bigdata.rdf.sail.webapp.InsertServlet$InsertWithBodyTask.call(InsertServlet.java:307)
      	at com.bigdata.rdf.sail.webapp.InsertServlet$InsertWithBodyTask.call(InsertServlet.java:225)
      	at com.bigdata.rdf.task.ApiTaskForIndexManager.call(ApiTaskForIndexManager.java:67)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at com.bigdata.rdf.task.AbstractApiTask.submitApiTask(AbstractApiTask.java:315)
      	at com.bigdata.rdf.sail.webapp.BigdataServlet.submitApiTask(BigdataServlet.java:220)
      	... 26 more
      Caused by: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: context bound, but not quads or sids: < TermId(5U), TermId(7U), TermId(4U), TermId(6U) : Explicit >
      	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
      	at java.util.concurrent.FutureTask.get(FutureTask.java:188)
      	at com.bigdata.rdf.spo.SPORelation.logFuture(SPORelation.java:2262)
      	at com.bigdata.rdf.spo.SPORelation.insert(SPORelation.java:2217)
      	... 41 more
      Caused by: java.lang.IllegalArgumentException: context bound, but not quads or sids: < TermId(5U), TermId(7U), TermId(4U), TermId(6U) : Explicit >
      	at com.bigdata.rdf.spo.SPOIndexWriter.call(SPOIndexWriter.java:275)
      	at com.bigdata.rdf.spo.SPOIndexWriter.call(SPOIndexWriter.java:68)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	... 1 more
      
      

      Expected output is:

      Modified: 1
      Milliseconds: whatever
      

        Activity

        Hide
        bryanthompson bryanthompson added a comment -

        The error message is unfortunate and should be fixed. You are trying to load quads data into a triple mode KB instance. It does not know what to do with the named graph values.

        Caused by: java.lang.IllegalArgumentException: context bound, but not quads or sids: < TermId(5U), TermId(7U), TermId(4U), TermId(6U) : Explicit >
        

        Create a quads mode KB instance for loading quads data.

        Thanks,
        Bryan

        Show
        bryanthompson bryanthompson added a comment - The error message is unfortunate and should be fixed. You are trying to load quads data into a triple mode KB instance. It does not know what to do with the named graph values. Caused by: java.lang.IllegalArgumentException: context bound, but not quads or sids: < TermId(5U), TermId(7U), TermId(4U), TermId(6U) : Explicit > Create a quads mode KB instance for loading quads data. Thanks, Bryan
        Hide
        michaelschmidt michaelschmidt added a comment -

        fixed in branch quads-loading-in-triple-mod. Will run CI prior to push request.

        Show
        michaelschmidt michaelschmidt added a comment - fixed in branch quads-loading-in-triple-mod. Will run CI prior to push request.
        Hide
        michaelschmidt michaelschmidt added a comment -

        Fixes:
        - bigdata-rdf/src/java/com/bigdata/rdf/rio/StatementBuffer.java (implemented stripping)
        - bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataSail.java (config option, raise exception if option is set true; defaults to false)

        Tests:
        - bigdata-rdf/src/test/com/bigdata/rdf/rio/TestStatementBuffer.java (buffer level test case)
        - bigdata-sails/src/test/com/bigdata/rdf/sail/TestTicket1086.java (SAIL level test case)
        - bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java (registered test case)
        - bigdata-sails/src/test/com/bigdata/rdf/sail/TestChangeSets.java (no changes, just import refactoring)

        -> will trigger pull request for branch

        Show
        michaelschmidt michaelschmidt added a comment - Fixes: - bigdata-rdf/src/java/com/bigdata/rdf/rio/StatementBuffer.java (implemented stripping) - bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataSail.java (config option, raise exception if option is set true; defaults to false) Tests: - bigdata-rdf/src/test/com/bigdata/rdf/rio/TestStatementBuffer.java (buffer level test case) - bigdata-sails/src/test/com/bigdata/rdf/sail/TestTicket1086.java (SAIL level test case) - bigdata-sails/src/test/com/bigdata/rdf/sail/TestBigdataSailWithSids.java (registered test case) - bigdata-sails/src/test/com/bigdata/rdf/sail/TestChangeSets.java (no changes, just import refactoring) -> will trigger pull request for branch
        Hide
        michaelschmidt michaelschmidt added a comment -

        merged branch into master, closing issue

        Show
        michaelschmidt michaelschmidt added a comment - merged branch into master, closing issue

          People

          • Assignee:
            michaelschmidt michaelschmidt
            Reporter:
            sergeykucherenko sergeykucherenko
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: