Module: Chemicalml::Cml::Elements

Defined in:
lib/chemicalml/cml/elements.rb

Overview

Single source of truth for the set of CML element wire classes each schema version must register. Adding a new CML element = adding one entry to ALL. Both Schema3::Configuration and Schema24::Configuration walk this list.

Constant Summary collapse

ALL =
{
  # Originally modeled elements
  Array:             :array,
  Atom:              :atom,
  AtomArray:         :atomArray,
  AtomParity:        :atomParity,
  Bond:              :bond,
  BondArray:         :bondArray,
  BondStereo:        :bondStereo,
  Dictionary:        :dictionary,
  DictionaryEntry:   :entry,
  Document:          :document,
  Formula:           :formula,
  Identifier:        :identifier,
  Label:             :label,
  List:              :list,
  Matrix:            :matrix,
  Metadata:          :metadata,
  MetadataList:      :metadataList,
  Module:            :module,
  Molecule:          :molecule,
  Name:              :name,
  Parameter:         :parameter,
  ParameterList:     :parameterList,
  Product:           :product,
  ProductList:       :productList,
  Property:          :property,
  PropertyList:      :propertyList,
  Reaction:          :reaction,
  ReactionList:      :reactionList,
  Reactant:          :reactant,
  ReactantList:      :reactantList,
  Scalar:            :scalar,
  Substance:         :substance,
  Unit:              :unit,
  UnitList:          :unitList,
  UnitType:          :unitType,
  UnitTypeList:      :unitTypeList,
  # Full schema coverage — every CML element from the XSD
  Abundance:           :abundance,
  Action:              :action,
  ActionList:          :actionList,
  Amount:              :amount,
  Angle:               :angle,
  AnyCml:              :anyCml,
  ArrayList:           :arrayList,
  AtomSet:             :atomSet,
  AtomType:            :atomType,
  AtomTypeList:        :atomTypeList,
  AtomicBasisFunction: :atomicBasisFunction,
  Band:                :band,
  BandList:            :bandList,
  BasisSet:            :basisSet,
  BondSet:             :bondSet,
  BondType:            :bondType,
  BondTypeList:        :bondTypeList,
  CellParameter:       :cellParameter,
  ConditionList:       :conditionList,
  Crystal:             :crystal,
  Definition:          :definition,
  Description:         :description,
  Dimension:           :dimension,
  Documentation:       :documentation,
  Eigen:               :eigen,
  Electron:            :electron,
  Fragment:            :fragment,
  FragmentList:        :fragmentList,
  Gradient:            :gradient,
  Isotope:             :isotope,
  IsotopeList:         :isotopeList,
  Join:                :join,
  Kpoint:              :kpoint,
  KpointList:          :kpointList,
  Lattice:             :lattice,
  LatticeVector:       :latticeVector,
  Length:              :length,
  Line3:               :line3,
  Link:                :link,
  Map:                 :map,
  Mechanism:           :mechanism,
  MechanismComponent:  :mechanismComponent,
  MoleculeList:        :moleculeList,
  Object:              :object,
  Observation:         :observation,
  Particle:            :particle,
  Peak:                :peak,
  PeakGroup:           :peakGroup,
  PeakList:            :peakList,
  PeakStructure:       :peakStructure,
  Plane3:              :plane3,
  Point3:              :point3,
  Potential:           :potential,
  PotentialForm:       :potentialForm,
  PotentialList:       :potentialList,
  ReactionScheme:      :reactionScheme,
  ReactionStep:        :reactionStep,
  ReactionStepList:    :reactionStepList,
  ReactiveCentre:      :reactiveCentre,
  Region:              :region,
  Sample:              :sample,
  Spectator:           :spectator,
  SpectatorList:       :spectatorList,
  Spectrum:            :spectrum,
  SpectrumData:        :spectrumData,
  SpectrumList:        :spectrumList,
  Sphere3:             :sphere3,
  Stmml:               :stmml,
  SubstanceList:       :substanceList,
  Symmetry:            :symmetry,
  System:              :system,
  Table:               :table,
  TableCell:           :tableCell,
  TableContent:        :tableContent,
  TableHeader:         :tableHeader,
  TableHeaderCell:     :tableHeaderCell,
  TableRow:            :tableRow,
  TableRowList:        :tableRowList,
  Torsion:             :torsion,
  Transform3:          :transform3,
  TransitionState:     :transitionState,
  Vector3:             :vector3,
  Xaxis:               :xaxis,
  Yaxis:               :yaxis,
  ZMatrix:             :zMatrix,
}.freeze
SCHEMA3_ONLY =

Elements that exist in Schema 3 but NOT in Schema 2.4.

%i[Module].freeze
XML_TO_CLASS =

Reverse index: XML element name (String) → Ruby class name (Symbol). O(1) lookup for VersionedParser root detection.

ALL.each_with_object({}) do |(cls, xml_id), h|
  h[xml_id.to_s] = cls
end.freeze