Class: Glossarist::ConceptReference
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Glossarist::ConceptReference
- Defined in:
- lib/glossarist/concept_reference.rb
Instance Method Summary collapse
Instance Method Details
#external? ⇒ Boolean
22 23 24 |
# File 'lib/glossarist/concept_reference.rb', line 22 def external? !local? end |
#local? ⇒ Boolean
17 18 19 20 |
# File 'lib/glossarist/concept_reference.rb', line 17 def local? %w[local designation].include?(ref_type) || (ref_type.nil? && (source.nil? || source.empty?)) end |
#to_gcr_hash ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/glossarist/concept_reference.rb', line 37 def to_gcr_hash h = { "term" => term } h["concept_id"] = concept_id if concept_id h["source"] = source if source h["ref_type"] = ref_type if ref_type h.compact end |
#to_urn ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/glossarist/concept_reference.rb', line 26 def to_urn return nil unless external? return nil unless source && concept_id case source when /\Aurn:iec/ then "#{source}-#{concept_id}" when /\Aurn:iso/ then "#{source}:term:#{concept_id}" else "#{source}/#{concept_id}" end end |