Extract class relationships for all properties and axiom shapes - #37
Merged
jvendetti merged 1 commit intoAug 7, 2026
Conversation
matthewhorridge
force-pushed
the
feature/principled-relationship-extraction
branch
from
July 31, 2026 18:00
60e9a9f to
f43b0db
Compare
generateGroundTriplesForAxioms only recognised the flat shape SubClassOf(A, someValuesFrom(p, B)) and only for a hard-coded set of OBO properties (part_of, contains, develops_from and their IRIs), gated on the property IRI containing "obo". Relationships on any other property — e.g. EDAM's has_topic/has_output/has_input — were silently dropped, which is why some relationships appear in the class Details view and others do not. Add generateRelationshipTriples, which visits the class expression of every SubClassOf and EquivalentClasses axiom of a named class (RelationshipVisitor, an OWLClassExpressionVisitorAdapter) and emits a relationship triple (subject --p--> filler, under the property's own IRI) for every someValuesFrom, hasValue, and min/exact cardinality (n >= 1). Intersection operands are traversed, both in the superclass expression and in a restriction's filler, so SubClassOf(A, p some (B and C)) yields A p B and A p C, and relationships stated via equivalences are extracted too. Unions, complements and allValuesFrom are not traversed/emitted (not entailed for every instance). This is additive: the existing OBO treeView/hierarchy emission is left unchanged, so the class tree is unaffected; the Details view now shows the full set of relationships. Verified on EDAM and UBERON, and with a fixture covering each shape.
matthewhorridge
force-pushed
the
feature/principled-relationship-extraction
branch
from
July 31, 2026 18:15
f43b0db to
1dcedbe
Compare
Member
|
Noting here that this change passes unit tests (in my local dev env) for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #38.
What
Extracts class-to-class (and class-to-individual) relationships for all object properties and from a wider range of axiom shapes, so they surface in a class's property listing (the Details view).
generateGroundTriplesForAxiomsonly recognises the flat shapeSubClassOf(A, someValuesFrom(p, B)), and only for a hard-coded set of OBO properties (part_of,contains,develops_fromand their IRIs), gated on the property IRI containing the substringobo. Relationships on any other property — for example EDAM'shas_topic/has_output/has_input, or UBERON's many RO/BSPO relations — are silently dropped. This is why some relationships appear on a class and others do not.Change
Adds
generateRelationshipTriples, run alongside the existing method. For everySubClassOfandEquivalentClassesaxiom of a named classA, it walks the class expression and emits a relationshipA --p--> filler(as an annotation assertion under the property's own IRI) for:someValuesFrom(p, namedClass)hasValue(p, individual)min/exactcardinality (n ≥ 1) onpwith a named fillerRecursion descends into
ObjectIntersectionOfoperands, so relationships nested inside an intersection, and those stated via an equivalence, are extracted too. Unions and complements are not traversed (their operands are not entailed for every instance ofA), andallValuesFromis not emitted (it is a constraint, not an existential relationship).The change is additive: the existing OBO
treeView/metadata/obo/*emission is untouched, so the class hierarchy is unaffected. Only the relationship coverage in the Details view grows.Testing
RelationshipExtractionTestwith a fixture (src/test/resources/repo/input/relations/relations.ttl) covering each extracted shape (baresomeValuesFrom,someValuesFromnested in an intersection,EquivalentClasses+ intersection,hasValue, min-cardinality) and the two that must not be extracted (allValuesFrom, union operands).has_topic(207),has_output(147),has_input(56) now emitted — previously 0.part_of,develops_from,contains) to ~180, addinghas part,regulates/positively/negatively regulates,occurs in,in taxon,capable of, the BSPO spatial relations, and UBERON's own connectivity relations. Parse time unchanged (~13s on the 96 MB file).Follow-ups (not in this PR)
treeView/ hierarchy path is still OBO-only and whitelist-based; broadening it changes the class tree and is deferred.metadata/obo/*remapping (e.g.part_ofmay now appear both under its own IRI and underobo/part_of).