在Javascript中创建rdfa

时间:2016-05-24 19:42:05

标签: javascript rdfa

我从dbpedia获取数据,需要创建一个rdfa链接回原始源。我真的不明白怎么做。我需要展示主题,关系等。有人能给我一个明确的例子吗?

http://dbpedia.org/page/Tiger

<div vocab="http://schema.org/" prefix=" dbr: http://dbpedia.org/resource/ dbo: http://dbpedia.org/ontology/" typeof="animal">

<span property="name"> Tiger </span>
<img property="dbr:image" src="cat_image_url" />
<span property="dbr:class" rel="dbr:class> Mammal </div> ?? or dbo?
<span property="dbr:age"> 24 </span>

1 个答案:

答案 0 :(得分:1)

你可以这样做:

<link rel="dc:subject schema:about ore:isDescribedBy" about="[dbr:Tiger]" title="Tiger" href="http://dbpedia.org/page/Tiger" datatype="xsd:string" content="Tiger">

和/或这:

<dd><span about="schema:TechArticle" typeof="schema:discussionUrl dc:URI" property="foaf:primaryTopic" rel="cheminf:CHEMINF_000410" resource="http://dbpedia.org/page/Tiger"><span property="skos:prefLabel"><a href="https://en.wikipedia.org/wiki/Tiger" title="Tiger">Tiger</a>&nbsp;<img class="" alt="Exit disclaimer" src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/54/Tigress_at_Jim_Corbett_National_Park.jpg/330px-Tigress_at_Jim_Corbett_National_Park.jpg" /></span></span></dd>

<head>中,您可以使用<head><body>中的词汇表使用,如下所示:

<html
 prefix="
 this: http://example.com/public/organizations/ONTO/#
 bibo: http://purl.org/ontology/bibo/
 dbr: http://dbpedia.org/resources/
 dc: http://purl.org/dc/terms/
 foaf: http://xmlns.com/foaf/0.1/
 lcsh: http://id.loc.gov/authorities/subjects/
 og: http://ogp.me/ns#
 ore: http://www.openarchives.org/ore/terms/
 schema: http://schema.org/
"
 lang="en"
 xml:lang="en"
>

对于仅在<body>中使用的词汇表,您将初始化为:

<body
 prefix="
 cc: http://creativecommons.org/ns#
 cheminf: http://semantiscience.org/resource/
 usgov: http://www.oegov.us/democracy/us/core/owl/usgov#
"
 about="this:_term"
 typeof="cc:Work bibo:Document ore:Aggregation schema:TechArticle"
>

对于_term,您可以选择自己的术语来确定您所呈现的about="this:的哪一部分。