JSON-LD Context auf Vollständigkeit testen?

Kennt jemand ein Tool, dass einen JSON-LD Context auf Vollständigkeit testen kann?

Ich würde gerne etwas kleines haben, um bei lobid-resources anhand von einem Testset mögliche fehlende properties und type-Klassen im context zu finden.

Kannst Du mal ein Beispiel zeigen (dein Testset?) und sagen, was genau Du prüfen willst?
Das hört sich im Moment für mich so an, als müsstest Du eine SHACL o.ä. für die Prüfung schreiben.
Hier ein schlichtes Beispiel im SHACL-Playground, wo in den Daten name fehlt: SHACL Playground by Zazuko

Die JSON Dtaen hier: lobid-resources/src/test/resources/alma-fix at master · hbz/lobid-resources · GitHub

und der JSON Kontext hier: http://lobid.org/resources/context.jsonld

Die Frage an den Daten wäre nun, welche properties und welche type Angaben kommen vor, die nicht im Kontext ausgewiesen sind.

Es geht darum, zu prüfen, ob alle JSON Keys, die in den Daten vorkommen auch im JSON-LD-Kontext auf einen URI gemappt sind. Ich kenne kein Tool für diese Prüfung, aber wir sind nicht die einzigen, die so etwas für hilfreich halten.

Bei lobid-resources haben wir ja zusätzlich noch ein JSON Schema, das ebenfalls in Sync mit den Daten und dem JSON-LD-Kontext gehalten werden muss (siehe dieses aktuelle Ticket). Ein erster Schritt zur Vereinfachung dieser Synchronisierung könnte die Nutzung von LinkML sein, das bereits Thema im Forum war, siehe LinkML als Metaformat.

Auf den LinkML-Seiten heißt es:

One of the value propositions of LinkML is that it allows a single Source of Truth with compilation to multiple representations using generators.

This means that your data modelers can maintain a single schema, and then derive:

  • JSON-LD contexts
  • JSON-Schema
  • Anything else (e.g. SHACL shape schema)

Vielleicht kann man einfach (ohne erst mit SHACL, LinkML etc. das Datenmodell definieren zu müssen) zuerst die Daten expandieren (Keys durch URIs ersetzen; die keine haben, fallen dabei weg), dann wieder „kompaktieren“ und dann mit den Originaldaten vergleichen.
Ich habe ein bisschen im JSON-LD Playground gespielt und diese Beispieldaten lobid-resources/src/test/resources/alma-fix/990001412590206441.json at master · hbz/lobid-resources · GitHub benutzt. Es gibt die Reiter „Expanded“ und „Compacted“, aber leider sind die Formatierungen in den Outputs zu unterschiedlich, um sie vergleichen zu können. Ich weiß nicht, was bei „Canonized“ passiert, da wird ein Fehler angezeigt:

jsonld.ValidationError: Safe mode validation error.
{
  "type": [
    "JsonLdEvent"
  ],
  "code": "invalid property",
  "level": "warning",
  "message": "Dropping property that did not expand into an absolute IRI or keyword.",
  "details": {
    "property": "currentLibrary",
    "expandedProperty": "currentLibrary"
  }
}

Wenn man in den Daten die Zeilen mit currentLibrary löscht, dann wird ein anderer/nächster Fehler angezeigt.

Vielleicht gibt es Tools, die das Expandieren und Kompaktieren machen und dabei die Formatierung beibehalten? Kenne mich damit nicht aus.

Der jsonld-lint kann das wohl, für lobid-resources/src/test/resources/alma-fix/990001412590206441.json at master · hbz/lobid-resources · GitHub zeigt er folgendes an:

phu@dell-5570:~/Downloads/jsonld$ jsonld-lint 990001412590206441.json
JSON-LD Linter
ERROR: /home/phu/Downloads/jsonld/990001412590206441.json - The term "subjectslabels" is not defined in the document context (unmapped)
ERROR: /home/phu/Downloads/jsonld/990001412590206441.json - The term "currentLibrary" is not defined in the document context (unmapped)
ERROR: /home/phu/Downloads/jsonld/990001412590206441.json - The term "inventoryNumber" is not defined in the document context (unmapped)
ERROR: /home/phu/Downloads/jsonld/990001412590206441.json - The term "currentLibrary" is not defined in the document context (unmapped)
ERROR: /home/phu/Downloads/jsonld/990001412590206441.json - The term "currentLibrary" is not defined in the document context (unmapped)
ERROR: /home/phu/Downloads/jsonld/990001412590206441.json - The term "currentLibrary" is not defined in the document context (unmapped)
ERROR: /home/phu/Downloads/jsonld/990001412590206441.json - The term "currentLibrary" is not defined in the document context (unmapped)
ERROR: /home/phu/Downloads/jsonld/990001412590206441.json - The term "currentLibrary" is not defined in the document context (unmapped)
ERROR: /home/phu/Downloads/jsonld/990001412590206441.json - The term "inventoryNumber" is not defined in the document context (unmapped)
ERROR: /home/phu/Downloads/jsonld/990001412590206441.json - The term "currentLibrary" is not defined in the document context (unmapped)
ERROR: /home/phu/Downloads/jsonld/990001412590206441.json - The term "currentLibrary" is not defined in the document context (unmapped)
ERROR: /home/phu/Downloads/jsonld/990001412590206441.json - The term "inventoryNumber" is not defined in the document context (unmapped)
ERROR: /home/phu/Downloads/jsonld/990001412590206441.json - The term "currentLibrary" is not defined in the document context (unmapped)
ERROR: /home/phu/Downloads/jsonld/990001412590206441.json - The term "currentLibrary" is not defined in the document context (unmapped)
ERROR: /home/phu/Downloads/jsonld/990001412590206441.json - The term "currentLibrary" is not defined in the document context (unmapped)
ERROR: /home/phu/Downloads/jsonld/990001412590206441.json - The term "currentLibrary" is not defined in the document context (unmapped)
ERROR: /home/phu/Downloads/jsonld/990001412590206441.json - The term "currentLibrary" is not defined in the document context (unmapped)
ERROR: /home/phu/Downloads/jsonld/990001412590206441.json - The term "currentLibrary" is not defined in the document context (unmapped)
ERROR: /home/phu/Downloads/jsonld/990001412590206441.json - The term "currentLibrary" is not defined in the document context (unmapped)
3 „Gefällt mir“