简体   繁体   English

JSON-LD 上下文:指定(固有)rdf:属性值的类型

[英]JSON-LD context: Specifying (inherent) rdf:type of a property value

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.为此,我想将任何上下文(词汇)信息包含到 json-ld 上下文中。 Specifically, I'd like to specify (inherent) rdf:type of a value of a particular property.具体来说,我想指定(固有) rdf:type 特定属性的值。

So: I have this json:所以:我有这个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?有任何想法吗?

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 .查看https://www.w3.org/TR/json-ld11/#type-coercion中的注释。

However, you can do this with framing.但是,您可以使用框架来做到这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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