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

Round-tripping of xsd:date with timezone

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: BLAZEGRAPH_2_1_0
    • Fix Version/s: BLAZEGRAPH_2_2_0
    • Component/s: Query Engine
    • Labels:
      None

      Description

      There seem to be round-tripping issues with xsd:date. The reproducer is as follows:

      1. Execute the following INSERT QUERY:

      INSERT{
      <http://a> <http://b> "1981-12-31+01:00"^^<http://www.w3.org/2001/XMLSchema#date> .
        } WHERE {}
      

      Note that according to http://books.xmlschemata.org/relaxng/ch19-77041.html a valid xsd:date datatype.

      2. When querying for it, the time zone seems to be stripped off:

      SELECT * WHERE{  
        <http://a> <http://b> ?date. 
      }
      

      we get 1981-12-30^^xsd:date.

      3. Querying without timezone fails, i.e. the following query gives no result:

       
      SELECT * WHERE{  
        <http://a> <http://b> "1981-12-31" ^^xsd:date. 
      }  
      

      4. Asking for the date with timezone succeeds:

      SELECT * WHERE{  
        <http://a> <http://b> "1981-12-31+01:00"^^xsd:date.
      }  
      

      5. The critical point is that deletion of the triple is not possible anymore:

      DELETE WHERE{
       <http://a> <http://b> ?date
      } 
      

      This results in the following exception:

       ERROR: SPARQL-UPDATE: updateStr=DELETE WHERE{
         ?date
      } 
      java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: org.openrdf.query.UpdateExecutionException: java.lang.IllegalStateException: Already assigned: old=LiteralExtensionIV [delegate=XSDLong(378601200000), datatype=Vocab(-53)], new=LiteralExtensionIV [delegate=XSDLong(378518400000), datatype=Vocab(-53)[http://www.w3.org/2001/XMLSchema#date]], this: "1981-12-30"^^
      	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
      	at java.util.concurrent.FutureTask.get(FutureTask.java:188)
      	at com.bigdata.rdf.sail.webapp.BigdataServlet.submitApiTask(BigdataServlet.java:281)
      	at com.bigdata.rdf.sail.webapp.QueryServlet.doSparqlUpdate(QueryServlet.java:458)
      	at com.bigdata.rdf.sail.webapp.QueryServlet.doPost(QueryServlet.java:239)
      	at com.bigdata.rdf.sail.webapp.RESTServlet.doPost(RESTServlet.java:269)
      	at com.bigdata.rdf.sail.webapp.MultiTenancyServlet.doPost(MultiTenancyServlet.java:192)
      	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:769)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1125)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1059)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
      	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
      	at org.eclipse.jetty.server.Server.handle(Server.java:497)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:248)
      	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:610)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:539)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: java.util.concurrent.ExecutionException: org.openrdf.query.UpdateExecutionException: java.lang.IllegalStateException: Already assigned: old=LiteralExtensionIV [delegate=XSDLong(378601200000), datatype=Vocab(-53)], new=LiteralExtensionIV [delegate=XSDLong(378518400000), datatype=Vocab(-53)[http://www.w3.org/2001/XMLSchema#date]], this: "1981-12-30"^^
      	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
      	at java.util.concurrent.FutureTask.get(FutureTask.java:188)
      	at com.bigdata.rdf.sail.webapp.QueryServlet$SparqlUpdateTask.call(QueryServlet.java:562)
      	at com.bigdata.rdf.sail.webapp.QueryServlet$SparqlUpdateTask.call(QueryServlet.java:1)
      	at com.bigdata.rdf.task.ApiTaskForIndexManager.call(ApiTaskForIndexManager.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
      Caused by: org.openrdf.query.UpdateExecutionException: java.lang.IllegalStateException: Already assigned: old=LiteralExtensionIV [delegate=XSDLong(378601200000), datatype=Vocab(-53)], new=LiteralExtensionIV [delegate=XSDLong(378518400000), datatype=Vocab(-53)[http://www.w3.org/2001/XMLSchema#date]], this: "1981-12-30"^^
      	at com.bigdata.rdf.sparql.ast.eval.ASTEvalHelper.executeUpdate(ASTEvalHelper.java:1081)
      	at com.bigdata.rdf.sail.BigdataSailUpdate.execute2(BigdataSailUpdate.java:152)
      	at com.bigdata.rdf.sail.webapp.BigdataRDFContext$UpdateTask.doQuery(BigdataRDFContext.java:1943)
      	at com.bigdata.rdf.sail.webapp.BigdataRDFContext$AbstractQueryTask.innerCall(BigdataRDFContext.java:1536)
      	at com.bigdata.rdf.sail.webapp.BigdataRDFContext$AbstractQueryTask.call(BigdataRDFContext.java:1501)
      	at com.bigdata.rdf.sail.webapp.BigdataRDFContext$AbstractQueryTask.call(BigdataRDFContext.java:1)
      	... 4 more
      Caused by: java.lang.IllegalStateException: Already assigned: old=LiteralExtensionIV [delegate=XSDLong(378601200000), datatype=Vocab(-53)], new=LiteralExtensionIV [delegate=XSDLong(378518400000), datatype=Vocab(-53)[http://www.w3.org/2001/XMLSchema#date]], this: "1981-12-30"^^
      	at com.bigdata.rdf.model.BigdataValueImpl.setIV(BigdataValueImpl.java:139)
      	at com.bigdata.rdf.internal.LexiconConfiguration.createInlineIV(LexiconConfiguration.java:505)
      	at com.bigdata.rdf.lexicon.LexiconRelation.getInlineIV(LexiconRelation.java:3380)
      	at com.bigdata.rdf.lexicon.LexiconRelation.addTerms(LexiconRelation.java:1804)
      	at com.bigdata.rdf.store.AbstractTripleStore.getAccessPath(AbstractTripleStore.java:3271)
      	at com.bigdata.rdf.store.AbstractTripleStore.getAccessPath(AbstractTripleStore.java:3216)
      	at com.bigdata.rdf.sail.BigdataSail$BigdataSailConnection.removeStatements(BigdataSail.java:3282)
      	at com.bigdata.rdf.sail.BigdataSail$BigdataSailConnection.removeStatements(BigdataSail.java:2965)
      	at com.bigdata.rdf.sparql.ast.eval.AST2BOpUpdate.addOrRemoveStatement(AST2BOpUpdate.java:2255)
      	at com.bigdata.rdf.sparql.ast.eval.AST2BOpUpdate.convertDeleteInsert(AST2BOpUpdate.java:845)
      	at com.bigdata.rdf.sparql.ast.eval.AST2BOpUpdate.convertUpdateSwitch(AST2BOpUpdate.java:443)
      	at com.bigdata.rdf.sparql.ast.eval.AST2BOpUpdate.convertUpdate(AST2BOpUpdate.java:293)
      	at com.bigdata.rdf.sparql.ast.eval.ASTEvalHelper.executeUpdate(ASTEvalHelper.java:1073)
      	... 9 more
      

        Activity

        Hide
        michaelschmidt michaelschmidt added a comment -

        Proposed fix in CI: https://github.com/SYSTAP/bigdata/pull/457. The problem was that date literals with timezone, such as "1981-12-31+01:00"^^<http://www.w3.org/2001/XMLSchema#date>, were resolved as timestamp representing 00:00:00.00 within the given time zone. This lead to inconsistencies. What we want to have instead is that they are resolved to the timestamp representing 00:00:00.00 in the default timezone, for the day they represent in the default timezone.

        Once CI is green, I would be glad to get a review on this one. We need to decide whether this will go into 2.2.

        Show
        michaelschmidt michaelschmidt added a comment - Proposed fix in CI: https://github.com/SYSTAP/bigdata/pull/457 . The problem was that date literals with timezone, such as "1981-12-31+01:00"^^< http://www.w3.org/2001/XMLSchema#date >, were resolved as timestamp representing 00:00:00.00 within the given time zone. This lead to inconsistencies. What we want to have instead is that they are resolved to the timestamp representing 00:00:00.00 in the default timezone, for the day they represent in the default timezone. Once CI is green, I would be glad to get a review on this one. We need to decide whether this will go into 2.2.
        Hide
        michaelschmidt michaelschmidt added a comment -

        CI is green. Please do not merge before review.

        Show
        michaelschmidt michaelschmidt added a comment - CI is green. Please do not merge before review.
        Hide
        michaelschmidt michaelschmidt added a comment -

        Mike reviewed this and merged it into master. Brad, could you please merge into 2.2RC and close it? Brad Bebee

        Show
        michaelschmidt michaelschmidt added a comment - Mike reviewed this and merged it into master. Brad, could you please merge into 2.2RC and close it? Brad Bebee

          People

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

            Dates

            • Created:
              Updated: