diff --git a/index.html b/index.html index 49cde345..66557007 100644 --- a/index.html +++ b/index.html @@ -3293,6 +3293,11 @@

Overview

base IRI. Finally, if the IRI or keyword still could not be compacted, it is returned as is.

+ +

In the case were this algorithm would return the input IRI as is, + and that IRI can be mistaken for a compact IRI in the active context, + this algorithm will raise an error, + because it has no way to return an unambiguous representation of the original IRI.

@@ -3516,7 +3521,7 @@

Algorithm

active context's vocabulary mapping. Try to create a compact IRI, starting by initializing compact IRI to null. This variable will be used to - tore the created compact IRI, if any. + store the created compact IRI, if any.
  • For each key term and value term definition in the active context:
      @@ -3543,6 +3548,13 @@

      Algorithm

  • If compact IRI is not null, return compact IRI.
  • +
  • To ensure that the absolute IRI var is + not confused with a compact IRI, + if the IRI scheme of var + matches any term in active context with prefix flag set to true, + and var has no IRI authority (beginning with double-forward-slash (//), + an IRI confused with prefix error has been detected, + and processing is aborted.
  • If vocab is false, transform var to a relative IRI using the base IRI from active context, if it exists.
  • @@ -5917,6 +5929,7 @@

    JsonLdErrorCode

    "invalid value object", "invalid value object value", "invalid vocab mapping", + "IRI confused with prefix", "keyword redefinition", "loading document failed", "loading remote context failed", @@ -6024,6 +6037,9 @@

    JsonLdErrorCode

    invalid vocab mapping
    An invalid vocabulary mapping has been detected, i.e., it is neither an IRI nor null.
    +
    IRI confused with prefix
    +
    When compacting an absolute IRI would result in an absolute IRI + which could be confused with a compact IRI (because its IRI scheme matches a term definition and it has no IRI authority).
    keyword redefinition
    A keyword redefinition has been detected.
    loading document failed
    @@ -6190,6 +6206,9 @@

    Changes since JSON-LD Community Group Final Report

    This allows a mechanism for documenting the content of a context using HTML.
  • Consolidate RemoteDocument processing into the LoadDocumentCallback including variations on HTML processing.
  • +
  • The IRI compaction algorithm may generate an error if the result is an + absolute IRI which could be confused with a compact IRI in the + active context.
  • diff --git a/tests/compact-manifest.jsonld b/tests/compact-manifest.jsonld index 1a76cef9..cdb24721 100644 --- a/tests/compact-manifest.jsonld +++ b/tests/compact-manifest.jsonld @@ -1148,6 +1148,15 @@ "input": "compact/e001-in.jsonld", "context": "compact/e001-context.jsonld", "expect": "compaction to list of lists" + }, { + "@id": "#te002", + "@type": [ "jld:NegativeEvaluationTest", "jld:CompactTest" ], + "name": "Absolute IRI confused with Compact IRI", + "purpose": "Verifies that IRI compaction detects when the result is an absolute IRI with a scheme matching a term.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "compact/e002-in.jsonld", + "context": "compact/e002-context.jsonld", + "expect": "IRI confused with prefix" }, { "@id": "#ten01", "@type": [ "jld:NegativeEvaluationTest", "jld:CompactTest" ], diff --git a/tests/compact/e002-context.jsonld b/tests/compact/e002-context.jsonld new file mode 100644 index 00000000..10ed9c17 --- /dev/null +++ b/tests/compact/e002-context.jsonld @@ -0,0 +1,5 @@ +{ + "@context": { + "tag": "http://example.org/ns/tag/" + } +} \ No newline at end of file diff --git a/tests/compact/e002-in.jsonld b/tests/compact/e002-in.jsonld new file mode 100644 index 00000000..6d4b8011 --- /dev/null +++ b/tests/compact/e002-in.jsonld @@ -0,0 +1,3 @@ +[{ + "tag:champin.net,2019:prop": {"@value": "hello world"} +}] \ No newline at end of file