Missing object property values in owl file after Save() when property type = "only"

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

Missing object property values in owl file after Save() when property type = "only"

Heidi
This post was updated on .
Dear Jean-Baptiste,

I am having some problems saving my OWL file when I have a property with the property type "only" (class_property_type = ["only"]). Basically, if such a property has values [value1, value2, value3, ... value-n], then the owl file will only contain [value1, value2].

I have made an example file based on my ontology of zoning types and land uses, where each zoning type "allowsUse" or "doesNotAllowUse" "Use". In my example, I have set allowsUse to have property type "only" and doesNotAllowUse to "some". When I assert that a CommercialZone allowsUse UseA, UseB and UseC, printing onto.CommercialZone.allowsUse returns UseA, UseB and UseC, as expected. However, when I save the file and open the owl file, then onto.CommercialZone.allowsUse only has values UseA and UseB (see image).

In general, with the "only" property, only max 2 property values are stored in the owl file. With a "some" property (such as doesNotAllowUse) there is no such problem.



Do you know if this is a bug in OwlReady2, or am I just missing something?

Thank you very much if you are able to help!

Best,
Heidi






Here is my full script:

from owlready2 import *
onto = get_ontology("http://www.theworldavatar.com/ontology/bug_report.owl")
onto_path.append("C://Users//....")

with onto:
    class ZoningType(Thing):
        pass
    class LandUse(Thing):
        pass
    class allowsUse(ZoningType >> LandUse): class_property_type = ["only"]
    class doesNotAllowUse(ZoningType >> LandUse): class_property_type = ["some"]

    class CommercialZone(ZoningType):
        pass
    class UseA(LandUse):
        pass
    class UseB(LandUse):
        pass
    class UseC(LandUse):
        pass
    class Use1(LandUse):
        pass
    class Use2(LandUse):
        pass
    class Use3(LandUse):
        pass

    CommercialZone.allowsUse.append(UseA)
    CommercialZone.allowsUse.append(UseB)
    CommercialZone.allowsUse.append(UseC)

    CommercialZone.doesNotAllowUse.append(Use1)
    CommercialZone.doesNotAllowUse.append(Use2)
    CommercialZone.doesNotAllowUse.append(Use3)
    sync_reasoner(infer_property_values=True)


print("onto.CommercialZone allows use: ", onto.CommercialZone.allowsUse)
onto.save()


Reply | Threaded
Open this post in threaded view
|

Re: Missing object property values in owl file after Save() when property type = "only"

Jiba
Administrator
Hello,

Indeed, there was a bug in Owlready; thank you for reporting it !

It should now be fixed in the development version.

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Missing object property values in owl file after Save() when property type = "only"

Heidi
This post was updated on .
Dear Jiba,

Thank you very much for the update!

Best,
Heidi