0

I have a class hierarchy like this:

Thing
  - ClassA
    -ClassC
    -ClassD
  - ClassB
    -ClassC
    -ClassE

Class C is a subclass of both, ClassA and ClassB while ClassD and ClassE are only subclasses of either ClassA or ClassB

Now I would like to specify a class which is equivalent to the Intersection of subclasses of ClassA and ClassB. The following doesn't work:

NamedClass a owl:Class
NamedClass owl:equivalentClass (ClassA and ClassB)

The reason is that this sort of rule would be used by the reasoner to classify individuals, i.e. is I had an individual Ind1 which is of type ClassA and ClassB, it would be classified to be also of type NamedClass. This is not (only) what I want. I want ClassC itself to be a subclass of NamedClass.

I know this is achievable using rules (e.g. SPIN) but can it be done without rules?

casualcoder
  • 480
  • 4
  • 17
  • What doesn't work about `F owl:equivalentClass (A and B)`? If you check with a reasoner, you'll see that `C` is a subclass of `F`. It's a simple inference: is something is a C, then it's an A; if something is a C, then it's a B; therefore, if something is a C, then it's an A and a B; therefore, if is an A and a B, then it's an F; therefore, if something is a C, then it's an F. That's the very definition of the subclass relation. – Joshua Taylor Mar 06 '14 at 13:17
  • No, Joshua, it doesn't work. It does work when I have a relation like owl:equivalentClass(property1 some ClassB) for example but the Intersection in my example doesn't work. When I start the reasoner (doesn't matter which one), ClassC is not classified as subclass of NamedClass. – casualcoder Mar 06 '14 at 13:21
  • I've added an answer showing an ontology with the structure in Protégé. Pellet correctly classifies my class C as a subclass of F (what you've been calling NamedClass). – Joshua Taylor Mar 06 '14 at 13:34
  • I see you've accepted the answer, thanks! Is there any chance that you pinpoint the problematic behavior that you'd been seeing though? It might be possible that some other modeling construction doesn't have quite the expected effect, and we might be able to track that down… – Joshua Taylor Mar 06 '14 at 13:40
  • see my comment on your answer :) – casualcoder Mar 06 '14 at 13:44

2 Answers2

2

Let's start with the initial hierarchy, including F, but before we've declared that F is equivalent to the intersection of A and B:

enter image description here

Then we add (A and B) as a class equivalent to F. Protégé is smart enough to render things that are equivalent or subclasses of intersections under each of the intersected classes, so we see F appear in two places here.

enter image description here

A reasoner can confirm the relation, too. Here I've turned on Pellet, entered F into the DL query, and asked for subclasses. Sure enough, C is a subclass of F:

enter image description here

Here's the ontology that you can copy and paste:

@prefix :      <http://stackoverflow.com/q/22221549/1281433/> .
@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#> .

:ontology a owl:Ontology .

:A a owl:Class .
:B a owl:Class .
:C a owl:Class ; rdfs:subClassOf  :A , :B .
:D a owl:Class ; rdfs:subClassOf  :A .
:E a owl:Class ; rdfs:subClassOf  :B .
:F a owl:Class ;
     owl:equivalentClass [ a owl:Class ;
                           owl:intersectionOf  ( :A :B ) ] .
Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
  • Thank you, I noticed I had a different problem which for some reason prevented the class-level inferences from being persisted in my model so when I opened it in Protege after reasoning (using the Jena API), it wasn't complete and using the reasoner on the incomplete model didn't help either. Though I solved my problem in a totally different way, your answer illustrates the intersection nicely. – casualcoder Mar 06 '14 at 13:43
  • Ah, I see. Well, there's nothing the matter with answering your own question; if you think that the problem you actually had might happen to someone else, you can write it up as a question and provide an answer, too! – Joshua Taylor Mar 06 '14 at 13:47
0

Yes, you can define that a class is defined as intersection of two other classes using OWL. Check the OWL 2 Primer.

Hope I helped!

PS If you want to apply more advanced rules to your model, I would suggest using SWRL which is a w3c recommendation.

Pantelis Natsiavas
  • 5,293
  • 5
  • 21
  • 36
  • I tried to define it like this but as described above, this would only work for individuals. I know I could use SWRL (I prefer SPIN) but it would be better without it. – casualcoder Mar 06 '14 at 11:53
  • There's nothing at all the matter with some ClassC being a subclass of two other classes. There's no assumption of class disjointness, so there's nothing the matter with something being both a ClassA and and a ClassB, so there'd be no problem with something being a ClassC. All the subclass relations are is an if then of the form "if X is a C, then X is an A", "if X is a C, then X is a B". There's absolutely nothing wrong with something being both an A and and a B, unless otherwise stated. – Joshua Taylor Mar 06 '14 at 13:13
  • You are right... I will delete my edit in order to prevent confusion for possible readers. – Pantelis Natsiavas Mar 06 '14 at 13:16