Class: Glossarist::Validation::Rules::ExternalConceptRule
- Defined in:
- lib/glossarist/validation/rules/external_concept_rule.rb
Overview
Validates that external concepts referenced by hyperedges have
a provided_by edge for resolution. Mirrors concept-model's
check-external-as-comprehensive validator, exposed as a
consumer-side Validation::Rule so it runs in the standard
validation pipeline.
Per concept-model docs/design/external-concepts.md: an external
concept (status: external) is referenced from this dataset but
defined elsewhere. Without a provided_by edge, the reference
dangles — there is no resolvable target. ISO 704 models this
case as a parenthetical term in the diagram; the data model
requires the resolution edge to exist.
Scope: concept (rule runs once per concept). The concept's
relations are inspected via context.relations; each
relation's comprehensive + members are checked.
Requires a concept_resolver on the context. Without one,
the rule is a no-op (cannot detect externals without
resolution).
Instance Method Summary collapse
- #applicable?(context) ⇒ Boolean
- #category ⇒ Object
- #check(context) ⇒ Object
- #code ⇒ Object
- #scope ⇒ Object
- #severity ⇒ Object
Methods inherited from Base
Instance Method Details
#applicable?(context) ⇒ Boolean
32 33 34 35 36 37 38 |
# File 'lib/glossarist/validation/rules/external_concept_rule.rb', line 32 def applicable?(context) return false unless context.concept.is_a?(V3::ManagedConcept) return false unless context.concept_resolver return false if context.relations.empty? true end |
#category ⇒ Object
28 |
# File 'lib/glossarist/validation/rules/external_concept_rule.rb', line 28 def category = :schema |
#check(context) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/glossarist/validation/rules/external_concept_rule.rb', line 40 def check(context) resolver = context.concept_resolver issues = [] context.relations.each_with_index do |rel, idx| check_comprehensive(rel, idx, context.file_name, resolver, issues) check_members(rel, idx, context.file_name, resolver, issues) end issues end |
#code ⇒ Object
27 |
# File 'lib/glossarist/validation/rules/external_concept_rule.rb', line 27 def code = "GLS-222" |
#scope ⇒ Object
30 |
# File 'lib/glossarist/validation/rules/external_concept_rule.rb', line 30 def scope = :concept |
#severity ⇒ Object
29 |
# File 'lib/glossarist/validation/rules/external_concept_rule.rb', line 29 def severity = "warning" |