Skip to content

rdfs_tools: derive class attributes from schema:domainIncludes as well as rdfs:domain - #81

Merged
Haigutus merged 2 commits into
mainfrom
feat/rdfs-domainincludes
Jul 18, 2026
Merged

rdfs_tools: derive class attributes from schema:domainIncludes as well as rdfs:domain#81
Haigutus merged 2 commits into
mainfrom
feat/rdfs-domainincludes

Conversation

@Haigutus

Copy link
Copy Markdown
Owner

Reads the attribute→class binding from schema:domainIncludes in addition to rdfs:domain in the RDFS schema generator (rdfs_tools.get_class_parameters, the single derivation point used by cim_rdfs_to_json).

Why

The ENTSO-E DatasetMetadata vocabulary is moving reused external terms (dcterms:, prov:, dcat:, adms:, RDF reification) off rdfs:domain and onto the non-inferential schema:domainIncludes, to stop ontology hijacking of terms CIM does not own (entsoe/application-profiles-library#92; convention implemented in entsoe/application-profiles-library#99). CIM-owned terms keep rdfs:domain. This lets our schema generator pick up those attributes without the external terms being re-hijacked, so 2.4.2/2.5-style bundles become onboardable.

Change

get_class_parameters now matches KEY in ['domain', 'domainIncludes']. The parser already yields KEY='domainIncludes' with the full class URI as VALUE (identical shape to rdfs:domain), so it's a one-line, purely additive change — 2.4.1 bundles (which use only rdfs:domain) are unaffected.

Test

New mixed-linkage test: a class with one attribute bound via rdfs:domain and one via schema:domainIncludes — both are found. Full suite green (720 passed); test_rdfs_tools + test_roundtrip_nc cover it.

Kristjan Vilgo added 2 commits July 18, 2026 20:57
…l as rdfs:domain

get_class_parameters now reads attribute->class binding from both rdfs:domain
(CIM-owned terms) and schema:domainIncludes (reused external terms, the
non-inferential convention from application-profiles-library#92). Additive:
2.4.1 bundles (rdfs:domain only) are unaffected; DatasetMetadata profiles that
express reused-term linkage via schema:domainIncludes are now onboardable
without re-hijacking the external terms. Covered by a mixed-linkage test.
… entries

Previously an rdf:Property with no rdfs:domain and no schema:domainIncludes was
dropped entirely — the generator only emitted attributes while walking classes,
so an unbound property's definition (datatype, multiplicity, description) was
lost. Now such orphaned properties are still written as top-level entries
(same structure, no extra flags), just not referenced by any class's parameter
list, and a logger.warning names them. A consumer can recover the unreferenced
set by diffing property entries against the class parameter lists.

The per-attribute build is factored into a nested add_parameter() helper reused
by both the class walk and the orphan pass. Orphans are detected by absence of
any domain/domainIncludes binding — a property that is bound but skipped for
other reasons (e.g. an unused inverse association) is not an orphan, so a
consistent profile like NC 2.4.1 produces no orphan warning and an unchanged
bundle (verified). Tested both cases.
@Haigutus
Haigutus merged commit cebd07e into main Jul 18, 2026
9 checks passed
Haigutus added a commit that referenced this pull request Jul 18, 2026
chore(release): CHANGELOG for #79/#81 + ignore qlever submodule build dirt
@Haigutus
Haigutus deleted the feat/rdfs-domainincludes branch July 18, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant