rdfIDrdfaboutrdfresource的用法

上传人:平*** 文档编号:12791587 上传时间:2017-10-21 格式:DOC 页数:5 大小:38.50KB
返回 下载 相关 举报
rdfIDrdfaboutrdfresource的用法_第1页
第1页 / 共5页
rdfIDrdfaboutrdfresource的用法_第2页
第2页 / 共5页
rdfIDrdfaboutrdfresource的用法_第3页
第3页 / 共5页
rdfIDrdfaboutrdfresource的用法_第4页
第4页 / 共5页
rdfIDrdfaboutrdfresource的用法_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

《rdfIDrdfaboutrdfresource的用法》由会员分享,可在线阅读,更多相关《rdfIDrdfaboutrdfresource的用法(5页珍藏版)》请在金锄头文库上搜索。

1、用 Protege 建立一个本体,关于 Pizza 的,有三个类,包括 Pizza, PiazzaBase 和 PizzaTopping,他们互相Disjointwith,我原以为这三个类既然是在层次上对等的,那代码也应该差不多。但是当我查看源代码时发现自动生成的代码中,这三个类是不一样的,主要是有些用的是 rdf:ID,有些用的是 rdf:about,还有用 rdf:resource 的,如下:同样的结构,为什么有些要用 rdf:resource 有些又用 rdf:about,还有些用 rdf:ID?这几个有什么区别呢?一些网友的观点:1.1) rdf:ID 和 rdf:about 的区别:

2、 rdf:about 的值是一个完整 URIref,注意也可以是相对 URI,(相对于 xml:base);rdf:ID 是对 rdf:about 的值的缩写,其值是一个“ XML Name”,所以,不能是数字开头,不能有“/”符号等。例如:rdf:ID=PizzaBase 等价于 rdf:about=(xml:base)+#+PizzaBase 这个 xml:base 的值可以在 XML 文件头声明,如你例子中的,xml:base=http:/www.owl- 如果没有声明,则其值是 RDF 文件所放在的位置 uri。2)rdf:resource 和 rdf:about是的缩写。这里必须没有

3、对资源=#PizzaBase 做进一步的说明。所以,rdf:resource 只能出现在表示属性的节点中,如这里的 owl:disjointWith 节点。而 是等价于: 这里不能用 rdf:resource 了,因为声明了 #PizzaTopping 是一个类。所以,我们可以看出:说明了: 以后,后面的都是用:了。2.其实我们可以把 rdf:ID 看作和 rdf:about 一样的东西,rdf:ID 只是一个缩写而已。所以中,把所有的 rdf:ID=xxx替换成 rdf:about=#xxx也是可以的,这是我的第一个理解。第二,为什么这里不能用 rdf:resource 呢,是因为到目前为止

4、,Pizza 类和 PizzaTopping 类还没有被定义,需要在这里申明它是一个类。如果 Pizza 类在之前就已经定义了,那么这里也可以用 rdf:resource 来简写。3.再补充一个 rdf:ID 和 rdf:about 的区别:rdf:ID 是用来定义一个资源,或者说引入一个新的资源名称;rdf:about 除了也可用来定义资源外,还可用来扩展对这个资源的定义(这可以出现在其他本体文件中)。如果 Pizza 是用 rdf:ID 定义的,那么要增加对 Pizza 的描述,就必须用 rdf:about。因为同一个 RDF 文档中,不能出现两个 rdf:ID=Pizza,否则 RDF

5、Parser 就会报错。参见:/RDF Primer. Section 3.2 的第 4 段中间However, using rdf:ID provides an additional check when assigning a set of distinct names, since a given value of the rdf:ID attribute can only appear once relative to the same base URI (the catalog document, in this example).4.Have you looked at the R

6、DF Primer (and specifically, Example 4 inSection 3.1 and its explanation, which is where this is discussed)?Basically, rdf:about is for expressing the *subject* of an RDF statementin RDF/XML. rdf:resource is for expressing the *object* of an RDFstatement in RDF/XML, when the object is another resour

7、ce rather than aliteral value. Does that help? If you have some particular example inmind that you are trying to express, could you provide it?-Frank按照 Frank 的说法, rdf:about 用来表示 statement 的主体,rdf:resource 在 statement 的客体是一个资源而不是文字值时用来表示客体5.在 RDF primer 的第三章有解释:http:/www.w3.org/TR/rdf-primer/其中的对 rdf

8、:ID 的解释:An important difference from previous examples is that, in line 5, the rdf:Description element has an rdf:ID attribute instead of an rdf:about attribute. Using rdf:ID specifies a fragment identifier, given by the value of the rdf:ID attribute (item10245 in this case, which might be the catal

9、og number assigned by ), as an abbreviation of the complete URIref of the resource being described. The fragment identifier item10245 will be interpreted relative to a base URI, in this case, the URI of the containing catalog document. The full URIref for the tent is formed by taking the base URI (o

10、f the catalog), and appending the character # (to indicate that what follows is a fragment identifier) and then item10245 to it, giving the absolute URIref http:/ rdf:ID attribute is somewhat similar to the ID attribute in XML and HTML, in that it defines a name which must be unique relative to the

11、current base URI (in this example, that of the catalog). In this case, the rdf:ID attribute appears to be assigning a name (item10245) to this particular kind of tent. Any other RDF/XML within this catalog could refer to the tent by using either the absolute URIref http:/ or the relative URIref #ite

12、m10245. The relative URIref would be understood as being a URIref defined relative to the base URIref of the catalog. Using a similar abbreviation, the URIref of the tent could also be given by specifying rdf:about=#item10245 in the catalog entry (i.e., by specifying the relative URIref directly) in

13、stead of rdf:ID=item10245 . As an abbreviation mechanism, the two forms are essentially synonyms: the full URIref formed by RDF/XML is the same in either case: http:/ However, using rdf:ID provides an additional check when assigning a set of distinct names, since a given value of the rdf:ID attribut

14、e can only appear once relative to the same base URI (the catalog document, in this example). Using either form, would be giving the URIref for the tent in a two-stage process, first assigning the URIref for the whole catalog, and then using a relative URIref in the description of the tent in the c

15、atalog to indicate the URIref that has been assigned to this particular kind of tent. Moreover, this use of a relative URIref can be thought of either as being an abbreviation for a full URIref that has been assigned to the tent independently of the RDF, or as being the assignment of the URIref to the tent within the catalog.总结:rdf:ID 是用来定义一个资源,或者说引入一个新的资源名称rdf:about 除了也可用来定义资源外(引入一个新的资源名称),还可用来扩展对这个资源的定义(这可以出现在其他本体文件中)。如果 Pizza 是用 rdf:ID 定义的,那么要增加对 Pizza 的描述,就必须用 rdf:about。因为同一个 RDF 文档中,不能出现两个 rdf:ID=Pizza。rdf:resource 只用于属性是对一个对象的引用时,可以是在前面或后面定义过的;也可以使引

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号