rdfs_tools: derive class attributes from schema:domainIncludes as well as rdfs:domain - #81
Merged
Merged
Conversation
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.
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.
Reads the attribute→class binding from
schema:domainIncludesin addition tordfs:domainin the RDFS schema generator (rdfs_tools.get_class_parameters, the single derivation point used bycim_rdfs_to_json).Why
The ENTSO-E DatasetMetadata vocabulary is moving reused external terms (
dcterms:,prov:,dcat:,adms:, RDF reification) offrdfs:domainand onto the non-inferentialschema: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 keeprdfs: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_parametersnow matchesKEY in ['domain', 'domainIncludes']. The parser already yieldsKEY='domainIncludes'with the full class URI as VALUE (identical shape tordfs:domain), so it's a one-line, purely additive change — 2.4.1 bundles (which use onlyrdfs:domain) are unaffected.Test
New mixed-linkage test: a class with one attribute bound via
rdfs:domainand one viaschema:domainIncludes— both are found. Full suite green (720 passed);test_rdfs_tools+test_roundtrip_nccover it.