Search code examples
rdfjson-ldhydra-core

How to refer to RDF statements in JSON-LD? How to state(ment) about statements?


Suppose you have a simple RDF statement x:Object x:predicate x:Subject, which is expressed in JSON-LD as {"@id": "x:Object", "x:predicate": {"@id": "x:Subject"}}. How do you refer to the specific object-predicate-subject relation, how do you "adress" the factual relation? What's the "@id" or the inline identity of a statement in JSON-LD? How do you ascribe "meta data" to a statement?

How do you express statements in JSON-LD, where the subject is another statement, e.g. [x:Subject x:predicate x:Object] x:metaPredicate x:MetaObject?

How do you express statements in JSON-LD, where the object is another statement, e.g. x:MetaSubject x:metaPredicate [x:Subject x:predicate x:Object]?

How do you express statements in JSON-LD, where the predicate is another statement (strange but possible), e.g. x:MetaSubject [x:Subject x:predicate x:Object] x:MetaObject?

(PS: I realize the [] syntax of my samples is not conformant Turtle, but they serve to express my thoughts/questions.)


Solution

  • You need to use reification, there exists a standardized vocabulary for that. In JSON-LD it would look somewhat like this:

    {
      "@context": {
        "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
        "subject": { "@id": "rdf:subject", "@type": "@id" },
        "predicate": { "@id": "rdf:predicate", "@type": "@id" },
        "object": { "@id": "rdf:object", "@type": "@id" }
      },
      "@type": "rdf:Statement",
      "subject": "x:Subject",
      "predicate": "x:predicate",
      "object": { "@id": "x:Object" },
      "x:metaPredicate": "x:MetaObject"
    }