Skip to content

JSON-LD 1.1 Feature Request: support @values for describing multidimensional containers (list of lists) #397

Closed
@pietercolpaert

Description

@pietercolpaert

Problem description

Many JSON specs existed before JSON-LD. A couple of these specs may not be compatible with JSON-LD as they contain multidimensional containers, such as GeoJSON.

Example of a multidimensional array:

[ [3.1,51.06,30],
  [3.1,51.06,20] ]

This issue is a result from the discussion on the GeoJSON-LD repository: geojson/geojson-ld#32. If this issue will not get resolved, the GeoJSON-LD community would suggest creating custom JSON-LD parsers for JSON-LD dialects. This situation would be far from desirable.

Suggested solution

Introduce a new @values keyword, which can be used to describe the values of a @set or a @list container in more detail.

When an array is given in the @values, then the precise amount of objects within this array corresponds with the array in the graph in this order.

When an object is given in the @values, each value of the array in the graph is mapped according to this template.

Example

{
  "@context": {
     "coordinates": {
        "@id": "geojson:coordinates",
        "@container" : "@list",
        "@values" : { 
           "@type" : "geojson:Coordinate",
           "@container" : "@set",
           "@values" : [
               {"@type" : "xsd:double", "@id":"geo:longitude"},
               {"@type" : "xsd:double", "@id":"geo:latitude"}
           ]
        }
     }
  },
  "@graph" : [{
   "@id" : "ex:LineString1",
    "coordinates" : [
          [
            3.1057405471801753,
            51.064216229943476
          ],
          [
            3.1056976318359375,
            51.063434090307574
          ]
    ]
  }]
}

Would transform to (and vice versa):

ex:LineString1 geojson:coordinates _:b0 .
_:b0 rdf:first _:b1 .
_:b1 a geojson:Coordinate ;
      geo:longitude "3.105740547180175E0"^^xsd:double ;
      geo:latitude "5.106421622994348E1"^^xsd:double .
_:b0 rdf:rest _:b2 .
_:b2 rdf:first a geojson:Coordinate ;
      geo:longitude "3.1056976318359375"^^xsd:double ;
      geo:latitude "51.063434090307574"^^xsd:double .
_:b2 rdf:rest rdf:nil .

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions