0

I would like to infer an anonymous class definition for my Individuals in Protege.

I have a simple Ontology with the Classes Rain NoRain and Scene, The object Property has_weather. My desire is to be able to infer "has_weather(?x, ?noRain), NoRain(?noRain), Scene(?x) -> (has_weather exactly 0 Rain)(?x) which i wrote in the Rules tab, where i can mix SWRL and OWL Expressions. enter image description here

I am using Pellet Reasoner, however I also tried with OnTop and Hermit and none works. For example if I do the rule the other way around:

`has_weather(?x, ?noRain), (has_weather exactly 0 Rain)(?x), Scene(?x) -> Test(?x)`

enter image description here

It works without problems.

Is the problem, that Protege just can't infer anonymous classes? Is there any workaround? Thank you in Advance!

here is the code to the ontology

<!-- 
///////////////////////////////////////////////////////////////////////////////////////
//
// Object Properties
//
///////////////////////////////////////////////////////////////////////////////////////
 -->




<!-- http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#has_weather -->

<owl:ObjectProperty rdf:about="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#has_weather">
    <rdfs:subPropertyOf rdf:resource="http://www.w3.org/2002/07/owl#topObjectProperty"/>
</owl:ObjectProperty>



<!-- 
///////////////////////////////////////////////////////////////////////////////////////
//
// Classes
//
///////////////////////////////////////////////////////////////////////////////////////
 -->




<!-- http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#NoRain -->

<owl:Class rdf:about="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#NoRain">
    <owl:disjointWith rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Rain"/>
</owl:Class>



<!-- http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Rain -->

<owl:Class rdf:about="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Rain"/>



<!-- http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Scene -->

<owl:Class rdf:about="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Scene"/>



<!-- 
///////////////////////////////////////////////////////////////////////////////////////
//
// Individuals
//
///////////////////////////////////////////////////////////////////////////////////////
 -->




<!-- http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#NoRain -->

<owl:NamedIndividual rdf:about="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#NoRain">
    <rdf:type rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#NoRain"/>
</owl:NamedIndividual>



<!-- http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Scene -->

<owl:NamedIndividual rdf:about="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Scene">
    <rdf:type rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Scene"/>
    <has_weather rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#NoRain"/>
</owl:NamedIndividual>



<!-- 
///////////////////////////////////////////////////////////////////////////////////////
//
// Rules
//
///////////////////////////////////////////////////////////////////////////////////////
 -->

<rdf:Description rdf:about="urn:swrl:var#x">
    <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Variable"/>
</rdf:Description>
<rdf:Description rdf:about="urn:swrl:var#noRain">
    <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Variable"/>
</rdf:Description>
<rdf:Description>
    <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Imp"/>
    <swrl:body>
        <rdf:Description>
            <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
            <rdf:first>
                <rdf:Description>
                    <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
                    <swrl:propertyPredicate rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#has_weather"/>
                    <swrl:argument1 rdf:resource="urn:swrl:var#x"/>
                    <swrl:argument2 rdf:resource="urn:swrl:var#noRain"/>
                </rdf:Description>
            </rdf:first>
            <rdf:rest>
                <rdf:Description>
                    <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
                    <rdf:first>
                        <rdf:Description>
                            <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
                            <swrl:classPredicate rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#NoRain"/>
                            <swrl:argument1 rdf:resource="urn:swrl:var#noRain"/>
                        </rdf:Description>
                    </rdf:first>
                    <rdf:rest>
                        <rdf:Description>
                            <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
                            <rdf:first>
                                <rdf:Description>
                                    <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
                                    <swrl:classPredicate rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Scene"/>
                                    <swrl:argument1 rdf:resource="urn:swrl:var#x"/>
                                </rdf:Description>
                            </rdf:first>
                            <rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
                        </rdf:Description>
                    </rdf:rest>
                </rdf:Description>
            </rdf:rest>
        </rdf:Description>
    </swrl:body>
    <swrl:head>
        <rdf:Description>
            <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
            <rdf:first>
                <rdf:Description>
                    <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
                    <swrl:classPredicate>
                        <owl:Restriction>
                            <owl:onProperty rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#has_weather"/>
                            <owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">0</owl:qualifiedCardinality>
                            <owl:onClass rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Rain"/>
                        </owl:Restriction>
                    </swrl:classPredicate>
                    <swrl:argument1 rdf:resource="urn:swrl:var#x"/>
                </rdf:Description>
            </rdf:first>
            <rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
        </rdf:Description>
    </swrl:head>
</rdf:Description>

</rdf:RDF>

`

  • 1
    are you sure that your second rule does work? – UninformedUser Sep 09 '21 at 05:47
  • other than that, impossible because an OWL reasoner could infer infinite complex class expressions like `A`, `A and A`, `A and A and A`, ... - so there is no tool that would give you all theoretically possible class expressions. Indeed, what always works is the other way around, i.e. ask whether an individual belongs to `A and A and A ...` in that case it could return `true` – UninformedUser Sep 09 '21 at 05:49
  • Hey! Yes I tested it, it works, when I explicitly say for an Individual that it has (has_weather exactly 0 Rain), otherwise it doesn't. But it also works if I tell the reasoner to infer NoRainScene, which is defined like the mentioned expression. For Example what I tried before that is just to not have the relation with the object property, but this doesn't work because of the Open World Assumption, i think – Stefani Guneshka Sep 09 '21 at 07:59
  • ah, ok. yes, if you add the class expression directly to the individual it works of course, otherwise it doesn't because of the OWA - and this holds for many thing, negation, max cardinality, etc. – UninformedUser Sep 09 '21 at 08:27

1 Answers1

1

In general a set of axioms has an infinite amout of entailments. See for example this paper. For this reason reasoners restrict inferences to known classes (not anonymous classes). I suspect this holds true for rules as well.

I therefore suggest you add a class NoRain that you set equivalent to has_weather 0 Rain and change your SWRL rule to use the class NoRain.

Henriette Harmse
  • 4,167
  • 1
  • 13
  • 22
  • Hey ! Thank you , I also though about doing it this way, but I was hoping to somehow avoid having to create a lot of new classes , because the ontology im building is quite big . Nevertheless thank you for your suggestion and I guess this is the way to do it. It also works by the way to have the anonymous expressions in the antecedent, but if i have the classes defined anyway , maybe it doesn't make sense to use anonymous expressions. – Stefani Guneshka Sep 09 '21 at 08:04