lambdamusic / Ontospy

Python library and command-line interface for inspecting and visualizing RDF models aka ontologies.
http://lambdamusic.github.io/Ontospy/
MIT License
219 stars 52 forks source link

Class "Usage" table does not recognize domains and ranges of superproperties #126

Open ajnelson-nist opened 1 year ago

ajnelson-nist commented 1 year ago

Hello,

This page contains some errant references to properties that are not truly relevant in the "Usage" table. They appear to be due to Ontospy not inheriting domains and ranges from properties' superproperties, and I believe this is a bug.

https://ontology.caseontology.org/documentation/class-investigationprovenancerecord.html

The property types:threadNextItem (and similarly for types:threadPreviousItem) is included in the usage here, because that property is represented by Ontospy as having a domain and range of owl:Thing.

The page for types:threadNextItem designates that owl:Thing is the inferred domain and range. The property does not directly assign rdfs:domain or rdfs:range.

However, the superproperty, types:threadSuccessor, does assign a domain and range.

types:threadSuccessor a owl:ObjectProperty,
        owl:TransitiveProperty ;
    rdfs:label "threadSuccessor"@en ;
    rdfs:comment "A link to a following item in a thread."@en ;
    rdfs:domain types:ThreadItem ;
    rdfs:range types:ThreadItem ;
    rdfs:seeAlso co:followedBy .

Because this information is available in the graph Ontospy is using to build the documentation, even without RDFS inferencing, I think the correct thing to do is inherit the domains and ranges all the way up the available property hierarchy, and then use their intersections to populate the Usage boxes.

ajnelson-nist commented 1 year ago

(In case this Issue hangs around a while, the deployed state backing the links above is the merge state after merging this PR.)