Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jamesh-kaiasm opened this issue Aug 9, 2024 · 0 comments

Comments

@jamesh-kaiasm
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant