expressir 0.2.13-x86-linux → 0.2.18-x86-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/exe/format +56 -11
  3. data/lib/expressir/express_exp/formatter.rb +201 -147
  4. data/lib/expressir/express_exp/hyperlink_formatter.rb +6 -4
  5. data/lib/expressir/express_exp/parser.rb +38 -25
  6. data/lib/expressir/express_exp/schema_head_formatter.rb +2 -7
  7. data/lib/expressir/express_exp/visitor.rb +27 -54
  8. data/lib/expressir/model.rb +2 -1
  9. data/lib/expressir/model/entity.rb +6 -6
  10. data/lib/expressir/model/expressions/query_expression.rb +3 -3
  11. data/lib/expressir/model/function.rb +15 -11
  12. data/lib/expressir/model/informal_proposition.rb +4 -1
  13. data/lib/expressir/model/{renamed_ref.rb → interface_item.rb} +2 -2
  14. data/lib/expressir/model/interfaced_item.rb +26 -0
  15. data/lib/expressir/model/model_element.rb +28 -7
  16. data/lib/expressir/model/procedure.rb +15 -11
  17. data/lib/expressir/model/repository.rb +3 -3
  18. data/lib/expressir/model/rule.rb +16 -12
  19. data/lib/expressir/model/schema.rb +60 -29
  20. data/lib/expressir/model/statements/alias.rb +3 -3
  21. data/lib/expressir/model/statements/repeat.rb +3 -3
  22. data/lib/expressir/model/subtype_constraint.rb +1 -6
  23. data/lib/expressir/model/type.rb +9 -5
  24. data/lib/expressir/version.rb +1 -1
  25. data/original/examples/syntax/multiple.exp +23 -0
  26. data/original/examples/syntax/multiple.yaml +184 -0
  27. data/original/examples/syntax/multiple_formatted.exp +71 -0
  28. data/original/examples/syntax/multiple_hyperlink_formatted.exp +71 -0
  29. data/original/examples/syntax/multiple_schema_head_hyperlink_formatted.exp +13 -0
  30. data/original/examples/syntax/remark.exp +41 -41
  31. data/original/examples/syntax/remark.yaml +446 -0
  32. data/original/examples/syntax/remark_formatted.exp +62 -50
  33. data/original/examples/syntax/{simple.exp → single.exp} +1 -1
  34. data/original/examples/syntax/single.yaml +9 -0
  35. data/original/examples/syntax/single_formatted.exp +6 -0
  36. data/original/examples/syntax/single_formatted.yaml +19 -0
  37. data/original/examples/syntax/single_root_path.yaml +9 -0
  38. data/original/examples/syntax/syntax.exp +29 -19
  39. data/original/examples/syntax/syntax.yaml +3439 -0
  40. data/original/examples/syntax/syntax_formatted.exp +271 -131
  41. data/original/examples/syntax/syntax_schema_head_formatted.exp +18 -0
  42. data/spec/expressir/express_exp/formatter_spec.rb +111 -0
  43. data/spec/expressir/express_exp/parser_spec.rb +121 -0
  44. data/spec/expressir/model/{model_element/find_spec.rb → model_element_spec.rb} +110 -10
  45. metadata +20 -18
  46. data/original/examples/syntax/hyperlink.exp +0 -8
  47. data/original/examples/syntax/hyperlink_formatted.exp +0 -19
  48. data/original/examples/syntax/source.exp +0 -16
  49. data/spec/expressir/express_exp/formatter/remark_spec.rb +0 -28
  50. data/spec/expressir/express_exp/formatter/syntax_spec.rb +0 -28
  51. data/spec/expressir/express_exp/hyperlink_formatter_spec.rb +0 -24
  52. data/spec/expressir/express_exp/parser/head_source_spec.rb +0 -38
  53. data/spec/expressir/express_exp/parser/multiple_spec.rb +0 -32
  54. data/spec/expressir/express_exp/parser/remark_spec.rb +0 -411
  55. data/spec/expressir/express_exp/parser/source_spec.rb +0 -29
  56. data/spec/expressir/express_exp/parser/syntax_spec.rb +0 -3080
  57. data/spec/expressir/express_exp/schema_head_formatter_spec.rb +0 -36
  58. 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,111 @@
1
+ require "yaml"
2
+ require "spec_helper"
3
+ require "expressir/express_exp/parser"
4
+ require "expressir/express_exp/formatter"
5
+ require "expressir/express_exp/schema_head_formatter"
6
+ require "expressir/express_exp/hyperlink_formatter"
7
+
8
+ RSpec.describe Expressir::ExpressExp::Formatter do
9
+ describe ".format" do
10
+ it "exports an object (single.exp)" do
11
+ exp_file = Expressir.root_path.join("original", "examples", "syntax", "single.exp")
12
+ formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "single_formatted.exp")
13
+
14
+ repo = Expressir::ExpressExp::Parser.from_file(exp_file)
15
+
16
+ result = Expressir::ExpressExp::Formatter.format(repo)
17
+ # File.write(formatted_exp_file, result)
18
+ expected_result = File.read(formatted_exp_file)
19
+
20
+ expect(result).to eq(expected_result)
21
+ end
22
+
23
+ it "exports an object (multiple.exp)" do
24
+ exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple.exp")
25
+ formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple_formatted.exp")
26
+
27
+ repo = Expressir::ExpressExp::Parser.from_file(exp_file)
28
+
29
+ result = Expressir::ExpressExp::Formatter.format(repo)
30
+ # File.write(formatted_exp_file, result)
31
+ expected_result = File.read(formatted_exp_file)
32
+
33
+ expect(result).to eq(expected_result)
34
+ end
35
+
36
+ it "exports an object (remark.exp)" do
37
+ exp_file = Expressir.root_path.join("original", "examples", "syntax", "remark.exp")
38
+ formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "remark_formatted.exp")
39
+
40
+ repo = Expressir::ExpressExp::Parser.from_file(exp_file)
41
+
42
+ result = Expressir::ExpressExp::Formatter.format(repo)
43
+ # File.write(formatted_exp_file, result)
44
+ expected_result = File.read(formatted_exp_file)
45
+
46
+ expect(result).to eq(expected_result)
47
+ end
48
+
49
+ it "exports an object (syntax.exp)" do
50
+ exp_file = Expressir.root_path.join("original", "examples", "syntax", "syntax.exp")
51
+ formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "syntax_formatted.exp")
52
+
53
+ repo = Expressir::ExpressExp::Parser.from_file(exp_file)
54
+
55
+ result = Expressir::ExpressExp::Formatter.format(repo)
56
+ # File.write(formatted_exp_file, result)
57
+ expected_result = File.read(formatted_exp_file)
58
+
59
+ expect(result).to eq(expected_result)
60
+ end
61
+
62
+ it "exports an object with schema head formatter (syntax.exp)" do
63
+ exp_file = Expressir.root_path.join("original", "examples", "syntax", "syntax.exp")
64
+ formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "syntax_schema_head_formatted.exp")
65
+
66
+ repo = Expressir::ExpressExp::Parser.from_file(exp_file)
67
+
68
+ formatter = Class.new(Expressir::ExpressExp::Formatter) do
69
+ include Expressir::ExpressExp::SchemaHeadFormatter
70
+ end
71
+ result = formatter.format(repo)
72
+ # File.write(formatted_exp_file, result)
73
+ expected_result = File.read(formatted_exp_file)
74
+
75
+ expect(result).to eq(expected_result)
76
+ end
77
+
78
+ it "exports an object with hyperlink formatter (multiple.exp)" do
79
+ exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple.exp")
80
+ formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple_hyperlink_formatted.exp")
81
+
82
+ repo = Expressir::ExpressExp::Parser.from_file(exp_file)
83
+
84
+ formatter = Class.new(Expressir::ExpressExp::Formatter) do
85
+ include Expressir::ExpressExp::HyperlinkFormatter
86
+ end
87
+ result = formatter.format(repo)
88
+ # File.write(formatted_exp_file, result)
89
+ expected_result = File.read(formatted_exp_file)
90
+
91
+ expect(result).to eq(expected_result)
92
+ end
93
+
94
+ it "exports an object with schema head and hyperlink formatter (multiple.exp)" do
95
+ exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple.exp")
96
+ formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple_schema_head_hyperlink_formatted.exp")
97
+
98
+ repo = Expressir::ExpressExp::Parser.from_file(exp_file)
99
+
100
+ formatter = Class.new(Expressir::ExpressExp::Formatter) do
101
+ include Expressir::ExpressExp::SchemaHeadFormatter
102
+ include Expressir::ExpressExp::HyperlinkFormatter
103
+ end
104
+ result = formatter.format(repo)
105
+ # File.write(formatted_exp_file, result)
106
+ expected_result = File.read(formatted_exp_file)
107
+
108
+ expect(result).to eq(expected_result)
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,121 @@
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].basename.to_s)
87
+ expect(schemas[0].id).to eq("single_schema")
88
+ expect(schemas[1].file).to eq(exp_files[1].basename.to_s)
89
+ expect(schemas[1].id).to eq("multiple_schema1")
90
+ expect(schemas[2].file).to eq(exp_files[1].basename.to_s)
91
+ expect(schemas[2].id).to eq("multiple_schema2")
92
+ expect(schemas[3].file).to eq(exp_files[1].basename.to_s)
93
+ expect(schemas[3].id).to eq("multiple_schema3")
94
+ expect(schemas[4].file).to eq(exp_files[1].basename.to_s)
95
+ expect(schemas[4].id).to eq("multiple_schema4")
96
+ end
97
+
98
+ it "parses multiple files with a root path (single.exp, multiple.exp)" do
99
+ exp_files = [
100
+ Expressir.root_path.join("original", "examples", "syntax", "single.exp"),
101
+ Expressir.root_path.join("original", "examples", "syntax", "multiple.exp")
102
+ ]
103
+ root_path = Expressir.root_path
104
+
105
+ repo = Expressir::ExpressExp::Parser.from_files(exp_files, root_path: root_path)
106
+
107
+ schemas = repo.schemas
108
+ expect(schemas.count).to eq(5)
109
+ expect(schemas[0].file).to eq(exp_files[0].relative_path_from(root_path).to_s)
110
+ expect(schemas[0].id).to eq("single_schema")
111
+ expect(schemas[1].file).to eq(exp_files[1].relative_path_from(root_path).to_s)
112
+ expect(schemas[1].id).to eq("multiple_schema1")
113
+ expect(schemas[2].file).to eq(exp_files[1].relative_path_from(root_path).to_s)
114
+ expect(schemas[2].id).to eq("multiple_schema2")
115
+ expect(schemas[3].file).to eq(exp_files[1].relative_path_from(root_path).to_s)
116
+ expect(schemas[3].id).to eq("multiple_schema3")
117
+ expect(schemas[4].file).to eq(exp_files[1].relative_path_from(root_path).to_s)
118
+ expect(schemas[4].id).to eq("multiple_schema4")
119
+ end
120
+ end
121
+ end
@@ -1,10 +1,94 @@
1
+
2
+ require "yaml"
1
3
  require "spec_helper"
2
4
  require "expressir/express_exp/parser"
5
+ require "expressir/express_exp/formatter"
3
6
 
4
7
  RSpec.describe Expressir::Model::ModelElement do
8
+ describe ".to_hash" do
9
+ it "exports an object with a root path (single.exp)" do
10
+ exp_file = Expressir.root_path.join("original", "examples", "syntax", "single.exp")
11
+ yaml_file = Expressir.root_path.join("original", "examples", "syntax", "single_root_path.yaml")
12
+ root_path = Expressir.root_path
13
+
14
+ repo = Expressir::ExpressExp::Parser.from_file(exp_file, root_path: root_path)
15
+
16
+ result = YAML.dump(repo.to_hash(skip_empty: true))
17
+ # File.write(yaml_file, result)
18
+ expected_result = File.read(yaml_file)
19
+
20
+ expect(result).to eq(expected_result)
21
+ end
22
+
23
+ it "exports an object with a formatter (single.exp)" do
24
+ exp_file = Expressir.root_path.join("original", "examples", "syntax", "single.exp")
25
+ yaml_file = Expressir.root_path.join("original", "examples", "syntax", "single_formatted.yaml")
26
+
27
+ repo = Expressir::ExpressExp::Parser.from_file(exp_file)
28
+
29
+ result = YAML.dump(repo.to_hash(formatter: Expressir::ExpressExp::Formatter, skip_empty: true))
30
+ # File.write(yaml_file, result)
31
+ expected_result = File.read(yaml_file)
32
+
33
+ expect(result).to eq(expected_result)
34
+ end
35
+ end
36
+
37
+ describe ".from_hash" do
38
+ it "parses an object (single.yaml)" do
39
+ yaml_file = Expressir.root_path.join("original", "examples", "syntax", "single.yaml")
40
+
41
+ input = YAML.load(File.read(yaml_file))
42
+ repo = Expressir::Model::ModelElement.from_hash(input)
43
+
44
+ result = YAML.dump(repo.to_hash(skip_empty: true))
45
+ expected_result = File.read(yaml_file)
46
+
47
+ expect(result).to eq(expected_result)
48
+ end
49
+
50
+ it "parses an object (multiple.yaml)" do
51
+ yaml_file = Expressir.root_path.join("original", "examples", "syntax", "multiple.yaml")
52
+
53
+ input = YAML.load(File.read(yaml_file))
54
+ repo = Expressir::Model::ModelElement.from_hash(input)
55
+
56
+ result = YAML.dump(repo.to_hash(skip_empty: true))
57
+ expected_result = File.read(yaml_file)
58
+
59
+ expect(result).to eq(expected_result)
60
+ end
61
+
62
+ it "parses an object (syntax.yaml)" do
63
+ yaml_file = Expressir.root_path.join("original", "examples", "syntax", "syntax.yaml")
64
+
65
+ input = YAML.load(File.read(yaml_file))
66
+ repo = Expressir::Model::ModelElement.from_hash(input)
67
+
68
+ result = YAML.dump(repo.to_hash(skip_empty: true))
69
+ expected_result = File.read(yaml_file)
70
+
71
+ expect(result).to eq(expected_result)
72
+ end
73
+
74
+ it "parses an object (remark.yaml)" do
75
+ yaml_file = Expressir.root_path.join("original", "examples", "syntax", "remark.yaml")
76
+
77
+ input = YAML.load(File.read(yaml_file))
78
+ repo = Expressir::Model::ModelElement.from_hash(input)
79
+
80
+ result = YAML.dump(repo.to_hash(skip_empty: true))
81
+ expected_result = File.read(yaml_file)
82
+
83
+ expect(result).to eq(expected_result)
84
+ end
85
+ end
86
+
5
87
  describe ".find" do
6
88
  it "finds an object" do
7
- repo = Expressir::ExpressExp::Parser.from_file(sample_file)
89
+ exp_file = Expressir.root_path.join("original", "examples", "syntax", "remark.exp")
90
+
91
+ repo = Expressir::ExpressExp::Parser.from_file(exp_file)
8
92
 
9
93
  # universal scope
10
94
  expect(repo.find('remark_schema')).to be_instance_of(Expressir::Model::Schema)
@@ -12,14 +96,18 @@ RSpec.describe Expressir::Model::ModelElement do
12
96
  expect(repo.find('remark_schema.remark_type')).to be_instance_of(Expressir::Model::Type)
13
97
  expect(repo.find('remark_schema.remark_type.WR1')).to be_instance_of(Expressir::Model::Where)
14
98
  expect(repo.find('remark_schema.remark_type.wr:WR1')).to be_instance_of(Expressir::Model::Where)
99
+ expect(repo.find('remark_schema.remark_type.IP1')).to be_instance_of(Expressir::Model::InformalProposition)
100
+ expect(repo.find('remark_schema.remark_type.ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
15
101
  expect(repo.find('remark_schema.remark_enumeration_item')).to be_instance_of(Expressir::Model::EnumerationItem)
16
102
  expect(repo.find('remark_schema.remark_entity')).to be_instance_of(Expressir::Model::Entity)
17
103
  expect(repo.find('remark_schema.remark_entity.remark_attribute')).to be_instance_of(Expressir::Model::Attribute)
18
104
  expect(repo.find('remark_schema.remark_entity.remark_derived_attribute')).to be_instance_of(Expressir::Model::Attribute)
19
105
  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.remark_unique')).to be_instance_of(Expressir::Model::Unique)
106
+ expect(repo.find('remark_schema.remark_entity.UR1')).to be_instance_of(Expressir::Model::Unique)
21
107
  expect(repo.find('remark_schema.remark_entity.WR1')).to be_instance_of(Expressir::Model::Where)
22
108
  expect(repo.find('remark_schema.remark_entity.wr:WR1')).to be_instance_of(Expressir::Model::Where)
109
+ expect(repo.find('remark_schema.remark_entity.IP1')).to be_instance_of(Expressir::Model::InformalProposition)
110
+ expect(repo.find('remark_schema.remark_entity.ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
23
111
  expect(repo.find('remark_schema.remark_subtype_constraint')).to be_instance_of(Expressir::Model::SubtypeConstraint)
24
112
  expect(repo.find('remark_schema.remark_function')).to be_instance_of(Expressir::Model::Function)
25
113
  expect(repo.find('remark_schema.remark_function.remark_parameter')).to be_instance_of(Expressir::Model::Parameter)
@@ -40,19 +128,27 @@ RSpec.describe Expressir::Model::ModelElement do
40
128
  expect(repo.find('remark_schema.remark_rule.remark_variable')).to be_instance_of(Expressir::Model::Variable)
41
129
  expect(repo.find('remark_schema.remark_rule.WR1')).to be_instance_of(Expressir::Model::Where)
42
130
  expect(repo.find('remark_schema.remark_rule.wr:WR1')).to be_instance_of(Expressir::Model::Where)
131
+ expect(repo.find('remark_schema.remark_rule.IP1')).to be_instance_of(Expressir::Model::InformalProposition)
132
+ expect(repo.find('remark_schema.remark_rule.ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
43
133
 
44
134
  # schema scope
45
135
  schema = repo.schemas.first
46
136
  expect(schema.find('remark_constant')).to be_instance_of(Expressir::Model::Constant)
47
137
  expect(schema.find('remark_type')).to be_instance_of(Expressir::Model::Type)
138
+ expect(schema.find('remark_type.WR1')).to be_instance_of(Expressir::Model::Where)
139
+ expect(schema.find('remark_type.wr:WR1')).to be_instance_of(Expressir::Model::Where)
140
+ expect(schema.find('remark_type.IP1')).to be_instance_of(Expressir::Model::InformalProposition)
141
+ expect(schema.find('remark_type.ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
48
142
  expect(schema.find('remark_enumeration_item')).to be_instance_of(Expressir::Model::EnumerationItem)
49
143
  expect(schema.find('remark_entity')).to be_instance_of(Expressir::Model::Entity)
50
144
  expect(schema.find('remark_entity.remark_attribute')).to be_instance_of(Expressir::Model::Attribute)
51
145
  expect(schema.find('remark_entity.remark_derived_attribute')).to be_instance_of(Expressir::Model::Attribute)
52
146
  expect(schema.find('remark_entity.remark_inverse_attribute')).to be_instance_of(Expressir::Model::Attribute)
53
- expect(schema.find('remark_entity.remark_unique')).to be_instance_of(Expressir::Model::Unique)
147
+ expect(schema.find('remark_entity.UR1')).to be_instance_of(Expressir::Model::Unique)
54
148
  expect(schema.find('remark_entity.WR1')).to be_instance_of(Expressir::Model::Where)
55
149
  expect(schema.find('remark_entity.wr:WR1')).to be_instance_of(Expressir::Model::Where)
150
+ expect(schema.find('remark_entity.IP1')).to be_instance_of(Expressir::Model::InformalProposition)
151
+ expect(schema.find('remark_entity.ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
56
152
  expect(schema.find('remark_subtype_constraint')).to be_instance_of(Expressir::Model::SubtypeConstraint)
57
153
  expect(schema.find('remark_function')).to be_instance_of(Expressir::Model::Function)
58
154
  expect(schema.find('remark_function.remark_parameter')).to be_instance_of(Expressir::Model::Parameter)
@@ -73,20 +169,26 @@ RSpec.describe Expressir::Model::ModelElement do
73
169
  expect(schema.find('remark_rule.remark_variable')).to be_instance_of(Expressir::Model::Variable)
74
170
  expect(schema.find('remark_rule.WR1')).to be_instance_of(Expressir::Model::Where)
75
171
  expect(schema.find('remark_rule.wr:WR1')).to be_instance_of(Expressir::Model::Where)
172
+ expect(schema.find('remark_rule.IP1')).to be_instance_of(Expressir::Model::InformalProposition)
173
+ expect(schema.find('remark_rule.ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
76
174
 
77
175
  # type scope
78
176
  type = schema.types.first
79
177
  expect(type.find('WR1')).to be_instance_of(Expressir::Model::Where)
80
178
  expect(type.find('wr:WR1')).to be_instance_of(Expressir::Model::Where)
179
+ expect(type.find('IP1')).to be_instance_of(Expressir::Model::InformalProposition)
180
+ expect(type.find('ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
81
181
 
82
182
  # entity scope
83
183
  entity = schema.entities.first
84
184
  expect(entity.find('remark_attribute')).to be_instance_of(Expressir::Model::Attribute)
85
185
  expect(entity.find('remark_derived_attribute')).to be_instance_of(Expressir::Model::Attribute)
86
186
  expect(entity.find('remark_inverse_attribute')).to be_instance_of(Expressir::Model::Attribute)
87
- expect(entity.find('remark_unique')).to be_instance_of(Expressir::Model::Unique)
187
+ expect(entity.find('UR1')).to be_instance_of(Expressir::Model::Unique)
88
188
  expect(entity.find('WR1')).to be_instance_of(Expressir::Model::Where)
89
189
  expect(entity.find('wr:WR1')).to be_instance_of(Expressir::Model::Where)
190
+ expect(entity.find('IP1')).to be_instance_of(Expressir::Model::InformalProposition)
191
+ expect(entity.find('ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
90
192
 
91
193
  # function scope
92
194
  function = schema.functions.first
@@ -112,17 +214,15 @@ RSpec.describe Expressir::Model::ModelElement do
112
214
  expect(rule.find('remark_variable')).to be_instance_of(Expressir::Model::Variable)
113
215
  expect(rule.find('WR1')).to be_instance_of(Expressir::Model::Where)
114
216
  expect(rule.find('wr:WR1')).to be_instance_of(Expressir::Model::Where)
217
+ expect(rule.find('IP1')).to be_instance_of(Expressir::Model::InformalProposition)
218
+ expect(rule.find('ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
115
219
 
116
220
  # retry search in parent scope
117
221
  expect(entity.find('remark_type')).to be_instance_of(Expressir::Model::Type)
118
222
  expect(entity.find('remark_type.WR1')).to be_instance_of(Expressir::Model::Where)
119
223
  expect(entity.find('remark_type.wr:WR1')).to be_instance_of(Expressir::Model::Where)
224
+ expect(entity.find('remark_type.IP1')).to be_instance_of(Expressir::Model::InformalProposition)
225
+ expect(entity.find('remark_type.ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
120
226
  end
121
227
  end
122
-
123
- def sample_file
124
- @sample_file ||= Expressir.root_path.join(
125
- "original", "examples", "syntax", "remark.exp"
126
- )
127
- end
128
228
  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.13
4
+ version: 0.2.18
5
5
  platform: x86-linux
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-25 00:00:00.000000000 Z
11
+ date: 2021-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -242,6 +242,8 @@ files:
242
242
  - lib/expressir/model/identifier.rb
243
243
  - lib/expressir/model/informal_proposition.rb
244
244
  - lib/expressir/model/interface.rb
245
+ - lib/expressir/model/interface_item.rb
246
+ - lib/expressir/model/interfaced_item.rb
245
247
  - lib/expressir/model/literals/binary.rb
246
248
  - lib/expressir/model/literals/integer.rb
247
249
  - lib/expressir/model/literals/logical.rb
@@ -250,7 +252,6 @@ files:
250
252
  - lib/expressir/model/model_element.rb
251
253
  - lib/expressir/model/parameter.rb
252
254
  - lib/expressir/model/procedure.rb
253
- - lib/expressir/model/renamed_ref.rb
254
255
  - lib/expressir/model/repository.rb
255
256
  - lib/expressir/model/rule.rb
256
257
  - lib/expressir/model/schema.rb
@@ -319,14 +320,23 @@ files:
319
320
  - original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.owl
320
321
  - original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xmi
321
322
  - original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xml
322
- - original/examples/syntax/hyperlink.exp
323
- - original/examples/syntax/hyperlink_formatted.exp
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
324
328
  - original/examples/syntax/remark.exp
329
+ - original/examples/syntax/remark.yaml
325
330
  - original/examples/syntax/remark_formatted.exp
326
- - original/examples/syntax/simple.exp
327
- - original/examples/syntax/source.exp
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
335
+ - original/examples/syntax/single_root_path.yaml
328
336
  - original/examples/syntax/syntax.exp
337
+ - original/examples/syntax/syntax.yaml
329
338
  - original/examples/syntax/syntax_formatted.exp
339
+ - original/examples/syntax/syntax_schema_head_formatted.exp
330
340
  - original/exp2ruby.rb
331
341
  - original/expsm.rb
332
342
  - original/mapping_owl.rb
@@ -338,17 +348,9 @@ files:
338
348
  - spec/acceptance/express_to_owl_spec.rb
339
349
  - spec/acceptance/version_spec.rb
340
350
  - spec/expressir/express/repository_spec.rb
341
- - spec/expressir/express_exp/formatter/remark_spec.rb
342
- - spec/expressir/express_exp/formatter/syntax_spec.rb
343
- - spec/expressir/express_exp/hyperlink_formatter_spec.rb
344
- - spec/expressir/express_exp/parser/head_source_spec.rb
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
351
+ - spec/expressir/express_exp/formatter_spec.rb
352
+ - spec/expressir/express_exp/parser_spec.rb
353
+ - spec/expressir/model/model_element_spec.rb
352
354
  - spec/expressr_spec.rb
353
355
  - spec/spec_helper.rb
354
356
  - spec/support/console_helper.rb