expressir 0.2.21-x64-mingw32 → 1.0.0-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +7 -6
  3. data/.github/workflows/release.yml +22 -6
  4. data/.gitignore +2 -2
  5. data/demo.rb +5 -5
  6. data/exe/format +10 -73
  7. data/exe/format-test +81 -0
  8. data/expressir.gemspec +0 -1
  9. data/lib/expressir.rb +0 -1
  10. data/lib/expressir/cli.rb +0 -6
  11. data/lib/expressir/express/2.4/express_parser.so +0 -0
  12. data/lib/expressir/express/2.5/express_parser.so +0 -0
  13. data/lib/expressir/express/2.6/express_parser.so +0 -0
  14. data/lib/expressir/express/2.7/express_parser.so +0 -0
  15. data/lib/expressir/express/3.0/express_parser.so +0 -0
  16. data/lib/expressir/{express_exp → express}/cache.rb +3 -6
  17. data/lib/expressir/{express_exp → express}/formatter.rb +84 -68
  18. data/lib/expressir/express/hyperlink_formatter.rb +22 -0
  19. data/lib/expressir/express/model_visitor.rb +23 -0
  20. data/lib/expressir/{express_exp → express}/parser.rb +16 -5
  21. data/lib/expressir/express/resolve_references_model_visitor.rb +29 -0
  22. data/lib/expressir/{express_exp → express}/schema_head_formatter.rb +1 -1
  23. data/lib/expressir/{express_exp → express}/visitor.rb +67 -44
  24. data/lib/expressir/model.rb +5 -3
  25. data/lib/expressir/model/attribute.rb +13 -6
  26. data/lib/expressir/model/cache.rb +2 -2
  27. data/lib/expressir/model/constant.rb +10 -3
  28. data/lib/expressir/model/entity.rb +18 -16
  29. data/lib/expressir/model/enumeration_item.rb +8 -1
  30. data/lib/expressir/model/expressions/aggregate_initializer.rb +2 -2
  31. data/lib/expressir/model/expressions/aggregate_item.rb +2 -2
  32. data/lib/expressir/model/expressions/attribute_reference.rb +2 -2
  33. data/lib/expressir/model/expressions/binary_expression.rb +3 -3
  34. data/lib/expressir/model/expressions/call.rb +3 -3
  35. data/lib/expressir/model/expressions/entity_constructor.rb +3 -3
  36. data/lib/expressir/model/expressions/group_reference.rb +2 -2
  37. data/lib/expressir/model/expressions/index_reference.rb +3 -3
  38. data/lib/expressir/model/expressions/interval.rb +5 -5
  39. data/lib/expressir/model/expressions/query_expression.rb +6 -4
  40. data/lib/expressir/model/expressions/simple_reference.rb +5 -1
  41. data/lib/expressir/model/expressions/unary_expression.rb +2 -2
  42. data/lib/expressir/model/function.rb +23 -21
  43. data/lib/expressir/model/identifier.rb +6 -3
  44. data/lib/expressir/model/interface.rb +4 -4
  45. data/lib/expressir/model/interface_item.rb +2 -2
  46. data/lib/expressir/model/interfaced_item.rb +10 -9
  47. data/lib/expressir/model/literals/binary.rb +1 -1
  48. data/lib/expressir/model/literals/integer.rb +1 -1
  49. data/lib/expressir/model/literals/logical.rb +1 -1
  50. data/lib/expressir/model/literals/real.rb +1 -1
  51. data/lib/expressir/model/literals/string.rb +2 -2
  52. data/lib/expressir/model/model_element.rb +39 -27
  53. data/lib/expressir/model/parameter.rb +10 -3
  54. data/lib/expressir/model/procedure.rb +22 -20
  55. data/lib/expressir/model/remark_item.rb +15 -0
  56. data/lib/expressir/model/repository.rb +2 -2
  57. data/lib/expressir/model/rule.rb +27 -25
  58. data/lib/expressir/model/schema.rb +24 -20
  59. data/lib/expressir/model/schema_version.rb +15 -0
  60. data/lib/expressir/model/schema_version_item.rb +15 -0
  61. data/lib/expressir/model/statements/alias.rb +7 -5
  62. data/lib/expressir/model/statements/assignment.rb +2 -2
  63. data/lib/expressir/model/statements/call.rb +3 -3
  64. data/lib/expressir/model/statements/case.rb +4 -4
  65. data/lib/expressir/model/statements/case_action.rb +3 -3
  66. data/lib/expressir/model/statements/compound.rb +2 -2
  67. data/lib/expressir/model/statements/if.rb +5 -5
  68. data/lib/expressir/model/statements/repeat.rb +11 -9
  69. data/lib/expressir/model/statements/return.rb +1 -1
  70. data/lib/expressir/model/subtype_constraint.rb +13 -6
  71. data/lib/expressir/model/type.rb +12 -10
  72. data/lib/expressir/model/types/aggregate.rb +9 -2
  73. data/lib/expressir/model/types/array.rb +5 -5
  74. data/lib/expressir/model/types/bag.rb +3 -3
  75. data/lib/expressir/model/types/binary.rb +2 -2
  76. data/lib/expressir/model/types/enumeration.rb +5 -7
  77. data/lib/expressir/model/types/generic.rb +8 -1
  78. data/lib/expressir/model/types/generic_entity.rb +8 -1
  79. data/lib/expressir/model/types/list.rb +4 -4
  80. data/lib/expressir/model/types/real.rb +1 -1
  81. data/lib/expressir/model/types/select.rb +6 -8
  82. data/lib/expressir/model/types/set.rb +3 -3
  83. data/lib/expressir/model/types/string.rb +2 -2
  84. data/lib/expressir/model/unique_rule.rb +26 -0
  85. data/lib/expressir/model/variable.rb +10 -3
  86. data/lib/expressir/model/where_rule.rb +26 -0
  87. data/lib/expressir/version.rb +1 -1
  88. data/rakelib/cross-ruby.rake +1 -1
  89. data/spec/expressir/{express_exp → express}/cache_spec.rb +9 -9
  90. data/spec/expressir/express/formatter_spec.rb +127 -0
  91. data/spec/expressir/{express_exp → express}/parser_spec.rb +24 -24
  92. data/spec/expressir/model/model_element_spec.rb +112 -60
  93. data/{original/examples → spec}/syntax/multiple.exp +1 -1
  94. data/{original/examples → spec}/syntax/multiple.yaml +19 -5
  95. data/{original/examples → spec}/syntax/multiple_formatted.exp +1 -1
  96. data/{original/examples → spec}/syntax/multiple_hyperlink_formatted.exp +4 -4
  97. data/{original/examples → spec}/syntax/multiple_schema_head_hyperlink_formatted.exp +1 -1
  98. data/{original/examples → spec}/syntax/remark.exp +12 -10
  99. data/{original/examples → spec}/syntax/remark.yaml +36 -16
  100. data/{original/examples → spec}/syntax/remark_formatted.exp +3 -1
  101. data/spec/syntax/single.exp +4 -0
  102. data/spec/syntax/single.yaml +18 -0
  103. data/spec/syntax/single_formatted.exp +10 -0
  104. data/spec/syntax/single_formatted.yaml +36 -0
  105. data/{original/examples → spec}/syntax/syntax.exp +11 -11
  106. data/{original/examples → spec}/syntax/syntax.yaml +205 -108
  107. data/{original/examples → spec}/syntax/syntax_formatted.exp +11 -11
  108. data/spec/syntax/syntax_hyperlink_formatted.exp +902 -0
  109. data/{original/examples → spec}/syntax/syntax_schema_head_formatted.exp +1 -1
  110. metadata +41 -83
  111. data/lib/expressir/express.rb +0 -11
  112. data/lib/expressir/express/aggregate_dimension.rb +0 -38
  113. data/lib/expressir/express/attribute.rb +0 -15
  114. data/lib/expressir/express/comment.rb +0 -7
  115. data/lib/expressir/express/defined_type.rb +0 -36
  116. data/lib/expressir/express/derived.rb +0 -65
  117. data/lib/expressir/express/derived_aggregate.rb +0 -43
  118. data/lib/expressir/express/entity.rb +0 -137
  119. data/lib/expressir/express/explicit.rb +0 -70
  120. data/lib/expressir/express/explicit_aggregate.rb +0 -46
  121. data/lib/expressir/express/explicit_or_derived.rb +0 -16
  122. data/lib/expressir/express/global_rule.rb +0 -44
  123. data/lib/expressir/express/interface_specification.rb +0 -51
  124. data/lib/expressir/express/interfaced_item.rb +0 -38
  125. data/lib/expressir/express/inverse.rb +0 -46
  126. data/lib/expressir/express/inverse_aggregate.rb +0 -37
  127. data/lib/expressir/express/model_element.rb +0 -7
  128. data/lib/expressir/express/named_type.rb +0 -19
  129. data/lib/expressir/express/remark.rb +0 -8
  130. data/lib/expressir/express/repository.rb +0 -306
  131. data/lib/expressir/express/schema_definition.rb +0 -96
  132. data/lib/expressir/express/subtype_constraint.rb +0 -14
  133. data/lib/expressir/express/type.rb +0 -26
  134. data/lib/expressir/express/type_aggregate.rb +0 -42
  135. data/lib/expressir/express/type_enum.rb +0 -29
  136. data/lib/expressir/express/type_parser.rb +0 -45
  137. data/lib/expressir/express/type_select.rb +0 -82
  138. data/lib/expressir/express/unique_rule.rb +0 -35
  139. data/lib/expressir/express/where_rule.rb +0 -32
  140. data/lib/expressir/express_exp/2.4/express_parser.so +0 -0
  141. data/lib/expressir/express_exp/2.5/express_parser.so +0 -0
  142. data/lib/expressir/express_exp/2.6/express_parser.so +0 -0
  143. data/lib/expressir/express_exp/2.7/express_parser.so +0 -0
  144. data/lib/expressir/express_exp/3.0/express_parser.so +0 -0
  145. data/lib/expressir/express_exp/hyperlink_formatter.rb +0 -27
  146. data/lib/expressir/express_parser.rb +0 -30
  147. data/lib/expressir/model/informal_proposition.rb +0 -18
  148. data/lib/expressir/model/unique.rb +0 -19
  149. data/lib/expressir/model/where.rb +0 -19
  150. data/lib/expressir/parser.rb +0 -6
  151. data/lib/expressir/parser/owl_parser.rb +0 -8
  152. data/original/examples/syntax/single.exp +0 -3
  153. data/original/examples/syntax/single.yaml +0 -9
  154. data/original/examples/syntax/single_formatted.exp +0 -6
  155. data/original/examples/syntax/single_formatted.yaml +0 -19
  156. data/spec/acceptance/express_to_owl_spec.rb +0 -18
  157. data/spec/expressir/express/repository_spec.rb +0 -25
  158. data/spec/expressir/express_exp/formatter_spec.rb +0 -111
@@ -0,0 +1,22 @@
1
+ module Expressir
2
+ module Express
3
+ module HyperlinkFormatter
4
+ def format_expressions_simple_reference(node)
5
+ return node.id unless node.base_path
6
+
7
+ # find closest node with path
8
+ current_node = node
9
+ while !current_node.path
10
+ current_node = current_node.parent
11
+ end
12
+
13
+ # skip if this reference and target node are in the same node with path
14
+ node_base_path_parts = node.base_path.split(".")
15
+ current_node_path_parts = current_node.path.split(".")
16
+ return node.id if node_base_path_parts[0..1] == current_node_path_parts[0..1]
17
+
18
+ "{{{<<express:#{node.base_path},#{node.id}>>}}}"
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,23 @@
1
+ require "expressir/model"
2
+
3
+ module Expressir
4
+ module Express
5
+ class ModelVisitor
6
+ def visit(node)
7
+ node.class.model_attrs.each do |variable|
8
+ value = node.send(variable)
9
+
10
+ if value.is_a? Array
11
+ value.each do |value|
12
+ if value.is_a? Model::ModelElement
13
+ visit(value)
14
+ end
15
+ end
16
+ elsif value.is_a? Model::ModelElement
17
+ visit(value)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -4,7 +4,8 @@ begin
4
4
  rescue LoadError
5
5
  require_relative "express_parser"
6
6
  end
7
- require 'expressir/express_exp/visitor'
7
+ require 'expressir/express/visitor'
8
+ require 'expressir/express/resolve_references_model_visitor'
8
9
 
9
10
  =begin
10
11
  char_stream = Antlr4::Runtime::CharStreams.from_string(input, 'String')
@@ -22,9 +23,11 @@ repo = visitor.visit(parse_tree)
22
23
  =end
23
24
 
24
25
  module Expressir
25
- module ExpressExp
26
+ module Express
26
27
  class Parser
27
28
  def self.from_file(file, options = {})
29
+ skip_references = options[:skip_references]
30
+
28
31
  input = File.read(file)
29
32
 
30
33
  parser = ::ExpressParser::Parser.parse(input)
@@ -38,13 +41,20 @@ module Expressir
38
41
  schema.file = file.to_s
39
42
  end
40
43
 
44
+ unless skip_references
45
+ resolve_references_model_visitor = ResolveReferencesModelVisitor.new
46
+ resolve_references_model_visitor.visit(repository)
47
+ end
48
+
41
49
  repository
42
50
  end
43
51
 
44
52
  def self.from_files(files, options = {})
53
+ skip_references = options[:skip_references]
54
+
45
55
  schemas = files.each_with_index.map do |file, i|
46
56
  # start = Time.now
47
- repository = self.from_file(file, options)
57
+ repository = self.from_file(file, options.merge(skip_references: true))
48
58
  # STDERR.puts "#{i+1}/#{files.length} #{file} #{Time.now - start}"
49
59
  repository.schemas
50
60
  end.flatten
@@ -53,8 +63,9 @@ module Expressir
53
63
  schemas: schemas
54
64
  })
55
65
 
56
- repository.schemas.each do |schema|
57
- schema.parent = repository
66
+ unless skip_references
67
+ resolve_references_model_visitor = ResolveReferencesModelVisitor.new
68
+ resolve_references_model_visitor.visit(repository)
58
69
  end
59
70
 
60
71
  repository
@@ -0,0 +1,29 @@
1
+ require "expressir/express/model_visitor"
2
+ require "expressir/model"
3
+
4
+ module Expressir
5
+ module Express
6
+ class ResolveReferencesModelVisitor < ModelVisitor
7
+ def visit(node)
8
+ if node.is_a? Model::Expressions::SimpleReference
9
+ visit_expressions_simple_reference(node)
10
+ end
11
+
12
+ super
13
+ end
14
+
15
+ def visit_expressions_simple_reference(node)
16
+ return if node.parent.is_a? Model::Expressions::AttributeReference
17
+
18
+ if node.parent.is_a? Model::InterfaceItem
19
+ base_item = node.find("#{node.parent.parent.schema.id}.#{node.parent.ref.id}")
20
+ else
21
+ base_item = node.find(node.id)
22
+ end
23
+ return unless base_item
24
+
25
+ node.base_path = base_item.path
26
+ end
27
+ end
28
+ end
29
+ end
@@ -1,5 +1,5 @@
1
1
  module Expressir
2
- module ExpressExp
2
+ module Express
3
3
  module SchemaHeadFormatter
4
4
  def format_schema(node)
5
5
  format_schema_head(node)
@@ -32,7 +32,7 @@ require "set"
32
32
  # - e.g. see visit_schema_decl
33
33
 
34
34
  module Expressir
35
- module ExpressExp
35
+ module Express
36
36
  class Visitor < ::ExpressParser::Visitor
37
37
  REMARK_CHANNEL = 2
38
38
 
@@ -107,27 +107,28 @@ module Expressir
107
107
  target_node = node.find(path)
108
108
  return target_node if target_node
109
109
 
110
- # check if path should create implicit informal proposal
111
- # see https://github.com/lutaml/expressir/issues/50
110
+ # check if path can create implicit remark item
111
+ # see https://github.com/lutaml/expressir/issues/78
112
112
  rest, _, current_path = path.rpartition(".") # get last path part
113
113
  _, _, current_path = current_path.rpartition(":") # ignore prefix
114
+ parent_node = node.find(rest)
115
+ if parent_node and parent_node.class.method_defined? :remark_items
116
+ remark_item = Model::RemarkItem.new({
117
+ id: current_path
118
+ })
119
+ remark_item.parent = parent_node
114
120
 
115
- # match informal proposition id
116
- informal_proposition_id = current_path.match(/^IP\d+$/).to_a[0]
117
- return unless informal_proposition_id
118
-
119
- # find informal proposition target
120
- target_node = node.find(rest)
121
- return unless target_node and target_node.class.method_defined? :informal_propositions
122
-
123
- # create implicit informal proposition
124
- informal_proposition = Model::InformalProposition.new({
125
- id: informal_proposition_id
126
- })
127
- target_node.informal_propositions << informal_proposition
128
- target_node.reset_children_by_id
129
- informal_proposition.parent = target_node
130
- informal_proposition
121
+ # check if path can create implicit informal proposition
122
+ # see https://github.com/lutaml/expressir/issues/50
123
+ if parent_node.class.method_defined? :informal_propositions and current_path.match(/^IP\d+$/)
124
+ parent_node.informal_propositions << remark_item
125
+ else
126
+ parent_node.remark_items << remark_item
127
+ end
128
+ parent_node.reset_children_by_id
129
+
130
+ remark_item
131
+ end
131
132
  end
132
133
 
133
134
  def attach_remarks(ctx, node)
@@ -693,7 +694,7 @@ module Expressir
693
694
  id = visit_if(ctx__rule_label_id)
694
695
  expression = visit_if(ctx__expression)
695
696
 
696
- Model::Where.new({
697
+ Model::WhereRule.new({
697
698
  id: id,
698
699
  expression: expression
699
700
  })
@@ -758,8 +759,8 @@ module Expressir
758
759
  *visit_if(ctx__entity_body__derive_clause),
759
760
  *visit_if(ctx__entity_body__inverse_clause)
760
761
  ]
761
- unique = visit_if(ctx__entity_body__unique_clause, [])
762
- where = visit_if(ctx__entity_body__where_clause, [])
762
+ unique_rules = visit_if(ctx__entity_body__unique_clause, [])
763
+ where_rules = visit_if(ctx__entity_body__where_clause, [])
763
764
 
764
765
  Model::Entity.new({
765
766
  id: id,
@@ -767,8 +768,8 @@ module Expressir
767
768
  supertype_expression: supertype_expression,
768
769
  subtype_of: subtype_of,
769
770
  attributes: attributes,
770
- unique: unique,
771
- where: where
771
+ unique_rules: unique_rules,
772
+ where_rules: where_rules
772
773
  })
773
774
  end
774
775
 
@@ -833,15 +834,13 @@ module Expressir
833
834
  ctx__enumeration_extension__enumeration_items = ctx__enumeration_extension&.enumeration_items
834
835
 
835
836
  extensible = ctx__EXTENSIBLE && true
836
- items = visit_if(ctx__enumeration_items, [])
837
- extension_type = visit_if(ctx__enumeration_extension__type_ref)
838
- extension_items = visit_if(ctx__enumeration_extension__enumeration_items, [])
837
+ based_on = visit_if(ctx__enumeration_extension__type_ref)
838
+ items = visit_if(ctx__enumeration_items || ctx__enumeration_extension__enumeration_items, [])
839
839
 
840
840
  Model::Types::Enumeration.new({
841
841
  extensible: extensible,
842
- items: items,
843
- extension_type: extension_type,
844
- extension_items: extension_items
842
+ based_on: based_on,
843
+ items: items
845
844
  })
846
845
  end
847
846
 
@@ -1869,7 +1868,7 @@ module Expressir
1869
1868
  constants = visit_if(ctx__algorithm_head__constant_decl, [])
1870
1869
  variables = visit_if(ctx__algorithm_head__local_decl, [])
1871
1870
  statements = visit_if_map(ctx__stmt)
1872
- where = visit_if(ctx__where_clause, [])
1871
+ where_rules = visit_if(ctx__where_clause, [])
1873
1872
 
1874
1873
  Model::Rule.new({
1875
1874
  id: id,
@@ -1882,7 +1881,7 @@ module Expressir
1882
1881
  constants: constants,
1883
1882
  variables: variables,
1884
1883
  statements: statements,
1885
- where: where
1884
+ where_rules: where_rules
1886
1885
  })
1887
1886
  end
1888
1887
 
@@ -1956,7 +1955,33 @@ module Expressir
1956
1955
  def visit_schema_version_id(ctx)
1957
1956
  ctx__string_literal = ctx.string_literal
1958
1957
 
1959
- visit_if(ctx__string_literal)
1958
+ value = visit_if(ctx__string_literal)
1959
+ value = value.value
1960
+
1961
+ items = if value.start_with?('{') and value.end_with?('}')
1962
+ parts = value.sub(/^\{/, '').sub(/\}$/, '').split(' ')
1963
+ parts.map do |part|
1964
+ if match = part.match(/^(.+)\((\d+)\)$/)
1965
+ Model::SchemaVersionItem.new({
1966
+ name: match[1],
1967
+ value: match[2]
1968
+ })
1969
+ elsif part.match(/^\d+$/)
1970
+ Model::SchemaVersionItem.new({
1971
+ value: part
1972
+ })
1973
+ else
1974
+ Model::SchemaVersionItem.new({
1975
+ name: part
1976
+ })
1977
+ end
1978
+ end
1979
+ end
1980
+
1981
+ Model::SchemaVersion.new({
1982
+ value: value,
1983
+ items: items
1984
+ })
1960
1985
  end
1961
1986
 
1962
1987
  def visit_selector(ctx)
@@ -1985,16 +2010,14 @@ module Expressir
1985
2010
 
1986
2011
  extensible = ctx__EXTENSIBLE && true
1987
2012
  generic_entity = ctx__GENERIC_ENTITY && true
1988
- items = visit_if(ctx__select_list, [])
1989
- extension_type = visit_if(ctx__select_extension__type_ref)
1990
- extension_items = visit_if(ctx__select_extension__select_list, [])
2013
+ based_on = visit_if(ctx__select_extension__type_ref)
2014
+ items = visit_if(ctx__select_list || ctx__select_extension__select_list, [])
1991
2015
 
1992
2016
  Model::Types::Select.new({
1993
2017
  extensible: extensible,
1994
2018
  generic_entity: generic_entity,
1995
- items: items,
1996
- extension_type: extension_type,
1997
- extension_items: extension_items
2019
+ based_on: based_on,
2020
+ items: items
1998
2021
  })
1999
2022
  end
2000
2023
 
@@ -2288,13 +2311,13 @@ module Expressir
2288
2311
  ctx__where_clause = ctx.where_clause
2289
2312
 
2290
2313
  id = visit_if(ctx__type_id)
2291
- type = visit_if(ctx__underlying_type)
2292
- where = visit_if(ctx__where_clause, [])
2314
+ underlying_type = visit_if(ctx__underlying_type)
2315
+ where_rules = visit_if(ctx__where_clause, [])
2293
2316
 
2294
2317
  Model::Type.new({
2295
2318
  id: id,
2296
- type: type,
2297
- where: where
2319
+ underlying_type: underlying_type,
2320
+ where_rules: where_rules
2298
2321
  })
2299
2322
  end
2300
2323
 
@@ -2354,7 +2377,7 @@ module Expressir
2354
2377
  id = visit_if(ctx__rule_label_id)
2355
2378
  attributes = visit_if_map(ctx__referenced_attribute)
2356
2379
 
2357
- Model::Unique.new({
2380
+ Model::UniqueRule.new({
2358
2381
  id: id,
2359
2382
  attributes: attributes
2360
2383
  })
@@ -9,20 +9,22 @@ require 'expressir/model/constant'
9
9
  require 'expressir/model/entity'
10
10
  require 'expressir/model/enumeration_item'
11
11
  require 'expressir/model/function'
12
- require 'expressir/model/informal_proposition'
13
12
  require 'expressir/model/interface'
14
13
  require 'expressir/model/interface_item'
15
14
  require 'expressir/model/interfaced_item'
16
15
  require 'expressir/model/parameter'
17
16
  require 'expressir/model/procedure'
17
+ require 'expressir/model/remark_item'
18
18
  require 'expressir/model/repository'
19
19
  require 'expressir/model/rule'
20
20
  require 'expressir/model/schema'
21
+ require 'expressir/model/schema_version'
22
+ require 'expressir/model/schema_version_item'
21
23
  require 'expressir/model/subtype_constraint'
22
24
  require 'expressir/model/type'
23
- require 'expressir/model/unique'
25
+ require 'expressir/model/unique_rule'
24
26
  require 'expressir/model/variable'
25
- require 'expressir/model/where'
27
+ require 'expressir/model/where_rule'
26
28
  require 'expressir/model/expressions/aggregate_initializer'
27
29
  require 'expressir/model/expressions/aggregate_item'
28
30
  require 'expressir/model/expressions/binary_expression'
@@ -7,15 +7,16 @@ module Expressir
7
7
  DERIVED = :DERIVED
8
8
  INVERSE = :INVERSE
9
9
 
10
- attr_accessor :kind
11
- attr_accessor :supertype_attribute
12
- attr_accessor :optional
13
- attr_accessor :type
14
- attr_accessor :expression
10
+ model_attr_accessor :kind
11
+ model_attr_accessor :supertype_attribute
12
+ model_attr_accessor :optional
13
+ model_attr_accessor :type
14
+ model_attr_accessor :expression
15
15
 
16
16
  def initialize(options = {})
17
17
  @id = options[:id]
18
- @remarks = options.fetch(:remarks, [])
18
+ @remarks = options[:remarks] || []
19
+ @remark_items = options[:remark_items] || []
19
20
  @source = options[:source]
20
21
 
21
22
  @kind = options[:kind]
@@ -26,6 +27,12 @@ module Expressir
26
27
 
27
28
  super
28
29
  end
30
+
31
+ def children
32
+ [
33
+ *remark_items
34
+ ]
35
+ end
29
36
  end
30
37
  end
31
38
  end
@@ -1,8 +1,8 @@
1
1
  module Expressir
2
2
  module Model
3
3
  class Cache < ModelElement
4
- attr_accessor :version
5
- attr_accessor :content
4
+ model_attr_accessor :version
5
+ model_attr_accessor :content
6
6
 
7
7
  def initialize(options = {})
8
8
  @version = options[:version]
@@ -3,12 +3,13 @@ module Expressir
3
3
  class Constant < ModelElement
4
4
  include Identifier
5
5
 
6
- attr_accessor :type
7
- attr_accessor :expression
6
+ model_attr_accessor :type
7
+ model_attr_accessor :expression
8
8
 
9
9
  def initialize(options = {})
10
10
  @id = options[:id]
11
- @remarks = options.fetch(:remarks, [])
11
+ @remarks = options[:remarks] || []
12
+ @remark_items = options[:remark_items] || []
12
13
  @source = options[:source]
13
14
 
14
15
  @type = options[:type]
@@ -16,6 +17,12 @@ module Expressir
16
17
 
17
18
  super
18
19
  end
20
+
21
+ def children
22
+ [
23
+ *remark_items
24
+ ]
25
+ end
19
26
  end
20
27
  end
21
28
  end