Closed marksem closed 1 year ago
There are two levels of inference here, to get all of this sort of thing may require going all the way up the sublass hierarchy for all classes. I hope not, but how are you going to get only what you want?
An option is to run an OWL 2 DL reasoner on gistCore.ttl
when we package up a release and make a .ttl file available in the release with all the triples ingistCore.ttl
+ all of the derivations.
If there is interest in that I can take a crack at it (so it can run it a hands-off manner).
A good idea - we might want to have a separate file of just materialized triples, so they can be swapped in a KG more easiliy.
Other contexts where this would be helpful: SHACL with RDFS reasoning turned on (turning on OWL reasoning to interpret the intersections results in an untenably large performance hit), RDFox.
IMO the best way to handle this is to add a function to onto_tool to generate the triples and add to a separate file. Rather than just generating it in a release package, it would be helpful to have in the repo for development purposes. The easiest way to manage that is by adding it to the pre-commit hook.
Using onto_tool to generate the subClassOf assertions may still be the best option, but I stumbled upon this feature of ROBOT and thought I'd link it here just in case it's useful.
That's very interesting, thanks for pointing it out. It's important to consolidate into onto_tool for the bundling, but we may be able to call this ROBOT function from onto_tool by making appropriate additions to bundle.yaml
- see the definition of the serializer tool and the transform action.
Another approach would be to do everything in bundle.yaml
itself using a sparql action - see the sparql action for generating rdfs:labels
into a new file. This could be done without running a reasoner by querying for an intersection and selecting only non-blank nodes. This would not require a change to onto_tool as my previous suggestion did.
The pre-commit hook could call ROBOT directly or go through onto_tool.
@justin2004 You may want to consider these alternatives to modifying onto_tool itself.
@dylan-sa and I are working on this for a client, so we can take this one on too. We'll start with a stand-alone script, then looking into adding to onto_tool.
@dylan-sa For release 12.0.0, let's just create the file to include in the release package. A second step is to run it on every commit, which could be handled in a couple of different ways:
The first might be preferable so that it runs before pushing to the remote repo.
This isn't required for the upcoming release, however. I've created a new issue #819 for this step.
I have created a draft subClassOf supplement for us to include in the gist 12 release package. The final version may differ depending on the changes that make it into the release, but I am hoping to get feedback on the general structure.
The general idea (as @justin2004 suggested) was to run an OWL 2 DL reasoner over gist to get subclass assertions like those cited by @marksem. (Some additional manipulation was required as detailed below.)
The supplement ends up taking the following shape:
subClassOf
statements that are explicitly asserted in gist, the supplement includes statements that are implied but not asserted in gist.
gist:Commitment rdfs:subClassOf gist:Intention
and gist:CoherentUnit rdfs:subClassOf gist:UnitOfMeasure
.rdfs:subClassOf
. So, for example, since gist:GeoRoute rdfs:subClassOf gist:OrderedCollection
and gist:OrderedCollection rdfs:subClassOf gist:Collection
, gist:GeoRoute rdfs:subClassOf gist:Collection
is included as well.?x rdfs:subClassOf owl:Thing
, ?x rdfs:subClassOf ?x
, and owl:Nothing rdfs:subClassOf ?x
. All of these kinds of statements are going to be true no matter which class you plug in for ?x
; they'd just bloat the file without adding much value.Any thoughts on what is valuable to include are much appreciated.
I'm not convinced that we should assert the cascade of subclass assertions. The point was to extract subclass assertions buried in an equivalentClass assertion for RL and RDFS reasoners that cannot do that. These reasoners can provide the upward chaining of subclassing themselves. That means, for example, that we don't need this:
gist:Actuator
rdfs:subClassOf
gist:Artifact ,
gist:Equipment ,
gist:PhysicalIdentifiableItem
;
.
or this:
gist:Account
rdfs:subClassOf
gist:Commitment ,
gist:Intention
;
.
I realize this is trickier to implement. One way is to run the DL reasoner and subtract from the result any triples that are asserted in the full ontology.
I'm not convinced that we should assert the cascade of subclass assertions.
@rjyounes but what are you gaining by putting in effort to try and remove them. I think they are fine to leave them in.
I am curious, how many are we talking about? A few? Or lots?
In response to the above comments, we have decided:
gist:Actuator rdfs:subClassOf gist:Equipment ;
This is tricky enough to eliminate that it's not worth the effort, but could potentially be included in the eventual script that automates this (see below).
Additional notes:
*.ttl
as in other targets and testing the result. If it's not necessary, change all lists to wildcard expressions./docs
folder, but you could check for that as well.The point was to extract subclass assertions buried in an equivalentClass assertion for RL and RDFS reasoners that cannot do that. These reasoners can provide the upward chaining of subclassing themselves.
That's very interesting, had not thought of that. All along, I assumed this was about inferring all subclasses. WE have done that a lot over the years, before reasoners worked in triple stores. Its much easier to do it that way also. I don't know what is best.
This is tricky enough to eliminate that it's not worth the effort, but could potentially be included in the eventual script that automates this (see below).
What exactly is tricky enough to eliminate? Im confused about what you plan to do.
@dylan-sa Are you going to submit a PR for this?
Yep, I've created a PR for this one here: https://github.com/semanticarts/gist/pull/837
Request: Explicitly assert subClassOf in gist where applicable.
Example:
gist:Commitment
is defined asbut it is not explicitly defined as subClassOf
gist:Intention
, even though it must be. Another example isgist:CoherentUnit
(not explicitly declared as subClassOfgist:UnitOfMeasure
)Rationale: We want gist to be as usable as possible. Many more triple stores and visualization tools support class subsumption but do not support OWL to the level where they can "figure out" the subsumption if implied.