Class: Glossarist::Rdf::GlossNaryRelation
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Glossarist::Rdf::GlossNaryRelation
- Defined in:
- lib/glossarist/rdf/gloss_nary_relation.rb
Overview
Shared base for typed n-ary relation RDF views (GlossPartitiveRelation, GlossGenericRelation, future leaves).
Concrete leaves override the rdf do block to declare their
type-specific subject prefix, types declaration, member-class
attribute, and link predicate name. The deterministic_id and
criterion_fingerprint algorithms are inherited unchanged.
Direct Known Subclasses
Class Method Summary collapse
-
.criterion_fingerprint(criterion) ⇒ Object
Stable, ordering-insensitive fingerprint of a localized criterion hash.
-
.deterministic_id(_relation) ⇒ Object
Content-derived subject identifier.
Class Method Details
.criterion_fingerprint(criterion) ⇒ Object
Stable, ordering-insensitive fingerprint of a localized criterion hash. Two relations with the same comprehensive, completeness, and criterion produce the same fingerprint regardless of hash-iteration order.
47 48 49 50 51 52 53 |
# File 'lib/glossarist/rdf/gloss_nary_relation.rb', line 47 def self.criterion_fingerprint(criterion) return nil unless criterion.is_a?(Hash) && !criterion.empty? criterion.sort_by { |k, _| k.to_s } .map { |k, v| "#{k}=#{v}" } .join(";") end |
.deterministic_id(_relation) ⇒ Object
Content-derived subject identifier. Combines identifier, comprehensive_uri, completeness, criterion fingerprint, and each member fingerprint. Same content → same hash across instances, runs, and processes.
Concrete subclasses override to specify the member attribute name and member deterministic_id callable.
38 39 40 41 |
# File 'lib/glossarist/rdf/gloss_nary_relation.rb', line 38 def self.deterministic_id(_relation) raise NotImplementedError, "#{name}.deterministic_id must be overridden by the concrete leaf" end |