Use data property of one class for restricting other class

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Use data property of one class for restricting other class

jayson
Hi All!

I tried to use the data property of one class for defining a restriction within another class, but was not successfull and always received the error:  

ontology._set_obj_triple_spo(self.storid, owl_ondatatype, _universal_datatype_2_abbrev[self.base_datatype])
KeyError: <class 'owlready2.prop.ObjectPropertyClass'>


Therefore, here is an example ontology based on an old question i asked.

    onto = get_ontology("http://test.org/test.owl")

    # ===================
    with onto:
        class Substance(Thing):
            pass

        class AmbientCondition(Thing):
            pass

        class SubstanceProperty(Thing):
            pass

        class substanceHasFlashpoint(Substance >> float, FunctionalProperty):
            pass

        class substanceExposedToAmbientCondition(SubstanceProperty >> AmbientCondition):
            pass

        class ambientTemperatureIs(AmbientCondition >> float, FunctionalProperty):
            pass

        class HighlyFlammable(SubstanceProperty):
            equivalent_to = [SubstanceProperty & (substanceHasFlashpoint >= 55.)] # 55. should be dynamic


        ambient_condition = AmbientCondition(ambientTemperatureIs=55.)

        substance_property = SubstanceProperty(substanceHasFlashpoint=60,
                                                                substanceExposedToAmbientCondition=[ambient_condition])

        sync_reasoner()


So what i would like to do is using the definition of the "ambientTemperatureIs" (55.) within "ambient_condition" instance instead of the hardcoded definition within the "HighlyFlammable" class definition.


Is there a way to archive that or or have I fundamentally misunderstood something?


Furthermore, I am not sure if this issue relates to this previous post:
http://owlready.8326.n8.nabble.com/Get-inferred-data-property-for-a-class-td1935.html


Thanks for your help!
Jayson
Reply | Threaded
Open this post in threaded view
|

Re: Use data property of one class for restricting other class

Jiba
Administrator
Hi,

I think what you want to achieve requires 2 "free variables", while OWL declarations allow only one. The only way to do that would be to use an SWRL rule.

Jiba