Skip to content

Is there a way to define additional metadata in JSON-LD @context? #32

Closed
@jechterhoff

Description

@jechterhoff

Hello,
I'm currently analysing JSON-LD 1.1 (reviewed the Final Community Group Report) with the goal of semantically enabling JSON data. Is there a way to define additional metadata in a JSON-LD context?

(I hope it is ok to ask this question here. If I should ask somewhere else, for example the mailing list, let me know, please.)

Let me explain what I mean with an example:

{
 "@context": {
  "@base": "http://example.org/baumregister/",
  "@version": 1.1,
  "xsd": "http://www.w3.org/2001/XMLSchema#",
  "geosparql": "http://www.opengis.net/ont/geosparql#",
  "ex": "http://example.org/ontology/flora/",
  "ort": "geosparql:hasGeometry",
  "wkt": {
   "@id": "geosparql:asWKT",
   "@type": "geosparql:wktLiteral"
  },
  "eid": "@id",
  "art": "@type",
  "Eiche": "ex:oak",
  "Walnuss": "ex:walnut",
  "hoehe": {   
   "@id": "ex:height",
   "@type": "xsd:double",
   "@derivedBy": "A specific description ...",
   "uom": "m"
  },
  "alter": {
   "@id": "ex:age",
   "@type": "xsd:integer"
  }
 },
 "art": "Eiche",
 "hoehe": "16",
 "eid": "08218adf-7947-4f28-bcaf-e069ef43e012",
 "alter": 242,
 "ort": {"wkt": "POINT(8.191035,51.899666)"}
}

In this example, the key "hoehe" expands to the IRI http://example.org/ontology/flora/height. In addition, the value type is defined as http://www.w3.org/2001/XMLSchema#double.

In the example, I've added two keys as metadata to the definition of term "hoehe":

  • "@derivedBy" - The value is supposed to contain a textual description. I used the leading "@" on purpose for testing.
  • "uom" - An indication of the unit of measure for "hoehe".

When I test this on the JSON-LD dev playground (a great tool, by the way - so helpful!), I get the following syntax errors:

  • For "@derivedBy": Invalid JSON-LD syntax; a term definition must not contain @derivedBy
  • For "uom": Invalid JSON-LD syntax; a term definition must not contain uom

When the two keys are removed, the example "works".
In the JSON-LD 1.1 specification I find the following:

An expanded term definition MUST be a JSON object composed of zero or more keys from @id, @reverse, @type, @language, @context, @Prefix, or @container. An expanded term definition SHOULD NOT contain any other keys.

Apparently I should not use the two additional keys, but they do not appear to be explicitly forbidden either. Now I am wondering if the dev playground is too strict or not. Can someone please enlighten me as to where in a JSON-LD context I can add custom keys - if at all - and what restrictions, if any, I need to be aware of? Any additional insight would be highly appreciated.

I did come across the following two issues, which may be related to my question:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions