用 RDFS 表示 class 和属性

Represent class and properties with RDFS

我想用 RDFS 表示这个:
- 一本书有书名和作者
- 作者有姓名

我试过这个:

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" >

    <rdf:Description rdf:ID="Book"> 
        <rdf:type rdf:resource="http://www.w3.org/…/rdf-schema#Class"/> 
    </rdf:Description>

    <rdf:Property rdf:ID="titleBook"> 
        <rdfs:domain rdf:resource="#Book"/> 
        <rdfs:range rdf:resource="xmlns:rdfsLiteral"/>
    </rdf:Property>

    <rdf:Property rdf:ID="authorBook"> 
        <rdfs:domain rdf:resource="#Book"/> 
        <rdfs:range rdf:resource="#Author"/>
    </rdf:Property>

    <rdf:Description rdf:ID="Author"> 
        <rdf:type rdf:resource="http://www.w3.org/…/rdf-schema#Class"/> 
    </rdf:Description>

    <rdf:Property rdf:ID="nameAuthor"> 
        <rdfs:domain rdf:resource="#Author"/> 
        <rdfs:range rdf:resource="xmlns:rdfsLiteral"/>
    </rdf:Property>

但我不确定,我对域和范围感到困惑。
如何用 RDFS 表示一本书包含作者(class 中的 class)?

谢谢。

But I'm not sure, I'm confused between domain and range.

当一个 属性 p 有一个域 D 时,这意味着每当你有一个三元组时

x p y

那么 x 是 D 的实例。当 属性 p 的范围为 R 时,这意味着只要你有一个三元组

x p y

则 y 是 R 的一个实例。例如,如果您有:

ex:hasTitle rdfs:domain ex:Book

然后从

:dickens1859 ex:hasTitle "A Tale of Two Cities"@en

您可以推断

:dickens1859 rdf:type ex:Book

How to represent that a book contains an author (a class in a class) with RDFS ?

RDFS 中的

类 与面向对象编程语言中的 类 不同。 类 更像是集合论中的集合。在 RDFS 中,您可以声明 Book 和 Author 类,并声明一个具有域 Book 和范围 Author:

的 hasAuthor 属性
ex:Book a rdfs:Class .
ex:Author a rdfs:Class .
ex:hasAuthor rdfs:domain ex:Book ;
             rdfs:range ex:Author .

如果你想说 Book 的每个实例都有至少一位作者,你需要使用比 RDFS 更强大的语言。例如,您可以使用 OWL,其中您可以说 "every book has an author"(即 "at least one author"),公理如下:

Book ⊑ ∃ hasAuthor.Author