如何使用 DL Manchester OWL 语法查询个人?
我知道这听起来像是一个非常愚蠢的问题,但我一直在试图解决这个问题,但我找不到任何相关内容,尽管很明显这应该是可行的。
我正在开发一些东西,可以使用曼彻斯特 OWL 语法和 HermiT 推理器通过其 API 查询 OWL 文件。我也可以在 Protege 4 的 DL 查询选项卡上运行查询,以检查该文件的查询结果。该文件基本上是添加了数据实例的 Friend Of A Friend (FOAF) 本体。
问题:我找不到通过唯一标识符查询实例的方法。
它应该是 URI,因此例如对于具有 URI http://xmlns.com/foaf/0.1/Andrew_Kuchling
的 Person 对象,我尝试运行以下查询:
Person and URI value "http://xmlns.com/foaf/0.1/Andrew_Kuchling"
Person value "http://xmlns.com/foaf/0.1/Andrew_Kuchling"
Person and URI value "Andrew_Kuchling"
Person that "Andrew_Kuchling"
这些都不起作用。 (URI 是通过将 http://xmlns.com/foaf/0.1/
前缀到您输入的任何字符串来构造的,并且 URI 实际上在本体中并未标识为属性)。
在 FOAF 中,mbox_sha1sum
是邮箱的 sha1sum。邮箱与个人有着独特的联系。所以我尝试了以下查询:
Person and mbox_sha1sum value "mbox_sha1sum-property-value-here"
但是,它甚至不执行此查询,因为它感觉查询不正确。 mbox_sha1sum
值与我为此人添加的值相同。它存在于个人中。
它确实执行此查询:
Person and firstName value "Andrew"
所有数据属性都不是专用数据类型。默认情况下被视为文字。
我真的不知道我做错了什么。有人可以帮忙吗?
I know this sounds like a very stupid question, but I've been trying to figure this out and I can't find anything on this, though it seems obvious that this should be doable.
I'm developing something that queries an OWL file through its API using the Manchester OWL Syntax and a HermiT reasoner. I alternatively also run queries on the DL Query tab in Protege 4 to check my query results on that file. The file is basically the Friend Of A Friend (FOAF) ontology with added data instances.
The problem: I can't find a way to query an instance by its unique identifier.
It's supposed to be the URI so e.g. for a Person object with URI http://xmlns.com/foaf/0.1/Andrew_Kuchling
, I tried to run the following queries:
Person and URI value "http://xmlns.com/foaf/0.1/Andrew_Kuchling"
Person value "http://xmlns.com/foaf/0.1/Andrew_Kuchling"
Person and URI value "Andrew_Kuchling"
Person that "Andrew_Kuchling"
none of these work. (The URI is constructed by prefixing http://xmlns.com/foaf/0.1/
to whatever string you enter and URI is not actually identified in the ontology as a property).
In FOAF, mbox_sha1sum
is the sha1sum of a mailbox. Mailboxes are uniquely connected to individuals. So I tried the following query:
Person and mbox_sha1sum value "mbox_sha1sum-property-value-here"
However, it doesn't even execute this query because it feels the query is incorrect. The mbox_sha1sum
value is the same that I've added for this Person. It exists in Individuals.
It does execute this query:
Person and firstName value "Andrew"
All data properties are not specialised data types. Treated as literals by default.
I really don't know what I'm doing wrong. Can someone please please help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我知道这个问题已经发布一年多前了,但我最近问了我同样的问题并找到了以下解决方案:
只需将您要查询的个人/成员的姓名放在大括号中:
这样您甚至可以一次查询多个个体:
请注意,这些查询形成所谓的枚举类。这意味着,此查询的结果将不仅仅是您在查询中指定的所有个人的所有超类或子类的列表。相反,它指的是一个匿名类,该类完全由您列出的个人组成。
匿名类是无法从本体外部获得的类,因为此类没有可引用的 owl 实体(没有可引用的 IRI)。
您可以在官方 W3C 规范中找到有关 OWL 曼彻斯特语法的更多信息。
I know this question has been posted more than a year ago, but I recently asked me the same question and found the following solution:
Just put the name of the individual/member you want to query for in curly brackets:
This way you can even query for more than one individual at a time:
Please note that these queries form class expressions of so called enumarated classes. This means, that the result of this query will not simply be a list of all super or sub classes of all the individuals you have named in your query. Instead it refers to an anonymous class that consists of exactly the individuals you have listed.
An anonymous class is a class that isn't available from outside of your ontology, because there is no referrable owl entity for this class (no IRI to refer to).
You can find more information on the OWL Manchester Syntax in the offcial W3C specification.