如何基于属性值而不是类编写RDF域和范围限制 [英] how to write RDF domain and range restriction based on property value rather than class

查看:80
本文介绍了如何基于属性值而不是类编写RDF域和范围限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到以下情况,我正在尝试为其编写RDF/OWL规则.目的是改善结果数据库中的一致性检查.

I have the following case which I'm trying write an RDF/OWL rule for. The goal is to improve consistency checking in the resulting data base.

我有一个名为"Expression"的类和一个名为"Manifestation"的类,可以通过"hasManifestation"将它们关联起来.

I have a class called "Expression" and a class called "Manifestation", they can be related by "hasManifestation".

足够容易地相应地限制域和范围,以使"hasManifestation"的域为"Expression",而Range为"Manifestation".

It easy to enough to restrict the domain and range accordingly so that the domain of "hasManifestation" is "Expression" and the Range is "Manifestation".

但是我想再走一步.

表达式和表现形式具有称为结构级别,级别1、2、3、4的属性

Expressions and Manifestation have a property called structure level, level 1, 2, 3, 4

因此,级别1的表达式应始终通过"hasManifestation"与也级别1的"Manifestation"相关联,而永远不要级别2、3等.

So an Expression at level 1 should always be related through "hasManifestation" to a "Manifestation" also at level 1, never at level 2, 3, etc.

同样,级别2的表达式应始终与级别2的表现形式相关,而永远不要级别1或3等.

Likewise an Expression at level 2 should always be related to a Manifestation at level 2 never at level 1 or 3, etc.

所以我想为"hasManifestation"的域和范围编写一条规则,如下所示:

So I want write a rule for the Domain and Range of "hasManifestation" that goes something like the following:

范围:Y必须是一个表现形式,并且如果域"的值是Z级,则Y必须是Z级.

Range: Y must be a Manifestation and if the value of the Domain is level Z, then Y must be level Z

域:X必须是一个表达式,并且如果Range的值是级别Z,则X是级别X.

Domain: X must be an Expression and if the value of the Range is level Z, then X is level X.

我想我可以用谓词逻辑编写如下:E =表达式,M =表现,L =级别,R =范围,D =域

I think I can write this in predicate logic as follows: E = expression, M=manifestation, L=level, R=Range, D=Domain

范围:y(My and (xz)(Dx and Lxz) -> (Lyz))

域:x(Ex and (yz)(Ry and Lyz) -> (Lxz))

我可能会把它弄乱了,但是希望您对我想做的事情有所了解. 但是我怎么能在ttl中将其写为OWL语句呢?

I might be messing that up somewhere, but hopefully you get the idea of what I would like to do. But how could I write this as an OWL statement in ttl.

任何建议都值得赞赏.

推荐答案

您可以使用hasValue限制来表示此内容,但不能在属性的域和范围级别上使用-对属性进行限制需要为每个属性都设置一个属性级别.

You can use hasValue restrictions to express this, but not at the domain and range level of the property - restricting it on the property requires a property for each level.

因此,您可以按照以下方式创建一个通用概念包含公理:

So, you could create a general concept inclusion axiom, along the lines of:

(<urn:test:Expression> and (<urn:test:hasLevel> value 1)) subclassOf
    (<urn:test:hasManifestation> some (<urn:test:Manifestation> and (<urn:test:hasLevel> value 1)))

(用曼彻斯特语法重写的示例-GCI实际上无法以这种语法编写,但是更易于阅读)

(example rewritten in Manchester Syntax - GCIs cannot actually be written in this syntax but it's easier to read)

在函数式语法中,公理看起来像这样:

In Functional syntax, the axiom looks like this:

SubClassOf(
    ObjectIntersectionOf(
           Expression
           DataHasValue(hasLevel "1"^^xsd:integer)
    )
    ObjectSomeValuesFrom(hasManifestation
           ObjectIntersectionOf(
                   Manifestation
                   DataHasValue(hasLevel "1"^^xsd:integer)
            )
    )
)

在海龟中:

@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://www.w3.org/2002/07/owl#> .
[ rdf:type owl:Ontology] .
<urn:test:hasManifestation> rdf:type owl:ObjectProperty .
<urn:test:hasLevel> rdf:type owl:DatatypeProperty .
<urn:test:Expression> rdf:type owl:Class .
<urn:test:Manifestation> rdf:type owl:Class .
[ owl:intersectionOf ( <urn:test:Expression>
                   [ rdf:type owl:Restriction ;
                     owl:onProperty <urn:test:hasLevel> ;
                     owl:hasValue 1
                   ]
                 ) ;
  rdf:type owl:Class ;
  rdfs:subClassOf [ rdf:type owl:Restriction ;
          owl:onProperty <urn:test:hasManifestation> ;
          owl:someValuesFrom [ owl:intersectionOf ( <urn:test:Manifestation>
                               [ rdf:type owl:Restriction ;
                                 owl:onProperty <urn:test:hasLevel> ;
                                 owl:hasValue 1
                               ]) ;
                      rdf:type owl:Class
                    ]
          ]
] .

如果您选择使用多个属性,则声明域和范围会更容易,但是您必须使用多个属性:

If you choose to use multiple properties, it's easier to declare domains and ranges but you have to use multiple properties:

hasManifestation1 domain exist hasLevel (hasValue 1)
hasManifestation1 range exist hasLevel (hasValue 1)

,依此类推(无需修改现有的域和范围表达式,因为多个公理已经隐含了类表达式的交集).

and so on (no need to modify existing domain and range expressions as multiple axioms are already implying intersection of the class expressions).

这篇关于如何基于属性值而不是类编写RDF域和范围限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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