Closed CyberDaedalus00 closed 5 years ago
Looking at this again, I think there is an issue with your implementation.
A custom datatype is normally implemented as an instance of rdfs:Datatype
. I'm not an expert about this but I dug around a bit and found some useful background info:
In your example you are declaring an instance to be a subclass of another instance. This makes it implicitly a set (= a class). That is, according to the rdfs schema specs:
A triple of the form:
C1 rdfs:subClassOf C2
states that C1 is an instance of rdfs:Class, C2 is an instance of rdfs:Class and C1 is a subclass of C2. The rdfs:subClassOf property is transitive.
So I think Ontospy is not deriving any false inference. That instance is indeed also a class.
Makes sense?
If an ontology contains a custom datatype by extending a standard one, such as xsd:string, Ontospy identifies it as a class. For example:
The example code above defines a custom datatype
http://www.example.com/cti_common#structuredText
by extending through subclassinghttp://wwww.w3.org/2001/XMLSchema#string
. When this ontology is loaded into OntoSpy, it is identified as a class as shown below:Yet when you retrieve the class using
model.getClass("structuredText")
and theserialize
you get the following:This appears to be because in QueryHelper.py, the method
getAllClasses
treats anything RDF entity that has anrefs:subClassOf
as a class.