RDFa DRY参考的概念 [英] Concepts for RDFa DRY references

查看:84
本文介绍了RDFa DRY参考的概念的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始研究RDFa,并尝试为我的网站添加语义信息.该站点提供服务,事件,博客,并且将来可能会提供产品.很高兴schema.org拥有粗略但足够的类别.但是现在涉及到实际问题.

所有示例都在一个页面上包含所有信息,对我来说似乎很学术.例如.我的目标网页上有即将发生的事件的列表.事件具有位置属性.我的活动在2个不同的位置进行.我可以在其中粘贴每个条目的位置信息,然后为html充气.我宁愿链接到页面,这些页面描述了位置并包含完整的详细信息.不确定这是否是相同的.但是即使那样,它仍如何知道应将目标URL上的哪些RDFa信息用作适当的vCard?

类似地,我的目标网页上只有部分公司信息可见.我可以添加很多<meta>,但是再次引用联系页面将很不错.

我只是不想相信这方面使RDF创作者失望.有减少冗余的最佳实践吗?

解决方案

URI! (或 IRIs ,例如,在 RDFa 1.1 )

这是RDF的主要特征之一,它使链接数据成为可能, 由Tim Berners-Lee发明(重点是我):

语义Web不仅仅是将数据放在Web上.它与建立链接有关,以便个人或机器可以浏览数据网络.

就像超文本网络一样,数据网络是由网络上的文档构成的.但是,与超文本网络不同,在超文本网络中,链接是用HTML编写的超文本文档中的关系锚,对于数据,它们由RDF描述的任意事物之间的链接

从我的回答到有关语义网的问题:

使用RDF (以序列化格式)并为您的实体定义URI ,以便您和其他人可以对它们进行声明.

因此,请提供您所有的实体", URI,并将其用作主题响应. RDF中的对象三元组.请注意,您可能不希望使用网页所具有的URI,因为这将使区分网页数据和网页所表示事物的数据变得困难(请参阅哈希URI 方法,您可以创建以下URI:

  • http://example.com/event/42#it(事件42,即真实事物)
  • http://example.com/location/51#it(位置51,即真实物体)

现在,当您想使用Schema.org词汇表提供有关事件的信息时,可以使用 <!-- on http://example.com/event/42 --> <article resource="#it" typeof="schema:Event"> <h1 property="schema:name">Event 42</h1> </article>

当您要指定活动的位置(使用地点")时,可以使用位置的URI:

 <!-- on http://example.com/event/42 -->
<article about="#it" typeof="schema:Event">
  <h1 property="schema:name">Event 42</h1>
  <a property="schema:location" typeof="schema:Place" href="/location/51#it">Location 51</a>
</article>
 

在位置页面上,您可能会有类似的内容:

 <!-- on http://example.com/location/51 -->
<article about="#it" typeof="schema:Place">
  <h1 property="schema:name">Location 51</h1>
  <a property="schema:event" typeof="schema:Event" href="/event/42#it">Event 42</a>
</article>
 

汇总此数据,您将获得以下三元组(在Turtle中):

 @prefix schema: <http://schema.org/> .

<http://example.com/location/51#it> a schema:Place .
<http://example.com/location/51#it> schema:event <http://example.com/event/42#it> .
<http://example.com/location/51#it> schema:name "Location 51" .

<http://example.com/event/42#it> a schema:Event .
<http://example.com/event/42#it> schema:location <http://example.com/location/51#it> .
<http://example.com/event/42#it> schema:name "Event 42" .
 


我不确定(希望不是这种情况),但是Schema.org可能希望空白节点具有url(或sameAs?)属性,例如:

 <article about="#it" typeof="schema:Event">
  <h1 property="schema:name">Event 42</h1>
  <div property="schema:location" typeof="schema:Place">
    <a property="schema:url" href="/location/51#it">Location 51</a>
  </div>
</article>
 

I started digging into RDFa recently and try to spice my website with semantic information. The site offers services, events, a blog and may offer products in future. Happily schema.org has coarse but adequate categories for it all. But now it comes to practical questions.

All the examples have all information on a single page, which seems pretty academic to me. E.g. on my landing page is a list with upcoming events. Events have a location property. My events run at 2 different locations. I could paste the location information for each entry in and inflate my html. I'd rather link to pages, which describe the locations and hold full details. Not sure, whether this is what sameAs is for. But even then, how would it know which RDFa information on the target URL should be used as the appropriate vCard?

Similarly, my landing page has only partial company information visible. I could add a lot of <meta>, but again a reference to the contact page would be nice.

I just don't want to believe that this aspect slipped the RDF creators. Are there any best practices for redundancy reduction?

解决方案

URIs! (or IRIs, e.g., in RDFa 1.1)

That’s one of the primary qualities of RDF, and it makes Linked Data possible, as coined by Tim Berners-Lee (emphasis mine):

The Semantic Web isn't just about putting data on the web. It is about making links, so that a person or machine can explore the web of data.

Like the web of hypertext, the web of data is constructed with documents on the web. However, unlike the web of hypertext, where links are relationships anchors in hypertext documents written in HTML, for data they links between arbitrary things described by RDF

From my answer to a question about the Semantic Web:

Use RDF (in the form of a serialization format of your choice) and define URIs for your entities so that you and other people can make statements about them.

So give all your "entities" an URI and use it as subject resp. object in RDF triples. Note that you may not want to use the same URI which your web pages have, as it would make it hard to distinguish between data about the web page and data about the thing represented by the web page (see my answer describing this in more detail).

So let’s say your website has these two pages:

  • http://example.com/event/42 (about the event 42, i.e., the HTML page)
  • http://example.com/location/51 (about the location 51, i.e., the HTML page)

Using the hash URI method, you could mint these URIs:

  • http://example.com/event/42#it (the event 42, i.e., the real thing)
  • http://example.com/location/51#it (the location 51, i.e., the real thing)

Now when you want to use the Schema.org vocabulary to give information about your event, you may use resource to give its URI:

<!-- on http://example.com/event/42 -->
<article resource="#it" typeof="schema:Event">
  <h1 property="schema:name">Event 42</h1>
</article>

And when you want to specify the event’s location (using Place), you could use the URI of the location:

<!-- on http://example.com/event/42 -->
<article about="#it" typeof="schema:Event">
  <h1 property="schema:name">Event 42</h1>
  <a property="schema:location" typeof="schema:Place" href="/location/51#it">Location 51</a>
</article>

And on the location page you might have something like:

<!-- on http://example.com/location/51 -->
<article about="#it" typeof="schema:Place">
  <h1 property="schema:name">Location 51</h1>
  <a property="schema:event" typeof="schema:Event" href="/event/42#it">Event 42</a>
</article>

Aggregating this data, you’ll have these triples (in Turtle):

@prefix schema: <http://schema.org/> .

<http://example.com/location/51#it> a schema:Place .
<http://example.com/location/51#it> schema:event <http://example.com/event/42#it> .
<http://example.com/location/51#it> schema:name "Location 51" .

<http://example.com/event/42#it> a schema:Event .
<http://example.com/event/42#it> schema:location <http://example.com/location/51#it> .
<http://example.com/event/42#it> schema:name "Event 42" .


EDIT: I’m not sure (and I hope it’s not the case), but maybe Schema.org expects a blank node with a url (or sameAs?) property instead, e.g.:

<article about="#it" typeof="schema:Event">
  <h1 property="schema:name">Event 42</h1>
  <div property="schema:location" typeof="schema:Place">
    <a property="schema:url" href="/location/51#it">Location 51</a>
  </div>
</article>

这篇关于RDFa DRY参考的概念的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆