From 2883c6ceb8d9a6ea797316af78eec55030250c42 Mon Sep 17 00:00:00 2001 From: Markus Lanthaler Date: Fri, 22 Mar 2013 10:41:06 +0100 Subject: [PATCH] Use relative IRI resolution and not IRI Expansion for remote contexts This means that no compact IRIs, terms, etc. are evaluated when expanding the relative IRI of a remote context. The other change in this commit ensures that, if the remote context doesn't define a base IRI, the "outer" base IRI is kept. I also fixed some references to RFCs. This addresses #223. --- spec/latest/json-ld-api/index.html | 63 ++++++++++++++++++------------ 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/spec/latest/json-ld-api/index.html b/spec/latest/json-ld-api/index.html index 3ec013978..734404356 100644 --- a/spec/latest/json-ld-api/index.html +++ b/spec/latest/json-ld-api/index.html @@ -701,9 +701,9 @@

General Terminology

which is an IRI.
language-tagged string
A language-tagged string consists of a string and a non-empty language - tag as defined by [[BCP47]]. The language tag must be well-formed according to section - 2.2.9 of [[BCP47]], and is - normalized to lowercase.
+ tag as defined by [[BCP47]]. The language tag must be well-formed according to + section 2.2.9 + of [[BCP47]], and is normalized to lowercase.
list
A list is an ordered sequence of IRIs, blank nodes, and @@ -892,27 +892,39 @@

Algorithm

next context.
  • If context is a string,
      -
    1. Set context to the result of calling the - IRI Expansion algorithm - passing active context, context for value, - false for vocabRelative and true for - documentRelative.
    2. +
    3. Set context to the result of resolving value against + the base IRI which is established as specified in + section 5.1 Establishing a Base URI + of [[!RFC3986]]. Only the basic algorithm in + section 5.2 + of [[!RFC3986]] is used; neither + Syntax-Based Normalization nor + Scheme-Based Normalization + are performed. Characters additionally allowed in IRI + references are treated in the same way that unreserved + characters are treated in URI references, per + section 6.5 + of [[!RFC3987]].
    4. If context is in the remote contexts array, a recursive context inclusion error has been detected; otherwise, add context to remote contexts.
    5. -
    6. Initialize context new base to the result of cloning the +
    7. Initialize context no base to the result of cloning the active context.
    8. -
    9. Set the base IRI of context new base to context.
    10. +
    11. Remove the base IRI of context no base.
    12. Dereference context. If the dereferenced document has no top-level JSON object with an @context member, an invalid remote context has been detected; otherwise, set context to the value of that member.
    13. -
    14. Set result to the result of recursively calling this algorithm, - passing context new base for active context, - context for local context, - and remote contexts and continue with the next context.
    15. +
    16. Set context to the result of recursively calling this algorithm, + passing context no base for active context, + context for local context, and remote contexts.
    17. +
    18. If context has no base IRI but result does, + set the base IRI of context to the one of + result.
    19. +
    20. Overwrite result with context and continue with the + next context.
  • If context is not a JSON object, a invalid local context @@ -923,14 +935,12 @@

    Algorithm

    1. Initialize value to the value associated with the @base key.
    2. -
    3. If value is null, set the - base IRI of result to the base IRI established according section - section 5.1 Establishing a Base URI - of [[!RFC3986]].
    4. +
    5. If value is null, remove the + base IRI of result.
    6. Otherwise, value must be an absolute IRI, if not, an invalid base IRI - error has been detected. Set result's base IRI - to value.
    7. + error has been detected. Set the base IRI of + result to value.
  • If context has an @vocab key: @@ -1341,11 +1351,14 @@

    Algorithm

  • Otherwise, if documentRelative is true, set result to the result of resolving result against the base IRI. Only the basic algorithm in - section 5.2 of [[!RFC3986]] is used; neither Syntax-Based Normalization - nor Scheme-Based Normalization (as described in sections 6.2.2 and - 6.2.3 of [[RFC3986]]) are performed. Characters additionally allowed in - IRI references are treated in the same way that unreserved characters - are treated in URI references, per section 6.5 of [[!RFC3987]].
  • + section 5.2 + of [[!RFC3986]] is used; neither + Syntax-Based Normalization nor + Scheme-Based Normalization + are performed. Characters additionally allowed in IRI references are treated + in the same way that unreserved characters are treated in URI references, per + section 6.5 + of [[!RFC3987]].
  • If local context is not null then result must be an absolute IRI, if not, an invalid IRI mapping