expressir 0.2.16-arm64-darwin → 0.2.17-arm64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/format +51 -13
- data/lib/expressir/express_exp/2.4/express_parser.bundle +0 -0
- data/lib/expressir/express_exp/2.5/express_parser.bundle +0 -0
- data/lib/expressir/express_exp/2.6/express_parser.bundle +0 -0
- data/lib/expressir/express_exp/2.7/express_parser.bundle +0 -0
- data/lib/expressir/express_exp/formatter.rb +185 -135
- data/lib/expressir/express_exp/parser.rb +29 -29
- data/lib/expressir/express_exp/schema_head_formatter.rb +1 -4
- data/lib/expressir/express_exp/visitor.rb +11 -6
- data/lib/expressir/model/entity.rb +6 -6
- data/lib/expressir/model/expressions/query_expression.rb +3 -3
- data/lib/expressir/model/function.rb +15 -11
- data/lib/expressir/model/informal_proposition.rb +4 -1
- data/lib/expressir/model/interfaced_item.rb +4 -1
- data/lib/expressir/model/model_element.rb +20 -7
- data/lib/expressir/model/procedure.rb +15 -11
- data/lib/expressir/model/repository.rb +3 -3
- data/lib/expressir/model/rule.rb +16 -12
- data/lib/expressir/model/schema.rb +52 -45
- data/lib/expressir/model/statements/alias.rb +3 -3
- data/lib/expressir/model/statements/repeat.rb +3 -3
- data/lib/expressir/model/subtype_constraint.rb +1 -6
- data/lib/expressir/model/type.rb +9 -5
- data/lib/expressir/version.rb +1 -1
- data/original/examples/syntax/{hyperlink.exp → multiple.exp} +8 -8
- data/original/examples/syntax/multiple.yaml +180 -0
- data/original/examples/syntax/multiple_formatted.exp +71 -0
- data/original/examples/syntax/multiple_hyperlink_formatted.exp +71 -0
- data/original/examples/syntax/multiple_schema_head_hyperlink_formatted.exp +13 -0
- data/original/examples/syntax/remark.exp +41 -41
- data/original/examples/syntax/remark.yaml +445 -0
- data/original/examples/syntax/remark_formatted.exp +62 -50
- data/original/examples/syntax/{simple.exp → single.exp} +1 -1
- data/original/examples/syntax/single.yaml +8 -0
- data/original/examples/syntax/single_formatted.exp +6 -0
- data/original/examples/syntax/single_formatted.yaml +18 -0
- data/original/examples/syntax/syntax.exp +29 -19
- data/original/examples/syntax/syntax.yaml +3438 -0
- data/original/examples/syntax/syntax_formatted.exp +271 -131
- data/original/examples/syntax/syntax_schema_head_formatted.exp +18 -0
- data/spec/expressir/express_exp/formatter_spec.rb +110 -0
- data/spec/expressir/express_exp/parser_spec.rb +98 -0
- data/spec/expressir/model/{model_element/find_spec.rb → model_element_spec.rb} +93 -10
- metadata +17 -16
- data/original/examples/syntax/hyperlink_formatted.exp +0 -51
- data/original/examples/syntax/source.exp +0 -16
- data/spec/expressir/express_exp/formatter/remark_spec.rb +0 -28
- data/spec/expressir/express_exp/formatter/syntax_spec.rb +0 -28
- data/spec/expressir/express_exp/hyperlink_formatter_spec.rb +0 -28
- data/spec/expressir/express_exp/parser/multiple_spec.rb +0 -37
- data/spec/expressir/express_exp/parser/remark_spec.rb +0 -411
- data/spec/expressir/express_exp/parser/source_spec.rb +0 -29
- data/spec/expressir/express_exp/parser/syntax_spec.rb +0 -3086
- data/spec/expressir/express_exp/schema_head_formatter_spec.rb +0 -40
- data/spec/expressir/model/model_element/hash_spec.rb +0 -66
@@ -0,0 +1,18 @@
|
|
1
|
+
SCHEMA syntax_schema 'version';
|
2
|
+
|
3
|
+
USE FROM contract_schema;
|
4
|
+
USE FROM contract_schema
|
5
|
+
(contract);
|
6
|
+
USE FROM contract_schema
|
7
|
+
(contract,
|
8
|
+
contract2);
|
9
|
+
USE FROM contract_schema
|
10
|
+
(contract AS contract2);
|
11
|
+
REFERENCE FROM contract_schema;
|
12
|
+
REFERENCE FROM contract_schema
|
13
|
+
(contract);
|
14
|
+
REFERENCE FROM contract_schema
|
15
|
+
(contract,
|
16
|
+
contract2);
|
17
|
+
REFERENCE FROM contract_schema
|
18
|
+
(contract AS contract2);
|
@@ -0,0 +1,110 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "expressir/express_exp/parser"
|
3
|
+
require "expressir/express_exp/formatter"
|
4
|
+
require "expressir/express_exp/schema_head_formatter"
|
5
|
+
require "expressir/express_exp/hyperlink_formatter"
|
6
|
+
|
7
|
+
RSpec.describe Expressir::ExpressExp::Formatter do
|
8
|
+
describe ".format" do
|
9
|
+
it "exports an object (single.exp)" do
|
10
|
+
exp_file = Expressir.root_path.join("original", "examples", "syntax", "single.exp")
|
11
|
+
formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "single_formatted.exp")
|
12
|
+
|
13
|
+
repo = Expressir::ExpressExp::Parser.from_file(exp_file)
|
14
|
+
|
15
|
+
result = Expressir::ExpressExp::Formatter.format(repo)
|
16
|
+
# File.write(formatted_exp_file, result)
|
17
|
+
expected_result = File.read(formatted_exp_file)
|
18
|
+
|
19
|
+
expect(result).to eq(expected_result)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "exports an object (multiple.exp)" do
|
23
|
+
exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple.exp")
|
24
|
+
formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple_formatted.exp")
|
25
|
+
|
26
|
+
repo = Expressir::ExpressExp::Parser.from_file(exp_file)
|
27
|
+
|
28
|
+
result = Expressir::ExpressExp::Formatter.format(repo)
|
29
|
+
# File.write(formatted_exp_file, result)
|
30
|
+
expected_result = File.read(formatted_exp_file)
|
31
|
+
|
32
|
+
expect(result).to eq(expected_result)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "exports an object (remark.exp)" do
|
36
|
+
exp_file = Expressir.root_path.join("original", "examples", "syntax", "remark.exp")
|
37
|
+
formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "remark_formatted.exp")
|
38
|
+
|
39
|
+
repo = Expressir::ExpressExp::Parser.from_file(exp_file)
|
40
|
+
|
41
|
+
result = Expressir::ExpressExp::Formatter.format(repo)
|
42
|
+
# File.write(formatted_exp_file, result)
|
43
|
+
expected_result = File.read(formatted_exp_file)
|
44
|
+
|
45
|
+
expect(result).to eq(expected_result)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "exports an object (syntax.exp)" do
|
49
|
+
exp_file = Expressir.root_path.join("original", "examples", "syntax", "syntax.exp")
|
50
|
+
formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "syntax_formatted.exp")
|
51
|
+
|
52
|
+
repo = Expressir::ExpressExp::Parser.from_file(exp_file)
|
53
|
+
|
54
|
+
result = Expressir::ExpressExp::Formatter.format(repo)
|
55
|
+
# File.write(formatted_exp_file, result)
|
56
|
+
expected_result = File.read(formatted_exp_file)
|
57
|
+
|
58
|
+
expect(result).to eq(expected_result)
|
59
|
+
end
|
60
|
+
|
61
|
+
it "exports an object with schema head formatter (syntax.exp)" do
|
62
|
+
exp_file = Expressir.root_path.join("original", "examples", "syntax", "syntax.exp")
|
63
|
+
formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "syntax_schema_head_formatted.exp")
|
64
|
+
|
65
|
+
repo = Expressir::ExpressExp::Parser.from_file(exp_file)
|
66
|
+
|
67
|
+
formatter = Class.new(Expressir::ExpressExp::Formatter) do
|
68
|
+
include Expressir::ExpressExp::SchemaHeadFormatter
|
69
|
+
end
|
70
|
+
result = formatter.format(repo)
|
71
|
+
# File.write(formatted_exp_file, result)
|
72
|
+
expected_result = File.read(formatted_exp_file)
|
73
|
+
|
74
|
+
expect(result).to eq(expected_result)
|
75
|
+
end
|
76
|
+
|
77
|
+
it "exports an object with hyperlink formatter (multiple.exp)" do
|
78
|
+
exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple.exp")
|
79
|
+
formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple_hyperlink_formatted.exp")
|
80
|
+
|
81
|
+
repo = Expressir::ExpressExp::Parser.from_file(exp_file)
|
82
|
+
|
83
|
+
formatter = Class.new(Expressir::ExpressExp::Formatter) do
|
84
|
+
include Expressir::ExpressExp::HyperlinkFormatter
|
85
|
+
end
|
86
|
+
result = formatter.format(repo)
|
87
|
+
# File.write(formatted_exp_file, result)
|
88
|
+
expected_result = File.read(formatted_exp_file)
|
89
|
+
|
90
|
+
expect(result).to eq(expected_result)
|
91
|
+
end
|
92
|
+
|
93
|
+
it "exports an object with schema head and hyperlink formatter (multiple.exp)" do
|
94
|
+
exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple.exp")
|
95
|
+
formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple_schema_head_hyperlink_formatted.exp")
|
96
|
+
|
97
|
+
repo = Expressir::ExpressExp::Parser.from_file(exp_file)
|
98
|
+
|
99
|
+
formatter = Class.new(Expressir::ExpressExp::Formatter) do
|
100
|
+
include Expressir::ExpressExp::SchemaHeadFormatter
|
101
|
+
include Expressir::ExpressExp::HyperlinkFormatter
|
102
|
+
end
|
103
|
+
result = formatter.format(repo)
|
104
|
+
# File.write(formatted_exp_file, result)
|
105
|
+
expected_result = File.read(formatted_exp_file)
|
106
|
+
|
107
|
+
expect(result).to eq(expected_result)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
require "yaml"
|
2
|
+
require "spec_helper"
|
3
|
+
require "expressir/express_exp/parser"
|
4
|
+
|
5
|
+
RSpec.describe Expressir::ExpressExp::Parser do
|
6
|
+
describe ".from_file" do
|
7
|
+
it "parses a file (single.exp)" do
|
8
|
+
exp_file = Expressir.root_path.join("original", "examples", "syntax", "single.exp")
|
9
|
+
yaml_file = Expressir.root_path.join("original", "examples", "syntax", "single.yaml")
|
10
|
+
|
11
|
+
repo = Expressir::ExpressExp::Parser.from_file(exp_file)
|
12
|
+
result = YAML.dump(repo.to_hash(skip_empty: true))
|
13
|
+
# File.write(yaml_file, result)
|
14
|
+
expected_result = File.read(yaml_file)
|
15
|
+
|
16
|
+
expect(result).to eq(expected_result)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "parses a file (multiple.exp)" do
|
20
|
+
exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple.exp")
|
21
|
+
yaml_file = Expressir.root_path.join("original", "examples", "syntax", "multiple.yaml")
|
22
|
+
|
23
|
+
repo = Expressir::ExpressExp::Parser.from_file(exp_file)
|
24
|
+
result = YAML.dump(repo.to_hash(skip_empty: true))
|
25
|
+
# File.write(yaml_file, result)
|
26
|
+
expected_result = File.read(yaml_file)
|
27
|
+
|
28
|
+
expect(result).to eq(expected_result)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "parses a file (syntax.exp)" do
|
32
|
+
exp_file = Expressir.root_path.join("original", "examples", "syntax", "syntax.exp")
|
33
|
+
yaml_file = Expressir.root_path.join("original", "examples", "syntax", "syntax.yaml")
|
34
|
+
|
35
|
+
repo = Expressir::ExpressExp::Parser.from_file(exp_file)
|
36
|
+
result = YAML.dump(repo.to_hash(skip_empty: true))
|
37
|
+
# File.write(yaml_file, result)
|
38
|
+
expected_result = File.read(yaml_file)
|
39
|
+
|
40
|
+
expect(result).to eq(expected_result)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "parses a file (remark.exp)" do
|
44
|
+
exp_file = Expressir.root_path.join("original", "examples", "syntax", "remark.exp")
|
45
|
+
yaml_file = Expressir.root_path.join("original", "examples", "syntax", "remark.yaml")
|
46
|
+
|
47
|
+
repo = Expressir::ExpressExp::Parser.from_file(exp_file)
|
48
|
+
result = YAML.dump(repo.to_hash(skip_empty: true))
|
49
|
+
# File.write(yaml_file, result)
|
50
|
+
expected_result = File.read(yaml_file)
|
51
|
+
|
52
|
+
expect(result).to eq(expected_result)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "parses a file including original source (multiple.exp)" do
|
56
|
+
exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple.exp")
|
57
|
+
|
58
|
+
input = File.read(exp_file)
|
59
|
+
repo = Expressir::ExpressExp::Parser.from_file(exp_file, include_source: true)
|
60
|
+
|
61
|
+
schema = repo.schemas.first
|
62
|
+
start_index = input.index("SCHEMA")
|
63
|
+
stop_index = input.index("END_SCHEMA;") + "END_SCHEMA;".length - 1
|
64
|
+
expected_result = input[start_index..stop_index]
|
65
|
+
expect(schema.source).to eq(expected_result)
|
66
|
+
|
67
|
+
entity = schema.entities.first
|
68
|
+
start_index = input.index("ENTITY")
|
69
|
+
stop_index = input.index("END_ENTITY;") + "END_ENTITY;".length - 1
|
70
|
+
expected_result = input[start_index..stop_index]
|
71
|
+
expect(entity.source).to eq(expected_result)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe ".from_files" do
|
76
|
+
it "parses multiple files (single.exp, multiple.exp)" do
|
77
|
+
exp_files = [
|
78
|
+
Expressir.root_path.join("original", "examples", "syntax", "single.exp"),
|
79
|
+
Expressir.root_path.join("original", "examples", "syntax", "multiple.exp")
|
80
|
+
]
|
81
|
+
|
82
|
+
repo = Expressir::ExpressExp::Parser.from_files(exp_files)
|
83
|
+
|
84
|
+
schemas = repo.schemas
|
85
|
+
expect(schemas.count).to eq(5)
|
86
|
+
expect(schemas[0].file).to eq(exp_files[0])
|
87
|
+
expect(schemas[0].id).to eq("single_schema")
|
88
|
+
expect(schemas[1].file).to eq(exp_files[1])
|
89
|
+
expect(schemas[1].id).to eq("multiple_schema1")
|
90
|
+
expect(schemas[2].file).to eq(exp_files[1])
|
91
|
+
expect(schemas[2].id).to eq("multiple_schema2")
|
92
|
+
expect(schemas[3].file).to eq(exp_files[1])
|
93
|
+
expect(schemas[3].id).to eq("multiple_schema3")
|
94
|
+
expect(schemas[4].file).to eq(exp_files[1])
|
95
|
+
expect(schemas[4].id).to eq("multiple_schema4")
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -2,9 +2,76 @@ require "spec_helper"
|
|
2
2
|
require "expressir/express_exp/parser"
|
3
3
|
|
4
4
|
RSpec.describe Expressir::Model::ModelElement do
|
5
|
+
describe ".to_hash" do
|
6
|
+
it "exports an object with a formatter (single.exp)" do
|
7
|
+
exp_file = Expressir.root_path.join("original", "examples", "syntax", "single.exp")
|
8
|
+
yaml_file = Expressir.root_path.join("original", "examples", "syntax", "single_formatted.yaml")
|
9
|
+
|
10
|
+
repo = Expressir::ExpressExp::Parser.from_file(exp_file)
|
11
|
+
|
12
|
+
result = YAML.dump(repo.to_hash(skip_empty: true, formatter: Expressir::ExpressExp::Formatter))
|
13
|
+
# File.write(yaml_file, result)
|
14
|
+
expected_result = File.read(yaml_file)
|
15
|
+
|
16
|
+
expect(result).to eq(expected_result)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe ".from_hash" do
|
21
|
+
it "parses an object (single.yaml)" do
|
22
|
+
yaml_file = Expressir.root_path.join("original", "examples", "syntax", "single.yaml")
|
23
|
+
|
24
|
+
input = YAML.load(File.read(yaml_file))
|
25
|
+
repo = Expressir::Model::ModelElement.from_hash(input)
|
26
|
+
|
27
|
+
result = YAML.dump(repo.to_hash(skip_empty: true))
|
28
|
+
expected_result = File.read(yaml_file)
|
29
|
+
|
30
|
+
expect(result).to eq(expected_result)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "parses an object (multiple.yaml)" do
|
34
|
+
yaml_file = Expressir.root_path.join("original", "examples", "syntax", "multiple.yaml")
|
35
|
+
|
36
|
+
input = YAML.load(File.read(yaml_file))
|
37
|
+
repo = Expressir::Model::ModelElement.from_hash(input)
|
38
|
+
|
39
|
+
result = YAML.dump(repo.to_hash(skip_empty: true))
|
40
|
+
expected_result = File.read(yaml_file)
|
41
|
+
|
42
|
+
expect(result).to eq(expected_result)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "parses an object (syntax.yaml)" do
|
46
|
+
yaml_file = Expressir.root_path.join("original", "examples", "syntax", "syntax.yaml")
|
47
|
+
|
48
|
+
input = YAML.load(File.read(yaml_file))
|
49
|
+
repo = Expressir::Model::ModelElement.from_hash(input)
|
50
|
+
|
51
|
+
result = YAML.dump(repo.to_hash(skip_empty: true))
|
52
|
+
expected_result = File.read(yaml_file)
|
53
|
+
|
54
|
+
expect(result).to eq(expected_result)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "parses an object (remark.yaml)" do
|
58
|
+
yaml_file = Expressir.root_path.join("original", "examples", "syntax", "remark.yaml")
|
59
|
+
|
60
|
+
input = YAML.load(File.read(yaml_file))
|
61
|
+
repo = Expressir::Model::ModelElement.from_hash(input)
|
62
|
+
|
63
|
+
result = YAML.dump(repo.to_hash(skip_empty: true))
|
64
|
+
expected_result = File.read(yaml_file)
|
65
|
+
|
66
|
+
expect(result).to eq(expected_result)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
5
70
|
describe ".find" do
|
6
71
|
it "finds an object" do
|
7
|
-
|
72
|
+
exp_file = Expressir.root_path.join("original", "examples", "syntax", "remark.exp")
|
73
|
+
|
74
|
+
repo = Expressir::ExpressExp::Parser.from_file(exp_file)
|
8
75
|
|
9
76
|
# universal scope
|
10
77
|
expect(repo.find('remark_schema')).to be_instance_of(Expressir::Model::Schema)
|
@@ -12,14 +79,18 @@ RSpec.describe Expressir::Model::ModelElement do
|
|
12
79
|
expect(repo.find('remark_schema.remark_type')).to be_instance_of(Expressir::Model::Type)
|
13
80
|
expect(repo.find('remark_schema.remark_type.WR1')).to be_instance_of(Expressir::Model::Where)
|
14
81
|
expect(repo.find('remark_schema.remark_type.wr:WR1')).to be_instance_of(Expressir::Model::Where)
|
82
|
+
expect(repo.find('remark_schema.remark_type.IP1')).to be_instance_of(Expressir::Model::InformalProposition)
|
83
|
+
expect(repo.find('remark_schema.remark_type.ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
|
15
84
|
expect(repo.find('remark_schema.remark_enumeration_item')).to be_instance_of(Expressir::Model::EnumerationItem)
|
16
85
|
expect(repo.find('remark_schema.remark_entity')).to be_instance_of(Expressir::Model::Entity)
|
17
86
|
expect(repo.find('remark_schema.remark_entity.remark_attribute')).to be_instance_of(Expressir::Model::Attribute)
|
18
87
|
expect(repo.find('remark_schema.remark_entity.remark_derived_attribute')).to be_instance_of(Expressir::Model::Attribute)
|
19
88
|
expect(repo.find('remark_schema.remark_entity.remark_inverse_attribute')).to be_instance_of(Expressir::Model::Attribute)
|
20
|
-
expect(repo.find('remark_schema.remark_entity.
|
89
|
+
expect(repo.find('remark_schema.remark_entity.UR1')).to be_instance_of(Expressir::Model::Unique)
|
21
90
|
expect(repo.find('remark_schema.remark_entity.WR1')).to be_instance_of(Expressir::Model::Where)
|
22
91
|
expect(repo.find('remark_schema.remark_entity.wr:WR1')).to be_instance_of(Expressir::Model::Where)
|
92
|
+
expect(repo.find('remark_schema.remark_entity.IP1')).to be_instance_of(Expressir::Model::InformalProposition)
|
93
|
+
expect(repo.find('remark_schema.remark_entity.ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
|
23
94
|
expect(repo.find('remark_schema.remark_subtype_constraint')).to be_instance_of(Expressir::Model::SubtypeConstraint)
|
24
95
|
expect(repo.find('remark_schema.remark_function')).to be_instance_of(Expressir::Model::Function)
|
25
96
|
expect(repo.find('remark_schema.remark_function.remark_parameter')).to be_instance_of(Expressir::Model::Parameter)
|
@@ -40,19 +111,27 @@ RSpec.describe Expressir::Model::ModelElement do
|
|
40
111
|
expect(repo.find('remark_schema.remark_rule.remark_variable')).to be_instance_of(Expressir::Model::Variable)
|
41
112
|
expect(repo.find('remark_schema.remark_rule.WR1')).to be_instance_of(Expressir::Model::Where)
|
42
113
|
expect(repo.find('remark_schema.remark_rule.wr:WR1')).to be_instance_of(Expressir::Model::Where)
|
114
|
+
expect(repo.find('remark_schema.remark_rule.IP1')).to be_instance_of(Expressir::Model::InformalProposition)
|
115
|
+
expect(repo.find('remark_schema.remark_rule.ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
|
43
116
|
|
44
117
|
# schema scope
|
45
118
|
schema = repo.schemas.first
|
46
119
|
expect(schema.find('remark_constant')).to be_instance_of(Expressir::Model::Constant)
|
47
120
|
expect(schema.find('remark_type')).to be_instance_of(Expressir::Model::Type)
|
121
|
+
expect(schema.find('remark_type.WR1')).to be_instance_of(Expressir::Model::Where)
|
122
|
+
expect(schema.find('remark_type.wr:WR1')).to be_instance_of(Expressir::Model::Where)
|
123
|
+
expect(schema.find('remark_type.IP1')).to be_instance_of(Expressir::Model::InformalProposition)
|
124
|
+
expect(schema.find('remark_type.ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
|
48
125
|
expect(schema.find('remark_enumeration_item')).to be_instance_of(Expressir::Model::EnumerationItem)
|
49
126
|
expect(schema.find('remark_entity')).to be_instance_of(Expressir::Model::Entity)
|
50
127
|
expect(schema.find('remark_entity.remark_attribute')).to be_instance_of(Expressir::Model::Attribute)
|
51
128
|
expect(schema.find('remark_entity.remark_derived_attribute')).to be_instance_of(Expressir::Model::Attribute)
|
52
129
|
expect(schema.find('remark_entity.remark_inverse_attribute')).to be_instance_of(Expressir::Model::Attribute)
|
53
|
-
expect(schema.find('remark_entity.
|
130
|
+
expect(schema.find('remark_entity.UR1')).to be_instance_of(Expressir::Model::Unique)
|
54
131
|
expect(schema.find('remark_entity.WR1')).to be_instance_of(Expressir::Model::Where)
|
55
132
|
expect(schema.find('remark_entity.wr:WR1')).to be_instance_of(Expressir::Model::Where)
|
133
|
+
expect(schema.find('remark_entity.IP1')).to be_instance_of(Expressir::Model::InformalProposition)
|
134
|
+
expect(schema.find('remark_entity.ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
|
56
135
|
expect(schema.find('remark_subtype_constraint')).to be_instance_of(Expressir::Model::SubtypeConstraint)
|
57
136
|
expect(schema.find('remark_function')).to be_instance_of(Expressir::Model::Function)
|
58
137
|
expect(schema.find('remark_function.remark_parameter')).to be_instance_of(Expressir::Model::Parameter)
|
@@ -73,20 +152,26 @@ RSpec.describe Expressir::Model::ModelElement do
|
|
73
152
|
expect(schema.find('remark_rule.remark_variable')).to be_instance_of(Expressir::Model::Variable)
|
74
153
|
expect(schema.find('remark_rule.WR1')).to be_instance_of(Expressir::Model::Where)
|
75
154
|
expect(schema.find('remark_rule.wr:WR1')).to be_instance_of(Expressir::Model::Where)
|
155
|
+
expect(schema.find('remark_rule.IP1')).to be_instance_of(Expressir::Model::InformalProposition)
|
156
|
+
expect(schema.find('remark_rule.ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
|
76
157
|
|
77
158
|
# type scope
|
78
159
|
type = schema.types.first
|
79
160
|
expect(type.find('WR1')).to be_instance_of(Expressir::Model::Where)
|
80
161
|
expect(type.find('wr:WR1')).to be_instance_of(Expressir::Model::Where)
|
162
|
+
expect(type.find('IP1')).to be_instance_of(Expressir::Model::InformalProposition)
|
163
|
+
expect(type.find('ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
|
81
164
|
|
82
165
|
# entity scope
|
83
166
|
entity = schema.entities.first
|
84
167
|
expect(entity.find('remark_attribute')).to be_instance_of(Expressir::Model::Attribute)
|
85
168
|
expect(entity.find('remark_derived_attribute')).to be_instance_of(Expressir::Model::Attribute)
|
86
169
|
expect(entity.find('remark_inverse_attribute')).to be_instance_of(Expressir::Model::Attribute)
|
87
|
-
expect(entity.find('
|
170
|
+
expect(entity.find('UR1')).to be_instance_of(Expressir::Model::Unique)
|
88
171
|
expect(entity.find('WR1')).to be_instance_of(Expressir::Model::Where)
|
89
172
|
expect(entity.find('wr:WR1')).to be_instance_of(Expressir::Model::Where)
|
173
|
+
expect(entity.find('IP1')).to be_instance_of(Expressir::Model::InformalProposition)
|
174
|
+
expect(entity.find('ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
|
90
175
|
|
91
176
|
# function scope
|
92
177
|
function = schema.functions.first
|
@@ -112,17 +197,15 @@ RSpec.describe Expressir::Model::ModelElement do
|
|
112
197
|
expect(rule.find('remark_variable')).to be_instance_of(Expressir::Model::Variable)
|
113
198
|
expect(rule.find('WR1')).to be_instance_of(Expressir::Model::Where)
|
114
199
|
expect(rule.find('wr:WR1')).to be_instance_of(Expressir::Model::Where)
|
200
|
+
expect(rule.find('IP1')).to be_instance_of(Expressir::Model::InformalProposition)
|
201
|
+
expect(rule.find('ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
|
115
202
|
|
116
203
|
# retry search in parent scope
|
117
204
|
expect(entity.find('remark_type')).to be_instance_of(Expressir::Model::Type)
|
118
205
|
expect(entity.find('remark_type.WR1')).to be_instance_of(Expressir::Model::Where)
|
119
206
|
expect(entity.find('remark_type.wr:WR1')).to be_instance_of(Expressir::Model::Where)
|
207
|
+
expect(entity.find('remark_type.IP1')).to be_instance_of(Expressir::Model::InformalProposition)
|
208
|
+
expect(entity.find('remark_type.ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
|
120
209
|
end
|
121
210
|
end
|
122
|
-
|
123
|
-
def sample_file
|
124
|
-
@sample_file ||= Expressir.root_path.join(
|
125
|
-
"original", "examples", "syntax", "remark.exp"
|
126
|
-
)
|
127
|
-
end
|
128
211
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: expressir
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.17
|
5
5
|
platform: arm64-darwin
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -320,14 +320,22 @@ files:
|
|
320
320
|
- original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.owl
|
321
321
|
- original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xmi
|
322
322
|
- original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xml
|
323
|
-
- original/examples/syntax/
|
324
|
-
- original/examples/syntax/
|
323
|
+
- original/examples/syntax/multiple.exp
|
324
|
+
- original/examples/syntax/multiple.yaml
|
325
|
+
- original/examples/syntax/multiple_formatted.exp
|
326
|
+
- original/examples/syntax/multiple_hyperlink_formatted.exp
|
327
|
+
- original/examples/syntax/multiple_schema_head_hyperlink_formatted.exp
|
325
328
|
- original/examples/syntax/remark.exp
|
329
|
+
- original/examples/syntax/remark.yaml
|
326
330
|
- original/examples/syntax/remark_formatted.exp
|
327
|
-
- original/examples/syntax/
|
328
|
-
- original/examples/syntax/
|
331
|
+
- original/examples/syntax/single.exp
|
332
|
+
- original/examples/syntax/single.yaml
|
333
|
+
- original/examples/syntax/single_formatted.exp
|
334
|
+
- original/examples/syntax/single_formatted.yaml
|
329
335
|
- original/examples/syntax/syntax.exp
|
336
|
+
- original/examples/syntax/syntax.yaml
|
330
337
|
- original/examples/syntax/syntax_formatted.exp
|
338
|
+
- original/examples/syntax/syntax_schema_head_formatted.exp
|
331
339
|
- original/exp2ruby.rb
|
332
340
|
- original/expsm.rb
|
333
341
|
- original/mapping_owl.rb
|
@@ -339,16 +347,9 @@ files:
|
|
339
347
|
- spec/acceptance/express_to_owl_spec.rb
|
340
348
|
- spec/acceptance/version_spec.rb
|
341
349
|
- spec/expressir/express/repository_spec.rb
|
342
|
-
- spec/expressir/express_exp/
|
343
|
-
- spec/expressir/express_exp/
|
344
|
-
- spec/expressir/
|
345
|
-
- spec/expressir/express_exp/parser/multiple_spec.rb
|
346
|
-
- spec/expressir/express_exp/parser/remark_spec.rb
|
347
|
-
- spec/expressir/express_exp/parser/source_spec.rb
|
348
|
-
- spec/expressir/express_exp/parser/syntax_spec.rb
|
349
|
-
- spec/expressir/express_exp/schema_head_formatter_spec.rb
|
350
|
-
- spec/expressir/model/model_element/find_spec.rb
|
351
|
-
- spec/expressir/model/model_element/hash_spec.rb
|
350
|
+
- spec/expressir/express_exp/formatter_spec.rb
|
351
|
+
- spec/expressir/express_exp/parser_spec.rb
|
352
|
+
- spec/expressir/model/model_element_spec.rb
|
352
353
|
- spec/expressr_spec.rb
|
353
354
|
- spec/spec_helper.rb
|
354
355
|
- spec/support/console_helper.rb
|