OWL 基于关系子集的推理

OWL reasoning based on subset of relationships

我有以下 Brick.ttl 建筑物的示例实例 ontology

@prefix : <https://example.org/ontologies/test#> .
@prefix brick: <https://brickschema.org/schema/1.1/Brick#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

:CH1_Active_Power_Sensor a owl:NamedIndividual,
    brick:Active_Power_Sensor ;
    brick:isPointOf :CH1 .

:CH1_Chilled_Water_Entering_Temperature_Sensor a owl:NamedIndividual,
    brick:Chilled_Water_Entering_Temperature_Sensor ;
    brick:isPointOf :CH1 .

:CH1_Chilled_Water_Leaving_Temperature_Sensor a owl:NamedIndividual,
    brick:Chilled_Water_Leaving_Temperature_Sensor ;
    brick:isPointOf :CH1 .

:CH2_Active_Power_Sensor a owl:NamedIndividual,
    brick:Active_Power_Sensor ;
    brick:isPointOf :CH2 .

:CH2_Chilled_Water_Leaving_Temperature_Sensor a owl:NamedIndividual,
    brick:Chilled_Water_Leaving_Temperature_Sensor ;
    brick:isPointOf :CH2 .

:CH3_Chilled_Water_Entering_Temperature_Sensor a owl:NamedIndividual,
    brick:Chilled_Water_Entering_Temperature_Sensor ;
    brick:isPointOf :CH3 .

:CH3_Chilled_Water_Leaving_Temperature_Sensor a owl:NamedIndividual,
    brick:Chilled_Water_Leaving_Temperature_Sensor ;
    brick:isPointOf :CH3 .


:CH1 a owl:NamedIndividual, brick:Chiller ;
    brick:hasPoint :CH1_Active_Power_Sensor ;
    brick:hasPoint :CH1_Chilled_Water_Entering_Temperature_Sensor ;
    brick:hasPoint :CH1_Chilled_Water_Leaving_Temperature_Sensor .

:CH2 a owl:NamedIndividual, brick:Chiller ;
    brick:hasPoint :CH2_Active_Power_Sensor ;
    brick:hasPoint :CH2_Chilled_Water_Leaving_Temperature_Sensor .

:CH3 a owl:NamedIndividual, brick:Chiller ;
    brick:hasPoint :CH3_Chilled_Water_Entering_Temperature_Sensor ;
    brick:hasPoint :CH3_Chilled_Water_Leaving_Temperature_Sensor .

我需要识别具有一组点的实例,即所有 brick:Chiller,其中包含来自 {brick:Chilled_Water_Entering_Temperature_Sensor、brick:Chilled_Water_Leaving_Temperature_Sensor}(以及任何其他)的所有成员。

使用 SPARQL 很容易,即

SELECT ?subject WHERE {
    ?subject brick:hasPoint ?p1 .
    ?p1 rdf:type/rdfs:subClassOf* brick:Chilled_Water_Entering_Temperature_Sensor .
    ?subject brick:hasPoint ?p2 .
    ?p2 rdf:type/rdfs:subClassOf* brick:Chilled_Water_Leaving_Temperature_Sensor .
    }

但我有很多这样的组合,我希望我能以这样一种方式定义它们,这样就可以推断出 :CH1 和 :CH3 是一个特定的子类型,这样我就可以直接查询它。到目前为止我的尝试是:

:CHWETLT a owl:Class ;
    owl:equivalentClass [ 
        a owl:Restriction ;
        owl:onProperty :hasPoint ;
        owl:allValuesFrom [
            a owl:Class ;
            owl:intersectionOf (
                brick:Chilled_Water_Entering_Temperature_Sensor
                brick:Chilled_Water_Leaving_Temperature_Sensor
            )
        ]
    ] .

我希望推理能够识别出 :CH1 和 :CH3 属于 :CHWETLT,这样我就可以直接查询了。但这似乎行不通-我不确定从现在开始该去哪里。这可能吗?如果可以,有人可以指出正确的方向吗?

我正在使用 brickschema python 包,它是 (afaik) 构建在 rdflib 上并使用 reasonable 作为推理机。

曼彻斯特语法,而不是

hasPoint only ( Chilled_Water_Entering_Temperature_Sensor and
                Chilled_Water_Leaving_Temperature_Sensor )

你更需要

( hasPoint some Chilled_Water_Entering_Temperature_Sensor ) and
( hasPoint some Chilled_Water_Leaving_Temperature_Sensor  )

返回 Turtle 语法:

:CHWETLT a owl:Class ;
    owl:equivalentClass [
        a owl:Class ;
        owl:intersectionOf (
            [ a owl:Restriction ;
              owl:onProperty brick:hasPoint ;
              owl:someValuesFrom brick:Chilled_Water_Entering_Temperature_Sensor
            ]
            [ a owl:Restriction ;
              owl:onProperty brick:hasPoint ;
              owl:someValuesFrom brick:Chilled_Water_Leaving_Temperature_Sensor
            ]
        ) 
    ] .

严格来说,这个公理在文档之外 OWL 2 RL. However, all you need for your inference is the left-to-right subsumption. Why OWL 2 RL? The owlrl Python reasoner mentioned 我想只支持这个 OWL 配置文件。