Module: Chemicalml::Cml::Base::Reaction

Included in:
Schema24::Reaction, Schema3::Reaction
Defined in:
lib/chemicalml/cml/base/reaction.rb

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/chemicalml/cml/base/reaction.rb', line 7

def self.included(klass)
  klass.class_eval do
    include Chemicalml::Cml::Role::Reaction
    attribute :id, :string
    attribute :title, :string
    attribute :type, :string
    attribute :state, :string
    attribute :dict_ref, :string
    attribute :convention, :string
    attribute :reactant_list, :reactantList
    attribute :product_list, :productList

                attribute :spectator_list, :spectatorList
    attribute :condition_list, :conditionList
    attribute :metadata_lists, :metadataList, collection: true

    attribute :reaction_format, :string
    attribute :ref, :string
    attribute :reaction_role, :string
    attribute :reaction_type, :string
    attribute :atom_map, :string
    attribute :electron_map, :string
    attribute :bond_map, :string
    attribute :yield, :string
    xml do
      namespace Chemicalml::Cml::Namespace
      root "reaction"
      map_attribute "id", to: :id
      map_attribute "title", to: :title
      map_attribute "type", to: :type
      map_attribute "state", to: :state
      map_attribute "dictRef", to: :dict_ref
      map_attribute "convention", to: :convention
      map_element "reactantList", to: :reactant_list
      map_element "productList", to: :product_list
      map_attribute "reactionFormat", to: :reaction_format
      map_attribute "ref", to: :ref
      map_attribute "reactionRole", to: :reaction_role
      map_attribute "reactionType", to: :reaction_type
      map_attribute "atomMap", to: :atom_map
      map_attribute "electronMap", to: :electron_map
      map_attribute "bondMap", to: :bond_map
      map_attribute "yield", to: :yield
    end
  end
end