Apache Jena
  1. Apache Jena
  2. JENA-198

TSV Output may be invalid but TSV Input reads it fine

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: ARQ 2.9.1
    • Fix Version/s: ARQ 2.9.1
    • Component/s: ARQ
    • Labels:
    • Environment:

      Any

      Description

      I noticed today that TSVOutput may produce output that contains prefixed names which is invalid per my reading of the relevant specification - http://www.w3.org/TR/sparql11-results-csv-tsv/

      This is due to the fact that TSVOutput called FmtUtils.stringForNode() with only a Node resulting in it using the ARQ default prefix mapping for output.

      Attached is a simple patch which fixes the issue, it should also speed up TSVOutput marginally as the existing code requires a SerializationContext to be created for every term serialized and incurs the cost of trying to turn URIs into prefixed names. Essentially the patch creates a null SerializationContext variable and just passes that to every call to FmtUtils.stringForNode() so that the ARQ default prefix mapping never gets used.

      The second part of the issue is that this malformed TSV input may be accepted because TSVInputIterator uses NodeFactory.parseNode() to parse terms which calls SSE.parseNode() without any prefix mapping and thus internally ends up using the default SSE prefix mapping which means some prefixed names get permitted as valid when they should be rejected.

      The second patch attached fixes this part of the issue by keeping an empty static prefix map and calling SSE.parseNode() directly and passing in this map.

      1. TSVIllegalIOTests.patch
        2 kB
        Rob Vesse
      2. TSVIllegalOutput.patch
        1 kB
        Rob Vesse
      3. TSVIllegalInput.patch
        2 kB
        Rob Vesse

        Activity

        Rob Vesse created issue -
        Rob Vesse made changes -
        Field Original Value New Value
        Attachment TSVIllegalInput.patch [ 12511053 ]
        Attachment TSVIllegalOutput.patch [ 12511054 ]
        Rob Vesse made changes -
        Attachment TSVIllegalIOTests.patch [ 12511056 ]
        Andy Seaborne made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Andy Seaborne [ andy.seaborne ]
        Resolution Fixed [ 1 ]
        Andy Seaborne made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Andy Seaborne
            Reporter:
            Rob Vesse
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development