diff --git a/common/extract-examples.rb b/common/extract-examples.rb index 44fc8eb3..6b589061 100755 --- a/common/extract-examples.rb +++ b/common/extract-examples.rb @@ -119,6 +119,13 @@ def table_to_dataset(table) # We might think something was an IRI, but determine that it's not object = RDF::Literal(object.to_s, language: cell.to_sym) end + when 'Direction' + case cell + when '-', /^\s*$/ + else + object = RDF::Literal(object.to_s, datatype: RDF::URI("https://www.w3.org/i18n##{object.language}_#{cell}")) + # We might think something was an IRI, but determine that it's not + end end end repo << RDF::Statement.new(subject, predicate, object, graph_name: gname) diff --git a/common/terms.html b/common/terms.html index 2f75e8ae..1a122622 100644 --- a/common/terms.html +++ b/common/terms.html @@ -174,6 +174,10 @@ whose value MUST be a string representing a [[BCP47]] language code or null.
default object
A default object is a map that has a @default key.
+
base direction
+ The base direction is the direction used when a string does not have a direction associated with it directly. + It can be set in the context using the @direction key + whose value MUST be one of the strings `"ltr"`, `"rtl"`, or null.
embedded context
An embedded context is a context which appears as the @context entry of one of the following: diff --git a/index.html b/index.html index 756ff3f6..1aad6bb1 100644 --- a/index.html +++ b/index.html @@ -966,18 +966,21 @@

Context Processing Algorithm

term definitions which specify how keys and values have to be interpreted as well as the current base IRI, the vocabulary mapping, the default language, - and an optional previous context, + the default base direction, + and an optional previous context, used when a non-propagated context is defined. Each term definition consists of:

@@ -987,7 +990,7 @@

Context Processing Algorithm

When processing, active context is initialized without any term definitions, - vocabulary mapping, or default language. + vocabulary mapping, default base direction, or default language. If a local context is encountered during processing, a new active context is created by cloning the existing active context. Then the information from the @@ -1023,10 +1026,20 @@

Overview

If context is a map, it is a context definition. - We first update the - base IRI, the vocabulary mapping, processing mode, and the - default language by processing three specific keywords: - @base, @vocab, @version, and @language. + We first update + the base IRI, + the default base direction, + the default language, + context propagation, + the processing mode, + and the vocabulary mapping + by processing six specific keywords: + @base, + @direction, + @language, + @propagate, + @version, + and @vocab. These are handled before any other entries in the local context because they affect how the other entries are processed. If context contains @import, it is retrieved and is reverse-merged @@ -1261,6 +1274,19 @@

Algorithm

error has been detected and processing is aborted. +
  • If context has an @direction entry: +
      +
    1. Initialize value to the value associated with the + @direction entry.
    2. +
    3. If value is null, remove + any base direction from result.
    4. +
    5. Otherwise, if value is string, the + base direction of result is set to + value. If it is not `null`, `"ltr"`, or `"rtl"`, an + invalid base direction + error has been detected and processing is aborted.
    6. +
    +
  • If context has an @propagate entry:
    1. If processing mode is json-ld-1.0, @@ -1279,6 +1305,7 @@

      Algorithm

    2. For each key-value pair in context where key is not @base, + @direction, @import, @language, @propagate, @@ -1333,8 +1360,10 @@

      Overview

      the information in the local context for the given term is taken into account, creating the appropriate IRI mapping, container mapping, and - type mapping or language mapping for the - term.

      + type mapping, + language mapping, + or direction mapping + for the term.

      @@ -1607,6 +1636,18 @@

      Algorithm

      of definition to language.
  • +
  • If value contains the entry @direction and + does not contain the entry @type: +
      +
    1. Initialize direction to the value associated with the + @direction entry, which MUST be either null, + `"ltr"`, or `"rtl"`. Otherwise, an + invalid base direction + error has been detected and processing is aborted.
    2. +
    3. Set the direction mapping + of definition to direction.
    4. +
    +
  • If value contains the entry @nest:
    1. If processing mode is json-ld-1.0, an @@ -1801,7 +1842,6 @@

      Algorithm

      -

      Expansion Algorithms

      @@ -1948,7 +1988,7 @@

      Algorithm

    2. If active context has a previous context, the active context is not propagated. If from map is undefined or false, - and element does not contain a entry expanding to @value, + and element does not contain an entry expanding to @value, and element does not consist of a single entry expanding to @id, set active context to previous context from active context, as the scope of a term-scoped context does not apply when processing new node objects.
    3. @@ -2099,6 +2139,15 @@

      Algorithm

      may also be an empty map or an array of zero or strings. expanded value will be an array of one or more string values converted to lower case.
    4. +
    5. If expanded property is @direction and + value is neither `"ltr"` nor `"rtl"`, an + invalid base direction + error has been detected and processing is aborted. + Otherwise, set expanded value to value. + When the {{JsonLdOptions/frameExpansion}} flag is set, value + may also be an empty map or an array of zero or + strings. expanded value will be an + array of one or more string values.
    6. If expanded property is @index and value is not a string, an invalid @index value @@ -2206,6 +2255,10 @@

      Algorithm

      1. Initialize expanded value to an empty array.
      2. +
      3. Initialize direction to the default base direction from active context.
      4. +
      5. If key's term definition in active context + has a direction mapping, + update direction with that value.
      6. For each key-value pair language-language value in value, ordered lexicographically by language if {{JsonLdOptions/ordered}} is true:
          @@ -2214,19 +2267,23 @@

          Algorithm

          language value.
        1. For each item in language value:
            -
          1. item must be a string - or null, +
          2. If item is `null`, + continue to the next entry in language value.
          3. +
          4. item must be a string, otherwise an invalid language map value error has been detected and processing is aborted.
          5. -
          6. Append a map to - expanded value that consists of two +
          7. Initialize a new map v + consisting of two key-value pairs: (@value-item) and (@language-lowercased - language), - unless item is null. - If language is @none, - or expands to @none, do not set the @language entry.
          8. + language). +
          9. If language is @none, + or expands to @none, remove @language from v.
          10. +
          11. + If direction is not `null`, + add an entry for `@direction` to v with direction.
          12. +
          13. Append v to expanded value.
        @@ -2395,11 +2452,13 @@

        Algorithm

      7. If result contains the entry @value:
        1. The result must not contain any entries other than - @value, @language, @type, - and @index. It must not contain both a - @language entry and an @type entry. - Otherwise, an - invalid value object + @direction, + `@index`, + `@language`, + `@type`, + and `@value`. + It must not contain an `@type` entry if it contains either `@language` or `@direction` entries. + Otherwise, an invalid value object error has been detected and processing is aborted.
        2. If the value of result's @value entry is null, then set result to null.
        3. @@ -2531,22 +2590,21 @@

          Algorithm

        4. If active property has a type mapping in active context, other than @id, @vocab, or @none, - add an @type entry to + add @type to result and set its value to the value associated with the type mapping.
        5. Otherwise, if value is a string:
            -
          1. If a language mapping is associated with - active property in active context, - add an @language to result and set its - value to the language code associated with the - language mapping; unless the - language mapping is set to null in - which case no such entry is added.
          2. -
          3. Otherwise, if the active context has a - default language, add an @language - to result and set its value to the - default language.
          4. +
          5. Initialize language to the language mapping for active property + in active context, if any, otherwise to the default language + of active context.
          6. +
          7. Initialize direction to the direction mapping for active property + in active context, if any, otherwise to the default base direction + of active context.
          8. +
          9. If language is not `null`, + add @language to result with the value language.
          10. +
          11. If direction is not `null`, + add @direction to result with the value direction.
        6. Return result.
        7. @@ -2868,8 +2926,11 @@

          Algorithm

          then the compacted result will be inside of an @index container, drop the @index entry by continuing to the next expanded property. -
        8. Otherwise, if expanded property is @index, - @value, or @language: +
        9. Otherwise, if expanded property is + @direction, + @index, + @language, + or @value:
          1. Initialize alias to the result of using the IRI Compaction algorithm, @@ -3264,9 +3325,9 @@

            Algorithm

            1. Initialize result to an empty map.
            2. -
            3. Initialize default language to @none. If the - active context has a default language, - set default language to it.
            4. +
            5. Initialize default language to @none. + If the active context has a default language, + set default language to the default language from the active context.
            6. For each key term and value term definition in the active context, ordered by shortest term first (breaking ties by choosing the lexicographically least @@ -3284,7 +3345,7 @@

              Algorithm

            7. Initialize var to the value of the IRI mapping for the term definition.
            8. If var is not an entry of result, add - a entry where the key is var and the value + an entry where the key is var and the value is an empty map to result.
            9. Reference the value associated with the var entry in result using the variable container map.
            10. @@ -3299,12 +3360,12 @@

              Algorithm

              @none set to the term being processed.
            11. Reference the value associated with the container entry in container map using the variable type/language map.
            12. +
            13. Reference the value associated with the @type + entry in type/language map using the variable + type map.
            14. If the term definition indicates that the term represents a reverse property:
                -
              1. Reference the value associated with the @type - entry in type/language map using the variable - type map.
              2. If type map does not have an @reverse entry, create one and set its value to the term being processed.
              3. @@ -3319,9 +3380,6 @@

                Algorithm

              4. If language map does not have an @any entry, create one and set its value to the term being processed.
              5. -
              6. Reference the value associated with the @type - entry in type/language map using the variable - type map.
              7. If type map does not have an @any entry, create one and set its value to the term being processed.
              8. @@ -3330,43 +3388,80 @@

                Algorithm

              9. Otherwise, if term definition has a type mapping:
                  -
                1. Reference the value associated with the @type - entry in type/language map using the variable - type map.
                2. -
                3. If type map does not have a entry corresponding +
                4. If type map does not have an entry corresponding to the type mapping in term definition, create one and set its value to the term being processed.
              10. +
              11. Reference the value associated with the @language + entry in type/language map using the variable + language map.
              12. +
              13. If term definition has both + a language mapping and a direction mapping: +
                  +
                1. Create a new variable lang dir.
                2. +
                3. If neither the language mapping nor the direction mapping + are `null`, set lang dir to the concatenation + of language mapping and direction mapping + separated by an underscore (`"_"`).
                4. +
                5. Otherwise, if language mapping is not `null`, + set lang dir to the language mapping. +
                6. Otherwise, if direction mapping is not `null`, + set lang dir to direction mapping + preceded by an underscore (`"_"`).
                7. +
                8. Otherwise, set lang dir to `@null`.
                9. +
                +
              14. If language map does not have a lang dir + entry, create one and set its value to the term + being processed.
              15. Otherwise, if term definition has a language mapping (might be null):
                  -
                1. Reference the value associated with the @language - entry in type/language map using the variable - language map.
                2. If the language mapping equals null, set language to @null; otherwise set it - to the language code in language mapping.
                3. + to the language mapping.
                4. If language map does not have a language entry, create one and set its value to the term being processed.
              16. +
              17. Otherwise, if term definition has a + direction mapping (might be null): +
                  +
                1. If the direction mapping equals null, + set direction to @none; otherwise set it + to direction mapping preceded by an underscore (`"_"`).
                2. +
                3. If language map does not have a direction entry, + create one and set its value to the term + being processed.
                4. +
                +
              18. +
              19. Otherwise, if active context has a + default base direction: +
                  +
                1. Initialize a variable lang dir + with the concatenation of default language and default base direction, + separate by an underscore (`"_"`).
                2. +
                3. If language map does not have a lang dir entry, + create one and set its value to the term + being processed.
                4. +
                5. If language map does not have an `@none` entry, + create one and set its value to the term + being processed.
                6. +
                7. If type map does not have an `@none` entry, + create one and set its value to the term + being processed.
                8. +
                +
              20. Otherwise:
                  -
                1. Reference the value associated with the @language - entry in type/language map using the variable - language map.
                2. If language map does not have a default language entry, create one and set its value to the term being processed.
                3. If language map does not have an @none entry, create one and set its value to the term being processed.
                4. -
                5. Reference the value associated with the @type - entry in type/language map using the variable - type map.
                6. If type map does not have an @none entry, create one and set its value to the term being processed.
                7. @@ -3391,38 +3486,42 @@

                  IRI Compaction

                  Overview

                  -

                  If the passed IRI is null, we simply - return null. Otherwise, we first try to find a term - that the IRI or keyword can be compacted to if - it is relative to active context's - vocabulary mapping. In order to select the most appropriate - term, we may have to collect information about the passed - value. This information includes which - container mapping - would be preferred for expressing the value, and what its - type mapping or language mapping is. For - JSON-LD lists, the type mapping +

                  If the passed IRI is null, + we simply return null. + Otherwise, we first try to find a term that the IRI or keyword + can be compacted to if it is relative to + active context's vocabulary mapping. + In order to select the most appropriate term, + we may have to collect information about the passed value. + This information includes determining the preferred container mapping, + type mapping or language mapping + for expressing the value. + For JSON-LD lists, the type mapping or language mapping will be chosen based on the most - specific values that work for all items in the list. Once this - information is gathered, it is passed to the - Term Selection algorithm, which will - return the most appropriate term to use.

                  - -

                  If no term was found that could be used to compact the - IRI, an attempt is made to compact the IRI using the - active context's vocabulary mapping, - if there is one. If the IRI could not be compacted, an - attempt is made to find a compact IRI. + specific values that work for all items in the list. + Once this information is gathered, + it is passed to the Term Selection algorithm, + which will return the most appropriate term.

                  + +

                  If no term was found that could be used to compact the IRI, + an attempt is made to compact the IRI + using the active context's vocabulary mapping, + if there is one. + If the IRI could not be compacted, + an attempt is made to find a compact IRI. A term will be used to create a compact IRI only if the term definition contains the prefix flag with the value true. If there is no appropriate compact IRI, - and the compactToRelative option is true, - the IRI is - transformed to a relative IRI using the document's - base IRI. Finally, if the IRI or - keyword still could not be compacted, it is returned - as is.

                  + and the compactToRelative option is true, + the IRI is transformed to a relative IRI + using the document's base IRI. + Finally, if the IRI or keyword still could not be compacted, + it is returned as is.

                  + +

                  When considering language mapping, + the direction mapping is also considered, either with, or without, + a language mapping.

                  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, @@ -3435,24 +3534,31 @@

                  Algorithm

                  This algorithm takes three required inputs and three optional inputs. The required inputs are an active context, an inverse context, - and the var to be compacted. The optional inputs are a value associated - with the var, a vocab flag which specifies whether the - passed var should be compacted using the - active context's - vocabulary mapping, and a reverse flag which specifies whether - a reverse property is being compacted. If not passed, value is set to - null and vocab and reverse are both set to - false.

                  + and the var to be compacted. + The optional inputs are a value associated with the var, + a vocab flag which specifies whether the passed var + should be compacted using the active context's vocabulary mapping, + and a reverse flag which specifies whether a reverse property is being compacted. + If not passed, value is set to null + and both vocab and reverse are both set to false.

                  1. If var is null, return null.
                  2. If vocab is true and var is an entry of inverse context:
                      -
                    1. Initialize default language to - active context's - default language, if it has one, otherwise to - @none.
                    2. +
                    3. Initialize default language + based on the active context's + default language and default base direction: +
                        +
                      1. If the active context's default base direction + is not `null`, to the concatenation of + the active context's default language + and default base direction, separated by an underscore (`"_"`).
                      2. +
                      3. Otherwise, to the active context's default language, + if it has one, otherwise to `@none`.
                      4. +
                      +
                    4. If value is a map containing the entry @preserve, use the first element from the value of @preserve as value.
                    5. @@ -3495,7 +3601,11 @@

                      Algorithm

                      item type to @none.
                    6. If item contains an @value entry:
                        -
                      1. If item contains an @language entry, +
                      2. If item contains an `@direction` entry, + then set item language to the concatenation of + the item's `@language` entry (if any) + the item's `@direction`, separated by an underscore (`"_"`).
                      3. +
                      4. Otherwise, if item contains an @language entry, then set item language to its associated value.
                      5. Otherwise, if item contains a @@ -3565,7 +3675,14 @@

                        Algorithm

                        1. If value is a value object:
                            -
                          1. If value contains an @language entry +
                          2. If value contains an `@direction` entry + and does not contain an `@index` entry, + then set type/language value to the concatenation of + the value's `@language` entry (if any) + the value's `@direction`, separated by an underscore (`"_"`). + Append `@language` and `@language@set` to + containers.
                          3. +
                          4. Otherwise, if value contains an @language entry and does not contain an @index entry, then set type/language value to its associated value and, append @language @@ -3590,12 +3707,12 @@

                            Algorithm

                            be the last container mapping value to be checked as it is the most generic.
                          5. - If processing mode is json-ld-1.1 and value does not contain an @index entry, append - @index and @index@set to containers. + If processing mode is json-ld-1.1 and value does not contain an @index entry, + append @index and @index@set to containers.
                          6. - If processing mode is json-ld-1.1 and value contains only an @value entry, append - @language and @language@set to containers. + If processing mode is json-ld-1.1 and value contains only an @value entry, + append @language and @language@set to containers.
                          7. If type/language value is null, set it to @null. This is the key under which null values @@ -3628,6 +3745,10 @@

                            Algorithm

                            If value is an empty list object, set type/language to @any.
                          8. Append @any to preferred values.
                          9. +
                          10. If preferred values + contains any entry having an underscore (`"_"`), + append the substring of that entry from the underscore to the end of the string + to preferred values.
                          11. Initialize term to the result of the Term Selection algorithm, passing inverse context, var, containers, @@ -3749,7 +3870,7 @@

                            Algorithm

                            var in the inverse context.
                          12. For each item container in containers:
                              -
                            1. If container is not a entry of container map, then +
                            2. If container is not an entry of container map, then there is no term with a matching container mapping for it, so continue to the next container.
                            3. @@ -3759,7 +3880,7 @@

                              Algorithm

                              with type/language entry in type/language map.
                            4. For each item in preferred values:
                                -
                              1. If item is not a entry of value map, +
                              2. If item is not an entry of value map, then there is no term with a matching type mapping or language mapping, so continue to the next item.
                              3. @@ -3957,77 +4078,73 @@

                                Algorithm

                                to be compacted.

                                  -
                                1. Initialize number entries to the number of entries - value contains.
                                2. -
                                3. If value has an @index entry and the - container mapping associated to active property - includes @index, decrease number entries by - 1.
                                4. -
                                5. If number entries is greater than 2, return - value as it cannot be compacted.
                                6. -
                                7. If the type mapping of active property is @none, - leave value as is, as value compaction is disabled. +
                                8. Initialize result to value.
                                9. +
                                10. Initialize language to the language mapping for active property + in active context, if any, otherwise to the default language + of active context.
                                11. +
                                12. Initialize direction to the direction mapping for active property + in active context, if any, otherwise to the default base direction + of active context.
                                13. +
                                14. If value has an @id entry + and has no other entries other than `@index`:
                                    -
                                  1. Replace any value of @type in value with the result of using the - IRI compaction algorithm, - passing active context, inverse context, - the value of the @type entry for var, and - true for vocab.
                                  2. -
                                  3. Replace each key in value with the result of using the - IRI compaction algorithm, - passing active context, inverse context, - the that key for var, and - true for vocab.
                                  4. -
                                  5. Return value.
                                  6. -
                                  -
                                15. -
                                16. If value has an @id entry: -
                                    -
                                  1. If number entries is 1 and +
                                  2. If value and the type mapping of active property - is set to @id, return the result of using the + is set to @id, set result to the result of using the IRI compaction algorithm, passing active context, inverse context, and the value of the @id entry for var.
                                  3. -
                                  4. Otherwise, if number entries is 1 and - the type mapping of active property - is set to @vocab, return the result of using the +
                                  5. Otherwise, the type mapping of active property + is set to @vocab, set result to the result of using the IRI compaction algorithm, passing active context, inverse context, the value of the @id entry for var, and true for vocab.
                                  6. -
                                  7. Otherwise, return value as is.
                                17. Otherwise, if value has an @type entry whose value matches the type mapping of active property, - return the value associated with the @value entry + set result to the value associated with the @value entry of value.
                                18. -
                                19. Otherwise, if value has an @language entry whose - value matches the language mapping of - active property, return the value associated with the - @value entry of value.
                                20. -
                                21. Otherwise, if number entries equals 1 and either - the value of the @value entry is not a string, - or the active context has no default language, - or the language mapping of active property - is set to null, return the value associated with the - @value entry.
                                22. -
                                23. Otherwise: -
                                    -
                                  1. Replace any value of @type in value with the result of using the +
                                  2. Otherwise, if the type mapping of active property is @none, + or value has an `@type` entry, + and the value of `@type` in value does not match the type mapping of active property, + leave value as is, as value compaction is disabled. +
                                      +
                                    1. Replace any value of @type in result with the result of using the IRI compaction algorithm, passing active context, inverse context, the value of the @type entry for var, and true for vocab.
                                    2. -
                                    3. Replace each key in value with the result of using the - IRI compaction algorithm, - passing active context, inverse context, - the that key for var, and - true for vocab.
                                    4. -
                                    5. Return value.
                                  3. +
                                  4. Otherwise, if the value of the @value entry is not a string: +
                                      +
                                    1. If value has an `@index` entry, + and the container mapping associated to active property + includes @index, + set result to the value associated with the `@value` entry.
                                    2. +
                                    +
                                  5. +
                                  6. If the value of `@language` in item exactly matches language, + if it is not `null`, or is not present, if it is `null`, + and the value of `@direction` in item exactly matches direction, + if it is not `null`, or is not present, if it is `null`: +
                                      +
                                    1. If value has an `@index` entry, + and the container mapping associated to active property + includes @index, + or value has no `@index` entry, + set result to the value associated with the `@value` entry.
                                    2. +
                                    + return value.
                                  7. +
                                  8. If result is a map, + replace each key in result with the result of using the + IRI compaction algorithm, + passing active context, inverse context, + the that key for var, and + true for vocab.
                                  9. +
                                  10. Return result.
                  @@ -4136,7 +4253,7 @@

                  Node Map Generation

                  represented in the passed expanded document. All nodes that are not uniquely identified by an IRI get assigned a (new) blank node identifier. The resulting node map will have an map entry for every graph in the document whose - value is another object with a entry for every node represented in the document. + value is another object with an entry for every node represented in the document. The default graph is stored under the @default entry, all other graphs are stored under their graph name.

                  @@ -4239,7 +4356,7 @@

                  Algorithm

                8. Otherwise, set id to the result of the Generate Blank Node Identifier algorithm passing null for identifier.
                9. -
                10. If graph does not contain a entry id, create one and initialize +
                11. If graph does not contain an entry id, create one and initialize its value to a map consisting of a single entry @id whose value is id.
                12. Reference the value of the id entry of graph using the @@ -4436,6 +4553,17 @@

                  Deserialize JSON-LD to RDF Algorithm

                  The use of blank node identifiers to label properties is obsolete, and may be removed in a future version of JSON-LD.

                  +

                  If the {{JsonLdOptions/rdfDirection}} option is not `null`, then special processing is used to + convert from an `i18n-datatype` or `compound-literal` form.

                  + +

                  The support for both `i18n-datatype` and `compound-literal` + algorithm steps are non-normative, and are AT RISK for JSON-LD 1.1. + They may be replaced with normative algorithm steps in a future version. + Either or both of these transformation methods may be removed prior to + JSON-LD 1.1 being finalized. + The JSON-LD Working Group solicits feedback from the community on the + usefulness of these transformations.

                  +

                  Implementations MUST generate only well-formed triples and graph names:

                    @@ -4483,6 +4611,8 @@

                    Algorithm

                    The algorithm takes a map node map, which is the result of the Node Map Generation algorithm and an RDF dataset dataset into which new graphs and triples are added. + It also takes two optional input variables {{JsonLdOptions/produceGeneralizedRdf}} + and {{JsonLdOptions/rdfDirection}}. Unless the {{JsonLdOptions/produceGeneralizedRdf}} option is set to true, triple containing a blank node predicate @@ -4618,7 +4748,7 @@

                    Algorithm

                    entry in item.
                  • Initialize datatype to the value associated with the @type entry of item or null if - item does not have such a entry.
                  • + item does not have such an entry.
                  • If datatype is not well-formed, return null.
                  • If item has an @language entry which is not well-formed, return null.
                  • @@ -4663,7 +4793,37 @@

                    Algorithm

                  • Otherwise, if datatype is null, set it to xsd:string or rdf:langString, depending on if item has an @language entry.
                  • -
                  • Initialize literal as an RDF literal using +
                  • If item contains an `@direction` entry + and {{JsonLdOptions/rdfDirection}} is not `null`, + item is a value object which is serialized using special rules. +
                      +
                    1. If {{JsonLdOptions/rdfDirection}} is `i18n-datatype`, + set datatype to the result of appending language + and the value of `@direction` in item separated by an underscore (`"_"`) + to `https://w3.org/ns/i18n#`. + Initialize literal as an RDF literal using + value and datatype. +
                      As `@direction` may be used without `@language`, + it is possible, and legitimate, to create a datatype IRI + such as `http://w3.org/ns/i18n#_ltr`, which does not encode a language tag.
                    2. +
                    3. Otherwise, if {{JsonLdOptions/rdfDirection}} is `compound-literal`: +
                        +
                      1. Initialize literal as a new blank node.
                      2. +
                      3. Create a new triple using literal as the subject, + `rdf:value` as the predicate, and the value of `@value` in item + as the object, and add it to list triples.
                      4. +
                      5. If the item has an entry for `@language`, + create a new triple using literal as the subject, + `rdf:language` as the predicate, and the value of `@language` in item + as the object, and add it to list triples.
                      6. +
                      7. Create a new triple using literal as the subject, + `rdf:direction` as the predicate, and the value of `@direction` in item + as the object, and add it to list triples.
                      8. +
                      +
                    4. +
                    +
                  • +
                  • Otherwise, initialize literal as an RDF literal using value and datatype. If item has an @language entry, add the value associated with the @language entry as the language tag of literal.
                  • @@ -4760,15 +4920,30 @@

                    Overview

                    Unless the useRdfType flag is set to true, rdf:type predicates will be serialized as @type as long as the associated object is either an IRI or blank node identifier.

                    + +

                    If the {{JsonLdOptions/rdfDirection}} option is not `null`, then special processing is used to + convert from an `i18n-datatype` or `compound-literal` form.

                    + +

                    The support for both `i18n-datatype` and `compound-literal` + algorithm steps are non-normative, and are AT RISK for JSON-LD 1.1. + They may be replaced with normative algorithm steps in a future version. + Either or both of these transformation methods may be removed prior to + JSON-LD 1.1 being finalized. + The JSON-LD Working Group solicits feedback from the community on the + usefulness of these transformations.

                    Algorithm

                    -

                    The algorithm takes one required and three optional inputs: an RDF dataset dataset - and the three flags useNativeTypes, useRdfType, - and the {{JsonLdOptions/ordered}} flag, used to order - map entry keys lexicographically, where noted +

                    The algorithm takes one required and five optional inputs: + an RDF dataset dataset + and the five flags + {{JsonLdOptions/ordered}}, used to order + map entry keys lexicographically, where noted, + {{JsonLdOptions/rdfDirection}}, + useNativeTypes, + and the useRdfType, that all default to false.

                    The dataset is iterable to iterate over graphs and graph names @@ -4781,6 +4956,7 @@

                    Algorithm

                    of a single entry @default whose value references default graph.
                  • Initialize referenced once to an empty map.
                  • +
                  • Initialize compound literal subjects to an empty map.
                  • For each graph in dataset:
                    1. If graph is the default graph, @@ -4788,13 +4964,17 @@

                      Algorithm

                      graph name associated with graph.
                    2. If graph map has no name entry, create one and set its value to an empty map.
                    3. +
                    4. If compound literal subjects has no name entry, create one and set + its value to an empty map.
                    5. If graph is not the default graph and default graph does not have a name entry, - create such a entry and initialize its value to a new + create such an entry and initialize its value to a new map with a single entry @id whose value is name.
                    6. Reference the value of the name entry in graph map using the variable node map.
                    7. +
                    8. Reference the value of the name entry in compound literal subjects + using the variable compound map.
                    9. For each triple in graph consisting of subject, predicate, and object:
                        @@ -4804,6 +4984,9 @@

                        Algorithm

                        set to subject.
                      1. Reference the value of the subject entry in node map using the variable node.
                      2. +
                      3. If the {{JsonLdOptions/rdfDirection}} option + is `compound-literal` and predicate is `rdf:direction`, + add an entry in compound map for subject with the value `true`.
                      4. If object is an IRI or blank node identifier, and node map does not have an object entry, create one and initialize its value to a new map @@ -4820,7 +5003,9 @@

                        Algorithm

                        triple.
                      5. Set value to the result of using the RDF to Object Conversion algorithm, - passing object and useNativeTypes.
                      6. + passing object, + {{JsonLdOptions/rdfDirection}}, + and useNativeTypes.
                      7. If node does not have a predicate entry, create one and initialize its value to an empty array.
                      8. If there is no item equivalent to value in the array @@ -4857,6 +5042,40 @@

                        Algorithm

                      9. For each name and graph object in graph map:
                          +
                        1. If compound literal subjects + has an entry for name, then for each cl + which is a key in that entry: +
                            +
                          1. Initialize cl entry to the value of cl + in referenced once, + continuing to the next cl if cl entry is not a map.
                          2. +
                          3. Initialize node to the value of `node` in cl entry.
                          4. +
                          5. Initialize property to value of `property` in cl entry.
                          6. +
                          7. Initialize value to value of `value` in cl entry.
                          8. +
                          9. Initialize cl node to the value of cl + in graph object, and remove that entry from graph object, + continuing to the next cl if cl node is not a map.
                          10. +
                          11. For each cl reference in the value of property in node + where the value of `@id` in cl reference is cl: +
                              +
                            1. Delete the `@id` entry in node.
                            2. +
                            3. Add an entry to node for `@value` with the value taken + from the `rdf:value` entry in cl node.
                            4. +
                            5. Add an entry to node for `@language` with the value taken + from the `rdf:language` entry in cl node, if any. + If that value is not a well-formed according to + section 2.2.9 of [[BCP47]], + an invalid language-tagged string + error has been detected and processing is aborted.
                            6. +
                            7. Add an entry to node for `@direction` with the value taken + from the `rdf:direction` entry in cl node, if any. + If that value is not `"ltr"` or `"rtl"`, an + invalid base direction + error has been detected and processing is aborted.
                            8. +
                            +
                          12. +
                          +
                        2. If graph object has no rdf:nil entry, continue with the next name-graph object pair as the graph does not contain any lists that need to be converted.
                        3. @@ -4950,13 +5169,21 @@

                          Overview

                          RDF literals are transformed to value objects whereas IRIs and blank node identifiers are - transformed to node objects. - Literals with datatype rdf:JSON - are transformed into a value object using the internal representation - based on the lexical-to-value mapping defined in - JSON datatype in [[JSON-LD11]], - and @type of @json. - If the useNativeTypes flag is set to true, + transformed to node objects.

                          +

                          Literals with datatype rdf:JSON + are transformed into a value object using the internal representation + based on the lexical-to-value mapping defined in + JSON datatype in [[JSON-LD11]], + and @type of @json.

                          +

                          With the {{JsonLdOptions/rdfDirection}} option set to `i18n-datatype`, + literals with datatype starting with `https://w3.org/ns/i18n#` + are transformed into a value object by decoding + the language tag and base direction from the datatype.

                          +

                          With the {{JsonLdOptions/rdfDirection}} option set to `compound-literal`, + blank node objects using `rdf:direction` are + are transformed into a value object by decoding + the `rdf:value`, `rdf:language`, and `rdf:direction` properties.

                          +

                          If the useNativeTypes flag is set to true, RDF literals with a datatype IRI that equals xsd:integer or xsd:double are converted @@ -4972,8 +5199,10 @@

                          Overview

                          Algorithm

                          -

                          This algorithm takes two required inputs: a value to be converted - to a map and a flag useNativeTypes.

                          +

                          This algorithm takes three required inputs: + a value to be converted to a map, + {{JsonLdOptions/rdfDirection}}, + and a flag useNativeTypes.

                          1. If value is an IRI or a @@ -5016,23 +5245,39 @@

                            Algorithm

                          2. Otherwise, if processing mode is json-ld-1.1, and value is a JSON literal, - set the @value entry to the result of + set converted value to the result of turning the lexical value of value into the JSON-LD internal representation, and set type to @json. If the lexical value of value is not valid JSON according to the JSON Grammar [[RFC8259]], an invalid JSON literal error has been detected and processing is aborted.
                          3. +
                          4. Otherwise, if processing mode is `json-ld-1.1`, + the datatype IRI of value starts with `https://w3.org/ns/i18n#`, + and {{JsonLdOptions/rdfDirection}} is `i18n-datatype`: +
                              +
                            1. Set converted value to the lexical form of value.
                            2. +
                            3. If the string prefix of the fragment identifier + of the datatype IRI up until the underscore (`"_"`) is not empty, + add an entry `@language` to result and set its value to that prefix. +
                              As `@direction` may be used without `@language`, + it is possible, and legitimate, to create a datatype IRI + such as `http://w3.org/ns/i18n#_ltr`, which does not encode a language tag.
                            4. +
                            5. Add an entry `@direction` to result and set its value to the substring of the + fragment identifier following + the underscore (`"_"`).
                            6. +
                            +
                          5. Otherwise, if value is a language-tagged string - add a entry @language to result and set its value to the + add an entry @language to result and set its value to the language tag of value.
                          6. Otherwise, set type to the datatype IRI of value, unless it equals xsd:string which is ignored.
                          7. -
                          8. Add a entry @value to result whose value +
                          9. Add an entry @value to result whose value is set to converted value.
                          10. -
                          11. If type is not null, add a entry @type +
                          12. If type is not null, add an entry @type to result whose value is set to type.
                          13. Return result.
                          @@ -5682,6 +5927,7 @@

                          The JsonLdOptions Type

                          boolean ordered = false; USVString processingMode = null; boolean produceGeneralizedRdf = true; + USVString rdfDirection = null; boolean useNativeTypes = false; boolean useRdfType = false; }; @@ -5751,6 +5997,22 @@

                          The JsonLdOptions Type

                          If set to true, certain algorithm processing steps where indicated are ordered lexicographically. If false, order is not considered in processing.
                          +
                          rdfDirection
                          +
                          Determines how value objects containing a base direction + are transformed to and from RDF. +
                            +
                          • If set to `i18n-datatype`, an RDF literal is generated using a datatype IRI + based on `https://w3.org/ns/i18n#` with both the language tag (if present) + and base direction encoded. + When transforming from RDF, this datatype is decoded to create a value object + containing `@language` (if present) and `@direction`.
                          • +
                          • If set to `compound-literal`, a blank node is emitted instead of a literal, + where the blank node is the subject of `rdf:value`, `rdf:direction`, and `rdf:language` (if present) + properties. + When transforming from RDF, this object is decoded to create a value object + containing `@language` (if present) and `@direction`.
                          • +
                          +
                          @@ -6226,6 +6488,9 @@

                          JsonLdErrorCode

                          An attempt was made to redefine a protected term.
                          invalid @included value
                          An included block contains an invalid value.
                          +
                          invalid base direction
                          +
                          The value of `@direction` is not `"ltr"`, `"rtl"`, + or null and thus invalid.
                  • @@ -6274,7 +6539,7 @@

                    Changes since 1.0 Recommendation of 16 January 2014

                  • An expanded term definition can now have an @nest entry, which identifies a term expanding to @nest which is used for containing properties using the same - @nest mapping. When expanding, the values of a entry + @nest mapping. When expanding, the values of an entry expanding to @nest are treated as if they were contained within the enclosing node object directly.
                  • @container values within an expanded term definition may now @@ -6389,6 +6654,8 @@

                    Changes since JSON-LD Community Group Final Report

                  • In the LoadDocumentCallback, if the retrieved content is not any JSON media type and there is a link header with `rel=alternate` and `type=application/ld+json`, redirect to that content.
                  • +
                  • Value objects, and associated context and term definitions have been updated to + support `@direction` for setting the base direction of strings.
                  diff --git a/tests/compact-manifest.html b/tests/compact-manifest.html index b50afa85..eb2756e2 100644 --- a/tests/compact-manifest.html +++ b/tests/compact-manifest.html @@ -4089,6 +4089,244 @@

  • +
    +Test tdi01 term direction null +
    +
    +
    +
    id
    +
    #tdi01
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:CompactTest
    +
    Purpose
    +
    Uses term with null direction when two terms conflict on direction.
    +
    input
    +
    +compact/di01-in.jsonld +
    +
    context
    +
    +compact/di01-context.jsonld +
    +
    expect
    +
    +compact/di01-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi02 use alias of @direction +
    +
    +
    +
    id
    +
    #tdi02
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:CompactTest
    +
    Purpose
    +
    Use alias of @direction.
    +
    input
    +
    +compact/di02-in.jsonld +
    +
    context
    +
    +compact/di02-context.jsonld +
    +
    expect
    +
    +compact/di02-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi03 term selection with lists and direction +
    +
    +
    +
    id
    +
    #tdi03
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:CompactTest
    +
    Purpose
    +
    Term selection includes values of @list.
    +
    input
    +
    +compact/di03-in.jsonld +
    +
    context
    +
    +compact/di03-context.jsonld +
    +
    expect
    +
    +compact/di03-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi04 simple language map with term direction +
    +
    +
    +
    id
    +
    #tdi04
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:CompactTest
    +
    Purpose
    +
    Term selection with language maps and @direction.
    +
    input
    +
    +compact/di04-in.jsonld +
    +
    context
    +
    +compact/di04-context.jsonld +
    +
    expect
    +
    +compact/di04-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi05 simple language mapwith overriding term direction +
    +
    +
    +
    id
    +
    #tdi05
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:CompactTest
    +
    Purpose
    +
    Term selection with language maps and @direction.
    +
    input
    +
    +compact/di05-in.jsonld +
    +
    context
    +
    +compact/di05-context.jsonld +
    +
    expect
    +
    +compact/di05-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi06 simple language mapwith overriding null direction +
    +
    +
    +
    id
    +
    #tdi06
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:CompactTest
    +
    Purpose
    +
    Term selection with language maps and @direction.
    +
    input
    +
    +compact/di06-in.jsonld +
    +
    context
    +
    +compact/di06-context.jsonld +
    +
    expect
    +
    +compact/di06-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi07 simple language map with mismatching term direction +
    +
    +
    +
    id
    +
    #tdi07
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:CompactTest
    +
    Purpose
    +
    Term selection with language maps and @direction.
    +
    input
    +
    +compact/di07-in.jsonld +
    +
    context
    +
    +compact/di07-context.jsonld +
    +
    expect
    +
    +compact/di07-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    +
    +
    +
    Test te001 Compaction to list of lists
    diff --git a/tests/compact-manifest.jsonld b/tests/compact-manifest.jsonld index d8d071f3..1ffd8f70 100644 --- a/tests/compact-manifest.jsonld +++ b/tests/compact-manifest.jsonld @@ -1175,6 +1175,69 @@ "context": "compact/c027-context.jsonld", "expect": "compact/c027-out.jsonld", "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#tdi01", + "@type": [ "jld:PositiveEvaluationTest", "jld:CompactTest" ], + "name": "term direction null", + "purpose": "Uses term with null direction when two terms conflict on direction.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}, + "input": "compact/di01-in.jsonld", + "context": "compact/di01-context.jsonld", + "expect": "compact/di01-out.jsonld" + }, { + "@id": "#tdi02", + "@type": [ "jld:PositiveEvaluationTest", "jld:CompactTest" ], + "name": "use alias of @direction", + "purpose": "Use alias of @direction.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}, + "input": "compact/di02-in.jsonld", + "context": "compact/di02-context.jsonld", + "expect": "compact/di02-out.jsonld" + }, { + "@id": "#tdi03", + "@type": [ "jld:PositiveEvaluationTest", "jld:CompactTest" ], + "name": "term selection with lists and direction", + "purpose": "Term selection includes values of @list.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}, + "input": "compact/di03-in.jsonld", + "context": "compact/di03-context.jsonld", + "expect": "compact/di03-out.jsonld" + }, { + "@id": "#tdi04", + "@type": [ "jld:PositiveEvaluationTest", "jld:CompactTest" ], + "name": "simple language map with term direction", + "purpose": "Term selection with language maps and @direction.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}, + "input": "compact/di04-in.jsonld", + "context": "compact/di04-context.jsonld", + "expect": "compact/di04-out.jsonld" + }, { + "@id": "#tdi05", + "@type": [ "jld:PositiveEvaluationTest", "jld:CompactTest" ], + "name": "simple language mapwith overriding term direction", + "purpose": "Term selection with language maps and @direction.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}, + "input": "compact/di05-in.jsonld", + "context": "compact/di05-context.jsonld", + "expect": "compact/di05-out.jsonld" + }, { + "@id": "#tdi06", + "@type": [ "jld:PositiveEvaluationTest", "jld:CompactTest" ], + "name": "simple language mapwith overriding null direction", + "purpose": "Term selection with language maps and @direction.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}, + "input": "compact/di06-in.jsonld", + "context": "compact/di06-context.jsonld", + "expect": "compact/di06-out.jsonld" + }, { + "@id": "#tdi07", + "@type": [ "jld:PositiveEvaluationTest", "jld:CompactTest" ], + "name": "simple language map with mismatching term direction", + "purpose": "Term selection with language maps and @direction.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}, + "input": "compact/di07-in.jsonld", + "context": "compact/di07-context.jsonld", + "expect": "compact/di07-out.jsonld" }, { "@id": "#te001", "@type": [ "jld:NegativeEvaluationTest", "jld:CompactTest" ], diff --git a/tests/compact/di01-context.jsonld b/tests/compact/di01-context.jsonld new file mode 100644 index 00000000..49916e71 --- /dev/null +++ b/tests/compact/di01-context.jsonld @@ -0,0 +1,6 @@ +{ + "@context": { + "term5": {"@id": "http://example.com/term", "@direction": null}, + "@direction": "ltr" + } +} \ No newline at end of file diff --git a/tests/compact/di01-in.jsonld b/tests/compact/di01-in.jsonld new file mode 100644 index 00000000..8a546baf --- /dev/null +++ b/tests/compact/di01-in.jsonld @@ -0,0 +1,6 @@ +{ + "http://example.com/term": [ + "v5", + {"@value": "plain literal"} + ] +} \ No newline at end of file diff --git a/tests/compact/di01-out.jsonld b/tests/compact/di01-out.jsonld new file mode 100644 index 00000000..f0dc26fd --- /dev/null +++ b/tests/compact/di01-out.jsonld @@ -0,0 +1,7 @@ +{ + "@context": { + "term5": {"@id": "http://example.com/term", "@direction": null}, + "@direction": "ltr" + }, + "term5": [ "v5", "plain literal" ] +} \ No newline at end of file diff --git a/tests/compact/di02-context.jsonld b/tests/compact/di02-context.jsonld new file mode 100644 index 00000000..7bfb3503 --- /dev/null +++ b/tests/compact/di02-context.jsonld @@ -0,0 +1,3 @@ +{ + "@context": {"direction": "@direction"} +} \ No newline at end of file diff --git a/tests/compact/di02-in.jsonld b/tests/compact/di02-in.jsonld new file mode 100644 index 00000000..63b5d46e --- /dev/null +++ b/tests/compact/di02-in.jsonld @@ -0,0 +1,3 @@ +{ + "http://example.org/foo": {"@value": "bar", "@direction": "ltr"} +} \ No newline at end of file diff --git a/tests/compact/di02-out.jsonld b/tests/compact/di02-out.jsonld new file mode 100644 index 00000000..d34c0015 --- /dev/null +++ b/tests/compact/di02-out.jsonld @@ -0,0 +1,4 @@ +{ + "@context": {"direction": "@direction"}, + "http://example.org/foo": {"@value": "bar", "direction": "ltr"} +} \ No newline at end of file diff --git a/tests/compact/di03-context.jsonld b/tests/compact/di03-context.jsonld new file mode 100644 index 00000000..ee90c316 --- /dev/null +++ b/tests/compact/di03-context.jsonld @@ -0,0 +1,8 @@ +{ + "@context": { + "foo_ltr": {"@id": "http://example.com/foo", "@container": "@list", "@direction": "ltr"}, + "foo_rtl": {"@id": "http://example.com/foo", "@container": "@list", "@direction": "rtl"} + }, + "foo_ltr": ["en"], + "foo_rtl": ["ar"] +} \ No newline at end of file diff --git a/tests/compact/di03-in.jsonld b/tests/compact/di03-in.jsonld new file mode 100644 index 00000000..429aa76f --- /dev/null +++ b/tests/compact/di03-in.jsonld @@ -0,0 +1,6 @@ +[{ + "http://example.com/foo": [ + {"@list": [{"@value": "en", "@direction": "ltr"}]}, + {"@list": [{"@value": "ar", "@direction": "rtl"}]} + ] +}] \ No newline at end of file diff --git a/tests/compact/di03-out.jsonld b/tests/compact/di03-out.jsonld new file mode 100644 index 00000000..ee90c316 --- /dev/null +++ b/tests/compact/di03-out.jsonld @@ -0,0 +1,8 @@ +{ + "@context": { + "foo_ltr": {"@id": "http://example.com/foo", "@container": "@list", "@direction": "ltr"}, + "foo_rtl": {"@id": "http://example.com/foo", "@container": "@list", "@direction": "rtl"} + }, + "foo_ltr": ["en"], + "foo_rtl": ["ar"] +} \ No newline at end of file diff --git a/tests/compact/di04-context.jsonld b/tests/compact/di04-context.jsonld new file mode 100644 index 00000000..b77d1034 --- /dev/null +++ b/tests/compact/di04-context.jsonld @@ -0,0 +1,11 @@ +{ + "@context": { + "@version": 1.1, + "vocab": "http://example.com/vocab/", + "label": { + "@id": "vocab:label", + "@direction": "ltr", + "@container": "@language" + } + } +} \ No newline at end of file diff --git a/tests/compact/di04-in.jsonld b/tests/compact/di04-in.jsonld new file mode 100644 index 00000000..a0b9512c --- /dev/null +++ b/tests/compact/di04-in.jsonld @@ -0,0 +1,10 @@ +[ + { + "@id": "http://example.com/queen", + "http://example.com/vocab/label": [ + {"@value": "Die Königin", "@language": "de", "@direction": "ltr"}, + {"@value": "Ihre Majestät", "@language": "de", "@direction": "ltr"}, + {"@value": "The Queen", "@language": "en", "@direction": "ltr"} + ] + } +] \ No newline at end of file diff --git a/tests/compact/di04-out.jsonld b/tests/compact/di04-out.jsonld new file mode 100644 index 00000000..a61d6a93 --- /dev/null +++ b/tests/compact/di04-out.jsonld @@ -0,0 +1,16 @@ +{ + "@context": { + "@version": 1.1, + "vocab": "http://example.com/vocab/", + "label": { + "@id": "vocab:label", + "@direction": "ltr", + "@container": "@language" + } + }, + "@id": "http://example.com/queen", + "label": { + "en": "The Queen", + "de": [ "Die Königin", "Ihre Majestät" ] + } +} \ No newline at end of file diff --git a/tests/compact/di05-context.jsonld b/tests/compact/di05-context.jsonld new file mode 100644 index 00000000..b302024c --- /dev/null +++ b/tests/compact/di05-context.jsonld @@ -0,0 +1,12 @@ +{ + "@context": { + "@version": 1.1, + "@direction": "rtl", + "vocab": "http://example.com/vocab/", + "label": { + "@id": "vocab:label", + "@direction": "ltr", + "@container": "@language" + } + } +} \ No newline at end of file diff --git a/tests/compact/di05-in.jsonld b/tests/compact/di05-in.jsonld new file mode 100644 index 00000000..a0b9512c --- /dev/null +++ b/tests/compact/di05-in.jsonld @@ -0,0 +1,10 @@ +[ + { + "@id": "http://example.com/queen", + "http://example.com/vocab/label": [ + {"@value": "Die Königin", "@language": "de", "@direction": "ltr"}, + {"@value": "Ihre Majestät", "@language": "de", "@direction": "ltr"}, + {"@value": "The Queen", "@language": "en", "@direction": "ltr"} + ] + } +] \ No newline at end of file diff --git a/tests/compact/di05-out.jsonld b/tests/compact/di05-out.jsonld new file mode 100644 index 00000000..33363f63 --- /dev/null +++ b/tests/compact/di05-out.jsonld @@ -0,0 +1,17 @@ +{ + "@context": { + "@version": 1.1, + "@direction": "rtl", + "vocab": "http://example.com/vocab/", + "label": { + "@id": "vocab:label", + "@direction": "ltr", + "@container": "@language" + } + }, + "@id": "http://example.com/queen", + "label": { + "en": "The Queen", + "de": [ "Die Königin", "Ihre Majestät" ] + } +} \ No newline at end of file diff --git a/tests/compact/di06-context.jsonld b/tests/compact/di06-context.jsonld new file mode 100644 index 00000000..f618d0d1 --- /dev/null +++ b/tests/compact/di06-context.jsonld @@ -0,0 +1,12 @@ +{ + "@context": { + "@version": 1.1, + "@direction": "rtl", + "vocab": "http://example.com/vocab/", + "label": { + "@id": "vocab:label", + "@direction": null, + "@container": "@language" + } + } +} \ No newline at end of file diff --git a/tests/compact/di06-in.jsonld b/tests/compact/di06-in.jsonld new file mode 100644 index 00000000..2ba56561 --- /dev/null +++ b/tests/compact/di06-in.jsonld @@ -0,0 +1,10 @@ +[ + { + "@id": "http://example.com/queen", + "http://example.com/vocab/label": [ + {"@value": "Die Königin", "@language": "de"}, + {"@value": "Ihre Majestät", "@language": "de"}, + {"@value": "The Queen", "@language": "en"} + ] + } +] \ No newline at end of file diff --git a/tests/compact/di06-out.jsonld b/tests/compact/di06-out.jsonld new file mode 100644 index 00000000..b9bb61e6 --- /dev/null +++ b/tests/compact/di06-out.jsonld @@ -0,0 +1,17 @@ +{ + "@context": { + "@version": 1.1, + "@direction": "rtl", + "vocab": "http://example.com/vocab/", + "label": { + "@id": "vocab:label", + "@direction": null, + "@container": "@language" + } + }, + "@id": "http://example.com/queen", + "label": { + "en": "The Queen", + "de": [ "Die Königin", "Ihre Majestät" ] + } +} \ No newline at end of file diff --git a/tests/compact/di07-context.jsonld b/tests/compact/di07-context.jsonld new file mode 100644 index 00000000..e0b7b922 --- /dev/null +++ b/tests/compact/di07-context.jsonld @@ -0,0 +1,15 @@ +{ + "@context": { + "@version": 1.1, + "vocab": "http://example.com/vocab/", + "label": { + "@id": "vocab:label", + "@direction": "rtl", + "@container": "@language" + } + }, + "@id": "http://example.com/queen", + "label": { + "en": "The Queen" + } +} \ No newline at end of file diff --git a/tests/compact/di07-in.jsonld b/tests/compact/di07-in.jsonld new file mode 100644 index 00000000..c7df546b --- /dev/null +++ b/tests/compact/di07-in.jsonld @@ -0,0 +1,10 @@ +[ + { + "@id": "http://example.com/queen", + "http://example.com/vocab/label": [ + {"@value": "Die Königin", "@language": "de"}, + {"@value": "Ihre Majestät", "@language": "de", "@direction": "ltr"}, + {"@value": "The Queen", "@language": "en", "@direction": "rtl"} + ] + } +] \ No newline at end of file diff --git a/tests/compact/di07-out.jsonld b/tests/compact/di07-out.jsonld new file mode 100644 index 00000000..65c287f0 --- /dev/null +++ b/tests/compact/di07-out.jsonld @@ -0,0 +1,19 @@ +{ + "@context": { + "@version": 1.1, + "vocab": "http://example.com/vocab/", + "label": { + "@id": "vocab:label", + "@direction": "rtl", + "@container": "@language" + } + }, + "@id": "http://example.com/queen", + "label": { + "en": "The Queen" + }, + "vocab:label": [ + {"@value": "Die Königin", "@language": "de"}, + {"@value": "Ihre Majestät", "@language": "de", "@direction": "ltr"} + ] +} \ No newline at end of file diff --git a/tests/compact/e001-context.jsonld b/tests/compact/e001-context.jsonld index 29f4e232..ee90c316 100644 --- a/tests/compact/e001-context.jsonld +++ b/tests/compact/e001-context.jsonld @@ -1,5 +1,8 @@ { "@context": { - "list": {"@id": "http://example/list", "@container": "@list"} - } + "foo_ltr": {"@id": "http://example.com/foo", "@container": "@list", "@direction": "ltr"}, + "foo_rtl": {"@id": "http://example.com/foo", "@container": "@list", "@direction": "rtl"} + }, + "foo_ltr": ["en"], + "foo_rtl": ["ar"] } \ No newline at end of file diff --git a/tests/expand-manifest.html b/tests/expand-manifest.html index 68e29032..001fd3bc 100644 --- a/tests/expand-manifest.html +++ b/tests/expand-manifest.html @@ -3763,6 +3763,258 @@

    +
    +Test tdi01 Expand string using default and term directions +
    +
    +
    +
    id
    +
    #tdi01
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:ExpandTest
    +
    Purpose
    +
    Strings are coerced to have @direction based on default and term direction.
    +
    input
    +
    +expand/di01-in.jsonld +
    +
    expect
    +
    +expand/di01-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi02 Expand string using default and term directions and languages +
    +
    +
    +
    id
    +
    #tdi02
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:ExpandTest
    +
    Purpose
    +
    Strings are coerced to have @direction based on default and term direction.
    +
    input
    +
    +expand/di02-in.jsonld +
    +
    expect
    +
    +expand/di02-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi03 expand list values with @direction +
    +
    +
    +
    id
    +
    #tdi03
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:ExpandTest
    +
    Purpose
    +
    List values where the term has @direction are used in expansion.
    +
    input
    +
    +expand/di03-in.jsonld +
    +
    expect
    +
    +expand/di03-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi04 simple language map with term direction +
    +
    +
    +
    id
    +
    #tdi04
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:ExpandTest
    +
    Purpose
    +
    Term selection with language maps and @direction.
    +
    input
    +
    +expand/di04-in.jsonld +
    +
    expect
    +
    +expand/di04-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi05 simple language mapwith overriding term direction +
    +
    +
    +
    id
    +
    #tdi05
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:ExpandTest
    +
    Purpose
    +
    Term selection with language maps and @direction.
    +
    input
    +
    +expand/di05-in.jsonld +
    +
    expect
    +
    +expand/di05-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi06 simple language mapwith overriding null direction +
    +
    +
    +
    id
    +
    #tdi06
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:ExpandTest
    +
    Purpose
    +
    Term selection with language maps and @direction.
    +
    input
    +
    +expand/di06-in.jsonld +
    +
    expect
    +
    +expand/di06-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi07 simple language map with mismatching term direction +
    +
    +
    +
    id
    +
    #tdi07
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:ExpandTest
    +
    Purpose
    +
    Term selection with language maps and @direction.
    +
    input
    +
    +expand/di07-in.jsonld +
    +
    expect
    +
    +expand/di07-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi08 @direction must be one of ltr or rtl +
    +
    +
    +
    id
    +
    #tdi08
    +
    Type
    +
    jld:NegativeEvaluationTest, jld:ExpandTest
    +
    Purpose
    +
    Generate an error if @direction has illegal value.
    +
    input
    +
    +expand/di08-in.jsonld +
    +
    expect
    +
    +invalid base direction +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi09 @direction is incompatible with @type +
    +
    +
    +
    id
    +
    #tdi09
    +
    Type
    +
    jld:NegativeEvaluationTest, jld:ExpandTest
    +
    Purpose
    +
    Value objects can have either @type but not @language or @direction.
    +
    input
    +
    +expand/di09-in.jsonld +
    +
    expect
    +
    +invalid value object +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    Test te001 Keywords cannot be aliased to other keywords
    diff --git a/tests/expand-manifest.jsonld b/tests/expand-manifest.jsonld index 22b15f35..9e0e88a2 100644 --- a/tests/expand-manifest.jsonld +++ b/tests/expand-manifest.jsonld @@ -1108,6 +1108,78 @@ "input": "expand/c030-in.jsonld", "expect": "invalid @propagate value", "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#tdi01", + "@type": [ "jld:PositiveEvaluationTest", "jld:ExpandTest" ], + "name": "Expand string using default and term directions", + "purpose": "Strings are coerced to have @direction based on default and term direction.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/di01-in.jsonld", + "expect": "expand/di01-out.jsonld" + }, { + "@id": "#tdi02", + "@type": [ "jld:PositiveEvaluationTest", "jld:ExpandTest" ], + "name": "Expand string using default and term directions and languages", + "purpose": "Strings are coerced to have @direction based on default and term direction.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/di02-in.jsonld", + "expect": "expand/di02-out.jsonld" + }, { + "@id": "#tdi03", + "@type": [ "jld:PositiveEvaluationTest", "jld:ExpandTest" ], + "name": "expand list values with @direction", + "purpose": "List values where the term has @direction are used in expansion.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/di03-in.jsonld", + "expect": "expand/di03-out.jsonld" + }, { + "@id": "#tdi04", + "@type": [ "jld:PositiveEvaluationTest", "jld:ExpandTest" ], + "name": "simple language map with term direction", + "purpose": "Term selection with language maps and @direction.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/di04-in.jsonld", + "expect": "expand/di04-out.jsonld" + }, { + "@id": "#tdi05", + "@type": [ "jld:PositiveEvaluationTest", "jld:ExpandTest" ], + "name": "simple language mapwith overriding term direction", + "purpose": "Term selection with language maps and @direction.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/di05-in.jsonld", + "expect": "expand/di05-out.jsonld" + }, { + "@id": "#tdi06", + "@type": [ "jld:PositiveEvaluationTest", "jld:ExpandTest" ], + "name": "simple language mapwith overriding null direction", + "purpose": "Term selection with language maps and @direction.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/di06-in.jsonld", + "expect": "expand/di06-out.jsonld" + }, { + "@id": "#tdi07", + "@type": [ "jld:PositiveEvaluationTest", "jld:ExpandTest" ], + "name": "simple language map with mismatching term direction", + "purpose": "Term selection with language maps and @direction.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/di07-in.jsonld", + "expect": "expand/di07-out.jsonld" + }, { + "@id": "#tdi08", + "@type": [ "jld:NegativeEvaluationTest", "jld:ExpandTest" ], + "name": "@direction must be one of ltr or rtl", + "purpose": "Generate an error if @direction has illegal value.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/di08-in.jsonld", + "expect": "invalid base direction" + }, { + "@id": "#tdi09", + "@type": [ "jld:NegativeEvaluationTest", "jld:ExpandTest" ], + "name": "@direction is incompatible with @type", + "purpose": "Value objects can have either @type but not @language or @direction.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/di09-in.jsonld", + "expect": "invalid value object" }, { "@id": "#te001", "@type": [ "jld:NegativeEvaluationTest", "jld:ExpandTest" ], diff --git a/tests/expand/di01-in.jsonld b/tests/expand/di01-in.jsonld new file mode 100644 index 00000000..ae8217d3 --- /dev/null +++ b/tests/expand/di01-in.jsonld @@ -0,0 +1,12 @@ +{ + "@context": { + "@version": 1.1, + "@direction": "rtl", + "ex": "http://example.org/vocab#", + "ex:ltr": { "@direction": "ltr" }, + "ex:none": { "@direction": null } + }, + "ex:rtl": "rtl", + "ex:ltr": "ltr", + "ex:none": "no direction" +} \ No newline at end of file diff --git a/tests/expand/di01-out.jsonld b/tests/expand/di01-out.jsonld new file mode 100644 index 00000000..17709834 --- /dev/null +++ b/tests/expand/di01-out.jsonld @@ -0,0 +1,7 @@ +[ + { + "http://example.org/vocab#rtl": [{"@value": "rtl", "@direction": "rtl"}], + "http://example.org/vocab#ltr": [{"@value": "ltr", "@direction": "ltr"}], + "http://example.org/vocab#none": [{"@value": "no direction"}] + } +] \ No newline at end of file diff --git a/tests/expand/di02-in.jsonld b/tests/expand/di02-in.jsonld new file mode 100644 index 00000000..379362f5 --- /dev/null +++ b/tests/expand/di02-in.jsonld @@ -0,0 +1,25 @@ +{ + "@context": { + "@version": 1.1, + "@language": "en", + "@direction": "rtl", + "ex": "http://example.org/vocab#", + "ex:ltr": { "@direction": "ltr" }, + "ex:none": { "@direction": null }, + "ex:german": { "@language": "de" }, + "ex:nolang": { "@language": null }, + "ex:german_ltr": { "@language": "de", "@direction": "ltr" }, + "ex:nolang_ltr": { "@language": null, "@direction": "ltr" }, + "ex:none_none": { "@language": null, "@direction": null }, + "ex:german_none": { "@language": "de", "@direction": null } + }, + "ex:rtl": "rtl en", + "ex:ltr": "ltr en", + "ex:none": "no direction en", + "ex:german": "german rtl", + "ex:nolang": "no language rtl", + "ex:german_ltr": "german ltr", + "ex:nolang_ltr": "no language ltr", + "ex:none_none": "no language or direction", + "ex:german_none": "german no direction" +} \ No newline at end of file diff --git a/tests/expand/di02-out.jsonld b/tests/expand/di02-out.jsonld new file mode 100644 index 00000000..77d62249 --- /dev/null +++ b/tests/expand/di02-out.jsonld @@ -0,0 +1,13 @@ +[ + { + "http://example.org/vocab#rtl": [{"@value": "rtl en", "@language": "en", "@direction": "rtl"}], + "http://example.org/vocab#ltr": [{"@value": "ltr en", "@language": "en", "@direction": "ltr"}], + "http://example.org/vocab#none": [{"@value": "no direction en", "@language": "en"}], + "http://example.org/vocab#german": [{"@value": "german rtl", "@language": "de", "@direction": "rtl"}], + "http://example.org/vocab#nolang": [{"@value": "no language rtl", "@direction": "rtl"}], + "http://example.org/vocab#german_ltr": [{"@value": "german ltr", "@language": "de", "@direction": "ltr"}], + "http://example.org/vocab#nolang_ltr": [{"@value": "no language ltr", "@direction": "ltr"}], + "http://example.org/vocab#none_none": [{"@value": "no language or direction"}], + "http://example.org/vocab#german_none": [{"@value": "german no direction", "@language": "de"}] + } +] \ No newline at end of file diff --git a/tests/expand/di03-in.jsonld b/tests/expand/di03-in.jsonld new file mode 100644 index 00000000..22ca2005 --- /dev/null +++ b/tests/expand/di03-in.jsonld @@ -0,0 +1,9 @@ +{ + "@context": { + "@version": 1.1, + "foo_ltr": {"@id": "http://example.com/foo", "@container": "@list", "@direction": "ltr"}, + "foo_rtl": {"@id": "http://example.com/foo", "@container": "@list", "@direction": "rtl"} + }, + "foo_ltr": ["en"], + "foo_rtl": ["ar"] +} \ No newline at end of file diff --git a/tests/expand/di03-out.jsonld b/tests/expand/di03-out.jsonld new file mode 100644 index 00000000..429aa76f --- /dev/null +++ b/tests/expand/di03-out.jsonld @@ -0,0 +1,6 @@ +[{ + "http://example.com/foo": [ + {"@list": [{"@value": "en", "@direction": "ltr"}]}, + {"@list": [{"@value": "ar", "@direction": "rtl"}]} + ] +}] \ No newline at end of file diff --git a/tests/expand/di04-in.jsonld b/tests/expand/di04-in.jsonld new file mode 100644 index 00000000..b1cf3f4a --- /dev/null +++ b/tests/expand/di04-in.jsonld @@ -0,0 +1,16 @@ +{ + "@context": { + "@version": 1.1, + "@direction": "ltr", + "vocab": "http://example.com/vocab/", + "label": { + "@id": "vocab:label", + "@container": "@language" + } + }, + "@id": "http://example.com/queen", + "label": { + "en": "The Queen", + "de": [ "Die Königin", "Ihre Majestät" ] + } +} \ No newline at end of file diff --git a/tests/expand/di04-out.jsonld b/tests/expand/di04-out.jsonld new file mode 100644 index 00000000..a0b9512c --- /dev/null +++ b/tests/expand/di04-out.jsonld @@ -0,0 +1,10 @@ +[ + { + "@id": "http://example.com/queen", + "http://example.com/vocab/label": [ + {"@value": "Die Königin", "@language": "de", "@direction": "ltr"}, + {"@value": "Ihre Majestät", "@language": "de", "@direction": "ltr"}, + {"@value": "The Queen", "@language": "en", "@direction": "ltr"} + ] + } +] \ No newline at end of file diff --git a/tests/expand/di05-in.jsonld b/tests/expand/di05-in.jsonld new file mode 100644 index 00000000..a61d6a93 --- /dev/null +++ b/tests/expand/di05-in.jsonld @@ -0,0 +1,16 @@ +{ + "@context": { + "@version": 1.1, + "vocab": "http://example.com/vocab/", + "label": { + "@id": "vocab:label", + "@direction": "ltr", + "@container": "@language" + } + }, + "@id": "http://example.com/queen", + "label": { + "en": "The Queen", + "de": [ "Die Königin", "Ihre Majestät" ] + } +} \ No newline at end of file diff --git a/tests/expand/di05-out.jsonld b/tests/expand/di05-out.jsonld new file mode 100644 index 00000000..a0b9512c --- /dev/null +++ b/tests/expand/di05-out.jsonld @@ -0,0 +1,10 @@ +[ + { + "@id": "http://example.com/queen", + "http://example.com/vocab/label": [ + {"@value": "Die Königin", "@language": "de", "@direction": "ltr"}, + {"@value": "Ihre Majestät", "@language": "de", "@direction": "ltr"}, + {"@value": "The Queen", "@language": "en", "@direction": "ltr"} + ] + } +] \ No newline at end of file diff --git a/tests/expand/di06-in.jsonld b/tests/expand/di06-in.jsonld new file mode 100644 index 00000000..f8a69db9 --- /dev/null +++ b/tests/expand/di06-in.jsonld @@ -0,0 +1,17 @@ +{ + "@context": { + "@version": 1.1, + "vocab": "http://example.com/vocab/", + "@direction": "rtl", + "label": { + "@id": "vocab:label", + "@direction": "ltr", + "@container": "@language" + } + }, + "@id": "http://example.com/queen", + "label": { + "en": "The Queen", + "de": [ "Die Königin", "Ihre Majestät" ] + } +} \ No newline at end of file diff --git a/tests/expand/di06-out.jsonld b/tests/expand/di06-out.jsonld new file mode 100644 index 00000000..a0b9512c --- /dev/null +++ b/tests/expand/di06-out.jsonld @@ -0,0 +1,10 @@ +[ + { + "@id": "http://example.com/queen", + "http://example.com/vocab/label": [ + {"@value": "Die Königin", "@language": "de", "@direction": "ltr"}, + {"@value": "Ihre Majestät", "@language": "de", "@direction": "ltr"}, + {"@value": "The Queen", "@language": "en", "@direction": "ltr"} + ] + } +] \ No newline at end of file diff --git a/tests/expand/di07-in.jsonld b/tests/expand/di07-in.jsonld new file mode 100644 index 00000000..23e90ddd --- /dev/null +++ b/tests/expand/di07-in.jsonld @@ -0,0 +1,17 @@ +{ + "@context": { + "@version": 1.1, + "vocab": "http://example.com/vocab/", + "@direction": "rtl", + "label": { + "@id": "vocab:label", + "@direction": null, + "@container": "@language" + } + }, + "@id": "http://example.com/queen", + "label": { + "en": "The Queen", + "de": [ "Die Königin", "Ihre Majestät" ] + } +} \ No newline at end of file diff --git a/tests/expand/di07-out.jsonld b/tests/expand/di07-out.jsonld new file mode 100644 index 00000000..2ba56561 --- /dev/null +++ b/tests/expand/di07-out.jsonld @@ -0,0 +1,10 @@ +[ + { + "@id": "http://example.com/queen", + "http://example.com/vocab/label": [ + {"@value": "Die Königin", "@language": "de"}, + {"@value": "Ihre Majestät", "@language": "de"}, + {"@value": "The Queen", "@language": "en"} + ] + } +] \ No newline at end of file diff --git a/tests/expand/di08-in.jsonld b/tests/expand/di08-in.jsonld new file mode 100644 index 00000000..de8e61c7 --- /dev/null +++ b/tests/expand/di08-in.jsonld @@ -0,0 +1,7 @@ +{ + "@context": { + "@version": 1.1, + "@direction": "foo" + }, + "vocab:term": "bar" +} \ No newline at end of file diff --git a/tests/expand/di09-in.jsonld b/tests/expand/di09-in.jsonld new file mode 100644 index 00000000..31f21d0d --- /dev/null +++ b/tests/expand/di09-in.jsonld @@ -0,0 +1,7 @@ +{ + "ex:p": { + "@value": "v", + "@type": "ex:t", + "@direction": "rtl" + } +} \ No newline at end of file diff --git a/tests/fromRdf-manifest.html b/tests/fromRdf-manifest.html index 6e0e4885..ff747e48 100644 --- a/tests/fromRdf-manifest.html +++ b/tests/fromRdf-manifest.html @@ -658,6 +658,382 @@

    +
    +Test tdi01 rdfDirection: null with i18n literal with direction and no language +
    +
    +
    +
    id
    +
    #tdi01
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:FromRDFTest
    +
    Purpose
    +
    Does not parse i18n datatype without proper option.
    +
    input
    +
    +fromRdf/di01-in.nq +
    +
    expect
    +
    +fromRdf/di01-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi02 rdfDirection: null with i18n literal with direction and language +
    +
    +
    +
    id
    +
    #tdi02
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:FromRDFTest
    +
    Purpose
    +
    Does not parse i18n datatype without proper option.
    +
    input
    +
    +fromRdf/di02-in.nq +
    +
    expect
    +
    +fromRdf/di02-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi03 rdfDirection: null with compound literal with direction and no language +
    +
    +
    +
    id
    +
    #tdi03
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:FromRDFTest
    +
    Purpose
    +
    Does not parse compound literal without proper option.
    +
    input
    +
    +fromRdf/di03-in.nq +
    +
    expect
    +
    +fromRdf/di03-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi04 rdfDirection: null with compound literal with direction and language +
    +
    +
    +
    id
    +
    #tdi04
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:FromRDFTest
    +
    Purpose
    +
    Does not parse compound literal without proper option.
    +
    input
    +
    +fromRdf/di04-in.nq +
    +
    expect
    +
    +fromRdf/di04-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi05 rdfDirection: i18n-datatype with i18n literal with direction and no language +
    +
    +
    +
    id
    +
    #tdi05
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:FromRDFTest
    +
    Purpose
    +
    Parses i18n datatype with proper option.
    +
    input
    +
    +fromRdf/di05-in.nq +
    +
    expect
    +
    +fromRdf/di05-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    rdfDirection
    +
    i18n-datatype
    +
    +
    +
    +
    +
    +Test tdi06 rdfDirection: i18n-datatype with i18n literal with direction and language +
    +
    +
    +
    id
    +
    #tdi06
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:FromRDFTest
    +
    Purpose
    +
    Parses i18n datatype with proper option.
    +
    input
    +
    +fromRdf/di06-in.nq +
    +
    expect
    +
    +fromRdf/di06-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    rdfDirection
    +
    i18n-datatype
    +
    +
    +
    +
    +
    +Test tdi07 rdfDirection: i18n-datatype with compound literal with direction and no language +
    +
    +
    +
    id
    +
    #tdi07
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:FromRDFTest
    +
    Purpose
    +
    Does not parse compound literal without proper option.
    +
    input
    +
    +fromRdf/di07-in.nq +
    +
    expect
    +
    +fromRdf/di07-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    rdfDirection
    +
    i18n-datatype
    +
    +
    +
    +
    +
    +Test tdi08 rdfDirection: i18n-datatype with compound literal with direction and language +
    +
    +
    +
    id
    +
    #tdi08
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:FromRDFTest
    +
    Purpose
    +
    Does not parse compound literal without proper option.
    +
    input
    +
    +fromRdf/di08-in.nq +
    +
    expect
    +
    +fromRdf/di08-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    rdfDirection
    +
    i18n-datatype
    +
    +
    +
    +
    +
    +Test tdi09 rdfDirection: compound-literal with i18n literal with direction and no language +
    +
    +
    +
    id
    +
    #tdi09
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:FromRDFTest
    +
    Purpose
    +
    Does not parse i18n datatype without proper option.
    +
    input
    +
    +fromRdf/di09-in.nq +
    +
    expect
    +
    +fromRdf/di09-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    rdfDirection
    +
    compound-literal
    +
    +
    +
    +
    +
    +Test tdi10 rdfDirection: compound-literal with i18n literal with direction and language +
    +
    +
    +
    id
    +
    #tdi10
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:FromRDFTest
    +
    Purpose
    +
    Does not parse i18n datatype without proper option.
    +
    input
    +
    +fromRdf/di10-in.nq +
    +
    expect
    +
    +fromRdf/di10-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    rdfDirection
    +
    compound-literal
    +
    +
    +
    +
    +
    +Test tdi11 rdfDirection: compound-literal with compound literal with direction and no language +
    +
    +
    +
    id
    +
    #tdi11
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:FromRDFTest
    +
    Purpose
    +
    Parses compound literal with proper option.
    +
    input
    +
    +fromRdf/di11-in.nq +
    +
    expect
    +
    +fromRdf/di11-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    rdfDirection
    +
    compound-literal
    +
    +
    +
    +
    +
    +Test tdi12 rdfDirection: compound-literal with compound literal with direction and language +
    +
    +
    +
    id
    +
    #tdi12
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:FromRDFTest
    +
    Purpose
    +
    Parses compound literal with proper option.
    +
    input
    +
    +fromRdf/di12-in.nq +
    +
    expect
    +
    +fromRdf/di12-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    rdfDirection
    +
    compound-literal
    +
    +
    +
    +
    Test tjs01 JSON literal (boolean true)
    diff --git a/tests/fromRdf-manifest.jsonld b/tests/fromRdf-manifest.jsonld index 135154e3..0ab20a01 100644 --- a/tests/fromRdf-manifest.jsonld +++ b/tests/fromRdf-manifest.jsonld @@ -195,6 +195,103 @@ "purpose": "Check list generation with rdf:first property and rdf:nil value.", "input": "fromRdf/0026-in.nq", "expect": "fromRdf/0026-out.jsonld" + }, { + "@id": "#tdi01", + "@type": [ "jld:PositiveEvaluationTest", "jld:FromRDFTest" ], + "name": "rdfDirection: null with i18n literal with direction and no language", + "purpose": "Does not parse i18n datatype without proper option.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}, + "input": "fromRdf/di01-in.nq", + "expect": "fromRdf/di01-out.jsonld" + }, { + "@id": "#tdi02", + "@type": [ "jld:PositiveEvaluationTest", "jld:FromRDFTest" ], + "name": "rdfDirection: null with i18n literal with direction and language", + "purpose": "Does not parse i18n datatype without proper option.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}, + "input": "fromRdf/di02-in.nq", + "expect": "fromRdf/di02-out.jsonld" + }, { + "@id": "#tdi03", + "@type": [ "jld:PositiveEvaluationTest", "jld:FromRDFTest" ], + "name": "rdfDirection: null with compound literal with direction and no language", + "purpose": "Does not parse compound literal without proper option.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}, + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}, + "input": "fromRdf/di03-in.nq", + "expect": "fromRdf/di03-out.jsonld" + }, { + "@id": "#tdi04", + "@type": [ "jld:PositiveEvaluationTest", "jld:FromRDFTest" ], + "name": "rdfDirection: null with compound literal with direction and language", + "purpose": "Does not parse compound literal without proper option.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1"}, + "input": "fromRdf/di04-in.nq", + "expect": "fromRdf/di04-out.jsonld" + }, { + "@id": "#tdi05", + "@type": [ "jld:PositiveEvaluationTest", "jld:FromRDFTest" ], + "name": "rdfDirection: i18n-datatype with i18n literal with direction and no language", + "purpose": "Parses i18n datatype with proper option.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1", "rdfDirection": "i18n-datatype"}, + "input": "fromRdf/di05-in.nq", + "expect": "fromRdf/di05-out.jsonld" + }, { + "@id": "#tdi06", + "@type": [ "jld:PositiveEvaluationTest", "jld:FromRDFTest" ], + "name": "rdfDirection: i18n-datatype with i18n literal with direction and language", + "purpose": "Parses i18n datatype with proper option.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1", "rdfDirection": "i18n-datatype"}, + "input": "fromRdf/di06-in.nq", + "expect": "fromRdf/di06-out.jsonld" + }, { + "@id": "#tdi07", + "@type": [ "jld:PositiveEvaluationTest", "jld:FromRDFTest" ], + "name": "rdfDirection: i18n-datatype with compound literal with direction and no language", + "purpose": "Does not parse compound literal without proper option.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1", "rdfDirection": "i18n-datatype"}, + "input": "fromRdf/di07-in.nq", + "expect": "fromRdf/di07-out.jsonld" + }, { + "@id": "#tdi08", + "@type": [ "jld:PositiveEvaluationTest", "jld:FromRDFTest" ], + "name": "rdfDirection: i18n-datatype with compound literal with direction and language", + "purpose": "Does not parse compound literal without proper option.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1", "rdfDirection": "i18n-datatype"}, + "input": "fromRdf/di08-in.nq", + "expect": "fromRdf/di08-out.jsonld" + }, { + "@id": "#tdi09", + "@type": [ "jld:PositiveEvaluationTest", "jld:FromRDFTest" ], + "name": "rdfDirection: compound-literal with i18n literal with direction and no language", + "purpose": "Does not parse i18n datatype without proper option.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1", "rdfDirection": "compound-literal"}, + "input": "fromRdf/di09-in.nq", + "expect": "fromRdf/di09-out.jsonld" + }, { + "@id": "#tdi10", + "@type": [ "jld:PositiveEvaluationTest", "jld:FromRDFTest" ], + "name": "rdfDirection: compound-literal with i18n literal with direction and language", + "purpose": "Does not parse i18n datatype without proper option.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1", "rdfDirection": "compound-literal"}, + "input": "fromRdf/di10-in.nq", + "expect": "fromRdf/di10-out.jsonld" + }, { + "@id": "#tdi11", + "@type": [ "jld:PositiveEvaluationTest", "jld:FromRDFTest" ], + "name": "rdfDirection: compound-literal with compound literal with direction and no language", + "purpose": "Parses compound literal with proper option.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1", "rdfDirection": "compound-literal"}, + "input": "fromRdf/di11-in.nq", + "expect": "fromRdf/di11-out.jsonld" + }, { + "@id": "#tdi12", + "@type": [ "jld:PositiveEvaluationTest", "jld:FromRDFTest" ], + "name": "rdfDirection: compound-literal with compound literal with direction and language", + "purpose": "Parses compound literal with proper option.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1", "rdfDirection": "compound-literal"}, + "input": "fromRdf/di12-in.nq", + "expect": "fromRdf/di12-out.jsonld" }, { "@id": "#tjs01", "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"], diff --git a/tests/fromRdf/di01-in.nq b/tests/fromRdf/di01-in.nq new file mode 100644 index 00000000..1925fd7a --- /dev/null +++ b/tests/fromRdf/di01-in.nq @@ -0,0 +1 @@ + "no language"^^ . diff --git a/tests/fromRdf/di01-out.jsonld b/tests/fromRdf/di01-out.jsonld new file mode 100644 index 00000000..0135c23c --- /dev/null +++ b/tests/fromRdf/di01-out.jsonld @@ -0,0 +1,4 @@ +[{ + "@id": "http://example.com/a", + "http://example.org/label": [{"@value": "no language", "@type": "https://w3.org/ns/i18n#_rtl"}] +}] \ No newline at end of file diff --git a/tests/fromRdf/di02-in.nq b/tests/fromRdf/di02-in.nq new file mode 100644 index 00000000..32202d89 --- /dev/null +++ b/tests/fromRdf/di02-in.nq @@ -0,0 +1 @@ + "en-US"^^ . diff --git a/tests/fromRdf/di02-out.jsonld b/tests/fromRdf/di02-out.jsonld new file mode 100644 index 00000000..d2d5d50d --- /dev/null +++ b/tests/fromRdf/di02-out.jsonld @@ -0,0 +1,4 @@ +[{ + "@id": "http://example.com/a", + "http://example.org/label": [{"@value": "en-US", "@type": "https://w3.org/ns/i18n#en-us_rtl"}] +}] \ No newline at end of file diff --git a/tests/fromRdf/di03-in.nq b/tests/fromRdf/di03-in.nq new file mode 100644 index 00000000..7bfd7638 --- /dev/null +++ b/tests/fromRdf/di03-in.nq @@ -0,0 +1,3 @@ + _:cl1 . +_:cl1 "no language" . +_:cl1 "rtl" . diff --git a/tests/fromRdf/di03-out.jsonld b/tests/fromRdf/di03-out.jsonld new file mode 100644 index 00000000..c783ad49 --- /dev/null +++ b/tests/fromRdf/di03-out.jsonld @@ -0,0 +1,8 @@ +[{ + "@id": "_:cl1", + "http://www.w3.org/1999/02/22-rdf-syntax-ns#value": [{"@value": "no language"}], + "http://www.w3.org/1999/02/22-rdf-syntax-ns#direction": [{"@value": "rtl"}] +}, { + "@id": "http://example.com/a", + "http://example.org/label": [{"@id": "_:cl1"}] +}] \ No newline at end of file diff --git a/tests/fromRdf/di04-in.nq b/tests/fromRdf/di04-in.nq new file mode 100644 index 00000000..a5b3041d --- /dev/null +++ b/tests/fromRdf/di04-in.nq @@ -0,0 +1,4 @@ + _:cl1 . +_:cl1 "en-US" . +_:cl1 "en-us" . +_:cl1 "rtl" . diff --git a/tests/fromRdf/di04-out.jsonld b/tests/fromRdf/di04-out.jsonld new file mode 100644 index 00000000..04d38f5c --- /dev/null +++ b/tests/fromRdf/di04-out.jsonld @@ -0,0 +1,9 @@ +[{ + "@id": "_:cl1", + "http://www.w3.org/1999/02/22-rdf-syntax-ns#value": [{"@value": "en-US"}], + "http://www.w3.org/1999/02/22-rdf-syntax-ns#language": [{"@value": "en-us"}], + "http://www.w3.org/1999/02/22-rdf-syntax-ns#direction": [{"@value": "rtl"}] +}, { + "@id": "http://example.com/a", + "http://example.org/label": [{"@id": "_:cl1"}] +}] \ No newline at end of file diff --git a/tests/fromRdf/di05-in.nq b/tests/fromRdf/di05-in.nq new file mode 100644 index 00000000..1925fd7a --- /dev/null +++ b/tests/fromRdf/di05-in.nq @@ -0,0 +1 @@ + "no language"^^ . diff --git a/tests/fromRdf/di05-out.jsonld b/tests/fromRdf/di05-out.jsonld new file mode 100644 index 00000000..3afb8934 --- /dev/null +++ b/tests/fromRdf/di05-out.jsonld @@ -0,0 +1,4 @@ +[{ + "@id": "http://example.com/a", + "http://example.org/label": [{"@value": "no language", "@direction": "rtl"}] +}] \ No newline at end of file diff --git a/tests/fromRdf/di06-in.nq b/tests/fromRdf/di06-in.nq new file mode 100644 index 00000000..32202d89 --- /dev/null +++ b/tests/fromRdf/di06-in.nq @@ -0,0 +1 @@ + "en-US"^^ . diff --git a/tests/fromRdf/di06-out.jsonld b/tests/fromRdf/di06-out.jsonld new file mode 100644 index 00000000..fa4c3d64 --- /dev/null +++ b/tests/fromRdf/di06-out.jsonld @@ -0,0 +1,4 @@ +[{ + "@id": "http://example.com/a", + "http://example.org/label": [{"@value": "en-US", "@language": "en-us", "@direction": "rtl"}] +}] \ No newline at end of file diff --git a/tests/fromRdf/di07-in.nq b/tests/fromRdf/di07-in.nq new file mode 100644 index 00000000..7bfd7638 --- /dev/null +++ b/tests/fromRdf/di07-in.nq @@ -0,0 +1,3 @@ + _:cl1 . +_:cl1 "no language" . +_:cl1 "rtl" . diff --git a/tests/fromRdf/di07-out.jsonld b/tests/fromRdf/di07-out.jsonld new file mode 100644 index 00000000..c783ad49 --- /dev/null +++ b/tests/fromRdf/di07-out.jsonld @@ -0,0 +1,8 @@ +[{ + "@id": "_:cl1", + "http://www.w3.org/1999/02/22-rdf-syntax-ns#value": [{"@value": "no language"}], + "http://www.w3.org/1999/02/22-rdf-syntax-ns#direction": [{"@value": "rtl"}] +}, { + "@id": "http://example.com/a", + "http://example.org/label": [{"@id": "_:cl1"}] +}] \ No newline at end of file diff --git a/tests/fromRdf/di08-in.nq b/tests/fromRdf/di08-in.nq new file mode 100644 index 00000000..a5b3041d --- /dev/null +++ b/tests/fromRdf/di08-in.nq @@ -0,0 +1,4 @@ + _:cl1 . +_:cl1 "en-US" . +_:cl1 "en-us" . +_:cl1 "rtl" . diff --git a/tests/fromRdf/di08-out.jsonld b/tests/fromRdf/di08-out.jsonld new file mode 100644 index 00000000..04d38f5c --- /dev/null +++ b/tests/fromRdf/di08-out.jsonld @@ -0,0 +1,9 @@ +[{ + "@id": "_:cl1", + "http://www.w3.org/1999/02/22-rdf-syntax-ns#value": [{"@value": "en-US"}], + "http://www.w3.org/1999/02/22-rdf-syntax-ns#language": [{"@value": "en-us"}], + "http://www.w3.org/1999/02/22-rdf-syntax-ns#direction": [{"@value": "rtl"}] +}, { + "@id": "http://example.com/a", + "http://example.org/label": [{"@id": "_:cl1"}] +}] \ No newline at end of file diff --git a/tests/fromRdf/di09-in.nq b/tests/fromRdf/di09-in.nq new file mode 100644 index 00000000..1925fd7a --- /dev/null +++ b/tests/fromRdf/di09-in.nq @@ -0,0 +1 @@ + "no language"^^ . diff --git a/tests/fromRdf/di09-out.jsonld b/tests/fromRdf/di09-out.jsonld new file mode 100644 index 00000000..0135c23c --- /dev/null +++ b/tests/fromRdf/di09-out.jsonld @@ -0,0 +1,4 @@ +[{ + "@id": "http://example.com/a", + "http://example.org/label": [{"@value": "no language", "@type": "https://w3.org/ns/i18n#_rtl"}] +}] \ No newline at end of file diff --git a/tests/fromRdf/di10-in.nq b/tests/fromRdf/di10-in.nq new file mode 100644 index 00000000..32202d89 --- /dev/null +++ b/tests/fromRdf/di10-in.nq @@ -0,0 +1 @@ + "en-US"^^ . diff --git a/tests/fromRdf/di10-out.jsonld b/tests/fromRdf/di10-out.jsonld new file mode 100644 index 00000000..d2d5d50d --- /dev/null +++ b/tests/fromRdf/di10-out.jsonld @@ -0,0 +1,4 @@ +[{ + "@id": "http://example.com/a", + "http://example.org/label": [{"@value": "en-US", "@type": "https://w3.org/ns/i18n#en-us_rtl"}] +}] \ No newline at end of file diff --git a/tests/fromRdf/di11-in.nq b/tests/fromRdf/di11-in.nq new file mode 100644 index 00000000..7bfd7638 --- /dev/null +++ b/tests/fromRdf/di11-in.nq @@ -0,0 +1,3 @@ + _:cl1 . +_:cl1 "no language" . +_:cl1 "rtl" . diff --git a/tests/fromRdf/di11-out.jsonld b/tests/fromRdf/di11-out.jsonld new file mode 100644 index 00000000..3afb8934 --- /dev/null +++ b/tests/fromRdf/di11-out.jsonld @@ -0,0 +1,4 @@ +[{ + "@id": "http://example.com/a", + "http://example.org/label": [{"@value": "no language", "@direction": "rtl"}] +}] \ No newline at end of file diff --git a/tests/fromRdf/di12-in.nq b/tests/fromRdf/di12-in.nq new file mode 100644 index 00000000..a5b3041d --- /dev/null +++ b/tests/fromRdf/di12-in.nq @@ -0,0 +1,4 @@ + _:cl1 . +_:cl1 "en-US" . +_:cl1 "en-us" . +_:cl1 "rtl" . diff --git a/tests/fromRdf/di12-out.jsonld b/tests/fromRdf/di12-out.jsonld new file mode 100644 index 00000000..fa4c3d64 --- /dev/null +++ b/tests/fromRdf/di12-out.jsonld @@ -0,0 +1,4 @@ +[{ + "@id": "http://example.com/a", + "http://example.org/label": [{"@value": "en-US", "@language": "en-us", "@direction": "rtl"}] +}] \ No newline at end of file diff --git a/tests/toRdf-manifest.html b/tests/toRdf-manifest.html index 309a4df7..741abc20 100644 --- a/tests/toRdf-manifest.html +++ b/tests/toRdf-manifest.html @@ -1255,6 +1255,358 @@

    +
    +Test tdi01 Expand string using default and term directions +
    +
    +
    +
    id
    +
    #tdi01
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:ToRDFTest
    +
    Purpose
    +
    Strings are coerced to have @direction based on default and term direction.
    +
    input
    +
    +toRdf/di01-in.jsonld +
    +
    expect
    +
    +toRdf/di01-out.nq +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi02 Expand string using default and term directions and languages +
    +
    +
    +
    id
    +
    #tdi02
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:ToRDFTest
    +
    Purpose
    +
    Strings are coerced to have @direction based on default and term direction.
    +
    input
    +
    +toRdf/di02-in.jsonld +
    +
    expect
    +
    +toRdf/di02-out.nq +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi03 expand list values with @direction +
    +
    +
    +
    id
    +
    #tdi03
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:ToRDFTest
    +
    Purpose
    +
    List values where the term has @direction are used in expansion.
    +
    input
    +
    +toRdf/di03-in.jsonld +
    +
    expect
    +
    +toRdf/di03-out.nq +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi04 simple language map with term direction +
    +
    +
    +
    id
    +
    #tdi04
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:ToRDFTest
    +
    Purpose
    +
    Term selection with language maps and @direction.
    +
    input
    +
    +toRdf/di04-in.jsonld +
    +
    expect
    +
    +toRdf/di04-out.nq +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi05 simple language mapwith overriding term direction +
    +
    +
    +
    id
    +
    #tdi05
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:ToRDFTest
    +
    Purpose
    +
    Term selection with language maps and @direction.
    +
    input
    +
    +toRdf/di05-in.jsonld +
    +
    expect
    +
    +toRdf/di05-out.nq +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi06 simple language mapwith overriding null direction +
    +
    +
    +
    id
    +
    #tdi06
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:ToRDFTest
    +
    Purpose
    +
    Term selection with language maps and @direction.
    +
    input
    +
    +toRdf/di06-in.jsonld +
    +
    expect
    +
    +toRdf/di06-out.nq +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi07 simple language map with mismatching term direction +
    +
    +
    +
    id
    +
    #tdi07
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:ToRDFTest
    +
    Purpose
    +
    Term selection with language maps and @direction.
    +
    input
    +
    +toRdf/di07-in.jsonld +
    +
    expect
    +
    +toRdf/di07-out.nq +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi08 @direction must be one of ltr or rtl +
    +
    +
    +
    id
    +
    #tdi08
    +
    Type
    +
    jld:NegativeEvaluationTest, jld:ToRDFTest
    +
    Purpose
    +
    Generate an error if @direction has illegal value.
    +
    input
    +
    +toRdf/di08-in.jsonld +
    +
    expect
    +
    +invalid base direction +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tdi09 rdfDirection: i18n-datatype with direction and no language +
    +
    +
    +
    id
    +
    #tdi09
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:ToRDFTest
    +
    Purpose
    +
    Generates i18n datatype from literal with direction with option.
    +
    input
    +
    +toRdf/di09-in.jsonld +
    +
    expect
    +
    +toRdf/di09-out.nq +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    rdfDirection
    +
    i18n-datatype
    +
    +
    +
    +
    +
    +Test tdi10 rdfDirection: i18n-datatype with direction and language +
    +
    +
    +
    id
    +
    #tdi10
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:ToRDFTest
    +
    Purpose
    +
    Generates i18n datatype from literal with direction with option.
    +
    input
    +
    +toRdf/di10-in.jsonld +
    +
    expect
    +
    +toRdf/di10-out.nq +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    rdfDirection
    +
    i18n-datatype
    +
    +
    +
    +
    +
    +Test tdi11 rdfDirection: compound-literal with direction and no language +
    +
    +
    +
    id
    +
    #tdi11
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:ToRDFTest
    +
    Purpose
    +
    Generates i18n datatype from literal with direction with option.
    +
    input
    +
    +toRdf/di11-in.jsonld +
    +
    expect
    +
    +toRdf/di11-out.nq +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    rdfDirection
    +
    compound-literal
    +
    +
    +
    +
    +
    +Test tdi12 rdfDirection: compound-literal with direction and language +
    +
    +
    +
    id
    +
    #tdi12
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:ToRDFTest
    +
    Purpose
    +
    Generates compound literal from literal with direction with option.
    +
    input
    +
    +toRdf/di12-in.jsonld +
    +
    expect
    +
    +toRdf/di12-out.nq +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    processingMode
    +
    json-ld-1.1
    +
    rdfDirection
    +
    compound-literal
    +
    +
    +
    +
    Test te001 drop free-floating nodes
    diff --git a/tests/toRdf-manifest.jsonld b/tests/toRdf-manifest.jsonld index d756f252..7a7d2889 100644 --- a/tests/toRdf-manifest.jsonld +++ b/tests/toRdf-manifest.jsonld @@ -395,6 +395,102 @@ "purpose": "IRI resolution according to RFC3986.", "input": "toRdf/0132-in.jsonld", "expect": "toRdf/0132-out.nq" + }, { + "@id": "#tdi01", + "@type": [ "jld:PositiveEvaluationTest", "jld:ToRDFTest" ], + "name": "Expand string using default and term directions", + "purpose": "Strings are coerced to have @direction based on default and term direction.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "toRdf/di01-in.jsonld", + "expect": "toRdf/di01-out.nq" + }, { + "@id": "#tdi02", + "@type": [ "jld:PositiveEvaluationTest", "jld:ToRDFTest" ], + "name": "Expand string using default and term directions and languages", + "purpose": "Strings are coerced to have @direction based on default and term direction.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "toRdf/di02-in.jsonld", + "expect": "toRdf/di02-out.nq" + }, { + "@id": "#tdi03", + "@type": [ "jld:PositiveEvaluationTest", "jld:ToRDFTest" ], + "name": "expand list values with @direction", + "purpose": "List values where the term has @direction are used in expansion.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "toRdf/di03-in.jsonld", + "expect": "toRdf/di03-out.nq" + }, { + "@id": "#tdi04", + "@type": [ "jld:PositiveEvaluationTest", "jld:ToRDFTest" ], + "name": "simple language map with term direction", + "purpose": "Term selection with language maps and @direction.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "toRdf/di04-in.jsonld", + "expect": "toRdf/di04-out.nq" + }, { + "@id": "#tdi05", + "@type": [ "jld:PositiveEvaluationTest", "jld:ToRDFTest" ], + "name": "simple language mapwith overriding term direction", + "purpose": "Term selection with language maps and @direction.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "toRdf/di05-in.jsonld", + "expect": "toRdf/di05-out.nq" + }, { + "@id": "#tdi06", + "@type": [ "jld:PositiveEvaluationTest", "jld:ToRDFTest" ], + "name": "simple language mapwith overriding null direction", + "purpose": "Term selection with language maps and @direction.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "toRdf/di06-in.jsonld", + "expect": "toRdf/di06-out.nq" + }, { + "@id": "#tdi07", + "@type": [ "jld:PositiveEvaluationTest", "jld:ToRDFTest" ], + "name": "simple language map with mismatching term direction", + "purpose": "Term selection with language maps and @direction.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "toRdf/di07-in.jsonld", + "expect": "toRdf/di07-out.nq" + }, { + "@id": "#tdi08", + "@type": [ "jld:NegativeEvaluationTest", "jld:ToRDFTest" ], + "name": "@direction must be one of ltr or rtl", + "purpose": "Generate an error if @direction has illegal value.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "toRdf/di08-in.jsonld", + "expect": "invalid base direction" + }, { + "@id": "#tdi09", + "@type": [ "jld:PositiveEvaluationTest", "jld:ToRDFTest" ], + "name": "rdfDirection: i18n-datatype with direction and no language", + "purpose": "Generates i18n datatype from literal with direction with option.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1", "rdfDirection": "i18n-datatype"}, + "input": "toRdf/di09-in.jsonld", + "expect": "toRdf/di09-out.nq" + }, { + "@id": "#tdi10", + "@type": [ "jld:PositiveEvaluationTest", "jld:ToRDFTest" ], + "name": "rdfDirection: i18n-datatype with direction and language", + "purpose": "Generates i18n datatype from literal with direction with option.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1", "rdfDirection": "i18n-datatype"}, + "input": "toRdf/di10-in.jsonld", + "expect": "toRdf/di10-out.nq" + }, { + "@id": "#tdi11", + "@type": [ "jld:PositiveEvaluationTest", "jld:ToRDFTest" ], + "name": "rdfDirection: compound-literal with direction and no language", + "purpose": "Generates i18n datatype from literal with direction with option.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1", "rdfDirection": "compound-literal"}, + "input": "toRdf/di11-in.jsonld", + "expect": "toRdf/di11-out.nq" + }, { + "@id": "#tdi12", + "@type": [ "jld:PositiveEvaluationTest", "jld:ToRDFTest" ], + "name": "rdfDirection: compound-literal with direction and language", + "purpose": "Generates compound literal from literal with direction with option.", + "option": {"specVersion": "json-ld-1.1", "processingMode": "json-ld-1.1", "rdfDirection": "compound-literal"}, + "input": "toRdf/di12-in.jsonld", + "expect": "toRdf/di12-out.nq" }, { "@id": "#te001", "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], diff --git a/tests/toRdf/di01-in.jsonld b/tests/toRdf/di01-in.jsonld new file mode 100644 index 00000000..ae8217d3 --- /dev/null +++ b/tests/toRdf/di01-in.jsonld @@ -0,0 +1,12 @@ +{ + "@context": { + "@version": 1.1, + "@direction": "rtl", + "ex": "http://example.org/vocab#", + "ex:ltr": { "@direction": "ltr" }, + "ex:none": { "@direction": null } + }, + "ex:rtl": "rtl", + "ex:ltr": "ltr", + "ex:none": "no direction" +} \ No newline at end of file diff --git a/tests/toRdf/di01-out.nq b/tests/toRdf/di01-out.nq new file mode 100644 index 00000000..3e213740 --- /dev/null +++ b/tests/toRdf/di01-out.nq @@ -0,0 +1,3 @@ +_:b0 "ltr" . +_:b0 "rtl" . +_:b0 "no direction" . diff --git a/tests/toRdf/di02-in.jsonld b/tests/toRdf/di02-in.jsonld new file mode 100644 index 00000000..379362f5 --- /dev/null +++ b/tests/toRdf/di02-in.jsonld @@ -0,0 +1,25 @@ +{ + "@context": { + "@version": 1.1, + "@language": "en", + "@direction": "rtl", + "ex": "http://example.org/vocab#", + "ex:ltr": { "@direction": "ltr" }, + "ex:none": { "@direction": null }, + "ex:german": { "@language": "de" }, + "ex:nolang": { "@language": null }, + "ex:german_ltr": { "@language": "de", "@direction": "ltr" }, + "ex:nolang_ltr": { "@language": null, "@direction": "ltr" }, + "ex:none_none": { "@language": null, "@direction": null }, + "ex:german_none": { "@language": "de", "@direction": null } + }, + "ex:rtl": "rtl en", + "ex:ltr": "ltr en", + "ex:none": "no direction en", + "ex:german": "german rtl", + "ex:nolang": "no language rtl", + "ex:german_ltr": "german ltr", + "ex:nolang_ltr": "no language ltr", + "ex:none_none": "no language or direction", + "ex:german_none": "german no direction" +} \ No newline at end of file diff --git a/tests/toRdf/di02-out.nq b/tests/toRdf/di02-out.nq new file mode 100644 index 00000000..1d647d91 --- /dev/null +++ b/tests/toRdf/di02-out.nq @@ -0,0 +1,9 @@ +_:b0 "german ltr"@de . +_:b0 "ltr en"@en . +_:b0 "german no direction"@de . +_:b0 "no language rtl" . +_:b0 "no language ltr" . +_:b0 "rtl en"@en . +_:b0 "no language or direction" . +_:b0 "german rtl"@de . +_:b0 "no direction en"@en . diff --git a/tests/toRdf/di03-in.jsonld b/tests/toRdf/di03-in.jsonld new file mode 100644 index 00000000..22ca2005 --- /dev/null +++ b/tests/toRdf/di03-in.jsonld @@ -0,0 +1,9 @@ +{ + "@context": { + "@version": 1.1, + "foo_ltr": {"@id": "http://example.com/foo", "@container": "@list", "@direction": "ltr"}, + "foo_rtl": {"@id": "http://example.com/foo", "@container": "@list", "@direction": "rtl"} + }, + "foo_ltr": ["en"], + "foo_rtl": ["ar"] +} \ No newline at end of file diff --git a/tests/toRdf/di03-out.nq b/tests/toRdf/di03-out.nq new file mode 100644 index 00000000..29f295f0 --- /dev/null +++ b/tests/toRdf/di03-out.nq @@ -0,0 +1,6 @@ +_:b2 . +_:b2 "ar" . +_:b0 _:b2 . +_:b0 _:b1 . +_:b1 . +_:b1 "en" . diff --git a/tests/toRdf/di04-in.jsonld b/tests/toRdf/di04-in.jsonld new file mode 100644 index 00000000..b1cf3f4a --- /dev/null +++ b/tests/toRdf/di04-in.jsonld @@ -0,0 +1,16 @@ +{ + "@context": { + "@version": 1.1, + "@direction": "ltr", + "vocab": "http://example.com/vocab/", + "label": { + "@id": "vocab:label", + "@container": "@language" + } + }, + "@id": "http://example.com/queen", + "label": { + "en": "The Queen", + "de": [ "Die Königin", "Ihre Majestät" ] + } +} \ No newline at end of file diff --git a/tests/toRdf/di04-out.nq b/tests/toRdf/di04-out.nq new file mode 100644 index 00000000..b2e176c4 --- /dev/null +++ b/tests/toRdf/di04-out.nq @@ -0,0 +1,3 @@ + "The Queen"@en . + "Die Königin"@de . + "Ihre Majestät"@de . diff --git a/tests/toRdf/di05-in.jsonld b/tests/toRdf/di05-in.jsonld new file mode 100644 index 00000000..a61d6a93 --- /dev/null +++ b/tests/toRdf/di05-in.jsonld @@ -0,0 +1,16 @@ +{ + "@context": { + "@version": 1.1, + "vocab": "http://example.com/vocab/", + "label": { + "@id": "vocab:label", + "@direction": "ltr", + "@container": "@language" + } + }, + "@id": "http://example.com/queen", + "label": { + "en": "The Queen", + "de": [ "Die Königin", "Ihre Majestät" ] + } +} \ No newline at end of file diff --git a/tests/toRdf/di05-out.nq b/tests/toRdf/di05-out.nq new file mode 100644 index 00000000..b2e176c4 --- /dev/null +++ b/tests/toRdf/di05-out.nq @@ -0,0 +1,3 @@ + "The Queen"@en . + "Die Königin"@de . + "Ihre Majestät"@de . diff --git a/tests/toRdf/di06-in.jsonld b/tests/toRdf/di06-in.jsonld new file mode 100644 index 00000000..f8a69db9 --- /dev/null +++ b/tests/toRdf/di06-in.jsonld @@ -0,0 +1,17 @@ +{ + "@context": { + "@version": 1.1, + "vocab": "http://example.com/vocab/", + "@direction": "rtl", + "label": { + "@id": "vocab:label", + "@direction": "ltr", + "@container": "@language" + } + }, + "@id": "http://example.com/queen", + "label": { + "en": "The Queen", + "de": [ "Die Königin", "Ihre Majestät" ] + } +} \ No newline at end of file diff --git a/tests/toRdf/di06-out.nq b/tests/toRdf/di06-out.nq new file mode 100644 index 00000000..b2e176c4 --- /dev/null +++ b/tests/toRdf/di06-out.nq @@ -0,0 +1,3 @@ + "The Queen"@en . + "Die Königin"@de . + "Ihre Majestät"@de . diff --git a/tests/toRdf/di07-in.jsonld b/tests/toRdf/di07-in.jsonld new file mode 100644 index 00000000..23e90ddd --- /dev/null +++ b/tests/toRdf/di07-in.jsonld @@ -0,0 +1,17 @@ +{ + "@context": { + "@version": 1.1, + "vocab": "http://example.com/vocab/", + "@direction": "rtl", + "label": { + "@id": "vocab:label", + "@direction": null, + "@container": "@language" + } + }, + "@id": "http://example.com/queen", + "label": { + "en": "The Queen", + "de": [ "Die Königin", "Ihre Majestät" ] + } +} \ No newline at end of file diff --git a/tests/toRdf/di07-out.nq b/tests/toRdf/di07-out.nq new file mode 100644 index 00000000..b2e176c4 --- /dev/null +++ b/tests/toRdf/di07-out.nq @@ -0,0 +1,3 @@ + "The Queen"@en . + "Die Königin"@de . + "Ihre Majestät"@de . diff --git a/tests/toRdf/di08-in.jsonld b/tests/toRdf/di08-in.jsonld new file mode 100644 index 00000000..de8e61c7 --- /dev/null +++ b/tests/toRdf/di08-in.jsonld @@ -0,0 +1,7 @@ +{ + "@context": { + "@version": 1.1, + "@direction": "foo" + }, + "vocab:term": "bar" +} \ No newline at end of file diff --git a/tests/toRdf/di09-in.jsonld b/tests/toRdf/di09-in.jsonld new file mode 100644 index 00000000..c00231e6 --- /dev/null +++ b/tests/toRdf/di09-in.jsonld @@ -0,0 +1 @@ +{"http://example.org/label": {"@value": "no language", "@direction": "rtl"}} \ No newline at end of file diff --git a/tests/toRdf/di09-out.nq b/tests/toRdf/di09-out.nq new file mode 100644 index 00000000..1b87be47 --- /dev/null +++ b/tests/toRdf/di09-out.nq @@ -0,0 +1 @@ +_:a "no language"^^ . diff --git a/tests/toRdf/di10-in.jsonld b/tests/toRdf/di10-in.jsonld new file mode 100644 index 00000000..9b887109 --- /dev/null +++ b/tests/toRdf/di10-in.jsonld @@ -0,0 +1 @@ +{"http://example.org/label": {"@value": "en-US", "@language": "en-US", "@direction": "rtl"}} \ No newline at end of file diff --git a/tests/toRdf/di10-out.nq b/tests/toRdf/di10-out.nq new file mode 100644 index 00000000..1ed86297 --- /dev/null +++ b/tests/toRdf/di10-out.nq @@ -0,0 +1 @@ +_:a "en-US"^^ . diff --git a/tests/toRdf/di11-in.jsonld b/tests/toRdf/di11-in.jsonld new file mode 100644 index 00000000..c00231e6 --- /dev/null +++ b/tests/toRdf/di11-in.jsonld @@ -0,0 +1 @@ +{"http://example.org/label": {"@value": "no language", "@direction": "rtl"}} \ No newline at end of file diff --git a/tests/toRdf/di11-out.nq b/tests/toRdf/di11-out.nq new file mode 100644 index 00000000..4a82ddb6 --- /dev/null +++ b/tests/toRdf/di11-out.nq @@ -0,0 +1,3 @@ +_:b0 _:b2 . +_:b2 "rtl" . +_:b2 "no language" . diff --git a/tests/toRdf/di12-in.jsonld b/tests/toRdf/di12-in.jsonld new file mode 100644 index 00000000..9b887109 --- /dev/null +++ b/tests/toRdf/di12-in.jsonld @@ -0,0 +1 @@ +{"http://example.org/label": {"@value": "en-US", "@language": "en-US", "@direction": "rtl"}} \ No newline at end of file diff --git a/tests/toRdf/di12-out.nq b/tests/toRdf/di12-out.nq new file mode 100644 index 00000000..24293392 --- /dev/null +++ b/tests/toRdf/di12-out.nq @@ -0,0 +1,4 @@ +_:b0 _:b2 . +_:b2 "rtl" . +_:b2 "en-us" . +_:b2 "en-US" .