You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Inherit relationships through the ontology #43
When creating subclasses in the ontology, it's great that the attributes are inherited and can be added in the mappings.
Relationships don't get the same functionality - if there are relationships defined on the parent class, data cannot be mapped to the relationship for the subclass and no relationships are created in the knowledge graph for the subclass.
Proposed Solution
Either:
Create an explicit mapping for relationships for the subclass when a parent has a defined relationship.
This could result in a combination explosion for mappings, especially for self-referencing relationships.
Load a relationship for the subclass based on the mapping from the parent class.
This would require resolving which subclass the mapping should be applied to when loading.
Area
Mapping (Manual / SparkSQL)
Additional Context
It's possible to assign a mapping for both the parent and subclass entities, and their id's don't have to be the same. This leads to some modeling considerations that might influence how inherited relationships can work:
If the knowledge graph loads entities at parent and subclass levels and the id's are the same, should both instances be loaded into separate entities or merged together at the subclass level?
Should the modeler define a relationship between the parent and subclass to inform they are the same, or should the equality of the instances be inferred?
If equality is inferred, can the query endpoints and AI chat functionality deduce the equality at execution time from the ontology, or would it be better to materialize these equality relationships using inference rules?
I explored approach 2, using one mapping to drive multiple entities and mappings.
This seems like it should be possible using R2RML string templates if the class can be expressed from the data source - e.g. added as a CASE WHEN to create a class column representing the entity. Then the mapping for an entity could be:
I tried to define this in R2RML manually and import - it didn't map to any classes and the R2RML could not be generated, breaking the build of the knowledge graph.
This would not fit natively within the current assumptions of the UI. So either it would have to be built in as a native feature, or it would require an "advanced" mapping mode that would support handcoded R2RML that could be used directly in the build phase.
This landed in 0.9.0. We went with the second idea from the issue: do not clone the relationship mapping onto every subclass. The object property stays declared on the parent; subclasses inherit it at read time.
What you get:
Studio / Mapping canvas — dashed subclass → range edges for inherited outgoing relations.
Entity panel — read-only “inherited from <parent>” list; Mapping Status links open the declaring class mapping.
Mapping / KG build — one SQL / R2RML triple map per property URI, on the class that declares the relation. Subclass instances that also type as the parent pick up those triples via rdfs:subClassOf. No second mapping on the child, so no mapping-combinatorial explosion (including self-loops).
OWL export — still rdfs:domain on the declaring class plus rdfs:subClassOf on the child.
That also explains the R2RML experiment with {class} templates: OntoBricks still assumes one mapping per class/property URI. We did not add an “advanced” hand-coded R2RML mode.
Not in scope (on purpose): incoming (range) inheritance, per-subclass relationship SQL, and inferring that a parent instance and a subclass instance are the same individual when their mapped IDs differ. Those stay two ABox nodes unless you model them as the same IRI (or add an explicit same-as / identity rule). If parent and subclass mappings share the same IRI, OWL already treats the subclass instance as a valid subject of the parent property.
Closing as completed in 0.9.0. If a case still fails (subclass KG with a distinct IRI from the parent, self-referencing properties, etc.), reopen with that example.
Activity
ulsmo commentedon Jun 24, 2026
I explored approach 2, using one mapping to drive multiple entities and mappings.
This seems like it should be possible using R2RML string templates if the class can be expressed from the data source - e.g. added as a CASE WHEN to create a class column representing the entity. Then the mapping for an entity could be:
and for a relationship:
I tried to define this in R2RML manually and import - it didn't map to any classes and the R2RML could not be generated, breaking the build of the knowledge graph.
This would not fit natively within the current assumptions of the UI. So either it would have to be built in as a native feature, or it would require an "advanced" mapping mode that would support handcoded R2RML that could be used directly in the build phase.
benoitcayladbx commentedon Oct 26, 2026
This landed in 0.9.0. We went with the second idea from the issue: do not clone the relationship mapping onto every subclass. The object property stays declared on the parent; subclasses inherit it at read time.
What you get:
rdfs:subClassOf. No second mapping on the child, so no mapping-combinatorial explosion (including self-loops).rdfs:domainon the declaring class plusrdfs:subClassOfon the child.That also explains the R2RML experiment with
{class}templates: OntoBricks still assumes one mapping per class/property URI. We did not add an “advanced” hand-coded R2RML mode.Not in scope (on purpose): incoming (range) inheritance, per-subclass relationship SQL, and inferring that a parent instance and a subclass instance are the same individual when their mapped IDs differ. Those stay two ABox nodes unless you model them as the same IRI (or add an explicit same-as / identity rule). If parent and subclass mappings share the same IRI, OWL already treats the subclass instance as a valid subject of the parent property.
Docs: user guide “Inherited relations”; architecture “Inherited outgoing relations”. Tests:
tests/units/ontology/test_inherited_relations.py,tests/units/front/test_inherited_relations_ui.py.Closing as completed in 0.9.0. If a case still fails (subclass KG with a distinct IRI from the parent, self-referencing properties, etc.), reopen with that example.