expressir 2.1.13 → 2.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +7 -82
  3. data/.rubocop_todo.yml +15 -74
  4. data/Gemfile +4 -5
  5. data/expressir.gemspec +3 -1
  6. data/lib/expressir/express/cache.rb +4 -6
  7. data/lib/expressir/express/formatter.rb +92 -63
  8. data/lib/expressir/express/model_visitor.rb +10 -9
  9. data/lib/expressir/express/parser.rb +10 -8
  10. data/lib/expressir/express/resolve_references_model_visitor.rb +0 -3
  11. data/lib/expressir/express/visitor.rb +2 -1
  12. data/lib/expressir/liquid.rb +0 -17
  13. data/lib/expressir/model/cache.rb +9 -8
  14. data/lib/expressir/model/data_types/aggregate.rb +6 -11
  15. data/lib/expressir/model/data_types/array.rb +14 -20
  16. data/lib/expressir/model/data_types/bag.rb +10 -14
  17. data/lib/expressir/model/data_types/binary.rb +8 -11
  18. data/lib/expressir/model/data_types/boolean.rb +6 -1
  19. data/lib/expressir/model/data_types/enumeration.rb +10 -14
  20. data/lib/expressir/model/data_types/enumeration_item.rb +3 -5
  21. data/lib/expressir/model/data_types/generic.rb +4 -6
  22. data/lib/expressir/model/data_types/generic_entity.rb +4 -6
  23. data/lib/expressir/model/data_types/integer.rb +6 -1
  24. data/lib/expressir/model/data_types/list.rb +12 -17
  25. data/lib/expressir/model/data_types/logical.rb +6 -1
  26. data/lib/expressir/model/data_types/number.rb +6 -1
  27. data/lib/expressir/model/data_types/real.rb +6 -8
  28. data/lib/expressir/model/data_types/select.rb +12 -17
  29. data/lib/expressir/model/data_types/set.rb +10 -14
  30. data/lib/expressir/model/data_types/string.rb +8 -11
  31. data/lib/expressir/model/declarations/attribute.rb +17 -26
  32. data/lib/expressir/model/declarations/constant.rb +8 -14
  33. data/lib/expressir/model/declarations/entity.rb +18 -29
  34. data/lib/expressir/model/declarations/function.rb +25 -39
  35. data/lib/expressir/model/declarations/interface.rb +12 -16
  36. data/lib/expressir/model/declarations/interface_item.rb +7 -11
  37. data/lib/expressir/model/declarations/interfaced_item.rb +11 -18
  38. data/lib/expressir/model/declarations/parameter.rb +8 -14
  39. data/lib/expressir/model/declarations/procedure.rb +23 -36
  40. data/lib/expressir/model/declarations/remark_item.rb +8 -11
  41. data/lib/expressir/model/declarations/rule.rb +27 -42
  42. data/lib/expressir/model/declarations/schema.rb +59 -58
  43. data/lib/expressir/model/declarations/schema_version.rb +7 -10
  44. data/lib/expressir/model/declarations/schema_version_item.rb +7 -10
  45. data/lib/expressir/model/declarations/subtype_constraint.rb +12 -20
  46. data/lib/expressir/model/declarations/type.rb +10 -17
  47. data/lib/expressir/model/declarations/unique_rule.rb +6 -11
  48. data/lib/expressir/model/declarations/variable.rb +8 -14
  49. data/lib/expressir/model/declarations/where_rule.rb +6 -11
  50. data/lib/expressir/model/expressions/aggregate_initializer.rb +6 -8
  51. data/lib/expressir/model/expressions/aggregate_initializer_item.rb +8 -11
  52. data/lib/expressir/model/expressions/binary_expression.rb +40 -42
  53. data/lib/expressir/model/expressions/entity_constructor.rb +8 -11
  54. data/lib/expressir/model/expressions/function_call.rb +8 -11
  55. data/lib/expressir/model/expressions/interval.rb +16 -22
  56. data/lib/expressir/model/expressions/query_expression.rb +8 -14
  57. data/lib/expressir/model/expressions/unary_expression.rb +11 -14
  58. data/lib/expressir/model/identifier.rb +8 -25
  59. data/lib/expressir/model/literals/binary.rb +6 -8
  60. data/lib/expressir/model/literals/integer.rb +6 -8
  61. data/lib/expressir/model/literals/logical.rb +9 -11
  62. data/lib/expressir/model/literals/real.rb +6 -8
  63. data/lib/expressir/model/literals/string.rb +8 -11
  64. data/lib/expressir/model/model_element.rb +164 -131
  65. data/lib/expressir/model/references/attribute_reference.rb +8 -11
  66. data/lib/expressir/model/references/group_reference.rb +8 -11
  67. data/lib/expressir/model/references/index_reference.rb +10 -14
  68. data/lib/expressir/model/references/simple_reference.rb +10 -13
  69. data/lib/expressir/model/repository.rb +5 -7
  70. data/lib/expressir/model/statements/alias.rb +8 -14
  71. data/lib/expressir/model/statements/assignment.rb +8 -11
  72. data/lib/expressir/model/statements/case.rb +10 -14
  73. data/lib/expressir/model/statements/case_action.rb +7 -10
  74. data/lib/expressir/model/statements/compound.rb +6 -8
  75. data/lib/expressir/model/statements/escape.rb +6 -1
  76. data/lib/expressir/model/statements/if.rb +10 -14
  77. data/lib/expressir/model/statements/null.rb +6 -1
  78. data/lib/expressir/model/statements/procedure_call.rb +8 -11
  79. data/lib/expressir/model/statements/repeat.rb +16 -26
  80. data/lib/expressir/model/statements/return.rb +6 -8
  81. data/lib/expressir/model/statements/skip.rb +6 -1
  82. data/lib/expressir/model/supertype_expressions/binary_supertype_expression.rb +12 -16
  83. data/lib/expressir/model/supertype_expressions/oneof_supertype_expression.rb +6 -8
  84. data/lib/expressir/model.rb +1 -8
  85. data/lib/expressir/version.rb +1 -1
  86. data/lib/expressir.rb +7 -3
  87. metadata +32 -89
  88. data/lib/expressir/liquid/cache_drop.rb +0 -20
  89. data/lib/expressir/liquid/data_type_drop.rb +0 -8
  90. data/lib/expressir/liquid/data_types/aggregate_drop.rb +0 -21
  91. data/lib/expressir/liquid/data_types/array_drop.rb +0 -34
  92. data/lib/expressir/liquid/data_types/bag_drop.rb +0 -26
  93. data/lib/expressir/liquid/data_types/binary_drop.rb +0 -22
  94. data/lib/expressir/liquid/data_types/boolean_drop.rb +0 -10
  95. data/lib/expressir/liquid/data_types/enumeration_drop.rb +0 -30
  96. data/lib/expressir/liquid/data_types/enumeration_item_drop.rb +0 -17
  97. data/lib/expressir/liquid/data_types/generic_drop.rb +0 -17
  98. data/lib/expressir/liquid/data_types/generic_entity_drop.rb +0 -17
  99. data/lib/expressir/liquid/data_types/integer_drop.rb +0 -10
  100. data/lib/expressir/liquid/data_types/list_drop.rb +0 -30
  101. data/lib/expressir/liquid/data_types/logical_drop.rb +0 -10
  102. data/lib/expressir/liquid/data_types/number_drop.rb +0 -10
  103. data/lib/expressir/liquid/data_types/real_drop.rb +0 -18
  104. data/lib/expressir/liquid/data_types/select_drop.rb +0 -34
  105. data/lib/expressir/liquid/data_types/set_drop.rb +0 -26
  106. data/lib/expressir/liquid/data_types/string_drop.rb +0 -22
  107. data/lib/expressir/liquid/declaration_drop.rb +0 -8
  108. data/lib/expressir/liquid/declarations/attribute_drop.rb +0 -37
  109. data/lib/expressir/liquid/declarations/constant_drop.rb +0 -25
  110. data/lib/expressir/liquid/declarations/entity_drop.rb +0 -65
  111. data/lib/expressir/liquid/declarations/function_drop.rb +0 -93
  112. data/lib/expressir/liquid/declarations/interface_drop.rb +0 -30
  113. data/lib/expressir/liquid/declarations/interface_item_drop.rb +0 -22
  114. data/lib/expressir/liquid/declarations/interfaced_item_drop.rb +0 -34
  115. data/lib/expressir/liquid/declarations/parameter_drop.rb +0 -25
  116. data/lib/expressir/liquid/declarations/procedure_drop.rb +0 -89
  117. data/lib/expressir/liquid/declarations/remark_item_drop.rb +0 -22
  118. data/lib/expressir/liquid/declarations/rule_drop.rb +0 -105
  119. data/lib/expressir/liquid/declarations/schema_drop.rb +0 -131
  120. data/lib/expressir/liquid/declarations/schema_version_drop.rb +0 -26
  121. data/lib/expressir/liquid/declarations/schema_version_item_drop.rb +0 -22
  122. data/lib/expressir/liquid/declarations/subtype_constraint_drop.rb +0 -37
  123. data/lib/expressir/liquid/declarations/type_drop.rb +0 -37
  124. data/lib/expressir/liquid/declarations/unique_rule_drop.rb +0 -21
  125. data/lib/expressir/liquid/declarations/variable_drop.rb +0 -25
  126. data/lib/expressir/liquid/declarations/where_rule_drop.rb +0 -21
  127. data/lib/expressir/liquid/expression_drop.rb +0 -8
  128. data/lib/expressir/liquid/expressions/aggregate_initializer_drop.rb +0 -24
  129. data/lib/expressir/liquid/expressions/aggregate_initializer_item_drop.rb +0 -22
  130. data/lib/expressir/liquid/expressions/binary_expression_drop.rb +0 -26
  131. data/lib/expressir/liquid/expressions/entity_constructor_drop.rb +0 -26
  132. data/lib/expressir/liquid/expressions/function_call_drop.rb +0 -26
  133. data/lib/expressir/liquid/expressions/interval_drop.rb +0 -34
  134. data/lib/expressir/liquid/expressions/query_expression_drop.rb +0 -25
  135. data/lib/expressir/liquid/expressions/unary_expression_drop.rb +0 -22
  136. data/lib/expressir/liquid/identifier_drop.rb +0 -33
  137. data/lib/expressir/liquid/literal_drop.rb +0 -8
  138. data/lib/expressir/liquid/literals/binary_drop.rb +0 -18
  139. data/lib/expressir/liquid/literals/integer_drop.rb +0 -18
  140. data/lib/expressir/liquid/literals/logical_drop.rb +0 -18
  141. data/lib/expressir/liquid/literals/real_drop.rb +0 -18
  142. data/lib/expressir/liquid/literals/string_drop.rb +0 -22
  143. data/lib/expressir/liquid/model_element_drop.rb +0 -33
  144. data/lib/expressir/liquid/reference_drop.rb +0 -8
  145. data/lib/expressir/liquid/references/attribute_reference_drop.rb +0 -22
  146. data/lib/expressir/liquid/references/group_reference_drop.rb +0 -22
  147. data/lib/expressir/liquid/references/index_reference_drop.rb +0 -26
  148. data/lib/expressir/liquid/references/simple_reference_drop.rb +0 -22
  149. data/lib/expressir/liquid/repository_drop.rb +0 -25
  150. data/lib/expressir/liquid/statement_drop.rb +0 -8
  151. data/lib/expressir/liquid/statements/alias_drop.rb +0 -29
  152. data/lib/expressir/liquid/statements/assignment_drop.rb +0 -22
  153. data/lib/expressir/liquid/statements/case_action_drop.rb +0 -26
  154. data/lib/expressir/liquid/statements/case_drop.rb +0 -30
  155. data/lib/expressir/liquid/statements/compound_drop.rb +0 -22
  156. data/lib/expressir/liquid/statements/escape_drop.rb +0 -10
  157. data/lib/expressir/liquid/statements/if_drop.rb +0 -34
  158. data/lib/expressir/liquid/statements/null_drop.rb +0 -10
  159. data/lib/expressir/liquid/statements/procedure_call_drop.rb +0 -26
  160. data/lib/expressir/liquid/statements/repeat_drop.rb +0 -45
  161. data/lib/expressir/liquid/statements/return_drop.rb +0 -18
  162. data/lib/expressir/liquid/statements/skip_drop.rb +0 -10
  163. data/lib/expressir/liquid/supertype_expression_drop.rb +0 -8
  164. data/lib/expressir/liquid/supertype_expressions/binary_supertype_expression_drop.rb +0 -26
  165. data/lib/expressir/liquid/supertype_expressions/oneof_supertype_expression_drop.rb +0 -22
  166. data/lib/expressir/model/data_type.rb +0 -9
  167. data/lib/expressir/model/declaration.rb +0 -9
  168. data/lib/expressir/model/expression.rb +0 -9
  169. data/lib/expressir/model/literal.rb +0 -9
  170. data/lib/expressir/model/reference.rb +0 -9
  171. data/lib/expressir/model/statement.rb +0 -9
  172. data/lib/expressir/model/supertype_expression.rb +0 -9
@@ -3,29 +3,21 @@ module Expressir
3
3
  module Declarations
4
4
  # Specified in ISO 10303-11:2004
5
5
  # - section 9.7 Subtype constraints
6
- class SubtypeConstraint < Declaration
6
+ class SubtypeConstraint < ModelElement
7
7
  include Identifier
8
8
 
9
- model_attr_accessor :applies_to, "Reference"
10
- model_attr_accessor :abstract, "Boolean"
11
- model_attr_accessor :total_over, "Array<Reference>"
12
- model_attr_accessor :supertype_expression, "SupertypeExpression"
9
+ attribute :applies_to, ModelElement
10
+ attribute :abstract, :boolean
11
+ attribute :total_over, ModelElement, collection: true
12
+ attribute :supertype_expression, ModelElement
13
+ attribute :_class, :string, default: -> { send(:name) }
13
14
 
14
- # @param [Hash] options
15
- # @option (see Identifier#initialize_identifier)
16
- # @option options [Reference] :applies_to
17
- # @option options [Boolean] :abstract
18
- # @option options [Array<Reference>] :total_over
19
- # @option options [SupertypeExpression] :supertype_expression
20
- def initialize(options = {})
21
- initialize_identifier(options)
22
-
23
- @applies_to = options[:applies_to]
24
- @abstract = options[:abstract]
25
- @total_over = options[:total_over] || []
26
- @supertype_expression = options[:supertype_expression]
27
-
28
- super
15
+ key_value do
16
+ map "_class", to: :_class, render_default: true
17
+ map "applies_to", to: :applies_to
18
+ map "abstract", to: :abstract
19
+ map "total_over", to: :total_over
20
+ map "supertype_expression", to: :supertype_expression
29
21
  end
30
22
 
31
23
  # @return [Array<Declaration>]
@@ -3,26 +3,19 @@ module Expressir
3
3
  module Declarations
4
4
  # Specified in ISO 10303-11:2004
5
5
  # - section 9.1 Type declaration
6
- class Type < Declaration
6
+ class Type < ModelElement
7
7
  include Identifier
8
8
 
9
- model_attr_accessor :underlying_type, "DataType"
10
- model_attr_accessor :where_rules, "Array<WhereRule>"
11
- model_attr_accessor :informal_propositions, "Array<RemarkItem>"
9
+ attribute :underlying_type, ModelElement
10
+ attribute :where_rules, WhereRule, collection: true
11
+ attribute :informal_propositions, RemarkItem, collection: true
12
+ attribute :_class, :string, default: -> { send(:name) }
12
13
 
13
- # @param [Hash] options
14
- # @option (see Identifier#initialize_identifier)
15
- # @option options [DataType] :underlying_type
16
- # @option options [Array<WhereRule>] :where_rules
17
- # @option options [Array<RemarkItem>] :informal_propositions
18
- def initialize(options = {})
19
- initialize_identifier(options)
20
-
21
- @underlying_type = options[:underlying_type]
22
- @where_rules = options[:where_rules] || []
23
- @informal_propositions = options[:informal_propositions] || []
24
-
25
- super
14
+ key_value do
15
+ map "_class", to: :_class, render_default: true
16
+ map "underlying_type", to: :underlying_type
17
+ map "where_rules", to: :where_rules
18
+ map "informal_propositions", to: :informal_propositions
26
19
  end
27
20
 
28
21
  # @return [Array<DataTypes::EnumerationItem>]
@@ -3,20 +3,15 @@ module Expressir
3
3
  module Declarations
4
4
  # Specified in ISO 10303-11:2004
5
5
  # - section 9.2.2.1 Uniqueness rule
6
- class UniqueRule < Declaration
6
+ class UniqueRule < ModelElement
7
7
  include Identifier
8
8
 
9
- model_attr_accessor :attributes, "Reference"
9
+ attribute :attributes, ModelElement, collection: true
10
+ attribute :_class, :string, default: -> { send(:name) }
10
11
 
11
- # @param [Hash] options
12
- # @option (see Identifier#initialize_identifier)
13
- # @option options [Reference] :attributes
14
- def initialize(options = {})
15
- initialize_identifier(options)
16
-
17
- @attributes = options[:attributes] || []
18
-
19
- super
12
+ key_value do
13
+ map "_class", to: :_class, render_default: true
14
+ map "attributes", to: :attributes
20
15
  end
21
16
 
22
17
  # @return [Array<Declaration>]
@@ -3,23 +3,17 @@ module Expressir
3
3
  module Declarations
4
4
  # Specified in ISO 10303-11:2004
5
5
  # - section 9.5.4 Local variables
6
- class Variable < Declaration
6
+ class Variable < ModelElement
7
7
  include Identifier
8
8
 
9
- model_attr_accessor :type, "DataType"
10
- model_attr_accessor :expression, "Expression"
9
+ attribute :type, ModelElement
10
+ attribute :expression, ModelElement
11
+ attribute :_class, :string, default: -> { send(:name) }
11
12
 
12
- # @param [Hash] options
13
- # @option (see Identifier#initialize_identifier)
14
- # @option options [DataType] :type
15
- # @option options [Expression] :expression
16
- def initialize(options = {})
17
- initialize_identifier(options)
18
-
19
- @type = options[:type]
20
- @expression = options[:expression]
21
-
22
- super
13
+ key_value do
14
+ map "_class", to: :_class, render_default: true
15
+ map "type", to: :type
16
+ map "expression", to: :expression
23
17
  end
24
18
 
25
19
  # @return [Array<Declaration>]
@@ -3,20 +3,15 @@ module Expressir
3
3
  module Declarations
4
4
  # Specified in ISO 10303-11:2004
5
5
  # - section 9.2.2.2 Domain rules (WHERE clause)
6
- class WhereRule < Declaration
6
+ class WhereRule < ModelElement
7
7
  include Identifier
8
8
 
9
- model_attr_accessor :expression, "Expression"
9
+ attribute :expression, ModelElement
10
+ attribute :_class, :string, default: -> { send(:name) }
10
11
 
11
- # @param [Hash] options
12
- # @option (see Identifier#initialize_identifier)
13
- # @option options [Expression] :expression
14
- def initialize(options = {})
15
- initialize_identifier(options)
16
-
17
- @expression = options[:expression]
18
-
19
- super
12
+ key_value do
13
+ map "_class", to: :_class, render_default: true
14
+ map "expression", to: :expression
20
15
  end
21
16
 
22
17
  # @return [Array<Declaration>]
@@ -3,15 +3,13 @@ module Expressir
3
3
  module Expressions
4
4
  # Specified in ISO 10303-11:2004
5
5
  # - section 12.9 Aggregate initializer
6
- class AggregateInitializer < Expression
7
- model_attr_accessor :items, "Array<AggregateInitializerItem>"
6
+ class AggregateInitializer < ModelElement
7
+ attribute :items, ModelElement, collection: true
8
+ attribute :_class, :string, default: -> { send(:name) }
8
9
 
9
- # @param [Hash] options
10
- # @option options [Array<AggregateInitializerItem>] :items
11
- def initialize(options = {})
12
- @items = options[:items] || []
13
-
14
- super
10
+ key_value do
11
+ map "_class", to: :_class, render_default: true
12
+ map "items", to: :items
15
13
  end
16
14
  end
17
15
  end
@@ -3,18 +3,15 @@ module Expressir
3
3
  module Expressions
4
4
  # Specified in ISO 10303-11:2004
5
5
  # - section 12.9 Aggregate initializer
6
- class AggregateInitializerItem < Expression
7
- model_attr_accessor :expression, "Expression"
8
- model_attr_accessor :repetition, "Expression"
6
+ class AggregateInitializerItem < ModelElement
7
+ attribute :expression, ModelElement
8
+ attribute :repetition, ModelElement
9
+ attribute :_class, :string, default: -> { send(:name) }
9
10
 
10
- # @param [Hash] options
11
- # @option options [Expression] :expression
12
- # @option options [Expression] :repetition
13
- def initialize(options = {})
14
- @expression = options[:expression]
15
- @repetition = options[:repetition]
16
-
17
- super
11
+ key_value do
12
+ map "_class", to: :_class, render_default: true
13
+ map "expression", to: :expression
14
+ map "repetition", to: :repetition
18
15
  end
19
16
  end
20
17
  end
@@ -9,50 +9,48 @@ module Expressir
9
9
  # - section 12.5 String operators
10
10
  # - section 12.6 Aggregate operators
11
11
  # - section 12.10 Complex entity instance construction operator
12
- class BinaryExpression < Expression
13
- ADDITION = :ADDITION
14
- AND = :AND
15
- COMBINE = :COMBINE
16
- EQUAL = :EQUAL
17
- EXPONENTIATION = :EXPONENTIATION
18
- GREATER_THAN = :GREATER_THAN
19
- GREATER_THAN_OR_EQUAL = :GREATER_THAN_OR_EQUAL
20
- IN = :IN
21
- INSTANCE_EQUAL = :INSTANCE_EQUAL
22
- INSTANCE_NOT_EQUAL = :INSTANCE_NOT_EQUAL
23
- INTEGER_DIVISION = :INTEGER_DIVISION
24
- LESS_THAN = :LESS_THAN
25
- LESS_THAN_OR_EQUAL = :LESS_THAN_OR_EQUAL
26
- LIKE = :LIKE
27
- MODULO = :MODULO
28
- MULTIPLICATION = :MULTIPLICATION
29
- NOT_EQUAL = :NOT_EQUAL
30
- OR = :OR
31
- REAL_DIVISION = :REAL_DIVISION
32
- SUBTRACTION = :SUBTRACTION
33
- XOR = :XOR
12
+ class BinaryExpression < ModelElement
13
+ ADDITION = "ADDITION".freeze
14
+ AND = "AND".freeze
15
+ COMBINE = "COMBINE".freeze
16
+ EQUAL = "EQUAL".freeze
17
+ EXPONENTIATION = "EXPONENTIATION".freeze
18
+ GREATER_THAN = "GREATER_THAN".freeze
19
+ GREATER_THAN_OR_EQUAL = "GREATER_THAN_OR_EQUAL".freeze
20
+ IN = "IN".freeze
21
+ INSTANCE_EQUAL = "INSTANCE_EQUAL".freeze
22
+ INSTANCE_NOT_EQUAL = "INSTANCE_NOT_EQUAL".freeze
23
+ INTEGER_DIVISION = "INTEGER_DIVISION".freeze
24
+ LESS_THAN = "LESS_THAN".freeze
25
+ LESS_THAN_OR_EQUAL = "LESS_THAN_OR_EQUAL".freeze
26
+ LIKE = "LIKE".freeze
27
+ MODULO = "MODULO".freeze
28
+ MULTIPLICATION = "MULTIPLICATION".freeze
29
+ NOT_EQUAL = "NOT_EQUAL".freeze
30
+ OR = "OR".freeze
31
+ REAL_DIVISION = "REAL_DIVISION".freeze
32
+ SUBTRACTION = "SUBTRACTION".freeze
33
+ XOR = "XOR".freeze
34
34
 
35
- model_attr_accessor :operator,
36
- ":ADDITION, :AND, :COMBINE, :EQUAL, :EXPONENTIATION, :GREATER_THAN, \
37
- :GREATER_THAN_OR_EQUAL, :IN, :INSTANCE_EQUAL, :INSTANCE_NOT_EQUAL, \
38
- :INTEGER_DIVISION, :LESS_THAN, :LESS_THAN_OR_EQUAL, :LIKE, :MODULO,\
39
- :MULTIPLICATION, :NOT_EQUAL, :OR, :REAL_DIVISION, :SUBTRACTION, :XOR"
40
- model_attr_accessor :operand1, "Expression"
41
- model_attr_accessor :operand2, "Expression"
35
+ attribute :operator, :string,
36
+ values: %w[
37
+ ADDITION AND COMBINE EQUAL EXPONENTIATION
38
+ GREATER_THAN
39
+ GREATER_THAN_OR_EQUAL IN INSTANCE_EQUAL
40
+ INSTANCE_NOT_EQUAL
41
+ INTEGER_DIVISION LESS_THAN LESS_THAN_OR_EQUAL LIKE
42
+ MODULO MULTIPLICATION NOT_EQUAL OR REAL_DIVISION
43
+ SUBTRACTION XOR
44
+ ]
45
+ attribute :operand1, ModelElement
46
+ attribute :operand2, ModelElement
47
+ attribute :_class, :string, default: -> { send(:name) }
42
48
 
43
- # @param [Hash] options
44
- # @option options [:ADDITION, :AND, :COMBINE, :EQUAL, :EXPONENTIATION, :GREATER_THAN,
45
- # :GREATER_THAN_OR_EQUAL, :IN, :INSTANCE_EQUAL, :INSTANCE_NOT_EQUAL,
46
- # :INTEGER_DIVISION, :LESS_THAN, :LESS_THAN_OR_EQUAL, :LIKE, :MODULO,
47
- # :MULTIPLICATION, :NOT_EQUAL, :OR, :REAL_DIVISION, :SUBTRACTION, :XOR] :operator
48
- # @option options [Expression] :operand1
49
- # @option options [Expression] :operand2
50
- def initialize(options = {})
51
- @operator = options[:operator]
52
- @operand1 = options[:operand1]
53
- @operand2 = options[:operand2]
54
-
55
- super
49
+ key_value do
50
+ map "_class", to: :_class, render_default: true
51
+ map "operator", to: :operator
52
+ map "operand1", to: :operand1
53
+ map "operand2", to: :operand2
56
54
  end
57
55
  end
58
56
  end
@@ -3,18 +3,15 @@ module Expressir
3
3
  module Expressions
4
4
  # Specified in ISO 10303-11:2004
5
5
  # - section 9.2.6 Implicit declarations
6
- class EntityConstructor < Expression
7
- model_attr_accessor :entity, "Reference"
8
- model_attr_accessor :parameters, "Array<Expression>"
6
+ class EntityConstructor < ModelElement
7
+ attribute :entity, ModelElement
8
+ attribute :parameters, ModelElement, collection: true
9
+ attribute :_class, :string, default: -> { send(:name) }
9
10
 
10
- # @param [Hash] options
11
- # @option options [Reference] :entity
12
- # @option options [Array<Expression>] :parameters
13
- def initialize(options = {})
14
- @entity = options[:entity]
15
- @parameters = options[:parameters] || []
16
-
17
- super
11
+ key_value do
12
+ map "_class", to: :_class, render_default: true
13
+ map "entity", to: :entity
14
+ map "parameters", to: :parameters
18
15
  end
19
16
  end
20
17
  end
@@ -3,18 +3,15 @@ module Expressir
3
3
  module Expressions
4
4
  # Specified in ISO 10303-11:2004
5
5
  # - section 12.8 Function call
6
- class FunctionCall < Expression
7
- model_attr_accessor :function, "Reference"
8
- model_attr_accessor :parameters, "Array<Expression>"
6
+ class FunctionCall < ModelElement
7
+ attribute :function, ModelElement
8
+ attribute :parameters, ModelElement, collection: true
9
+ attribute :_class, :string, default: -> { send(:name) }
9
10
 
10
- # @param [Hash] options
11
- # @option options [Reference] :function
12
- # @option options [Array<Expression>] :parameters
13
- def initialize(options = {})
14
- @function = options[:function]
15
- @parameters = options[:parameters]
16
-
17
- super
11
+ key_value do
12
+ map "_class", to: :_class, render_default: true
13
+ map "function", to: :function
14
+ map "parameters", to: :parameters
18
15
  end
19
16
  end
20
17
  end
@@ -3,30 +3,24 @@ module Expressir
3
3
  module Expressions
4
4
  # Specified in ISO 10303-11:2004
5
5
  # - section 12.2.4 Interval expressions
6
- class Interval < Expression
7
- LESS_THAN = :LESS_THAN
8
- LESS_THAN_OR_EQUAL = :LESS_THAN_OR_EQUAL
6
+ class Interval < ModelElement
7
+ LESS_THAN = "LESS_THAN".freeze
8
+ LESS_THAN_OR_EQUAL = "LESS_THAN_OR_EQUAL".freeze
9
9
 
10
- model_attr_accessor :low, "Expression"
11
- model_attr_accessor :operator1, ":LESS_THAN, :LESS_THAN_OR_EQUAL"
12
- model_attr_accessor :item, "Reference"
13
- model_attr_accessor :operator2, ":LESS_THAN, :LESS_THAN_OR_EQUAL"
14
- model_attr_accessor :high, "Expression"
10
+ attribute :low, ModelElement
11
+ attribute :operator1, :string, values: %w[LESS_THAN LESS_THAN_OR_EQUAL]
12
+ attribute :item, ModelElement
13
+ attribute :operator2, :string, values: %w[LESS_THAN LESS_THAN_OR_EQUAL]
14
+ attribute :high, ModelElement
15
+ attribute :_class, :string, default: -> { send(:name) }
15
16
 
16
- # @param [Hash] options
17
- # @option options [Expression] :low
18
- # @option options [:LESS_THAN, :LESS_THAN_OR_EQUAL] :operator1
19
- # @option options [Reference] :item
20
- # @option options [:LESS_THAN, :LESS_THAN_OR_EQUAL] :operator2
21
- # @option options [Expression] :high
22
- def initialize(options = {})
23
- @low = options[:low]
24
- @operator1 = options[:operator1]
25
- @item = options[:item]
26
- @operator2 = options[:operator2]
27
- @high = options[:high]
28
-
29
- super
17
+ key_value do
18
+ map "_class", to: :_class, render_default: true
19
+ map "low", to: :low
20
+ map "operator1", to: :operator1
21
+ map "item", to: :item
22
+ map "operator2", to: :operator2
23
+ map "high", to: :high
30
24
  end
31
25
  end
32
26
  end
@@ -3,23 +3,17 @@ module Expressir
3
3
  module Expressions
4
4
  # Specified in ISO 10303-11:2004
5
5
  # - section 12.6.7 Query expression
6
- class QueryExpression < Expression
6
+ class QueryExpression < ModelElement
7
7
  include Identifier
8
8
 
9
- model_attr_accessor :aggregate_source, "Reference"
10
- model_attr_accessor :expression, "Expression"
9
+ attribute :aggregate_source, ModelElement
10
+ attribute :expression, ModelElement
11
+ attribute :_class, :string, default: -> { send(:name) }
11
12
 
12
- # @param [Hash] options
13
- # @option (see Identifier#initialize_identifier)
14
- # @option options [Reference] :aggregace_source
15
- # @option options [Expression] :expression
16
- def initialize(options = {})
17
- initialize_identifier(options)
18
-
19
- @aggregate_source = options[:aggregate_source]
20
- @expression = options[:expression]
21
-
22
- super
13
+ key_value do
14
+ map "_class", to: :_class, render_default: true
15
+ map "aggregate_source", to: :aggregate_source
16
+ map "expression", to: :expression
23
17
  end
24
18
 
25
19
  # @return [Array<Declaration>]
@@ -4,22 +4,19 @@ module Expressir
4
4
  # Specified in ISO 10303-11:2004
5
5
  # - section 12.1 Arithmetic operators
6
6
  # - section 12.4.1 NOT operator
7
- class UnaryExpression < Expression
8
- MINUS = :MINUS
9
- NOT = :NOT
10
- PLUS = :PLUS
7
+ class UnaryExpression < ModelElement
8
+ MINUS = "MINUS".freeze
9
+ NOT = "NOT".freeze
10
+ PLUS = "PLUS".freeze
11
11
 
12
- model_attr_accessor :operator, ":MINUS, :NOT, :PLUS"
13
- model_attr_accessor :operand, "Expression"
12
+ attribute :operator, :string, values: %w[MINUS NOT PLUS]
13
+ attribute :operand, ModelElement
14
+ attribute :_class, :string, default: -> { send(:name) }
14
15
 
15
- # @param [Hash] options
16
- # @option options [:MINUS, :NOT, :PLUS] :operator
17
- # @option options [Expression] :operand
18
- def initialize(options = {})
19
- @operator = options[:operator]
20
- @operand = options[:operand]
21
-
22
- super
16
+ key_value do
17
+ map "_class", to: :_class, render_default: true
18
+ map "operator", to: :operator
19
+ map "operand", to: :operand
23
20
  end
24
21
  end
25
22
  end
@@ -1,33 +1,16 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Identifier
4
- # @!attribute id
5
- # @return [::String]
6
- # @!attribute remarks
7
- # @return [::Array<::String>]
8
- # @!attribute remark_items
9
- # @return [::Array<RemarkItem>]
10
- # @!attribute source
11
- # @return [::String]
12
- # @!visibility private
13
4
  def self.included(mod)
14
- mod.model_attr_accessor :id, "::String"
15
- mod.model_attr_accessor :remarks, "::Array<::String>"
16
- mod.model_attr_accessor :remark_items, "::Array<RemarkItem>"
17
- mod.model_attr_accessor :source, "::String"
18
- end
5
+ mod.attribute :id, :string
6
+ mod.attribute :remarks, :string, collection: true
7
+ mod.attribute :remark_items, ::Expressir::Model::Declarations::RemarkItem, collection: true
19
8
 
20
- # @param [Hash] options
21
- # @option options [::String] :id
22
- # @option options [::Array<::String>] :remarks
23
- # @option options [::Array<RemarkItem>] :remark_items
24
- # @option options [::String] :source
25
- # @!visibility private
26
- def initialize_identifier(options = {})
27
- @id = options[:id]
28
- @remarks = options[:remarks] || []
29
- @remark_items = options[:remark_items] || []
30
- @source = options[:source]
9
+ mod.key_value do
10
+ map "id", to: :id
11
+ map "remarks", to: :remarks
12
+ map "remark_items", to: :remark_items
13
+ end
31
14
  end
32
15
  end
33
16
  end
@@ -3,15 +3,13 @@ module Expressir
3
3
  module Literals
4
4
  # Specified in ISO 10303-11:2004
5
5
  # - section 7.5.1 Binary literal
6
- class Binary < Literal
7
- model_attr_accessor :value, "::String"
6
+ class Binary < ModelElement
7
+ attribute :value, :string
8
+ attribute :_class, :string, default: -> { send(:name) }
8
9
 
9
- # @param [Hash] options
10
- # @option options [::String] :value
11
- def initialize(options = {})
12
- @value = options[:value]
13
-
14
- super
10
+ key_value do
11
+ map "_class", to: :_class, render_default: true
12
+ map "value", to: :value
15
13
  end
16
14
  end
17
15
  end
@@ -3,15 +3,13 @@ module Expressir
3
3
  module Literals
4
4
  # Specified in ISO 10303-11:2004
5
5
  # - section 7.5.2 Integer literal
6
- class Integer < Literal
7
- model_attr_accessor :value, "::String"
6
+ class Integer < ModelElement
7
+ attribute :value, :string
8
+ attribute :_class, :string, default: -> { send(:name) }
8
9
 
9
- # @param [Hash] options
10
- # @option options [::String] :value
11
- def initialize(options = {})
12
- @value = options[:value]
13
-
14
- super
10
+ key_value do
11
+ map "_class", to: :_class, render_default: true
12
+ map "value", to: :value
15
13
  end
16
14
  end
17
15
  end
@@ -3,19 +3,17 @@ module Expressir
3
3
  module Literals
4
4
  # Specified in ISO 10303-11:2004
5
5
  # - section 7.5.5 Logical literal
6
- class Logical < Literal
7
- TRUE = :TRUE
8
- FALSE = :FALSE
9
- UNKNOWN = :UNKNOWN
6
+ class Logical < ModelElement
7
+ TRUE = "TRUE".freeze
8
+ FALSE = "FALSE".freeze
9
+ UNKNOWN = "UNKNOWN".freeze
10
10
 
11
- model_attr_accessor :value, ":TRUE, :FALSE, :UNKNOWN"
11
+ attribute :value, :string, values: %w[TRUE FALSE UNKNOWN]
12
+ attribute :_class, :string, default: -> { send(:name) }
12
13
 
13
- # @param [Hash] options
14
- # @option options [:TRUE, :FALSE, :UNKNOWN] :value
15
- def initialize(options = {})
16
- @value = options[:value]
17
-
18
- super
14
+ key_value do
15
+ map "_class", to: :_class, render_default: true
16
+ map "value", to: :value
19
17
  end
20
18
  end
21
19
  end
@@ -3,15 +3,13 @@ module Expressir
3
3
  module Literals
4
4
  # Specified in ISO 10303-11:2004
5
5
  # - section 7.5.3 Real literal
6
- class Real < Literal
7
- model_attr_accessor :value, "::String"
6
+ class Real < ModelElement
7
+ attribute :value, :string
8
+ attribute :_class, :string, default: -> { send(:name) }
8
9
 
9
- # @param [Hash] options
10
- # @option options [::String] :value
11
- def initialize(options = {})
12
- @value = options[:value]
13
-
14
- super
10
+ key_value do
11
+ map "_class", to: :_class, render_default: true
12
+ map "value", to: :value
15
13
  end
16
14
  end
17
15
  end