我试图掌握语义网的概念。我发现很难理解RDF和OWL之间的确切区别。OWL是RDF的扩展还是这两种完全不同的技术?


当前回答

当您使用术语RDF时,您必须区分两件事:

You can refer to RDF as a concept: A way of describing things/logic/anything using collections of triples. Example: "Anna has apples." "Apples are healthy." Above you have two triples that describe two resources "Anna" and "apples". The concept of RDF (Resource Description Framework) is that you can describe resources (anything) with sets of only 3 words (terms). At this level you don't care about how you are storing information, whether you have a string of 3 words, or a painting on a wall, or a table with 3 columns etc. At this conceptual level the only thing that is important is that you can represent anything that you want using triple statements. You can refer to RDF as a vocabulary A vocabulary is just a collection of term definitions stored in a file or somewhere. These defined terms have the purpose of being generally reused in other descriptions so people can describe data (resources) more easily and in a standard manner. On the web you can find some standard vocabularies like: RDF (https://www.w3.org/1999/02/22-rdf-syntax-ns) RDFS (https://www.w3.org/2000/01/rdf-schema#) OWL (https://www.w3.org/2002/07/owl) The RDF vocubalary defines terms that help you to describe (at the most basic level as possible) individuals/instances of classes. Example: rdf:type, rdf:Property. With rdf:type you can describe that some resource is an instance of a class: <http://foo.com/anna> rdf:type <http://foo.com/teacher> So the RDF vocabulary has terms that are targeting basic descriptions of class instances and some other descriptions (like the triple statement definition, or the predicate definition... in general things that are realted to the RDF concept). The RDFS vocabulary has term definitions that help you describe classes and relationships between them. RDFS vocabulary doesn't care about instances of classes (individuals) like the RDF vocabulary. Example: the rdfs:subClassOf property which you can use to describe that a class A is subclass of class B. The RDF and the RDFS vocabularies are dependent to one another. RDF defines it's terms using RDFS, and RDFS uses RDF for defining it's own terms. The RDF/RDFS vocabularies provide terms that can be used to create very basic descriptions of resources. If you want to have more complex and accurate descriptions you have to use the OWL vocabulary.

OWL词汇表附带了一组针对更详细描述的新术语。这些术语是使用RDF/RDFS词汇表中的术语定义的。

owl:ObjectProperty a rdfs:Class ;
                   rdfs:label "ObjectProperty" ;
                   rdfs:comment "The class of object properties." ;
                   rdfs:isDefinedBy <http://www.w3.org/2002/07/owl#> ;
                   rdfs:subClassOf rdf:Property .

owl:DatatypeProperty a rdfs:Class ;
                     rdfs:label "DatatypeProperty" ;
                     rdfs:comment "The class of data properties." ;
                     rdfs:isDefinedBy <http://www.w3.org/2002/07/owl#> ;
                     rdfs:subClassOf rdf:Property .

 owl:TransitiveProperty a rdfs:Class ;
                        rdfs:label "TransitiveProperty" ;
                        rdfs:comment "The class of transitive properties." ;
                        rdfs:isDefinedBy <http://www.w3.org/2002/07/owl#> ;
                        rdfs:subClassOf owl:ObjectProperty .

正如您在上面所看到的,OWL词汇表通过创建新的属性类型来扩展rdf:Property的概念,这些类型不那么抽象,可以提供更准确的资源描述。

结论:

RDF is a concept or a way of describing resources using sets of triples. RDF triples can be stored in different formats (XML/RDF, Turtle etc.) The concept of RDF is the base model of all semantic web technologies and structures (like vocabularies). RDF is also a vocabulary that along with the RDFS vocabulary provides a set of terms that can be used for creating general/abstract descriptions of resources. OWL is a vocabulary built with RDF and RDFS vocabularies that provide new terms for creating more detailed descriptions of resources. All semantic web vocabularies (RDF, RDFS, OWL etc) are built by respecting the RDF concept. And of course the OWL vocabulary has behind the scenes all kind of complex logic and concepts which define the Web Ontology Language. The OWL vocabulary is just a way of using all that logic in practice.

其他回答

语义网是分层的。这是一个简短的总结,我认为你会感兴趣。

更新:请注意,RDFS是用来定义数据结构的,而不是OWL。OWL描述的语义关系是普通编程(如C结构体)所不关心的,而且更接近人工智能研究和集合论。

三元组和uri

Subject - Predicate - Object

这些描述了一个事实。通常URI用于主语和谓语。对象可以是另一个URI,也可以是一个文字,比如数字或字符串。文字可以有一个类型(也是一个URI),也可以有一种语言。是的,这意味着三元组最多可以有5位数据!

例如,三连音可以描述查尔斯是哈里的父亲这一事实。

<http://example.com/person/harry> <http://familyontology.net/1.0#hasFather> <http://example.com/person/charles> .

三元组是数据库规范化在逻辑上的极端。它们的优点是可以将来自多个源的三元组加载到一个数据库中,而无需重新配置。

RDF和RDFS

下一层是RDF——资源描述框架。RDF为三元组定义了一些额外的结构。RDF定义的最重要的东西是一个称为“RDF:type”的谓词。这是用来表示事物是某种类型的。每个人都使用rdf:type,这使得它非常有用。

RDFS (RDF Schema) defines some classes which represent the concept of subjects, objects, predicates etc. This means you can start making statements about classes of thing, and types of relationship. At the most simple level you can state things like http://familyontology.net/1.0#hasFather is a relationship between a person and a person. It also allows you to describe in human readable text the meaning of a relationship or a class. This is a schema. It tells you legal uses of various classes and relationships. It is also used to indicate that a class or property is a sub-type of a more general type. For example "HumanParent" is a subclass of "Person". "Loves" is a sub-class of "Knows".

RDF连载

RDF可以以多种文件格式导出。最常见的是RDF+XML,但这有一些弱点。

N3是一种更容易阅读的非xml格式,并且有一些更严格的子集(Turtle和N-Triples)。

重要的是要知道RDF是一种处理三元组的方法,而不是文件格式。

XSD

XSD是一个命名空间,主要用于描述属性类型,如日期、整数等。它通常出现在RDF数据中,用于标识文字的特定类型。它也用于XML模式,这是一种略有不同的情况。

OWL

OWL adds semantics to the schema. It allows you to specify far more about the properties and classes. It is also expressed in triples. For example, it can indicate that "If A isMarriedTo B" then this implies "B isMarriedTo A". Or that if " C isAncestorOf D " and " D isAncestorOf E " then " C isAncestorOf E ". Another useful thing owl adds is the ability to say two things are the same, this is very helpful for joining up data expressed in different schemas. You can say that relationship "sired" in one schema is owl:sameAs "fathered" in some other schema. You can also use it to say two things are the same, such as the "Elvis Presley" on wikipedia is the same one on the BBC. This is very exciting as it means you can start joining up data from multiple sites (this is "Linked Data").

您还可以使用OWL来推断隐含的事实,例如“C isancestry of E”。

基本的语义web堆栈已经在这篇文章中解释了很多。我想把重点放在最初的问题上,并比较RDF和OWL。

OWL是RDF和RDF- s的超级集(在上面) OWL允许有效地使用RDF和RDF- s OWL有一些扩展的词汇表 类和个人(“实例”) 属性和数据类型(“谓词”) OWL是正确的推理和推断所必需的 OWL有三种方言,精简,描述逻辑和完整

使用OWL是通过了解一些事实来获得更多意义(推理和推断)的必要条件。这种“动态创建”的信息可以进一步用于像SPARQL中那样的一致查询。

一些例子将显示这实际上与OWL一起工作——这些都是从我2015年在西班牙马略卡的TYPO3camp上关于语义网基础知识的演讲中摘录出来的。

规则等价

Spaniard: Person and (inhabitantOf some SpanishCity)

这意味着西班牙人必须是一个人(因此继承了推理部分中的所有财产),并且必须至少居住在一个(或多个)西班牙城市。

属性的含义

<Palma isPartOf Mallorca>
<Mallorca contains Palma>

该示例显示了对属性isPartOf和contains应用inverseOf的结果。

逆 对称的 传递 不相交的 ...

属性的基数

<:hasParent owl:cardinality “2“^^xsd:integer>

这定义了每个事物(在这个场景中很可能是人)都有两个父元素——基数被分配给hasParent属性。

最低 最大 确切的

我试图掌握语义网的概念。我发现这很难 来理解RDF和OWL之间的确切区别。是 OWL是RDF的扩展或者这两者是完全不同的 技术吗?

简而言之,是的,您可以说OWL是RDF的扩展。

In more detail, with RDF you can describe a directed graph by defining subject-predicate-object triples. The subject and the object are the nodes, the predicate is the edge, or by other words, the predicate describes the relation between the subject and the object. For example :Tolkien :wrote :LordOfTheRings or :LordOfTheRings :author :Tolkien, etc... Linked data systems use these triples to describe knowledge graphs, and they provide ways to store them, query them. Now these are huge systems, but you can use RDF by smaller projects. Every application has a domain specific language (or by DDD terms ubiquitous language). You can describe that language in your ontology/vocabulary, so you can describe the domain model of your application with a graph, which you can visualize show it to business ppl, talk about business decisions based on the model, and build the application on top of that. You can bind the vocab of your application to the data it returns and to a vocabulary known by the search engines, like microdata (for example you can use HTML with RDFA to do this), and so search engines can find your applications easily, because the knowledge about what it does will be machine processable. This is how semantic web works. (At least this is how I imagine it.)

Now to describe object oriented applications you need types, classes, properties, instances, etc... With RDF you can describe only objects. RDFS (RDF schema) helps you to describe classes, inheritance (based on objects ofc.), but it is too broad. To define constraints (for example one kid per chinese family) you need another vocab. OWL (web ontology language) does this job. OWL is an ontology which you can use to describe web applications. It integrates the XSD simpleTypes. So RDF -> RDFS -> OWL -> MyWebApp is the order to describe your web application in a more and more specific way.

首先,正如前面所指出的,owl可以在RDF中序列化。

其次,OWL通过提供使用正式的可计算一阶描述逻辑定义三元组组件的设备,为RDF添加了本体功能(RDF本身仅为正式的知识表示提供了极其有限的功能)。这就是所谓的“语义丰富性”。

第三,重要的是要意识到在OWL- full(对于OWL 1)中rdfs:class和OWL:class是等价的,在OWL- dl中,OWL:class是rdfs:class的子类。实际上,这意味着您可以使用OWL本体作为RDF的模式(它不正式地需要模式)。

我希望这有助于进一步澄清。

RDF、RDFS和OWL是表示日益复杂的信息或知识的方法。它们都可以用RDF/XML语法(或任何其他RDF序列化语法,例如Turtle或N3)序列化。

这些技术是相关的,应该是可互操作的,但它们有不同的起源,这可能就是为什么它们之间的关系很难掌握的原因。选择一种还是另一种取决于建模所需要的情况有多复杂。

表达能力的总结

RDF:简单的表示,主要关注实例及其类型的映射(RDF: type)。可以定义自定义属性来链接数据和创建三元组。使用SPARQL查询RDF数据。 在Turtle中序列化RDF的例子:

@prefix : <http://www.example.org/> .
:john    rdf:type           :Man .
:john    :livesIn  "New-York" .
:livesIn    rdf:type    rdf:Property .

RDFS: Some situations are not easily modelled by RDF alone, it is sometimes interesting to represent more complex relations like subclasses (the type of a type) for example. RDFS provides special means to represent such cases, with constructs like rdfs:subClassOf, rdfs:range or rdfs:domain. Ideally, a reasoner can understand the RDFS semantics and expand the number of triples based on the relations: For instance if you have the triples John a Man and Man rdfs:subClassOf Human then you should generate as well the triple John a Human. Note that this is not possible to do with RDF alone. RDFS data are queried using SPARQL. Example of RDFS serialised in Turtle:

@prefix : <http://www.example.org/> .
:john    rdf:type           :Man .
:Man    rdfs:subClassOf    :Human .
:john    :livesIn  "New-York" .
:livesIn    rdf:type    rdf:Property .
# After reasoning
:john    rdf:type    :Human .

OWL: The highest level of expressivity. Relation between classes can be formally modelled based on description logics (mathematical theory). OWL relies heavily on the reasoner, it is possible to express complex constructs such as chained properties for instance or restriction between classes. OWL serves to build ontologies or schema on the top of RDF datasets. As OWL can be serialised as RDF/XML, it is theoretically possible to query it via SPARQL, yet it is much more intuitive to query an OWL ontology with a DL query (which is usually a standard OWL class expression). Example of OWL constructs serialised in Turtle.

@prefix : <http://www.example.org/> .
:livesIn    rdf:type    owl:DatatypeProperty .
:Human    rdf:type    owl:Class .
:Man   rdf:type    owl:Class .
:Man    rdfs:subClassOf    :Human .
:John    rdf:type    :Man . 
:John    rdf:type    owl:NamedIndividual .