Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
402 views
in Technique[技术] by (71.8m points)

rdf - Equal relationship between ontology properties

I have 2 properties, e.g. 'hasColor' and 'hasFinish'. I want to express with ontology that in case of ontology class A are properties 'hasColor' and 'hasFinish' equal (owl:equivalentProperty). But in case of ontology class B the properties 'hasColor' and 'hasFinish' are NOT equal.

How can I achieve this?

One way probably is to create 'hasColor' and 'hasFinish' properties with class A as a range and set them to be equal. Then create another ones 'hasColor' and 'hasFinish' properties with class B as a range and without equal relationship. But is it right approach?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It's not entirely clear yet what you mean by making two properties un-equal. By default, two properties can be distinct, so you don't really have to do anything special to let them be unequal. If the question is clarified, though, perhaps more information can be added about that.

It's not entirely trivial to say that, e.g.,

∀a,x . A(a) → (hasFinish(a,x) ⇔ hasColor(a,x))

in OWL, but you can do it. If you want to say this for all classes, you can, as you pointed out, use owl:equivalentProperty. Now, when you say that p is an equivalent property to r, you could also say that

p ⊑ r
r ⊑ p

that is, that each of p and r are subproperties of the other. In OWL 2 (but, unfortunately, not OWL 2 DL, as Antoine Zimmermann pointed out in the comments), you can assert that a given property is a superproperty of a chain of properties, e.g.,

hasFather • hasBrother ⊑ hasUncle

which says that if someone has a father who has a brother, then that father's brother is that person's uncle.

There's also a concept called rolification, which has been described more in OWL 2 rolification, which is the process of creating a property corresponding to a class that relates each individual of that class to itself. For you class A, there would be a relation RA that relates each A to itself, and only relates those instances. If you then look at a property chain like

RA • hasFinish

you'll notice that it's really the subproperty of hasFinish where the first argument is an A. This means that you can say that hasFinish and hasColor are the same for the class A by making two subproperty assertions:

RA • hasColor ⊑ hasFinish
RA • hasFinish ⊑ hasColor

These assume that individuals of type A are the subjects of these statements. If A is actually the range here, then you'd just use

∀a,x . A(a) → (hasFinish(x,a) ⇔ hasColor(x,a))
hasColor • RA ⊑ hasFinish
hasFinish • RA ⊑ hasColor

To get the property RA, you need to add the definition

A ≡ ∃RA.Self

to your ontology. In Protégé, this would look like:

enter image description here enter image description here enter image description here

and the resulting ontology looks like (in RDF/XML):

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns="http://example.org/ep#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
  <owl:Ontology rdf:about="http://example.org/ep"/>
  <owl:Class rdf:about="http://example.org/ep#A">
    <owl:equivalentClass>
      <owl:Restriction>
        <owl:onProperty>
          <owl:ObjectProperty rdf:about="http://example.org/ep#R_A"/>
        </owl:onProperty>
        <owl:hasSelf rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean"
        >true</owl:hasSelf>
      </owl:Restriction>
    </owl:equivalentClass>
  </owl:Class>
  <owl:ObjectProperty rdf:about="http://example.org/ep#hasFinish">
    <owl:propertyChainAxiom rdf:parseType="Collection">
      <owl:ObjectProperty rdf:about="http://example.org/ep#R_A"/>
      <owl:ObjectProperty rdf:about="http://example.org/ep#hasColor"/>
    </owl:propertyChainAxiom>
  </owl:ObjectProperty>
  <owl:ObjectProperty rdf:about="http://example.org/ep#hasColor">
    <owl:propertyChainAxiom rdf:parseType="Collection">
      <owl:ObjectProperty rdf:about="http://example.org/ep#R_A"/>
      <owl:ObjectProperty rdf:about="http://example.org/ep#hasFinish"/>
    </owl:propertyChainAxiom>
  </owl:ObjectProperty>
</rdf:RDF>

and in Turtle:

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

:hasFinish  a                   owl:ObjectProperty ;
        owl:propertyChainAxiom  ( :R_A :hasColor ) .

:A      a                    owl:Class ;
        owl:equivalentClass  [ a               owl:Restriction ;
                               owl:hasSelf     true ;
                               owl:onProperty  :R_A
                             ] .

:hasColor  a                    owl:ObjectProperty ;
        owl:propertyChainAxiom  ( :R_A :hasFinish ) .

<http://example.org/ep>
        a       owl:Ontology .

:R_A    a       owl:ObjectProperty .

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...