Skip to content

Loading Gist v13 ontology loses information while parsing range of numericValue class.  #47

@jamesh-kaiasm

Description

@jamesh-kaiasm

Importing the Gist ontology using owlready2 is (inconsistently) losing information while trying to parse a complex datatype range.

The numericValue datatype property is defined like so:

<owl:DatatypeProperty rdf:about="&gist;numericValue">
<rdfs:domain rdf:resource="&gist;Magnitude"/>
<rdfs:isDefinedBy rdf:resource="https://w3id.org/semanticarts/ontology/gistCore"/>
<rdfs:range>
	<rdfs:Datatype>
		<owl:unionOf rdf:parseType="Collection">
			<rdf:Description rdf:about="&xsd;byte"></rdf:Description>
			<rdf:Description rdf:about="&xsd;decimal"></rdf:Description>
			<rdf:Description rdf:about="&xsd;double"></rdf:Description>
			<rdf:Description rdf:about="&xsd;float"></rdf:Description>
			<rdf:Description rdf:about="&xsd;int"></rdf:Description>
			<rdf:Description rdf:about="&xsd;integer"></rdf:Description>
			<rdf:Description rdf:about="&xsd;long"></rdf:Description>
			<rdf:Description rdf:about="&xsd;negativeInteger"></rdf:Description>
			<rdf:Description rdf:about="&xsd;nonNegativeInteger"></rdf:Description>
			<rdf:Description rdf:about="&xsd;nonPositiveInteger"></rdf:Description>
			<rdf:Description rdf:about="&xsd;positiveInteger"></rdf:Description>
			<rdf:Description rdf:about="&xsd;short"></rdf:Description>
			<rdf:Description rdf:about="&xsd;unsignedByte"></rdf:Description>
			<rdf:Description rdf:about="&xsd;unsignedInt"></rdf:Description>
			<rdf:Description rdf:about="&xsd;unsignedLong"></rdf:Description>
			<rdf:Description rdf:about="&xsd;unsignedShort"></rdf:Description>
			<rdf:Description rdf:about="&owl;rational"></rdf:Description>
			<rdf:Description rdf:about="&owl;real"></rdf:Description>
		</owl:unionOf>
	</rdfs:Datatype>
</rdfs:range>
<skos:definition rdf:datatype="&xsd;string">The actual value of a magnitude.</skos:definition>
<skos:prefLabel rdf:datatype="&xsd;string">numeric value</skos:prefLabel>
</owl:DatatypeProperty>

However, what is given to my python code when asking for the range attribute of the property class, is this:
[<class 'int'> | <class 'float'> | <class 'float'> | <class 'float'> | <class 'int'> | <class 'int'> | <class 'int'> | <class 'int'> | <class 'int'> | 'http://www.w3.org/2001/XMLSchema#nonPositiveInteger' | <class 'int'> | <class 'int'> | <class 'int'> | <class 'int'> | <class 'int'> | <class 'int'> | None | <class 'float'>]
There are three obvious problems:

  • the distinction between the various different numeric types has been lost, and I don't know of a way to get it back (e.g. for export)
  • for some reason it's given up on trying to convert xsd:nonPositiveInteger to a Python type, and has just left it as a plain IRI
  • it's lost owl:rational altogether, replacing it with None

Is there any way I would be able to get back the original information here once it had been loaded into owlready2 (e.g. if I wanted to re-export it)? Why are xsd:nonPositiveInteger and owl:rational being treated differently to the others?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions