Class: Metanorma::Plugin::Glossarist::SectionCascade

Inherits:
Object
  • Object
show all
Defined in:
lib/metanorma/plugin/glossarist/section_cascade.rb

Overview

Resolves whether a concept is a member of a target section, including via cascading ancestor traversal (concept-model: gloss:hasChildSection is owl:TransitiveProperty — a concept in “3.1.1” is also in “3.1” and “3”).

Resolution order:

1. DatasetRegister#concept_section_ids(concept) when register is
   available — the canonical V3 path with full cascading.
2. Direct ConceptReference domain match (ref_type: "section") —
   legacy/fallback when no register is provided. Still applies
   cascading by walking the register's section tree if available.

Constant Summary collapse

SECTION_REF_TYPE =
"section"

Instance Method Summary collapse

Constructor Details

#initialize(register = nil) ⇒ SectionCascade

Returns a new instance of SectionCascade.



20
21
22
# File 'lib/metanorma/plugin/glossarist/section_cascade.rb', line 20

def initialize(register = nil)
  @register = register
end

Instance Method Details

#member?(concept, target_id) ⇒ Boolean

True if the concept belongs to target_id or any of target_id’s descendant sections (cascading membership).

Returns:

  • (Boolean)


26
27
28
29
30
31
32
33
34
# File 'lib/metanorma/plugin/glossarist/section_cascade.rb', line 26

def member?(concept, target_id)
  return false unless concept&.data

  if @register
    cascade_member?(concept, target_id)
  else
    local_member?(concept, target_id)
  end
end