2

I've created an owl ontology and want to create as simple transfer format possible. To do that, I'd like to include any context (vocab) information into json-ld context. Specifically, I'd like to specify (inherent) rdf:type of a value of a particular property.

So: I have this json:

{
  "@type": "Observation",
  "observedProperty": "temperature"
}

I'd like to create a context, so that the expanded form looks like this:

[
  {
    "@type": [
      "http://www.my.vocab.org/def/Observation"
    ],
    "http://www.my.vocab.org/def/observedProperty": [
      {
        "@id": "http://www.my.vocab.org/temperature",
        "@type": "http://www.my.vocab.org/def/Property"
      }
    ]
  }
]

Expansion using this context:

"@context": {
    "@base": "http://www.my.vocab.org/",
    "@vocab": "def/",
    "property": "property/",
    "observedProperty": {
      "@type": "Property"
    }
  }

results in

...
   "@type": "http://www.my.vocab.org/def/Property",
   "@value": "temperature"
...

Expansion using

"@context": {
 ...
      "@type": "@id"
 ...
  }

obviously doesn't include the type. Any ideas?

1 Answer 1

1

This has come up before, and type coercion doesn’t work that way. Take a look at the note in https://www.w3.org/TR/json-ld11/#type-coercion.

However, you can do this with framing.

Sign up to request clarification or add additional context in comments.

2 Comments

That's a shame. Yes, framing looks quite powerful when it comes to shaping a graph into a json-ld document with fixed structure or even enriching it. But we're trying to develop an API for two sets of users: those who only want the simplest answer possible with least amount of data transferred (especially not interested in reading 1000x that observableProperty contains - what a surprise - Properties); and those who seek full semantic grounding, e.g. for automated processing.
While reading about json-ld, I was hoping we could build a simple interface that would publish core data and a context, that would help to interpret it, which would fully satisfy both categories. Now it looks like we'd have to build two interfaces or do some sort of compromise.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.