Class: Glossarist::ConceptReference

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/glossarist/concept_reference.rb

Overview

A typed reference to another concept, either local (within the same glossary) or external (in another concept registry).

Local references use concept_id without source. External references use source (a registry URN prefix) and concept_id to identify the target concept, or a direct urn field for formal URN references.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.domain(concept_id) ⇒ Object



25
26
27
# File 'lib/glossarist/concept_reference.rb', line 25

def self.domain(concept_id)
  new(concept_id: concept_id, ref_type: "domain")
end

Instance Method Details

#dedup_keyObject



38
39
40
# File 'lib/glossarist/concept_reference.rb', line 38

def dedup_key
  concept_id ? [source, concept_id] : [source, concept_id, term]
end

#external?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/glossarist/concept_reference.rb', line 34

def external?
  !local?
end

#local?Boolean

Returns:

  • (Boolean)


29
30
31
32
# File 'lib/glossarist/concept_reference.rb', line 29

def local?
  %w[local designation].include?(ref_type) ||
    (ref_type.nil? && (source.nil? || source.empty?))
end