expressir 0.2.7-x86-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.cross_rubies +30 -0
- data/.github/workflows/rake.yml +45 -0
- data/.github/workflows/release.yml +84 -0
- data/.gitignore +17 -0
- data/.gitmodules +3 -0
- data/.rspec +2 -0
- data/.rubocop.yml +508 -0
- data/Gemfile +4 -0
- data/README.adoc +147 -0
- data/Rakefile +11 -0
- data/bin/console +12 -0
- data/bin/rspec +29 -0
- data/bin/setup +8 -0
- data/demo.rb +18 -0
- data/docs/development.md +90 -0
- data/exe/expressir +20 -0
- data/exe/generate-parser +48 -0
- data/expressir.gemspec +43 -0
- data/lib/expressir/cli/ui.rb +36 -0
- data/lib/expressir/cli.rb +27 -0
- data/lib/expressir/config.rb +23 -0
- data/lib/expressir/express/aggregate_dimension.rb +38 -0
- data/lib/expressir/express/attribute.rb +15 -0
- data/lib/expressir/express/comment.rb +7 -0
- data/lib/expressir/express/defined_type.rb +36 -0
- data/lib/expressir/express/derived.rb +65 -0
- data/lib/expressir/express/derived_aggregate.rb +43 -0
- data/lib/expressir/express/entity.rb +137 -0
- data/lib/expressir/express/explicit.rb +70 -0
- data/lib/expressir/express/explicit_aggregate.rb +46 -0
- data/lib/expressir/express/explicit_or_derived.rb +16 -0
- data/lib/expressir/express/global_rule.rb +44 -0
- data/lib/expressir/express/interface_specification.rb +51 -0
- data/lib/expressir/express/interfaced_item.rb +38 -0
- data/lib/expressir/express/inverse.rb +46 -0
- data/lib/expressir/express/inverse_aggregate.rb +37 -0
- data/lib/expressir/express/model_element.rb +7 -0
- data/lib/expressir/express/named_type.rb +19 -0
- data/lib/expressir/express/remark.rb +8 -0
- data/lib/expressir/express/repository.rb +306 -0
- data/lib/expressir/express/schema_definition.rb +96 -0
- data/lib/expressir/express/subtype_constraint.rb +14 -0
- data/lib/expressir/express/type.rb +26 -0
- data/lib/expressir/express/type_aggregate.rb +42 -0
- data/lib/expressir/express/type_enum.rb +29 -0
- data/lib/expressir/express/type_parser.rb +45 -0
- data/lib/expressir/express/type_select.rb +82 -0
- data/lib/expressir/express/unique_rule.rb +35 -0
- data/lib/expressir/express/where_rule.rb +32 -0
- data/lib/expressir/express.rb +11 -0
- data/lib/expressir/express_exp/2.4/express_parser.so +0 -0
- data/lib/expressir/express_exp/2.5/express_parser.so +0 -0
- data/lib/expressir/express_exp/2.6/express_parser.so +0 -0
- data/lib/expressir/express_exp/2.7/express_parser.so +0 -0
- data/lib/expressir/express_exp/3.0/express_parser.so +0 -0
- data/lib/expressir/express_exp/formatter.rb +1450 -0
- data/lib/expressir/express_exp/parser.rb +41 -0
- data/lib/expressir/express_exp/visitor.rb +2464 -0
- data/lib/expressir/express_parser.rb +30 -0
- data/lib/expressir/model/attribute.rb +27 -0
- data/lib/expressir/model/constant.rb +17 -0
- data/lib/expressir/model/entity.rb +46 -0
- data/lib/expressir/model/enumeration_item.rb +11 -0
- data/lib/expressir/model/expressions/aggregate_initializer.rb +13 -0
- data/lib/expressir/model/expressions/aggregate_item.rb +15 -0
- data/lib/expressir/model/expressions/attribute_reference.rb +15 -0
- data/lib/expressir/model/expressions/binary_expression.rb +40 -0
- data/lib/expressir/model/expressions/call.rb +15 -0
- data/lib/expressir/model/expressions/entity_constructor.rb +15 -0
- data/lib/expressir/model/expressions/group_reference.rb +15 -0
- data/lib/expressir/model/expressions/index_reference.rb +17 -0
- data/lib/expressir/model/expressions/interval.rb +21 -0
- data/lib/expressir/model/expressions/query_expression.rb +26 -0
- data/lib/expressir/model/expressions/simple_reference.rb +13 -0
- data/lib/expressir/model/expressions/unary_expression.rb +19 -0
- data/lib/expressir/model/function.rb +62 -0
- data/lib/expressir/model/identifier.rb +10 -0
- data/lib/expressir/model/interface.rb +18 -0
- data/lib/expressir/model/literals/binary.rb +13 -0
- data/lib/expressir/model/literals/integer.rb +13 -0
- data/lib/expressir/model/literals/logical.rb +17 -0
- data/lib/expressir/model/literals/real.rb +13 -0
- data/lib/expressir/model/literals/string.rb +15 -0
- data/lib/expressir/model/parameter.rb +17 -0
- data/lib/expressir/model/procedure.rb +60 -0
- data/lib/expressir/model/renamed_ref.rb +13 -0
- data/lib/expressir/model/repository.rb +19 -0
- data/lib/expressir/model/rule.rb +62 -0
- data/lib/expressir/model/schema.rb +67 -0
- data/lib/expressir/model/scope.rb +17 -0
- data/lib/expressir/model/statements/alias.rb +26 -0
- data/lib/expressir/model/statements/assignment.rb +15 -0
- data/lib/expressir/model/statements/call.rb +15 -0
- data/lib/expressir/model/statements/case.rb +17 -0
- data/lib/expressir/model/statements/case_action.rb +15 -0
- data/lib/expressir/model/statements/compound.rb +13 -0
- data/lib/expressir/model/statements/escape.rb +8 -0
- data/lib/expressir/model/statements/if.rb +17 -0
- data/lib/expressir/model/statements/null.rb +8 -0
- data/lib/expressir/model/statements/repeat.rb +34 -0
- data/lib/expressir/model/statements/return.rb +13 -0
- data/lib/expressir/model/statements/skip.rb +8 -0
- data/lib/expressir/model/subtype_constraint.rb +27 -0
- data/lib/expressir/model/type.rb +24 -0
- data/lib/expressir/model/types/aggregate.rb +17 -0
- data/lib/expressir/model/types/array.rb +21 -0
- data/lib/expressir/model/types/bag.rb +17 -0
- data/lib/expressir/model/types/binary.rb +15 -0
- data/lib/expressir/model/types/boolean.rb +8 -0
- data/lib/expressir/model/types/enumeration.rb +19 -0
- data/lib/expressir/model/types/generic.rb +13 -0
- data/lib/expressir/model/types/generic_entity.rb +13 -0
- data/lib/expressir/model/types/integer.rb +8 -0
- data/lib/expressir/model/types/list.rb +19 -0
- data/lib/expressir/model/types/logical.rb +8 -0
- data/lib/expressir/model/types/number.rb +8 -0
- data/lib/expressir/model/types/real.rb +13 -0
- data/lib/expressir/model/types/select.rb +21 -0
- data/lib/expressir/model/types/set.rb +17 -0
- data/lib/expressir/model/types/string.rb +15 -0
- data/lib/expressir/model/unique.rb +15 -0
- data/lib/expressir/model/variable.rb +17 -0
- data/lib/expressir/model/where.rb +15 -0
- data/lib/expressir/model.rb +65 -0
- data/lib/expressir/parser/owl_parser.rb +8 -0
- data/lib/expressir/parser.rb +6 -0
- data/lib/expressir/version.rb +3 -0
- data/lib/expressir.rb +21 -0
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.exp +9589 -0
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.owl +36619 -0
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.xml +13294 -0
- data/original/examples/employment/eclipse/.project +17 -0
- data/original/examples/employment/eclipse/Export/Employment.png +0 -0
- data/original/examples/employment/eclipse/Express/employment_schema.exp +33 -0
- data/original/examples/employment/eclipse/Express/employment_schema.xmi +77 -0
- data/original/examples/employment/eclipse/Express/employment_schema.xml +93 -0
- data/original/examples/employment/eclipse/Models/Employment.uml +4 -0
- data/original/examples/employment/eclipse/Models/Employment.umldi +240 -0
- data/original/examples/employment/eclipse/readme.txt +7 -0
- data/original/examples/employment/employment_schema.exp +33 -0
- data/original/examples/employment/employment_schema.rb +232 -0
- data/original/examples/employment/employment_schema.xml +93 -0
- data/original/examples/employment/employment_schema___module.rb +46 -0
- data/original/examples/employment/employment_schema___p28attr.rb +126 -0
- data/original/examples/employment/employment_schema___p28inst.rb +26 -0
- data/original/examples/employment/example_employment_data.xml +1 -0
- data/original/examples/employment/example_employment_data_copy.xml +1 -0
- data/original/examples/employment/example_employment_reader.rb +30 -0
- data/original/examples/employment/example_employment_writer.rb +51 -0
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.exp +3710 -0
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.owl +35880 -0
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xmi +15357 -0
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xml +9468 -0
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.exp +8404 -0
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.owl +43147 -0
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xmi +18341 -0
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xml +11632 -0
- data/original/examples/syntax/remark.exp +146 -0
- data/original/examples/syntax/remark_formatted.exp +175 -0
- data/original/examples/syntax/syntax.exp +311 -0
- data/original/examples/syntax/syntax_formatted.exp +1191 -0
- data/original/exp2ruby.rb +525 -0
- data/original/expsm.rb +34 -0
- data/original/mapping_owl.rb +1018 -0
- data/original/mapping_sysml.rb +2281 -0
- data/original/mapping_uml2.rb +599 -0
- data/original/mapping_uml2_eclipse.rb +433 -0
- data/original/reeper.rb +134 -0
- data/rakelib/cross-ruby.rake +308 -0
- data/spec/acceptance/express_to_owl_spec.rb +18 -0
- data/spec/acceptance/version_spec.rb +12 -0
- data/spec/expressir/express/repository_spec.rb +25 -0
- data/spec/expressir/express_exp/ap233_spec.rb +22 -0
- data/spec/expressir/express_exp/format_remark_spec.rb +28 -0
- data/spec/expressir/express_exp/format_syntax_spec.rb +28 -0
- data/spec/expressir/express_exp/parse_remark_spec.rb +346 -0
- data/spec/expressir/express_exp/parse_syntax_spec.rb +3003 -0
- data/spec/expressir/model/find_spec.rb +110 -0
- data/spec/expressr_spec.rb +5 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/support/console_helper.rb +29 -0
- metadata +357 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
require "expressir/parser"
|
2
|
+
|
3
|
+
module Expressir
|
4
|
+
class ExpressParser
|
5
|
+
def initialize(file, options)
|
6
|
+
@file = file
|
7
|
+
@options = options
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_owl
|
11
|
+
owl_parser.parse(express_xml, options)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.to_owl(file, **options)
|
15
|
+
new(file, options).to_owl
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
attr_reader :file, :options
|
21
|
+
|
22
|
+
def owl_parser
|
23
|
+
Expressir::Parser::OwlParser
|
24
|
+
end
|
25
|
+
|
26
|
+
def express_xml
|
27
|
+
Expressir::Express.from_xml(file)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
class Attribute
|
4
|
+
include Identifier
|
5
|
+
|
6
|
+
EXPLICIT = :EXPLICIT
|
7
|
+
DERIVED = :DERIVED
|
8
|
+
INVERSE = :INVERSE
|
9
|
+
|
10
|
+
attr_accessor :kind
|
11
|
+
attr_accessor :supertype_attribute
|
12
|
+
attr_accessor :optional
|
13
|
+
attr_accessor :type
|
14
|
+
attr_accessor :expression
|
15
|
+
|
16
|
+
def initialize(options = {})
|
17
|
+
@id = options[:id]
|
18
|
+
|
19
|
+
@kind = options[:kind]
|
20
|
+
@supertype_attribute = options[:supertype_attribute]
|
21
|
+
@optional = options[:optional]
|
22
|
+
@type = options[:type]
|
23
|
+
@expression = options[:expression]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
class Constant
|
4
|
+
include Identifier
|
5
|
+
|
6
|
+
attr_accessor :type
|
7
|
+
attr_accessor :expression
|
8
|
+
|
9
|
+
def initialize(options = {})
|
10
|
+
@id = options[:id]
|
11
|
+
|
12
|
+
@type = options[:type]
|
13
|
+
@expression = options[:expression]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
class Entity
|
4
|
+
include Scope
|
5
|
+
include Identifier
|
6
|
+
|
7
|
+
attr_accessor :abstract
|
8
|
+
attr_accessor :supertype_expression
|
9
|
+
attr_accessor :subtype_of
|
10
|
+
attr_accessor :attributes
|
11
|
+
attr_accessor :unique
|
12
|
+
attr_accessor :where
|
13
|
+
|
14
|
+
def initialize(options = {})
|
15
|
+
@id = options[:id]
|
16
|
+
|
17
|
+
@abstract = options[:abstract]
|
18
|
+
@supertype_expression = options[:supertype_expression]
|
19
|
+
@subtype_of = options[:subtype_of]
|
20
|
+
@attributes = options[:attributes]
|
21
|
+
@unique = options[:unique]
|
22
|
+
@where = options[:where]
|
23
|
+
end
|
24
|
+
|
25
|
+
def explicit_attributes
|
26
|
+
@attributes.select{|x| x.kind == Expressir::Model::Attribute::EXPLICIT}
|
27
|
+
end
|
28
|
+
|
29
|
+
def derived_attributes
|
30
|
+
@attributes.select{|x| x.kind == Expressir::Model::Attribute::DERIVED}
|
31
|
+
end
|
32
|
+
|
33
|
+
def inverse_attributes
|
34
|
+
@attributes.select{|x| x.kind == Expressir::Model::Attribute::INVERSE}
|
35
|
+
end
|
36
|
+
|
37
|
+
def children
|
38
|
+
items = []
|
39
|
+
items.push(*@attributes) if @attributes
|
40
|
+
items.push(*@unique) if @unique
|
41
|
+
items.push(*@where) if @where
|
42
|
+
items
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
module Expressions
|
4
|
+
class AggregateItem
|
5
|
+
attr_accessor :expression
|
6
|
+
attr_accessor :repetition
|
7
|
+
|
8
|
+
def initialize(options = {})
|
9
|
+
@expression = options[:expression]
|
10
|
+
@repetition = options[:repetition]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
module Expressions
|
4
|
+
class AttributeReference
|
5
|
+
attr_accessor :ref
|
6
|
+
attr_accessor :attribute
|
7
|
+
|
8
|
+
def initialize(options = {})
|
9
|
+
@ref = options[:ref]
|
10
|
+
@attribute = options[:attribute]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
module Expressions
|
4
|
+
class BinaryExpression
|
5
|
+
ADDITION = :ADDITION
|
6
|
+
AND = :AND
|
7
|
+
ANDOR = :ANDOR
|
8
|
+
COMBINE = :COMBINE
|
9
|
+
EQUAL = :EQUAL
|
10
|
+
EXPONENTIATION = :EXPONENTIATION
|
11
|
+
GREATER_THAN = :GREATER_THAN
|
12
|
+
GREATER_THAN_OR_EQUAL = :GREATER_THAN_OR_EQUAL
|
13
|
+
IN = :IN
|
14
|
+
INSTANCE_EQUAL = :INSTANCE_EQUAL
|
15
|
+
INSTANCE_NOT_EQUAL = :INSTANCE_NOT_EQUAL
|
16
|
+
INTEGER_DIVISION = :INTEGER_DIVISION
|
17
|
+
LESS_THAN = :LESS_THAN
|
18
|
+
LESS_THAN_OR_EQUAL = :LESS_THAN_OR_EQUAL
|
19
|
+
LIKE = :LIKE
|
20
|
+
MODULO = :MODULO
|
21
|
+
MULTIPLICATION = :MULTIPLICATION
|
22
|
+
NOT_EQUAL = :NOT_EQUAL
|
23
|
+
OR = :OR
|
24
|
+
REAL_DIVISION = :REAL_DIVISION
|
25
|
+
SUBTRACTION = :SUBTRACTION
|
26
|
+
XOR = :XOR
|
27
|
+
|
28
|
+
attr_accessor :operator
|
29
|
+
attr_accessor :operand1
|
30
|
+
attr_accessor :operand2
|
31
|
+
|
32
|
+
def initialize(options = {})
|
33
|
+
@operator = options[:operator]
|
34
|
+
@operand1 = options[:operand1]
|
35
|
+
@operand2 = options[:operand2]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
module Expressions
|
4
|
+
class EntityConstructor
|
5
|
+
attr_accessor :entity
|
6
|
+
attr_accessor :parameters
|
7
|
+
|
8
|
+
def initialize(options = {})
|
9
|
+
@entity = options[:entity]
|
10
|
+
@parameters = options[:parameters]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
module Expressions
|
4
|
+
class IndexReference
|
5
|
+
attr_accessor :ref
|
6
|
+
attr_accessor :index1
|
7
|
+
attr_accessor :index2
|
8
|
+
|
9
|
+
def initialize(options = {})
|
10
|
+
@ref = options[:ref]
|
11
|
+
@index1 = options[:index1]
|
12
|
+
@index2 = options[:index2]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
module Expressions
|
4
|
+
class Interval
|
5
|
+
attr_accessor :low
|
6
|
+
attr_accessor :operator1
|
7
|
+
attr_accessor :item
|
8
|
+
attr_accessor :operator2
|
9
|
+
attr_accessor :high
|
10
|
+
|
11
|
+
def initialize(options = {})
|
12
|
+
@low = options[:low]
|
13
|
+
@operator1 = options[:operator1]
|
14
|
+
@item = options[:item]
|
15
|
+
@operator2 = options[:operator2]
|
16
|
+
@high = options[:high]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
module Expressions
|
4
|
+
class QueryExpression
|
5
|
+
include Scope
|
6
|
+
include Identifier
|
7
|
+
|
8
|
+
attr_accessor :aggregate_source
|
9
|
+
attr_accessor :expression
|
10
|
+
|
11
|
+
def initialize(options = {})
|
12
|
+
@id = options[:id]
|
13
|
+
|
14
|
+
@aggregate_source = options[:aggregate_source]
|
15
|
+
@expression = options[:expression]
|
16
|
+
end
|
17
|
+
|
18
|
+
def children
|
19
|
+
items = []
|
20
|
+
items.push(self)
|
21
|
+
items
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
module Expressions
|
4
|
+
class UnaryExpression
|
5
|
+
MINUS = :MINUS
|
6
|
+
NOT = :NOT
|
7
|
+
PLUS = :PLUS
|
8
|
+
|
9
|
+
attr_accessor :operator
|
10
|
+
attr_accessor :operand
|
11
|
+
|
12
|
+
def initialize(options = {})
|
13
|
+
@operator = options[:operator]
|
14
|
+
@operand = options[:operand]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
class Function
|
4
|
+
include Scope
|
5
|
+
include Identifier
|
6
|
+
|
7
|
+
attr_accessor :parameters
|
8
|
+
attr_accessor :return_type
|
9
|
+
attr_accessor :declarations
|
10
|
+
attr_accessor :constants
|
11
|
+
attr_accessor :variables
|
12
|
+
attr_accessor :statements
|
13
|
+
|
14
|
+
def initialize(options = {})
|
15
|
+
@id = options[:id]
|
16
|
+
|
17
|
+
@parameters = options[:parameters]
|
18
|
+
@return_type = options[:return_type]
|
19
|
+
@declarations = options[:declarations]
|
20
|
+
@constants = options[:constants]
|
21
|
+
@variables = options[:variables]
|
22
|
+
@statements = options[:statements]
|
23
|
+
end
|
24
|
+
|
25
|
+
def types
|
26
|
+
@declarations.select{|x| x.instance_of? Expressir::Model::Type}
|
27
|
+
end
|
28
|
+
|
29
|
+
def entities
|
30
|
+
@declarations.select{|x| x.instance_of? Expressir::Model::Entity}
|
31
|
+
end
|
32
|
+
|
33
|
+
def subtype_constraints
|
34
|
+
@declarations.select{|x| x.instance_of? Expressir::Model::SubtypeConstraint}
|
35
|
+
end
|
36
|
+
|
37
|
+
def functions
|
38
|
+
@declarations.select{|x| x.instance_of? Expressir::Model::Function}
|
39
|
+
end
|
40
|
+
|
41
|
+
def procedures
|
42
|
+
@declarations.select{|x| x.instance_of? Expressir::Model::Procedure}
|
43
|
+
end
|
44
|
+
|
45
|
+
def children
|
46
|
+
items = []
|
47
|
+
items.push(*@parameters) if @parameters
|
48
|
+
items.push(*@declarations.flat_map do |x|
|
49
|
+
[
|
50
|
+
x,
|
51
|
+
*if x.instance_of? Expressir::Model::Type and x.type.instance_of? Expressir::Model::Types::Enumeration
|
52
|
+
x.type.items
|
53
|
+
end
|
54
|
+
]
|
55
|
+
end) if @declarations
|
56
|
+
items.push(*@constants) if @constants
|
57
|
+
items.push(*@variables) if @variables
|
58
|
+
items
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
class Interface
|
4
|
+
USE = :USE
|
5
|
+
REFERENCE = :REFERENCE
|
6
|
+
|
7
|
+
attr_accessor :kind
|
8
|
+
attr_accessor :schema
|
9
|
+
attr_accessor :items
|
10
|
+
|
11
|
+
def initialize(options = {})
|
12
|
+
@kind = options[:kind]
|
13
|
+
@schema = options[:schema]
|
14
|
+
@items = options[:items]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
class Parameter
|
4
|
+
include Identifier
|
5
|
+
|
6
|
+
attr_accessor :var
|
7
|
+
attr_accessor :type
|
8
|
+
|
9
|
+
def initialize(options = {})
|
10
|
+
@id = options[:id]
|
11
|
+
|
12
|
+
@var = options[:var]
|
13
|
+
@type = options[:type]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
class Procedure
|
4
|
+
include Scope
|
5
|
+
include Identifier
|
6
|
+
|
7
|
+
attr_accessor :parameters
|
8
|
+
attr_accessor :declarations
|
9
|
+
attr_accessor :constants
|
10
|
+
attr_accessor :variables
|
11
|
+
attr_accessor :statements
|
12
|
+
|
13
|
+
def initialize(options = {})
|
14
|
+
@id = options[:id]
|
15
|
+
|
16
|
+
@parameters = options[:parameters]
|
17
|
+
@declarations = options[:declarations]
|
18
|
+
@constants = options[:constants]
|
19
|
+
@variables = options[:variables]
|
20
|
+
@statements = options[:statements]
|
21
|
+
end
|
22
|
+
|
23
|
+
def types
|
24
|
+
@declarations.select{|x| x.instance_of? Expressir::Model::Type}
|
25
|
+
end
|
26
|
+
|
27
|
+
def entities
|
28
|
+
@declarations.select{|x| x.instance_of? Expressir::Model::Entity}
|
29
|
+
end
|
30
|
+
|
31
|
+
def subtype_constraints
|
32
|
+
@declarations.select{|x| x.instance_of? Expressir::Model::SubtypeConstraint}
|
33
|
+
end
|
34
|
+
|
35
|
+
def functions
|
36
|
+
@declarations.select{|x| x.instance_of? Expressir::Model::Function}
|
37
|
+
end
|
38
|
+
|
39
|
+
def procedures
|
40
|
+
@declarations.select{|x| x.instance_of? Expressir::Model::Procedure}
|
41
|
+
end
|
42
|
+
|
43
|
+
def children
|
44
|
+
items = []
|
45
|
+
items.push(*@parameters) if @parameters
|
46
|
+
items.push(*@declarations.flat_map do |x|
|
47
|
+
[
|
48
|
+
x,
|
49
|
+
*if x.instance_of? Expressir::Model::Type and x.type.instance_of? Expressir::Model::Types::Enumeration
|
50
|
+
x.type.items
|
51
|
+
end
|
52
|
+
]
|
53
|
+
end) if @declarations
|
54
|
+
items.push(*@constants) if @constants
|
55
|
+
items.push(*@variables) if @variables
|
56
|
+
items
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Expressir
|
2
|
+
module Model
|
3
|
+
class Repository
|
4
|
+
include Scope
|
5
|
+
|
6
|
+
attr_accessor :schemas
|
7
|
+
|
8
|
+
def initialize(options = {})
|
9
|
+
@schemas = options[:schemas]
|
10
|
+
end
|
11
|
+
|
12
|
+
def children
|
13
|
+
items = []
|
14
|
+
items.push(*@schemas) if @schemas
|
15
|
+
items
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|