expressir 0.2.21-arm64-darwin → 1.0.0-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) 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_exp → express}/2.4/express_parser.bundle +0 -0
  12. data/lib/expressir/{express_exp → express}/2.5/express_parser.bundle +0 -0
  13. data/lib/expressir/{express_exp → express}/2.6/express_parser.bundle +0 -0
  14. data/lib/expressir/{express_exp → express}/2.7/express_parser.bundle +0 -0
  15. data/lib/expressir/{express_exp → express}/3.0/express_parser.bundle +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/hyperlink_formatter.rb +0 -27
  141. data/lib/expressir/express_parser.rb +0 -30
  142. data/lib/expressir/model/informal_proposition.rb +0 -18
  143. data/lib/expressir/model/unique.rb +0 -19
  144. data/lib/expressir/model/where.rb +0 -19
  145. data/lib/expressir/parser.rb +0 -6
  146. data/lib/expressir/parser/owl_parser.rb +0 -8
  147. data/original/examples/syntax/single.exp +0 -3
  148. data/original/examples/syntax/single.yaml +0 -9
  149. data/original/examples/syntax/single_formatted.exp +0 -6
  150. data/original/examples/syntax/single_formatted.yaml +0 -19
  151. data/spec/acceptance/express_to_owl_spec.rb +0 -18
  152. data/spec/expressir/express/repository_spec.rb +0 -25
  153. data/spec/expressir/express_exp/formatter_spec.rb +0 -111
@@ -3,26 +3,27 @@ module Expressir
3
3
  class Entity < ModelElement
4
4
  include Identifier
5
5
 
6
- attr_accessor :abstract
7
- attr_accessor :supertype_expression
8
- attr_accessor :subtype_of
9
- attr_accessor :attributes
10
- attr_accessor :unique
11
- attr_accessor :where
12
- attr_accessor :informal_propositions
6
+ model_attr_accessor :abstract
7
+ model_attr_accessor :supertype_expression
8
+ model_attr_accessor :subtype_of
9
+ model_attr_accessor :attributes
10
+ model_attr_accessor :unique_rules
11
+ model_attr_accessor :where_rules
12
+ model_attr_accessor :informal_propositions
13
13
 
14
14
  def initialize(options = {})
15
15
  @id = options[:id]
16
- @remarks = options.fetch(:remarks, [])
16
+ @remarks = options[:remarks] || []
17
+ @remark_items = options[:remark_items] || []
17
18
  @source = options[:source]
18
19
 
19
20
  @abstract = options[:abstract]
20
21
  @supertype_expression = options[:supertype_expression]
21
- @subtype_of = options.fetch(:subtype_of, [])
22
- @attributes = options.fetch(:attributes, [])
23
- @unique = options.fetch(:unique, [])
24
- @where = options.fetch(:where, [])
25
- @informal_propositions = options.fetch(:informal_propositions, [])
22
+ @subtype_of = options[:subtype_of] || []
23
+ @attributes = options[:attributes] || []
24
+ @unique_rules = options[:unique_rules] || []
25
+ @where_rules = options[:where_rules] || []
26
+ @informal_propositions = options[:informal_propositions] || []
26
27
 
27
28
  super
28
29
  end
@@ -30,9 +31,10 @@ module Expressir
30
31
  def children
31
32
  [
32
33
  *attributes,
33
- *unique,
34
- *where,
35
- *informal_propositions
34
+ *unique_rules,
35
+ *where_rules,
36
+ *informal_propositions,
37
+ *remark_items
36
38
  ]
37
39
  end
38
40
  end
@@ -5,11 +5,18 @@ module Expressir
5
5
 
6
6
  def initialize(options = {})
7
7
  @id = options[:id]
8
- @remarks = options.fetch(:remarks, [])
8
+ @remarks = options[:remarks] || []
9
+ @remark_items = options[:remark_items] || []
9
10
  @source = options[:source]
10
11
 
11
12
  super
12
13
  end
14
+
15
+ def children
16
+ [
17
+ *remark_items
18
+ ]
19
+ end
13
20
  end
14
21
  end
15
22
  end
@@ -2,10 +2,10 @@ module Expressir
2
2
  module Model
3
3
  module Expressions
4
4
  class AggregateInitializer < ModelElement
5
- attr_accessor :items
5
+ model_attr_accessor :items
6
6
 
7
7
  def initialize(options = {})
8
- @items = options.fetch(:items, [])
8
+ @items = options[:items] || []
9
9
 
10
10
  super
11
11
  end
@@ -2,8 +2,8 @@ module Expressir
2
2
  module Model
3
3
  module Expressions
4
4
  class AggregateItem < ModelElement
5
- attr_accessor :expression
6
- attr_accessor :repetition
5
+ model_attr_accessor :expression
6
+ model_attr_accessor :repetition
7
7
 
8
8
  def initialize(options = {})
9
9
  @expression = options[:expression]
@@ -2,8 +2,8 @@ module Expressir
2
2
  module Model
3
3
  module Expressions
4
4
  class AttributeReference < ModelElement
5
- attr_accessor :ref
6
- attr_accessor :attribute
5
+ model_attr_accessor :ref
6
+ model_attr_accessor :attribute
7
7
 
8
8
  def initialize(options = {})
9
9
  @ref = options[:ref]
@@ -25,9 +25,9 @@ module Expressir
25
25
  SUBTRACTION = :SUBTRACTION
26
26
  XOR = :XOR
27
27
 
28
- attr_accessor :operator
29
- attr_accessor :operand1
30
- attr_accessor :operand2
28
+ model_attr_accessor :operator
29
+ model_attr_accessor :operand1
30
+ model_attr_accessor :operand2
31
31
 
32
32
  def initialize(options = {})
33
33
  @operator = options[:operator]
@@ -2,12 +2,12 @@ module Expressir
2
2
  module Model
3
3
  module Expressions
4
4
  class Call < ModelElement
5
- attr_accessor :ref
6
- attr_accessor :parameters
5
+ model_attr_accessor :ref
6
+ model_attr_accessor :parameters
7
7
 
8
8
  def initialize(options = {})
9
9
  @ref = options[:ref]
10
- @parameters = options.fetch(:parameters, [])
10
+ @parameters = options[:parameters] || []
11
11
 
12
12
  super
13
13
  end
@@ -2,12 +2,12 @@ module Expressir
2
2
  module Model
3
3
  module Expressions
4
4
  class EntityConstructor < ModelElement
5
- attr_accessor :entity
6
- attr_accessor :parameters
5
+ model_attr_accessor :entity
6
+ model_attr_accessor :parameters
7
7
 
8
8
  def initialize(options = {})
9
9
  @entity = options[:entity]
10
- @parameters = options.fetch(:parameters, [])
10
+ @parameters = options[:parameters] || []
11
11
 
12
12
  super
13
13
  end
@@ -2,8 +2,8 @@ module Expressir
2
2
  module Model
3
3
  module Expressions
4
4
  class GroupReference < ModelElement
5
- attr_accessor :ref
6
- attr_accessor :entity
5
+ model_attr_accessor :ref
6
+ model_attr_accessor :entity
7
7
 
8
8
  def initialize(options = {})
9
9
  @ref = options[:ref]
@@ -2,9 +2,9 @@ module Expressir
2
2
  module Model
3
3
  module Expressions
4
4
  class IndexReference < ModelElement
5
- attr_accessor :ref
6
- attr_accessor :index1
7
- attr_accessor :index2
5
+ model_attr_accessor :ref
6
+ model_attr_accessor :index1
7
+ model_attr_accessor :index2
8
8
 
9
9
  def initialize(options = {})
10
10
  @ref = options[:ref]
@@ -2,11 +2,11 @@ module Expressir
2
2
  module Model
3
3
  module Expressions
4
4
  class Interval < ModelElement
5
- attr_accessor :low
6
- attr_accessor :operator1
7
- attr_accessor :item
8
- attr_accessor :operator2
9
- attr_accessor :high
5
+ model_attr_accessor :low
6
+ model_attr_accessor :operator1
7
+ model_attr_accessor :item
8
+ model_attr_accessor :operator2
9
+ model_attr_accessor :high
10
10
 
11
11
  def initialize(options = {})
12
12
  @low = options[:low]
@@ -4,12 +4,13 @@ module Expressir
4
4
  class QueryExpression < ModelElement
5
5
  include Identifier
6
6
 
7
- attr_accessor :aggregate_source
8
- attr_accessor :expression
7
+ model_attr_accessor :aggregate_source
8
+ model_attr_accessor :expression
9
9
 
10
10
  def initialize(options = {})
11
11
  @id = options[:id]
12
- @remarks = options.fetch(:remarks, [])
12
+ @remarks = options[:remarks] || []
13
+ @remark_items = options[:remark_items] || []
13
14
  @source = options[:source]
14
15
 
15
16
  @aggregate_source = options[:aggregate_source]
@@ -20,7 +21,8 @@ module Expressir
20
21
 
21
22
  def children
22
23
  [
23
- self
24
+ self,
25
+ *remark_items
24
26
  ]
25
27
  end
26
28
  end
@@ -2,11 +2,15 @@ module Expressir
2
2
  module Model
3
3
  module Expressions
4
4
  class SimpleReference < ModelElement
5
- attr_accessor :id
5
+ model_attr_accessor :id
6
+
7
+ model_attr_accessor :base_path
6
8
 
7
9
  def initialize(options = {})
8
10
  @id = options[:id]
9
11
 
12
+ @base_path = options[:base_path]
13
+
10
14
  super
11
15
  end
12
16
  end
@@ -6,8 +6,8 @@ module Expressir
6
6
  NOT = :NOT
7
7
  PLUS = :PLUS
8
8
 
9
- attr_accessor :operator
10
- attr_accessor :operand
9
+ model_attr_accessor :operator
10
+ model_attr_accessor :operand
11
11
 
12
12
  def initialize(options = {})
13
13
  @operator = options[:operator]
@@ -3,32 +3,33 @@ module Expressir
3
3
  class Function < ModelElement
4
4
  include Identifier
5
5
 
6
- attr_accessor :parameters
7
- attr_accessor :return_type
8
- attr_accessor :types
9
- attr_accessor :entities
10
- attr_accessor :subtype_constraints
11
- attr_accessor :functions
12
- attr_accessor :procedures
13
- attr_accessor :constants
14
- attr_accessor :variables
15
- attr_accessor :statements
6
+ model_attr_accessor :parameters
7
+ model_attr_accessor :return_type
8
+ model_attr_accessor :types
9
+ model_attr_accessor :entities
10
+ model_attr_accessor :subtype_constraints
11
+ model_attr_accessor :functions
12
+ model_attr_accessor :procedures
13
+ model_attr_accessor :constants
14
+ model_attr_accessor :variables
15
+ model_attr_accessor :statements
16
16
 
17
17
  def initialize(options = {})
18
18
  @id = options[:id]
19
- @remarks = options.fetch(:remarks, [])
19
+ @remarks = options[:remarks] || []
20
+ @remark_items = options[:remark_items] || []
20
21
  @source = options[:source]
21
22
 
22
- @parameters = options.fetch(:parameters, [])
23
+ @parameters = options[:parameters] || []
23
24
  @return_type = options[:return_type]
24
- @types = options.fetch(:types, [])
25
- @entities = options.fetch(:entities, [])
26
- @subtype_constraints = options.fetch(:subtype_constraints, [])
27
- @functions = options.fetch(:functions, [])
28
- @procedures = options.fetch(:procedures, [])
29
- @constants = options.fetch(:constants, [])
30
- @variables = options.fetch(:variables, [])
31
- @statements = options.fetch(:statements, [])
25
+ @types = options[:types] || []
26
+ @entities = options[:entities] || []
27
+ @subtype_constraints = options[:subtype_constraints] || []
28
+ @functions = options[:functions] || []
29
+ @procedures = options[:procedures] || []
30
+ @constants = options[:constants] || []
31
+ @variables = options[:variables] || []
32
+ @statements = options[:statements] || []
32
33
 
33
34
  super
34
35
  end
@@ -47,7 +48,8 @@ module Expressir
47
48
  *functions,
48
49
  *procedures,
49
50
  *constants,
50
- *variables
51
+ *variables,
52
+ *remark_items
51
53
  ]
52
54
  end
53
55
  end
@@ -1,9 +1,12 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Identifier
4
- attr_accessor :id
5
- attr_accessor :remarks
6
- attr_accessor :source
4
+ def self.included(mod)
5
+ mod.model_attr_accessor :id
6
+ mod.model_attr_accessor :remarks
7
+ mod.model_attr_accessor :remark_items
8
+ mod.model_attr_accessor :source
9
+ end
7
10
  end
8
11
  end
9
12
  end
@@ -4,14 +4,14 @@ module Expressir
4
4
  USE = :USE
5
5
  REFERENCE = :REFERENCE
6
6
 
7
- attr_accessor :kind
8
- attr_accessor :schema
9
- attr_accessor :items
7
+ model_attr_accessor :kind
8
+ model_attr_accessor :schema
9
+ model_attr_accessor :items
10
10
 
11
11
  def initialize(options = {})
12
12
  @kind = options[:kind]
13
13
  @schema = options[:schema]
14
- @items = options.fetch(:items, [])
14
+ @items = options[:items] || []
15
15
 
16
16
  super
17
17
  end
@@ -1,8 +1,8 @@
1
1
  module Expressir
2
2
  module Model
3
3
  class InterfaceItem < ModelElement
4
- attr_accessor :ref
5
- attr_accessor :id
4
+ model_attr_accessor :ref
5
+ model_attr_accessor :id
6
6
 
7
7
  def initialize(options = {})
8
8
  @ref = options[:ref]
@@ -1,25 +1,26 @@
1
1
  module Expressir
2
2
  module Model
3
3
  class InterfacedItem < ModelElement
4
- include Identifier
4
+ model_attr_accessor :id
5
+ model_attr_accessor :remarks
6
+ model_attr_accessor :remark_items
5
7
 
6
- undef :source
7
- undef :source=
8
-
9
- attr_accessor :base_item
8
+ model_attr_accessor :base_item
10
9
 
11
10
  def initialize(options = {})
12
11
  @id = options[:id]
13
- @remarks = options.fetch(:remarks, [])
14
- # @source = options[:source]
12
+ @remarks = options[:remarks] || []
13
+ @remark_items = options[:remark_items] || []
15
14
 
16
15
  @base_item = options[:base_item]
17
16
 
18
17
  super
19
18
  end
20
19
 
21
- def path
22
- base_item.path
20
+ def children
21
+ [
22
+ *remark_items
23
+ ]
23
24
  end
24
25
  end
25
26
  end
@@ -2,7 +2,7 @@ module Expressir
2
2
  module Model
3
3
  module Literals
4
4
  class Binary < ModelElement
5
- attr_accessor :value
5
+ model_attr_accessor :value
6
6
 
7
7
  def initialize(options = {})
8
8
  @value = options[:value]
@@ -2,7 +2,7 @@ module Expressir
2
2
  module Model
3
3
  module Literals
4
4
  class Integer < ModelElement
5
- attr_accessor :value
5
+ model_attr_accessor :value
6
6
 
7
7
  def initialize(options = {})
8
8
  @value = options[:value]
@@ -6,7 +6,7 @@ module Expressir
6
6
  FALSE = :FALSE
7
7
  UNKNOWN = :UNKNOWN
8
8
 
9
- attr_accessor :value
9
+ model_attr_accessor :value
10
10
 
11
11
  def initialize(options = {})
12
12
  @value = options[:value]