[data-shapes] JSON-LD examples should use context (#468)

VladimirAlexiev has just created a new issue for https://github.com/w3c/data-shapes:

== JSON-LD examples should use context ==
See https://raw.githack.com/w3c/data-shapes/master/shacl12-core/index.html#example-12 in JSON-LD:
```json
{
 "@id": "ex:MyShape",
 "@type": "sh:NodeShape",
 "sh:property": [
  {
   "sh:datatype": {
    "@id": "xsd:string"
   },
   "sh:minCount": {
    "@type": "xsd:integer",
    "@value": "1"
   },
   "sh:path": {
    "@id": "ex:myProperty"
   },
   "sh:severity": {
    "@id": "sh:Warning"
   }
  },
  {
   "sh:maxLength": {
    "@type": "xsd:integer",
    "@value": "10"
   },
   "sh:message": [
    {
     "@language": "en",
     "@value": "Too many characters"
    },
    {
     "@language": "de",
     "@value": "Zu viele Zeichen"
    }
   ],
   "sh:path": {
    "@id": "ex:myProperty"
   }
  }
 ],
 "sh:targetNode": {
  "@id": "ex:MyInstance"
 }
}
```
It is too wordy. The SHACL prop types should be defined, so that using `@type` and `@id` in SHACL JSON-LD data is unnecessary.
- The next issue discusses changes needed to the current context.
- To parse the above example, you need to prepend the inline context found at https://raw.githack.com/w3c/data-shapes/master/shacl12-core/index.html#conventions like this:
```json
{
  "@context": {
    "owl": "http://www.w3.org/2002/07/owl#",
    "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
    "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
    "sh": "http://www.w3.org/ns/shacl#",
    "xsd": "http://www.w3.org/2001/XMLSchema#",
    "ex": "http://example.com/ns#"
  },
  "@id": "ex:MyShape",
   ...
}
```
- But it's better to rely on a deployed (network) context

Please view or discuss this issue at https://github.com/w3c/data-shapes/issues/468 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 5 August 2025 07:43:08 UTC