总结:rdf:ID和rdf:about的区别(转载)
1)rdf:ID和rdf:about的区别:
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-ontologies.com/unnamed.owl", 如果没有声明,则其值是RDF文件所放在的位置uri。
2)rdf:resource 和rdf:about
<owl:disjointWith rdf:resource="#PizzaBase"/> 是
<owl:disjointWith >
<rdf:Description rdf:about="#PizzaBase" />
</owl:disjointWith >
的缩写。这里必须没有对资源="#PizzaBase" 做进一步的说明。所以,rdf:resource只能出现在表示属性的节点中,如这里的owl:disjointWith节点。
而 <owl:disjointWith>
<owl:Class rdf:about="#PizzaTopping"/>
</owl:disjointWith>
是等价于:
<owl:disjointWith >
<rdf:Description rdf:about="#PizzaTopping" >
<rdf:type rdf:resource="&rdfs;Class" />
</rdf:Description>
</owl:disjointWith >
这里不能用rdf:resource了,因为声明了#PizzaTopping是一个类。
所以,我们可以看出:
说明了: <owl:Class rdf:ID="PizzaBase">
以后,后面的都是用:
<owl:disjointWith rdf:resource="#PizzaBase"/>
了。
如果Pizza是用rdf:ID定义的,那么要增加对Pizza的描述,就必须用rdf:about。因为同一个RDF文档中,不能出现两个rdf:ID="Pizza",否则RDF Parser就会报错。
附录:
<?xml version="1.0"?>
<rdf:RDF
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns="http://www.owl-ontologies.com/unnamed.owl#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:rdf="http://www.w3.org/
xml:base="http://www.owl-ontologies.com/unnamed.owl">
<owl:Ontology rdf:about=""/>
<owl:Class rdf:ID="PizzaBase">
<owl:disjointWith>
<owl:Class rdf:ID="Pizza"/>
</owl:disjointWith>
<owl:disjointWith>
<owl:Class rdf:ID="PizzaTopping"/>
</owl:disjointWith>
</owl:Class>
<owl:Class rdf:about="#Pizza">
<owl:disjointWith rdf:resource="#PizzaBase"/>
<owl:disjointWith>
<owl:Class rdf:about="#PizzaTopping"/>
</owl:disjointWith>
</owl:Class>
<owl:Class rdf:about="#PizzaTopping">
<owl:disjointWith rdf:resource="#PizzaBase"/>
<owl:disjointWith rdf:resource="#Pizza"/>
</owl:Class>
</rdf:RDF>
posted on 2005-11-10 14:32 Jacquette.wang 阅读(1276) 评论(0) 编辑 收藏 举报