使用来自 getschema.org IOT 的 JSON 数据获得 "thing" 名称
Consuming JSON data from getschema.org IOT get the "thing" name
刚刚进入语义世界,有些东西还看不懂。我试图弄清楚如何根据 HTML 元素上的 Microdata 标签来检查哪种元素。我在 Firefox 扩展上工作,所以我对请求和低权限的东西没有限制。我只需要通过了解架构中定义的 "thing" 的类型来弄清楚元素是什么,并以用户可理解的语言(例如没有 MusicRecording
)显示警报。考虑这个微数据示例:
<div itemscope itemtype="http://schema.org/MusicRecording">
<span itemprop="byArtist" itemscope itemtype="http://schema.org/MusicGroup">
British rock band
<span itemprop="name">Queen</span>
</span>
for their
<span itemprop="inAlbum" itemscope itemtype="http://schema.org/MusicAlbum">
<span itemprop="dateCreated">1977</span> album
<span itemprop="name">News of the World</span>
</span>
<div>
通过读取项目类型,我需要能够检索事物的名称(类似于 "Music Recording"),但不能分析字符串;在 "right way" 中,通过查询某事并提出要求。问题是,我找不到用于获取名称的 REST api 或类似的东西,我需要使用纯 javascript 来完成。
所以...有 clue/idea 吗? (除了问这样的DOMURL)
我认为RDF translator app will help you. In addition to a UI it exposes a REST Service, which you can use to convert Microdata to other RDF serializations, like turtle etc. You will then be able to interrogate that data with SPARQL。您可以想象的任何语言都有实现。
或者,可能有一个库可以直接理解微数据,但我不确定。
canonical machine-readable representation of the Schema.org vocabulary is in RDFa: http://schema.org/docs/schema_org_rdfa.html
在此文件中,每个 Schema.org 类型 (rdfs:Class
) 都有一个 rdfs:label
property 的值,"may be used to provide a human-readable version of a resource's name"。
但是,Schema.org 团队似乎决定像 URL 中那样提供标签,因此 http://schema.org/MusicRecording
是 "MusicRecording",而不是 "Music recording":
<div typeof="rdfs:Class" resource="http://schema.org/MusicRecording">
<span class="h" property="rdfs:label">MusicRecording</span>
<span property="rdfs:comment">A music recording (track), usually a single song.</span>
<span>Subclass of: <a property="rdfs:subClassOf" href="http://schema.org/CreativeWork">CreativeWork</a></span>
</div>
刚刚进入语义世界,有些东西还看不懂。我试图弄清楚如何根据 HTML 元素上的 Microdata 标签来检查哪种元素。我在 Firefox 扩展上工作,所以我对请求和低权限的东西没有限制。我只需要通过了解架构中定义的 "thing" 的类型来弄清楚元素是什么,并以用户可理解的语言(例如没有 MusicRecording
)显示警报。考虑这个微数据示例:
<div itemscope itemtype="http://schema.org/MusicRecording">
<span itemprop="byArtist" itemscope itemtype="http://schema.org/MusicGroup">
British rock band
<span itemprop="name">Queen</span>
</span>
for their
<span itemprop="inAlbum" itemscope itemtype="http://schema.org/MusicAlbum">
<span itemprop="dateCreated">1977</span> album
<span itemprop="name">News of the World</span>
</span>
<div>
通过读取项目类型,我需要能够检索事物的名称(类似于 "Music Recording"),但不能分析字符串;在 "right way" 中,通过查询某事并提出要求。问题是,我找不到用于获取名称的 REST api 或类似的东西,我需要使用纯 javascript 来完成。
所以...有 clue/idea 吗? (除了问这样的DOMURL)
我认为RDF translator app will help you. In addition to a UI it exposes a REST Service, which you can use to convert Microdata to other RDF serializations, like turtle etc. You will then be able to interrogate that data with SPARQL。您可以想象的任何语言都有实现。
或者,可能有一个库可以直接理解微数据,但我不确定。
canonical machine-readable representation of the Schema.org vocabulary is in RDFa: http://schema.org/docs/schema_org_rdfa.html
在此文件中,每个 Schema.org 类型 (rdfs:Class
) 都有一个 rdfs:label
property 的值,"may be used to provide a human-readable version of a resource's name"。
但是,Schema.org 团队似乎决定像 URL 中那样提供标签,因此 http://schema.org/MusicRecording
是 "MusicRecording",而不是 "Music recording":
<div typeof="rdfs:Class" resource="http://schema.org/MusicRecording"> <span class="h" property="rdfs:label">MusicRecording</span> <span property="rdfs:comment">A music recording (track), usually a single song.</span> <span>Subclass of: <a property="rdfs:subClassOf" href="http://schema.org/CreativeWork">CreativeWork</a></span> </div>