Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-1863

ARQ formats query with wrong padding when rdf:type is present

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • Jena 3.14.0
    • Jena 3.15.0
    • ARQ
    • None

    Description

      Description
      Creating a query with any QueryBuilder (SelectBuilder, AskBuilder etc.) when an RDF.type predicate is present will result in a query that contains the character 'a' followed by 19 spaces instead of a single 'a' (shortcut to the RDF.type predicate) or "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>" (the URI of the RDF.type predicate).

      Example:

      new SelectBuilder().addWhere(createVariable("subject"), org.apache.jena.vocabulary.RDF.type, createVariable("object")).buildString()
      

      OR

      new SelectBuilder().addWhere(createVariable("subject"), createURI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), createVariable("object")).buildString()
      

      OR

      new SelectBuilder().addWhere(createVariable("subject"), "a", createVariable("object")).buildString()
      

      will create the following query

      SELECT  *
      WHERE
        { ?subject  a                     ?object}
      

      Probably caused by:
      https://github.com/apache/jena/commit/6570c25be8c6e958a5647a7d2c1e23466498b332

      Summary
      The formatting of the query is invalid when the rdf:type predicate is present.

      Steps to reproduce
      Check the result of

      new SelectBuilder().addWhere(createVariable("subject"), "a", createVariable("object")).buildString()
      

      Expected results

      SELECT  *
      WHERE
        { ?subject  a  ?object}
      

      Actual results

      SELECT  *
      WHERE
        { ?subject  a                     ?object}
      

      Attachments

        Issue Links

          Activity

            People

              andy Andy Seaborne
              Hestegszveg David Ruszkai
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m