Add function to generate explicit subclass assertions
Opened this issue · 6 comments
See gist issue #714 for discussion.
The idea is that many tools support subClassOf
assertions that are not able to infer the relationship. We would like to be able to generate these and store them in a separate file for use as desired.
That makes sense, and I have run into this problem before. So, two possible approaches -
- Run a simple query for the sort of patterns we use in gist, which is what is used to generate schema graphs in onto_tool, i.e
select ?class ?parent where { ?class (owl:equivalentClass|rdfs:subClassOf)/(owl:unionOf|owl:intersectionOf)/rdf:rest*/rdf:first ?parent . ?parent a owl:Class filter (!isblank(?class) && !isblank(?parent)) }
- Run a full OWL2 reasoner, as suggested by @justin2004, and then just extract subClassOf triples from the output into a generated
.ttl
.
I think we'd want to exclude subclasses that are already explicitly asserted in the ontology. Not that the redundancy does any harm, but it seems sloppy. In that case option 1 would be simpler - we could just remove the rdfs:subClassOf
disjunct. On the other hand, 2 is more general and will catch everything, even if it doesn't follow the gist pattern. Maybe we just live with the redundancies.
@justin2004 Thoughts?
@dylan-sa Has written a script to generate the subclass assertions for gist. The idea here is to build it in as an onto_tool
action.
@dylan-sa Has written a script to generate the subclass assertions for gist. The idea here is to build it in as an
onto_tool
action.
That's a pretty cool script, but seems a little too specific for a general utility like onto-tool
. How about the following solution:
- Add a
reason
bundle command that would take some input(s) and run the reasoner, storing the output as specified - Use the existing
sparql
bundle command toCONSTRUCT
the ontology, grabbing thesubClassOf
triples only and adding the ontology definition.
That sounds great.
Once this has done, we should revisit semanticarts/gist#838.