简体   繁体   中英

Reify triples in JSON-LD

Suppose I have the following JSON doc:

{
  "@id":"http://www.example.com/id/linkFrom",
  "http://www.example.com/link":{
    "@id":"http://www.example.com/id/linkTo",
    "linkType":{
      "@id": "http://www.example.com/vocab#specialLink"
    }
  }
}

How do I express that the triple <http://www.example.com/id/linkFrom> <http://www.example.com/link> <http://www.example.com/id/linkTo> has the type http://www.example.com/vocab#specialLink ?

I'm not sure if you really want to assign "a type" to the whole triple, but as you ask for it and mention Reification , you could do something like this:

[
  {
    "@id": "http://www.example.com/id/linkFrom",
    "http://www.example.com/link": [
      {
        "@id": "http://www.example.com/id/linkTo"
      }
    ]
  },
  {
    "@id": "http://www.example.com/reifi/1",
    "@type": [
      "http://www.example.com/vocab#specialLink",
      "http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"
    ],
    "http://www.w3.org/1999/02/22-rdf-syntax-ns#subject": [
      {
        "@id": "http://www.example.com/id/linkFrom"
      }
    ],
    "http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate": [
      {
        "@id": "http://www.example.com/link"
      }
    ],
    "http://www.w3.org/1999/02/22-rdf-syntax-ns#object": [
      {
        "@id": "http://www.example.com/id/linkTo"
      }
    ]
  }
]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM