如何识别对象属性与数据类型属性? [英] how can I recognize object properties vs datatype properties?

查看:187
本文介绍了如何识别对象属性与数据类型属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的本​​体是书籍分类库.我有这个问题. 我想通过protégé4.1建立书籍分类本体,该分类有14个类别,除了同级类Author,book,Isbn.图书班级的个人是图书的主题(约600个学科),作者班级的个人是姓名的作者,也是isbn班级. 然后我对对象属性和数据类型属性感到困惑.如果hasEdition在我本体中的属性中,那么我说课本中的每一本书都与版本类有关系.因此我使用对象属性,但此类(版本类)中的单个值为整数<9.那怎么知道呢?是数据类型还是对象? 并可以使用对象属性与数据类型属性? (同名)

My ontology is book classification library. I have problems in this. I want to build a book classification ontology by protégé 4.1, this classification has 14 categories, beside the sibling classes Author, book, Isbn. Individuals in book class are book’s subject(about 600 subjects) , and individuals in author class are name’s author and also isbn class. then I'm confused in object properties and datatype properties. if hasEdition is in properties in my ontology then i say that every book in class book have relation with edition class. so i use object properties but individual in this class(edition class) is integer<9. then how can tell it? is it datatype or object? and can use object properties vs datatype properties? (a same name)

推荐答案

关于对象和数据类型属性

Protégé中有多个用于创建对象属性"和数据类型属性"的选项卡.如果属性应将个人与个人相关联,则它必须是对象属性,而如果将个人与文字相关联,则它必须是数据类型属性.

On Object and Datatype Properties

In Protégé there are are different tabs for creating Object Properties and Datatype Properties. If a property should relate individuals to individuals, then it needs to be an object property, and if it relates individuals to literals, then it needs to be a datatype property.

如果您有一个域为Book的属性hasEdition,那么问题就变成了范围应该是多少.如果您希望使用三元组,例如:

If you have a property hasEdition whose domain is Book, then the question becomes what the range should be. If you expect triples like:

Book72 hasEdition "1"^^xsd:int
Book16 hasEdition "3"^^xsd:int

,其中值是文字,那么hasEdition应该是数据类型属性.另一方面,如果您的班级Edition包含一些特定的个人,例如

where the value are literals, then hasEdition should be a datatype property. If, on the other hand, you have a class Edition with some particular individuals, e.g.,

Edition a owl:Class .
first a Edition .
second a Edition .
third a Edition .
…

这样您就可以拥有

Book72 hasEdition first .
Book16 hasEdition third .

然后hasEdition应该是对象属性.

如果需要查看RDF序列化并确定属性是哪种类型,则应查询类owl:ObjectPropertyowl:DatatypeProperty(为了完整起见,还请查询owl:AnnotationProperty).也就是说,根据hasEdition是对象属性还是数据类型属性,您将看到:

If you need to look at the RDF serialization and determine which types the properties are, you should query for the classes owl:ObjectProperty and owl:DatatypeProperty (and, for the sake of completeness, owl:AnnotationProperty). That is, depending on whether hasEdition is an object property or a datatype property you would see:

hasEdition a owl:ObjectProperty .

hasEdition a owl:DatatypeProperty .

决定使用哪个

您是否希望hasEdition属性是数据类型属性还是对象属性,实际上取决于要存储的数据类型,并且取决于您的应用程序.如果您只是表示诸如"first""second"等之类的简单信息,那么您可能希望使用将书籍与其版本相关联的数据类型属性.如果您以抽象形式表示书籍,而不是单独的书籍实例,这可能是一个不错的选择(与书商的库存系统相对,后者会涉及书籍的各个实例)

Deciding which to use

Whether you want a hasEdition property to be a datatype property or an object property really depends on what kind of data you're going to be storing, and that depends on your application. If you're just representing simple information like "first", "second", etc., then you probably want to use a datatype property that relates a book to its edition. This is probably a good route if you're representing books in the abstract, i.e, not individual instances of books (as opposed to a bookseller's inventory system, which would be be concerned with individual instances of books).

另一方面,如果您实际代表的是图书的 instances .例如,如果您是一家书商,并且有25份面向工作本体的语义网和27份对语义网进行编程),那么您可能实际上对在书名,ISBN等可能会存储在版本中,而不是书本中.

If, on the other hand, what you're actually representing are instances of books. E.g., if you're a bookseller and have in stock 25 copies of Semantic Web for the Working Ontologist and 27 copies of Programming the Semantic Web), then you might actually be interested in representing individual editions of books, on which the title, ISBN, and the like would probably be stored on the edition, not the book individual.

这只是一种意见,您在选择数据模型时确实具有很大的灵活性.通常,需要一些经验才能获得好的数据模型,而经验则需要时间.即便如此,您仍然拥有用于处理和转换数据的良好工具,因此您可以尝试不同的表示形式,并从一个映射到另一个.

This is just an opinion, and you really do have a lot of flexibility in choosing your data model. It typically takes some experience to get nice data models, and experience takes time. Even so, you've got good tools for manipulating and transforming the data, so you can experiment with different representations, and map from one to the other.

我建议您看看 RDF入门.资源和文字是事物的不同类型.资源是匿名的或由IRI标识的,并且可以是语句的主题(并因此可以成为语句的类的成员

I suggest you take a look at the RDF Primer. Resources and literals are distinct types of things. Resources are anonymous or identified by an IRI, and can be the subjects of statements (and thus be member of classes, by virtue of the statement

@prefix lib: <http://example.org/library/> .

lib:HermanMelville rdf:type lib:Author .

诸如字符串"Herman Melville之类的文学不能作为句子的主题,因此也不能成为类的成员.使用作者作为资源(个人),您可以做到

Literals, such as the string "Herman Melville" cannot be the subjects of sentences, and so cannot be members of classes. With authors as resources (individuals), you can do

lib:MobyDick lib:hasAuthor lib:HermanMelville .
lib:HermanMelville  lib:hasName "HermanMelville"@en .

在这种情况下,hasAuthor是对象属性,而hasName是数据类型属性.

In this case, hasAuthor is an object property and hasName is a datatype property.

另一方面,您可以将hasAuthor设置为数据类型属性,而不是这样做

On the other hand, you can make hasAuthor a datatype property and instead do

lib:MobyDick lib:hasAuthor "Herman Melville"@en .

但是,如果执行此操作,那么您将没有方便的方法来添加有关作者的任何其他信息,因为文字"Herman Melville"@en不能是三元组的主题,因此例如说

If you do this, though, then you don't have a convenient way to add any additional information about the author, since the literal "Herman Melville"@en cannot be the subject of a triple, so you can't for instance, say

"Herman Melville"@en places:livedAt places:Arrowhead .

在第一种情况下,您可以说

whereas in the first case, you could say

lib:HermanMelville places:livedAt places:Arrowhead .

这实际上只是您希望如何查询数据的问题.在hasAuthor是对象属性的情况下,我可以编写这样的查询来查找居住在Arrowhead的作者写的书:

It's really just a matter of how you want to be able to query your data. In the case that hasAuthor is an object property, I can write a query like this to find books written by authors who lived at Arrowhead:

PREFIX lib: <http://...>
PREFIX places: <http//...>

SELECT ?book WHERE { 
  ?book lib:hasAuthor ?author .
  ?author places:livedAt places:Arrowhead .
}

或更简洁(但等效):

PREFIX lib: <http://...>
PREFIX places: <http//...>

SELECT ?book WHERE { 
  ?book lib:hasAuthor [ places:livedAt places:Arrowhead ] .
}

另一方面,如果hasAuthor是将一本书与其作者名称相关联的数据类型属性,我们仍然可以拥有一个Author类,其实例通过hasName属性与其名称相关,但是由于hasAuthor属性强制了一层间接操作(获取书的作者名称,然后找到具有该名称的作者),这使查询数据变得更加复杂,因此我们具有以下查询: /p>

On the otherhand, if hasAuthor is a datatype property that relates a book to the name of its author, we can still have an Author class whose instances are related to their names by the hasName property, but it makes querying the data a bit more complicated, since the hasAuthor property is forcing a layer of indirection (get the name of the author of the book, then find the author who has that name), so we have queries like:

PREFIX lib: <http://...>
PREFIX places: <http//...>

SELECT ?book WHERE { 
  ?book lib:hasAuthor ?authorName .
  ?author lib:hasName ?authorName .
  ?author places:livedAt places:Arrowhead .
}

无法很好地简化此查询.实际上,这取决于您希望如何查询数据以及对您而言是什么方便.请注意,您可以用SPARQL编写的某些查询很难作为OWL DL表达式编写.当hasAuthor是对象属性时,其作者居住在Arrowhead的书籍的类别由以下表达式给出:

This query can't be simplified so nicely. It really comes down to how you want to be able to query your data, and what's convenient for you. Note that some queries that you can write in SPARQL are much harder to write as OWL DL expressions. When hasAuthor is an object property, the class of books whose authors lived at Arrowhead with is given by the expression:

lib:hasAuthor (places:livedAt value places:Arrowhead)

这仅仅是 属于作者居住在Arrowhead的事物的一类.如果hasAuthor是数据类型属性,则要编写这样的表达式要困难得多,即使不是不可能,因为您需要查找具有相同文字值的两件事(一本书和一本作者)(即作者的名字).

which simply is the class of things that have an author that lived at Arrowhead. If hasAuthor is a datatype property, it is much more difficult, if not impossible to write such an expression, because you need to find two things (a book and an author) that have the same literal value (the string that is the author's name).

这篇关于如何识别对象属性与数据类型属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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