Class: Chemicalml::Convention::Molecular::Constraints::DictRefShouldResolve
- Inherits:
-
Constraint::NodeConstraint
- Object
- Constraint
- Constraint::NodeConstraint
- Chemicalml::Convention::Molecular::Constraints::DictRefShouldResolve
- Defined in:
- lib/chemicalml/convention/molecular/constraints/dict_ref_should_resolve.rb
Overview
Walks the document and warns on any element whose dictRef
attribute cannot be resolved against the built-in
dictionaries. Catches typos like dictRef="cml:bpingpoint".
DocumentConstraint — needs the whole tree, but the resolver works per-node so it's just a wrapper around the per-node check.
Instance Method Summary collapse
Methods inherited from Constraint::NodeConstraint
Instance Method Details
#check_node(node, path) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/chemicalml/convention/molecular/constraints/dict_ref_should_resolve.rb', line 26 def check_node(node, path) dict_ref = node.dict_ref.to_s.strip return [] if dict_ref.empty? return [] if resolves?(dict_ref) [violation(path: path_fingerprint(node, path), message: "#{node.element_name} #{node_id_or_blank(node).inspect} " \ "dictRef #{dict_ref.inspect} does not resolve against any built-in dictionary", severity: :warning, value: dict_ref)] end |