无法使用公理推断实例

时间:2016-06-07 11:47:52

标签: owl ontology protege reasoning

我想通过本体匹配和推理来收集数据。要做到这一点,我想先确定相关的个人,以便以后使用,如果他们符合某些标准(使用一般的公理)。
但目前,我无法使用Protégé进行必要的推断。由不同个人组成的数据如下所示:

# Data
# Common Prefixes omitted for readability
@prefix ns: <http://example.org/underlyingSchema#> .
@prefix data: <http://example.org/data#> .

data:A1 a ns:A .
data:A2 a ns:A .

data:R1 a ns:R .
 ns:defines data:A1 ;
 ns:definedBy data:P1 .

data:R2 a ns:R .
 ns:defines data:A2 ;
 ns:definedBy data:P2 .

data:P1 a ns:P ;
 ns:hasS data:S1.

data:P2 a ns:P ;
 ns:hasS data:S2.

data:S1 a ns:S ;
 ns:hasI data:I1 ;
 ns:hasV data:B1 .

data:S2 a ns:S ;
 ns:hasI data:I1 ;
 ns:hasV data:B2 .

data:I1 a ns:I ;
 expr:hasString "relevant" .

data:B1 a ns:B ;
 expr:hasBoolean "true"^^xsd:boolean .

data:B2 a ns:B ;
 expr:hasBoolean "false"^^xsd:boolean .

我想推断出相关属性为真的A的每个实例也是我的示例类的一个实例,在我自己的本体中定义为eg:Example a owl:class
不幸的是,由于数据的基础架构非常繁琐,我必须通过A -> R -> P -> S -> I and B来实现。然而,由于R不是一个简单的定义(A <- R -> P -> S -> I and B可能是一个更准确的表示),我不能只做一个someValuesFrom链和(我假设)这是我失败的地方。
使用Protégé,我加载了定义属性和类(Namespace ns)的模式,以便能够在类表达式编辑器中使用建议/自动完成。在我自己的本体论(仅包含示例类)之后,我尝试使用公理:

A and (inverse defines some) and definedBy some (hasS some (hasI some(hasString value "relevant")) and (hasV some(hasBoolean value "true"^^xsd:boolean))) EquivalentTo: Example

然后我将我的本体与数据合并并运行推理器,期望看到A1(但不是A2)作为我的示例类的实例,但没有得到任何结果。我还尝试仅使用"true"true以及"relevant"^^xsd:string来查看数据类型是否导致了问题,但只是推断示例是A的子类。
我相信我对inverse所做的事情的理解是不正确的(我认为它已被使用,因为A1是三元组R1 defines A1中的对象;所以我也试过inverse defines self),但我无法理解它出。非常感谢任何帮助。

  

编辑:

正如约书亚正确指出的那样,我的例子缺乏宣言。就我而言,这些是在不同的模式本体中制作的,所以我在这里忘了它们。将为完整性添加:

# Might as well include prefixes
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix expr:  <http://purl.org/voc/express#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .

# Classes
ns:A a owl:Class .
ns:R a owl:Class .
ns:P a owl:Class .
ns:S a owl:Class .
ns:I a owl:Class .
ns:B a owl:Class .

# Object Properties
ns:defines a owl:ObjectProperty .
ns:definedBy a owl:ObjectProperty .
ns:hasS a owl:ObjectProperty .
ns:hasI a owl:ObjectProperty .
ns:hasV a owl:ObjectProperty .

# Data Properties
expr:hasString a owlDatatypeProperty .
expr:hasBoolean a owlDatatypeProperty .

1 个答案:

答案 0 :(得分:1)

看起来像Protege没有生成数据。当我复制该内容并将其加载到Protege中时,所有内容都显示为注释属性,这些属性通常不会在OWL推理下处理。它们显示为注释属性,因为没有属性声明使它们成为对象属性或数据类型属性。这可能是你问题的一部分。这个公理也不是很正确。例如,(反向定义一些)没有意义;这必须是(反向定义)一些类表达式 等。一般来说,如果你能提供我们可以使用的完整工作示例,它会有很大帮助。请参见如何创建Minimal, Complete, and Verifiable example

所有这一切,我认为我们可以重新创建足够的问题来弄清楚如何解决它。听起来你想要识别像

这样的模式
A  <--rdf:type--  ?a  <--p--  ?b  --q-->  ?c  --r--> 42

然后推断三重

?a  --rdf:type-->  Goal 

这在OWL中是可以实现的。它需要一个形式的公理:

((反向 p)某些(q 某些(r 42))) SubClassOf 目标

这就是说,如果某事物是A并且是具有r值为42的q值的p值,那么第一个事物也是一个目标。

这是实际本体中的样子:

protege screenshot

启动推理后,它正确地推断 a 目标的实例:

reasoner result

这是实际的本体论:

@prefix : <http://example.org/gca#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <http://example.org/gca> .

<http://example.org/gca> rdf:type owl:Ontology .

#################################################################
#    Object Properties
#################################################################

###  http://example.org/gca#p
:p rdf:type owl:ObjectProperty .


###  http://example.org/gca#q
:q rdf:type owl:ObjectProperty .


#################################################################
#    Data properties
#################################################################

###  http://example.org/gca#r
:r rdf:type owl:DatatypeProperty .


#################################################################
#    Classes
#################################################################

###  http://example.org/gca#A
:A rdf:type owl:Class .


###  http://example.org/gca#Goal
:Goal rdf:type owl:Class .


#################################################################
#    Individuals
#################################################################

###  http://example.org/gca#a
:a rdf:type owl:NamedIndividual ,
            :A .


###  http://example.org/gca#b
:b rdf:type owl:NamedIndividual ;
   :p :a ;
   :q :c .


###  http://example.org/gca#c
:c rdf:type owl:NamedIndividual ;
   :r 42 .


#################################################################
#    General axioms
#################################################################

[ owl:intersectionOf ( :A
                       [ rdf:type owl:Restriction ;
                         owl:onProperty [ owl:inverseOf :p
                                        ] ;
                         owl:someValuesFrom [ rdf:type owl:Restriction ;
                                              owl:onProperty :q ;
                                              owl:someValuesFrom [ rdf:type owl:Restriction ;
                                                                   owl:onProperty :r ;
                                                                   owl:hasValue 42
                                                                 ]
                                            ]
                       ]
                     ) ;
  rdf:type owl:Class ;
  rdfs:subClassOf :Goal
] .


###  Generated by the OWL API (version 4.2.5.20160517-0735) https://github.com/owlcs/owlapi
相关问题