Specifying both item's @id and @value for collections

Hello,

I have a list of items ("interests") as a part of a JSON-LD document:

{
    "@context": {
      "@base": "http://localhost/",
      "name": "http://localhost/name",
      "interests": "http://localhost/interests",
      "items": {
        "@id": "http://localhost/interest",
        "@container": "@list"
      }
    },
    "@id": "http://localhost/john",
    "name": "John",
    "interests": {
      "@context": {
        "@base": "http://localhost/",
        "items": {
          "@id": "http://localhost/interest",
          "@container": "@list"
        }
      },
      "@id": "http://localhost/john/interests",
      "@type": "http://localhost/array",
      "items": [ "Reading", "Writing" ]
    }
  }

My challenge is that I want to enrich "items" element with node id for each
individual interest, something like this:

{
    "@context": {
      "@base": "http://localhost/",
      "name": "http://localhost/name",
      "interests": "http://localhost/interests",
      "items": {
        "@id": "http://localhost/interest",
        "@container": "@list"
      }
    },
    "@id": "http://localhost/john",
    "name": "John",
    "interests": {
      "@context": {
        "@base": "http://localhost/",
        "items": {
          "@id": "http://localhost/interest",
          "@container": "@list"
        }
      },
      "@id": "http://localhost/john/interests",
      "@type": "http://localhost/array",
      "items": [
        {
          "@id": "http://localhost/123",
          "@value": "Reading"
        },
        {
          "@id": "http://localhost/456",
          "@value": "Writing"
        }
      ]
    }
  }

Unfortunately this approach doesn't work because @value can not be combined
with @id in a JSON-LD node. I wonder if there is a way to attach a node id
to a container element of a primitive type, e.g. I would like to keep
"items" element values as strings without wrapping them in a new structure.
I thought I could do this with @value specifier, but it doesn't work.

Thanks in advance

Vagif

Received on Wednesday, 25 June 2014 13:35:05 UTC