pwin / owlready2

GNU Lesser General Public License v3.0
140 stars 23 forks source link

Loading Gist v13 ontology parses `numericValue/#Literal` restriction on Magnitude incorrectly. #46

Open jamesh-kaiasm opened 3 months ago

jamesh-kaiasm commented 3 months ago

I'm trying to load the new Gist v13 ontology using the owlready2 library: this is freely available for download at https://www.semanticarts.com/gist/.

One of the classes is defined as follows:

<owl:Class rdf:about="https://w3id.org/semanticarts/ns/ontology/gist/Magnitude">
    <owl:equivalentClass>
        <owl:Class>
            <owl:intersectionOf rdf:parseType="Collection">
                <owl:Restriction>
                    <owl:onProperty rdf:resource="https://w3id.org/semanticarts/ns/ontology/gist/hasAspect"/>
                    <owl:someValuesFrom rdf:resource="https://w3id.org/semanticarts/ns/ontology/gist/Aspect"/>
                </owl:Restriction>
                <owl:Restriction>
                    <owl:onProperty rdf:resource="https://w3id.org/semanticarts/ns/ontology/gist/hasUnitOfMeasure"/>
                    <owl:someValuesFrom rdf:resource="https://w3id.org/semanticarts/ns/ontology/gist/UnitOfMeasure"/>
                </owl:Restriction>
                <owl:Restriction>
                    <owl:onProperty rdf:resource="https://w3id.org/semanticarts/ns/ontology/gist/numericValue"/>
                    <owl:someValuesFrom rdf:resource="http://www.w3.org/2000/01/rdf-schema#Literal"/>
                </owl:Restriction>
            </owl:intersectionOf>
        </owl:Class>
    </owl:equivalentClass>
   ...
</owl:Class>

If I load the ontology into Protege it interprets this correctly: image

but when I load the file with owlready2 the #Literal is dropped, and my code is shown And(hasAspect(Aspect),hasUnitOfMeasure(UnitOfMeasure),numericValue(None))

If I replace the <owl:someValuesFrom rdf:resource="http://www.w3.org/2000/01/rdf-schema#Literal"/> in the definition with <owl:someValuesFrom rdf:resource="http://www.w3.org/2001/XMLSchema#string"/> it interprets as I would expect (as And(hasAspect(Aspect),hasUnitOfMeasure(UnitOfMeasure),numericValue(str))).

Can anyone explain why the rdf:resource="http://www.w3.org/2000/01/rdf-schema#Literal" is being interpreted as None? The prologue already defines xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" and while the rdfs: prefix is used consistently throughout the rest of the file, this is the only occurrence of it within a full IRI like this.