Re: ObjectProprerty Restrictions not generating in RDFXML

Posted by MartyStache on
URL: http://owlready.306.s1.nabble.com/ObjectProprerty-Restrictions-not-generating-in-RDFXML-tp2124p2126.html

from owlready2 import *

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

with onto:
        class EquipmentContainer(Thing):
                pass
        EquipmentContainer.comment = ["Something that contains equipment."]

        class Equipment(Thing):
                pass
        Equipment.comment = ["A necessary item for a particular purpose."]

        class has_Equipments(ObjectProperty):
                domain = [EquipmentContainer]
                range = [Equipment]
        has_Equipments.comment = ["Contained equipment."]
        has_Equipments.min(0,Equipment)
        has_Equipments.max(25,Equipment)

        class EquipmentContainer_of(ObjectProperty):
                domain = [Equipment]
                range = [EquipmentContainer]
                inverse_property = has_Equipments
        EquipmentContainer_of.comment = ["Container of this equipment."]
        EquipmentContainer_of.min(0,EquipmentContainer)
        EquipmentContainer_of.max(1,EquipmentContainer)

onto.save(file = "ExampleWithNoCardinality.xml", format = "rdfxml")

I would expect the output of this is supposed to look something like this:

<owl:Class rdf:about="http://test.org/test.owl#EquipmentContainer">
    <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
    <rdfs:subClassOf>
        <owl:Restriction>
            <owl:onProperty rdf:resource="http://test.org/test.owl#has_Equipments"/>
            <owl:minQualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">0</owl:minQualifiedCardinality>
            <owl:onClass rdf:resource="http://test.org/test.owl#Equipment/>
        </owl:Restriction>
    </rdfs:subClassOf>
    <rdfs:subClassOf>
        <owl:Restriction>
            <owl:onProperty rdf:resource="http://test.org/test.owl#has_Equipments"/>
            <owl:maxQualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">25</owl:maxQualifiedCardinality>
            <owl:onClass rdf:resource="http://test.org/test.owl#Equipment"/>
        </owl:Restriction>
    </rdfs:subClassOf>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string"></rdfs:comment>
</owl:Class>

<owl:Class rdf:about="http://test.org/test.owl#Equipment">
    <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
    <rdfs:subClassOf>
        <owl:Restriction>
            <owl:onProperty rdf:resource="http://test.org/test.owl#EquipmentContainer_of"/>
            <owl:minQualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">0</owl:minQualifiedCardinality>
            <owl:onClass rdf:resource="http://test.org/test.owl#EquipmentContainer"/>
        </owl:Restriction>
    </rdfs:subClassOf>
    <rdfs:subClassOf>
        <owl:Restriction>
            <owl:onProperty rdf:resource="http://test.org/test.owl#EquipmentContainer_of"/>
            <owl:maxQualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:maxQualifiedCardinality>
            <owl:onClass rdf:resource="http://test.org/test.owl#EquipmentContainer"/>
        </owl:Restriction>
    </rdfs:subClassOf>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string"></rdfs:comment>
</owl:Class>