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

BIND (xsd:date('2015-01-01') as ?date) does not work

    Details

    • Type: Bug
    • Status: Done
    • Priority: Medium
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: BLAZEGRAPH_2_2_0
    • Component/s: None
    • Labels:
      None

      Description

      The following query does not work in Blazegraph 2.1.0:

      CONSTRUCT {<http://test.com> <http://hasdate.com> ?date }
      WHERE { BIND (xsd:date('2015-01-01') as ?date)}
      

      I get nothing back while I would expect

      @prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
      @prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
      @prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
      
      <http://test.com>  <http://hasdate.com>
                      "2015-01-01"^^xsd:date .
      

      This breaks a whole bunch of queries we would like to execute, is that a bug?

        Activity

        Hide
        ktk Adrian Gschwend added a comment -

        WTF is Jira doing with Preformatted text...

        Show
        ktk Adrian Gschwend added a comment - WTF is Jira doing with Preformatted text...
        Hide
        beebs Brad Bebee added a comment -

        Yes, JIRA doesn't like SPARQL queries much...

        Show
        beebs Brad Bebee added a comment - Yes, JIRA doesn't like SPARQL queries much...
        Hide
        beebs Brad Bebee added a comment -

        igorkim Can you take a quick triage on this one?

        thompsonbry

        michaelschmidt

        Show
        beebs Brad Bebee added a comment - igorkim Can you take a quick triage on this one? thompsonbry michaelschmidt
        Hide
        igorkim igorkim added a comment - - edited

        xsd:date constructor is registered in function registry as DateOp (Converted to DateBOp at later stage).

        add(XSD_DATE, new DateFactory(DateOp.DATE));
        

        DateBOp.get() function expects its operand to have a data type (one of dateTime, date, time):
        https://github.com/SYSTAP/bigdata/blob/049d510e0932dec021882c615b57acace445cb14/bigdata-core/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/DateBOp.java#L155
        Thus UnsupportedOperationException is thrown and converted to no results response.

        Suggested fix: make DateBOp parse operand's stringValue as SimpleDateFormat, and return FullyInlineTypedLiteralIV wrapping this parsed value in case if provided literal is not dateTime, date or time.

        Show
        igorkim igorkim added a comment - - edited xsd:date constructor is registered in function registry as DateOp (Converted to DateBOp at later stage). add(XSD_DATE, new DateFactory(DateOp.DATE)); DateBOp.get() function expects its operand to have a data type (one of dateTime, date, time): https://github.com/SYSTAP/bigdata/blob/049d510e0932dec021882c615b57acace445cb14/bigdata-core/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/DateBOp.java#L155 Thus UnsupportedOperationException is thrown and converted to no results response. Suggested fix: make DateBOp parse operand's stringValue as SimpleDateFormat, and return FullyInlineTypedLiteralIV wrapping this parsed value in case if provided literal is not dateTime, date or time.
        Hide
        igorkim igorkim added a comment -
        Show
        igorkim igorkim added a comment - PR: https://github.com/SYSTAP/bigdata/pull/442
        Hide
        igorkim igorkim added a comment -

        Changeset:

        • MockTermResolverOp changed to use cast to AbstractInlineIV instead of AbstractLiteralIV (asValue is provided as higher type hierarchy level as previous cast).
        • DateBOp extended with codepath covering string to date conversion
        • new test added TestTicket1939
        Show
        igorkim igorkim added a comment - Changeset: MockTermResolverOp changed to use cast to AbstractInlineIV instead of AbstractLiteralIV (asValue is provided as higher type hierarchy level as previous cast). DateBOp extended with codepath covering string to date conversion new test added TestTicket1939
        Hide
        bryanthompson bryanthompson added a comment - - edited

        Assigned to Alexandre for code review

        PR: https://github.com/SYSTAP/bigdata/pull/442/files

        Show
        bryanthompson bryanthompson added a comment - - edited Assigned to Alexandre for code review PR: https://github.com/SYSTAP/bigdata/pull/442/files
        Hide
        beebs Brad Bebee added a comment -

        Merged down.

        Show
        beebs Brad Bebee added a comment - Merged down.

          People

          • Assignee:
            alexr Alexandre Riazanov
            Reporter:
            ktk Adrian Gschwend
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: