微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

从 schema.org

如何解决从 schema.org

这可能是一个愚蠢的问题,但我正在尝试弄清楚如何从 https://schema.org/Person 将实际的 Person 模式加载为 JSON-LD 文档。

据我所知,应该有一个包含架构定义的脚本标记,如下所示:

<script type="application/ld+json">
{

// here would be the schema deFinition in JSON-LD format

}
<script/>

然而,我在这个网站上找不到任何这样的标签

还有另一个端点可以在此处下载模式集合 https://schema.org/version/latest/schemaorg-current-http.jsonld。在此架构中,我可以找到具有以下搜索查询 "@id": "schema:Person" 的 Person 架构。然而,这个对象似乎并不完整,因为它只包含以下信息:

    {
      "@id": "schema:Person","@type": "rdfs:Class","http://www.w3.org/2002/07/owl#equivalentClass": {
        "@id": "http://xmlns.com/foaf/0.1/Person"
      },"rdfs:comment": "A person (alive,dead,undead,or fictional).","rdfs:label": "Person","rdfs:subClassOf": {
        "@id": "schema:Thing"
      },"schema:source": {
        "@id": "http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_rNews"
      }
    }

如果我只对 Person 模式感兴趣,那么总是下载整个 json-ld 集合似乎也不是很有效。所以我想,我在从 schema.org 检索 JSON-LD 文档的过程中误解了一些东西。

有人可以解释我应该如何使用 schema.org 中的模式吗?

编辑:为了更清楚,让我添加一个用例。以下来自 here 的 json-ld 文档:

{  // external (all terms in this example)
  "@context": [
    "https://www.w3.org/2018/credentials/v1","https://w3id.org/citizenship/v1"
  ],"type": [
    "VerifiableCredential","PermanentResidentCard"
  ],"credentialSubject": {
    "id": "did:example:123","type": [
      "PermanentResident","Person"
    ],"givenname": "JOHN","familyName": "SMITH","gender": "Male","image": "data:image/png;base64,iVBORw0KGgo...kJggg==","residentSince": "2015-01-01","lprCategory": "C09","lprNumber": "000-000-204","commuterClassification": "C1","birthCountry": "Bahamas","birthDate": "1958-08-17"
  },"issuer": "did:example:456","issuanceDate": "2020-04-22T10:37:22Z","identifier": "83627465","name": "Permanent Resident Card","description": "Government of Example Permanent Resident Card.","proof": {
    "type": "Ed25519Signature2018","created": "2020-04-22T10:37:22Z","proofPurpose": "assertionMethod","verificationMethod": "did:example:456#key-1","jws": "eyJjcml0IjpbImI2NCJdLCJiNjQiOmZhbHNlLCJhbGciOiJFZERTQSJ9..BhWew0x-txcroGjgdtK-yBCqoetg9DD9SgV4245TmXJi-PmqFzux6Cwaph0r-mbqzlE17yLebjfqbRT275U1AA"
  }
}

在本例中,我可以通过链接 https://www.w3.org/2018/credentials/v1https://w3id.org/citizenship/v1 获取架构定义。使用 @type 我知道我应该只考虑 VerifiableCredential 作为第一个上下文和 PermanentResidentCard (虽然它应该是 PermanentResident IMO 因为 birthDate 不是一部分PermanentResidentCard) 的第二个链接。因此,我知道例如 birthDate 可以解释为 date

如何从 schema.org 获得与架构相同的逻辑?

解决方法

我发布了另一个更简单的问题,阐明了分辨率的工作原理。请参阅答案 here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。