openehr 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/lib/openehr.rb +0 -1
- data/lib/openehr/parser/adl_grammar.tt +3094 -10
- data/lib/openehr/parser/{adl.rb → adl_helper.rb} +41 -2
- data/lib/openehr/parser/adl_parser.rb +1 -1
- data/openehr.gemspec +4 -8
- data/spec/lib/openehr/parser/adl14/openEHR-EHR-OBSERVATION.apgar.v1.adl +1216 -545
- data/spec/lib/openehr/parser/openehr_apgar_spec.rb +16 -0
- metadata +41 -45
- data/lib/openehr/parser/cadl_grammar.tt +0 -1527
- data/lib/openehr/parser/cadl_node.rb +0 -44
- data/lib/openehr/parser/dadl.rb +0 -13
- data/lib/openehr/parser/dadl_grammar.tt +0 -358
- data/lib/openehr/parser/shared_token_grammar.tt +0 -1229
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
+
require File.dirname(__FILE__) + '/parser_spec_helper'
|
3
|
+
require 'openehr/am/openehr_profile/data_types/quantity'
|
4
|
+
include OpenEHR::AM::OpenEHRProfile::DataTypes::Quantity
|
5
|
+
|
6
|
+
describe ADLParser do
|
7
|
+
describe CDvOrdinal do
|
8
|
+
before(:all) do
|
9
|
+
@archetype = adl14_archetype('adl-test-entry.c_dv_ordinal.test.adl')
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'archetype should be parsed' do
|
13
|
+
@archetype.should_not be_nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openehr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-05-
|
13
|
+
date: 2012-05-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: xml-simple
|
17
|
-
requirement: &
|
17
|
+
requirement: &17203595880 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *17203595880
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: activesupport
|
28
|
-
requirement: &
|
28
|
+
requirement: &17203593680 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *17203593680
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: locale
|
39
|
-
requirement: &
|
39
|
+
requirement: &17203591680 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *17203591680
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: builder
|
50
|
-
requirement: &
|
50
|
+
requirement: &17203605880 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :runtime
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *17203605880
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: jeweler
|
61
|
-
requirement: &
|
61
|
+
requirement: &17203603980 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: '0'
|
67
67
|
type: :runtime
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *17203603980
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: i18n
|
72
|
-
requirement: &
|
72
|
+
requirement: &17203601940 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ! '>='
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: '0'
|
78
78
|
type: :runtime
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *17203601940
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: treetop
|
83
|
-
requirement: &
|
83
|
+
requirement: &17203600140 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - ! '>='
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: '0'
|
89
89
|
type: :runtime
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *17203600140
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: polyglot
|
94
|
-
requirement: &
|
94
|
+
requirement: &17203615140 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ! '>='
|
@@ -99,10 +99,10 @@ dependencies:
|
|
99
99
|
version: '0'
|
100
100
|
type: :runtime
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
102
|
+
version_requirements: *17203615140
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: rdoc
|
105
|
-
requirement: &
|
105
|
+
requirement: &17203614020 !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
108
108
|
- - ! '>='
|
@@ -110,10 +110,10 @@ dependencies:
|
|
110
110
|
version: '0'
|
111
111
|
type: :runtime
|
112
112
|
prerelease: false
|
113
|
-
version_requirements: *
|
113
|
+
version_requirements: *17203614020
|
114
114
|
- !ruby/object:Gem::Dependency
|
115
115
|
name: sqlite3
|
116
|
-
requirement: &
|
116
|
+
requirement: &17203612360 !ruby/object:Gem::Requirement
|
117
117
|
none: false
|
118
118
|
requirements:
|
119
119
|
- - ! '>='
|
@@ -121,10 +121,10 @@ dependencies:
|
|
121
121
|
version: '0'
|
122
122
|
type: :runtime
|
123
123
|
prerelease: false
|
124
|
-
version_requirements: *
|
124
|
+
version_requirements: *17203612360
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: activerecord
|
127
|
-
requirement: &
|
127
|
+
requirement: &17203608580 !ruby/object:Gem::Requirement
|
128
128
|
none: false
|
129
129
|
requirements:
|
130
130
|
- - ! '>='
|
@@ -132,10 +132,10 @@ dependencies:
|
|
132
132
|
version: '0'
|
133
133
|
type: :runtime
|
134
134
|
prerelease: false
|
135
|
-
version_requirements: *
|
135
|
+
version_requirements: *17203608580
|
136
136
|
- !ruby/object:Gem::Dependency
|
137
137
|
name: rspec
|
138
|
-
requirement: &
|
138
|
+
requirement: &17203622500 !ruby/object:Gem::Requirement
|
139
139
|
none: false
|
140
140
|
requirements:
|
141
141
|
- - ! '>='
|
@@ -143,10 +143,10 @@ dependencies:
|
|
143
143
|
version: '0'
|
144
144
|
type: :development
|
145
145
|
prerelease: false
|
146
|
-
version_requirements: *
|
146
|
+
version_requirements: *17203622500
|
147
147
|
- !ruby/object:Gem::Dependency
|
148
148
|
name: guard-rspec
|
149
|
-
requirement: &
|
149
|
+
requirement: &17203620620 !ruby/object:Gem::Requirement
|
150
150
|
none: false
|
151
151
|
requirements:
|
152
152
|
- - ! '>='
|
@@ -154,10 +154,10 @@ dependencies:
|
|
154
154
|
version: '0'
|
155
155
|
type: :development
|
156
156
|
prerelease: false
|
157
|
-
version_requirements: *
|
157
|
+
version_requirements: *17203620620
|
158
158
|
- !ruby/object:Gem::Dependency
|
159
159
|
name: ruby-debug19
|
160
|
-
requirement: &
|
160
|
+
requirement: &17203619200 !ruby/object:Gem::Requirement
|
161
161
|
none: false
|
162
162
|
requirements:
|
163
163
|
- - ! '>='
|
@@ -165,10 +165,10 @@ dependencies:
|
|
165
165
|
version: '0'
|
166
166
|
type: :development
|
167
167
|
prerelease: false
|
168
|
-
version_requirements: *
|
168
|
+
version_requirements: *17203619200
|
169
169
|
- !ruby/object:Gem::Dependency
|
170
170
|
name: spork
|
171
|
-
requirement: &
|
171
|
+
requirement: &17203617260 !ruby/object:Gem::Requirement
|
172
172
|
none: false
|
173
173
|
requirements:
|
174
174
|
- - ~>
|
@@ -176,10 +176,10 @@ dependencies:
|
|
176
176
|
version: 1.0rc
|
177
177
|
type: :development
|
178
178
|
prerelease: false
|
179
|
-
version_requirements: *
|
179
|
+
version_requirements: *17203617260
|
180
180
|
- !ruby/object:Gem::Dependency
|
181
181
|
name: guard-spork
|
182
|
-
requirement: &
|
182
|
+
requirement: &17203631140 !ruby/object:Gem::Requirement
|
183
183
|
none: false
|
184
184
|
requirements:
|
185
185
|
- - ! '>='
|
@@ -187,10 +187,10 @@ dependencies:
|
|
187
187
|
version: '0'
|
188
188
|
type: :development
|
189
189
|
prerelease: false
|
190
|
-
version_requirements: *
|
190
|
+
version_requirements: *17203631140
|
191
191
|
- !ruby/object:Gem::Dependency
|
192
192
|
name: simplecov
|
193
|
-
requirement: &
|
193
|
+
requirement: &17203630200 !ruby/object:Gem::Requirement
|
194
194
|
none: false
|
195
195
|
requirements:
|
196
196
|
- - ! '>='
|
@@ -198,10 +198,10 @@ dependencies:
|
|
198
198
|
version: '0'
|
199
199
|
type: :development
|
200
200
|
prerelease: false
|
201
|
-
version_requirements: *
|
201
|
+
version_requirements: *17203630200
|
202
202
|
- !ruby/object:Gem::Dependency
|
203
203
|
name: libnotify
|
204
|
-
requirement: &
|
204
|
+
requirement: &17203628700 !ruby/object:Gem::Requirement
|
205
205
|
none: false
|
206
206
|
requirements:
|
207
207
|
- - ! '>='
|
@@ -209,7 +209,7 @@ dependencies:
|
|
209
209
|
version: '0'
|
210
210
|
type: :development
|
211
211
|
prerelease: false
|
212
|
-
version_requirements: *
|
212
|
+
version_requirements: *17203628700
|
213
213
|
description: This project is an implementation of the openEHR specification on Ruby.
|
214
214
|
email: skoba@moss.gr.jp
|
215
215
|
executables: []
|
@@ -242,15 +242,10 @@ files:
|
|
242
242
|
- lib/openehr/am/openehr_profile/data_types/text.rb
|
243
243
|
- lib/openehr/assumed_library_types.rb
|
244
244
|
- lib/openehr/parser.rb
|
245
|
-
- lib/openehr/parser/adl.rb
|
246
245
|
- lib/openehr/parser/adl_grammar.tt
|
246
|
+
- lib/openehr/parser/adl_helper.rb
|
247
247
|
- lib/openehr/parser/adl_parser.rb
|
248
|
-
- lib/openehr/parser/cadl_grammar.tt
|
249
|
-
- lib/openehr/parser/cadl_node.rb
|
250
|
-
- lib/openehr/parser/dadl.rb
|
251
|
-
- lib/openehr/parser/dadl_grammar.tt
|
252
248
|
- lib/openehr/parser/exception.rb
|
253
|
-
- lib/openehr/parser/shared_token_grammar.tt
|
254
249
|
- lib/openehr/parser/validator.rb
|
255
250
|
- lib/openehr/parser/xml_perser.rb
|
256
251
|
- lib/openehr/rm.rb
|
@@ -474,6 +469,7 @@ files:
|
|
474
469
|
- spec/lib/openehr/parser/mixed_node_types_spec.rb
|
475
470
|
- spec/lib/openehr/parser/most_minimal_adl_spec.rb
|
476
471
|
- spec/lib/openehr/parser/multi_language_spec.rb
|
472
|
+
- spec/lib/openehr/parser/openehr_apgar_spec.rb
|
477
473
|
- spec/lib/openehr/parser/parser_spec_helper.rb
|
478
474
|
- spec/lib/openehr/parser/path_based_terminology_binding_spec.rb
|
479
475
|
- spec/lib/openehr/parser/special_string_spec.rb
|
@@ -615,7 +611,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
615
611
|
version: '0'
|
616
612
|
segments:
|
617
613
|
- 0
|
618
|
-
hash:
|
614
|
+
hash: 4317873807425963811
|
619
615
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
620
616
|
none: false
|
621
617
|
requirements:
|
@@ -1,1527 +0,0 @@
|
|
1
|
-
require 'shared_token_grammar'
|
2
|
-
require 'openehr/assumed_library_types'
|
3
|
-
require 'openehr/am/archetype/constraint_model'
|
4
|
-
require 'openehr/am/openehr_profile/data_types/text'
|
5
|
-
require 'cadl_node'
|
6
|
-
|
7
|
-
module OpenEHR
|
8
|
-
module Parser
|
9
|
-
grammar CADL
|
10
|
-
# include OpenEHR::Parser::CADL
|
11
|
-
|
12
|
-
rule V_CADL_TEXT
|
13
|
-
c_complex_object '' {
|
14
|
-
def value
|
15
|
-
c_complex_object.value
|
16
|
-
end
|
17
|
-
}
|
18
|
-
/ assertions '' {
|
19
|
-
def value
|
20
|
-
assertions.value
|
21
|
-
end
|
22
|
-
}
|
23
|
-
end
|
24
|
-
|
25
|
-
rule c_complex_object
|
26
|
-
head:c_complex_object_head SYM_MATCHES SYM_START_CBLOCK body:c_complex_object_body SYM_END_CBLOCK space {
|
27
|
-
def value(node = ArchetypeNode.new)
|
28
|
-
args = head.value
|
29
|
-
args[:occurrences] ||= OpenEHR::AssumedLibraryTypes::Interval.new(
|
30
|
-
:lower => 1, :upper => 1)
|
31
|
-
node.id = args[:node_id]
|
32
|
-
if node.root? or node.id.nil?
|
33
|
-
args[:path] = node.path
|
34
|
-
else
|
35
|
-
args[:path] = node.path + '[' + node.id + ']'
|
36
|
-
end
|
37
|
-
args.update body.value(node)
|
38
|
-
OpenEHR::AM::Archetype::ConstraintModel::CComplexObject.new(args)
|
39
|
-
end
|
40
|
-
}
|
41
|
-
/ c_complex_object_head '' {
|
42
|
-
def value(node = ArchetypeNode.new)
|
43
|
-
args = c_complex_object_head.value
|
44
|
-
args[:occurrences] ||= OpenEHR::AssumedLibraryTypes::Interval.new(
|
45
|
-
:lower => 1, :upper => 1)
|
46
|
-
node.id = args[:node_id]
|
47
|
-
args[:path] = node.path
|
48
|
-
OpenEHR::AM::Archetype::ConstraintModel::CComplexObject.new(args)
|
49
|
-
end
|
50
|
-
}
|
51
|
-
end
|
52
|
-
|
53
|
-
rule c_complex_object_head
|
54
|
-
c_complex_object_id c_occurrences {
|
55
|
-
def value
|
56
|
-
args = c_complex_object_id.value
|
57
|
-
args[:occurrences] = c_occurrences.value
|
58
|
-
args
|
59
|
-
end
|
60
|
-
}
|
61
|
-
/ c_complex_object_id '' {
|
62
|
-
def value
|
63
|
-
c_complex_object_id.value
|
64
|
-
end
|
65
|
-
}
|
66
|
-
end
|
67
|
-
|
68
|
-
rule c_complex_object_id
|
69
|
-
ti:type_identifier lo:V_LOCAL_TERM_CODE_REF space {
|
70
|
-
def value
|
71
|
-
{:rm_type_name => ti.value,
|
72
|
-
:node_id => lo.value}
|
73
|
-
end
|
74
|
-
}
|
75
|
-
/ ti:type_identifier space {
|
76
|
-
def value
|
77
|
-
{:rm_type_name => ti.value}
|
78
|
-
end
|
79
|
-
}
|
80
|
-
end
|
81
|
-
|
82
|
-
rule c_complex_object_body
|
83
|
-
c_any '' {
|
84
|
-
def value(node)
|
85
|
-
Hash[:attributes => [c_any.value(node)]]
|
86
|
-
end
|
87
|
-
}
|
88
|
-
/ c_attributes '' {
|
89
|
-
def value(node)
|
90
|
-
Hash[:attributes => c_attributes.value(node)]
|
91
|
-
end
|
92
|
-
}
|
93
|
-
end
|
94
|
-
|
95
|
-
rule c_object
|
96
|
-
c_dv_quantity '' {
|
97
|
-
def value(node)
|
98
|
-
c_dv_quantity.value(node)
|
99
|
-
end
|
100
|
-
}
|
101
|
-
/ c_ordinal '' {
|
102
|
-
def value(node)
|
103
|
-
args = c_ordinal.value
|
104
|
-
args[:path] = node.path
|
105
|
-
args[:rm_type_name] = 'DvOrdinal'
|
106
|
-
args[:occurrences] ||= OpenEHR::AssumedLibraryTypes::Interval.new(
|
107
|
-
:upper => 1, :lower => 1)
|
108
|
-
OpenEHR::AM::OpenEHRProfile::DataTypes::Quantity::CDvOrdinal.new(
|
109
|
-
args)
|
110
|
-
end
|
111
|
-
}
|
112
|
-
/ c_primitive_object '' {
|
113
|
-
def value(node)
|
114
|
-
c_primitive_object.value
|
115
|
-
end
|
116
|
-
}
|
117
|
-
/ c_complex_object '' {
|
118
|
-
def value(node)
|
119
|
-
c_complex_object.value(node)
|
120
|
-
end
|
121
|
-
}
|
122
|
-
/ c_code_phrase '' {
|
123
|
-
def value(node)
|
124
|
-
c_code_phrase.value(node)
|
125
|
-
end
|
126
|
-
}
|
127
|
-
/ constraint_ref '' {
|
128
|
-
def value(node)
|
129
|
-
constraint_ref.value(node)
|
130
|
-
end
|
131
|
-
}
|
132
|
-
/ archetype_slot '' {
|
133
|
-
def value(node)
|
134
|
-
archetype_slot.value(node)
|
135
|
-
end
|
136
|
-
}
|
137
|
-
/ archetype_internal_ref '' {
|
138
|
-
def value(node = nil)
|
139
|
-
archetype_internal_ref.value(node)
|
140
|
-
end
|
141
|
-
}
|
142
|
-
/ V_C_DOMAIN_TYPE '' {
|
143
|
-
def value(node = nil)
|
144
|
-
p elemetns
|
145
|
-
end
|
146
|
-
}
|
147
|
-
# / ERR_V_C_DOMAIN_TYPE
|
148
|
-
end
|
149
|
-
|
150
|
-
rule archetype_internal_ref
|
151
|
-
SYM_USE_NODE type_identifier c_occurrences object_path space {
|
152
|
-
def value(node)
|
153
|
-
OpenEHR::AM::Archetype::ConstraintModel::ArchetypeInternalRef.new(
|
154
|
-
:rm_type_name => type_identifier.value,
|
155
|
-
:occurrences => c_occurrences.value,
|
156
|
-
:path => node.path,
|
157
|
-
:target_path => object_path.value)
|
158
|
-
end
|
159
|
-
}
|
160
|
-
/ SYM_USE_NODE type_identifier object_path space {
|
161
|
-
def value(node = nil)
|
162
|
-
OpenEHR::AM::Archetype::ConstraintModel::ArchetypeInternalRef.new(
|
163
|
-
:rm_type_name => type_identifier.value,
|
164
|
-
:occurrences => OpenEHR::AssumedLibraryTypes::Interval.new(
|
165
|
-
:lower => 1, :upper => 1),
|
166
|
-
:path => node.path,
|
167
|
-
:target_path => object_path.value)
|
168
|
-
end
|
169
|
-
}
|
170
|
-
end
|
171
|
-
|
172
|
-
rule archetype_slot
|
173
|
-
c_archetype_slot_head SYM_MATCHES SYM_START_CBLOCK c_includes c_excludes SYM_END_CBLOCK space {
|
174
|
-
def value(node)
|
175
|
-
args = c_archetype_slot_head.value(node)
|
176
|
-
args[:includes] = c_includes.value
|
177
|
-
args[:excludes] = c_excludes.value
|
178
|
-
OpenEHR::AM::Archetype::ConstraintModel::ArchetypeSlot.new(args)
|
179
|
-
end
|
180
|
-
}
|
181
|
-
/ c_archetype_slot_head SYM_MATCHES SYM_START_CBLOCK c_includes SYM_END_CBLOCK space {
|
182
|
-
def value(node)
|
183
|
-
args = c_archetype_slot_head.value(node)
|
184
|
-
args[:includes] = c_includes.value
|
185
|
-
OpenEHR::AM::Archetype::ConstraintModel::ArchetypeSlot.new(args)
|
186
|
-
end
|
187
|
-
}
|
188
|
-
/ c_archetype_slot_head SYM_MATCHES SYM_START_CBLOCK c_excludes SYM_END_CBLOCK space {
|
189
|
-
def value(node)
|
190
|
-
args = c_archetype_slot_head.value(node)
|
191
|
-
args[:excludes] = c_excludes.value
|
192
|
-
OpenEHR::AM::Archetype::ConstraintModel::ArchetypeSlot.new(args)
|
193
|
-
end
|
194
|
-
}
|
195
|
-
end
|
196
|
-
|
197
|
-
rule c_archetype_slot_head
|
198
|
-
c_archetype_slot_id white_space c_occurrences {
|
199
|
-
def value(node)
|
200
|
-
args = c_archetype_slot_id.value(node)
|
201
|
-
args[:occurrences] = c_occurrences.value
|
202
|
-
args
|
203
|
-
end
|
204
|
-
}
|
205
|
-
/ c_archetype_slot_id white_space {
|
206
|
-
def value(node)
|
207
|
-
args = c_archetype_slot_id.value(node)
|
208
|
-
args[:occurrences] = OpenEHR::AssumedLibraryTypes::Interval.new(
|
209
|
-
:upper => 1, :lower => 1)
|
210
|
-
args
|
211
|
-
end
|
212
|
-
}
|
213
|
-
end
|
214
|
-
|
215
|
-
rule c_archetype_slot_id
|
216
|
-
SYM_ALLOW_ARCHETYPE type_identifier lt:V_LOCAL_TERM_CODE_REF {
|
217
|
-
def value(node)
|
218
|
-
{:rm_type_name => type_identifier.value,
|
219
|
-
:node_id => lt.value,
|
220
|
-
:path => node.path + "[#{lt.value}]"}
|
221
|
-
end
|
222
|
-
}
|
223
|
-
/ SYM_ALLOW_ARCHETYPE type_identifier {
|
224
|
-
def value(node)
|
225
|
-
{:rm_type_name => type_identifier.value,
|
226
|
-
:path => node.path}
|
227
|
-
end
|
228
|
-
}
|
229
|
-
end
|
230
|
-
|
231
|
-
rule c_primitive_object
|
232
|
-
c_primitive '' {
|
233
|
-
def value
|
234
|
-
c_primitive.value
|
235
|
-
end
|
236
|
-
}
|
237
|
-
end
|
238
|
-
|
239
|
-
rule c_primitive
|
240
|
-
c_boolean '' {
|
241
|
-
def value
|
242
|
-
c_boolean.value
|
243
|
-
end
|
244
|
-
}
|
245
|
-
/ c_date_time '' {
|
246
|
-
def value
|
247
|
-
c_date_time.value
|
248
|
-
end
|
249
|
-
}
|
250
|
-
/ c_time '' {
|
251
|
-
def value
|
252
|
-
c_time.value
|
253
|
-
end
|
254
|
-
}
|
255
|
-
/ c_date '' {
|
256
|
-
def value
|
257
|
-
c_date.value
|
258
|
-
end
|
259
|
-
}
|
260
|
-
/ c_duration '' {
|
261
|
-
def value
|
262
|
-
c_duration.value
|
263
|
-
end
|
264
|
-
}
|
265
|
-
/ c_real '' {
|
266
|
-
def value
|
267
|
-
c_real.value
|
268
|
-
end
|
269
|
-
}
|
270
|
-
/ c_integer '' {
|
271
|
-
def value
|
272
|
-
c_integer.value
|
273
|
-
end
|
274
|
-
}
|
275
|
-
/ c_string '' {
|
276
|
-
def value
|
277
|
-
c_string.value
|
278
|
-
end
|
279
|
-
}
|
280
|
-
end
|
281
|
-
|
282
|
-
rule c_any
|
283
|
-
'*' space {
|
284
|
-
def value(node)
|
285
|
-
OpenEHR::AM::Archetype::ConstraintModel::CAttribute.new(
|
286
|
-
:path => node.path, :rm_attribute_name => 'ANY',
|
287
|
-
:exsitence => OpenEHR::AssumedLibraryTypes::Interval.new(
|
288
|
-
:lower => 1, :upper => 1))
|
289
|
-
end
|
290
|
-
}
|
291
|
-
end
|
292
|
-
|
293
|
-
rule c_attributes
|
294
|
-
c_attribute more_attr:(c_attribute white_space)* {
|
295
|
-
def value(node)
|
296
|
-
attributes.map {|c| c.value(node)}
|
297
|
-
end
|
298
|
-
|
299
|
-
def attributes
|
300
|
-
[c_attribute] + more_attr.elements.map {|e| e.c_attribute}
|
301
|
-
end
|
302
|
-
}
|
303
|
-
end
|
304
|
-
|
305
|
-
rule c_attribute
|
306
|
-
c_attr_head c_attr_body {
|
307
|
-
def value(node)
|
308
|
-
val = c_attr_head.value(node)
|
309
|
-
child_node = ArchetypeNode.new(node)
|
310
|
-
child_node.path = val.path
|
311
|
-
val.children = c_attr_body.value(child_node)
|
312
|
-
val
|
313
|
-
end
|
314
|
-
}
|
315
|
-
end
|
316
|
-
|
317
|
-
rule c_attr_head
|
318
|
-
id:(V_ATTRIBUTE_IDENTIFIER) white_space c_existence c_cardinality {
|
319
|
-
def value(node)
|
320
|
-
if node.root?
|
321
|
-
path = node.path + id.value
|
322
|
-
elsif node.id
|
323
|
-
path = node.path + "[#{node.id}]/" + id.value
|
324
|
-
elsif
|
325
|
-
path = node.path + '/' + id.value
|
326
|
-
end
|
327
|
-
OpenEHR::AM::Archetype::ConstraintModel::CMultipleAttribute.new(
|
328
|
-
:rm_attribute_name => id.value,
|
329
|
-
:path => path,
|
330
|
-
:existence => c_existence.value,
|
331
|
-
:cardinality => c_cardinality.value)
|
332
|
-
end
|
333
|
-
}
|
334
|
-
/ id:V_ATTRIBUTE_IDENTIFIER white_space c_existence {
|
335
|
-
def value(node)
|
336
|
-
if node.root?
|
337
|
-
path = node.path + id.value
|
338
|
-
elsif node.id
|
339
|
-
path = node.path + "[#{node.id}]/" + id.value
|
340
|
-
elsif
|
341
|
-
path = node.path + '/' + id.value
|
342
|
-
end
|
343
|
-
OpenEHR::AM::Archetype::ConstraintModel::CSingleAttribute.new(
|
344
|
-
:rm_attribute_name => id.value,
|
345
|
-
:path => path,
|
346
|
-
:existence => c_existence.value)
|
347
|
-
end
|
348
|
-
}
|
349
|
-
/ id:(V_ATTRIBUTE_IDENTIFIER) white_space c_cardinality {
|
350
|
-
def value(node)
|
351
|
-
if node.root?
|
352
|
-
path = node.path + id.value
|
353
|
-
elsif node.id
|
354
|
-
path = node.path + "[#{node.id}]/" + id.value
|
355
|
-
elsif
|
356
|
-
path = node.path + '/' + id.value
|
357
|
-
end
|
358
|
-
OpenEHR::AM::Archetype::ConstraintModel::CMultipleAttribute.new(
|
359
|
-
:rm_attribute_name => id.value,
|
360
|
-
:path => path,
|
361
|
-
:cardinality => c_cardinality.value)
|
362
|
-
end
|
363
|
-
}
|
364
|
-
/ id:(V_ATTRIBUTE_IDENTIFIER) white_space {
|
365
|
-
def value(node)
|
366
|
-
if node.root?
|
367
|
-
path = node.path + id.value
|
368
|
-
elsif node.id
|
369
|
-
path = node.path + "[#{node.id}]/" + id.value
|
370
|
-
elsif
|
371
|
-
path = node.path + '/' + id.value
|
372
|
-
end
|
373
|
-
OpenEHR::AM::Archetype::ConstraintModel::CSingleAttribute.new(
|
374
|
-
:rm_attribute_name => id.value, :path => path)
|
375
|
-
end
|
376
|
-
}
|
377
|
-
end
|
378
|
-
|
379
|
-
rule c_attr_body
|
380
|
-
SYM_MATCHES SYM_START_CBLOCK c_attr_values SYM_END_CBLOCK space {
|
381
|
-
def value(node)
|
382
|
-
c_attr_values.value(node)
|
383
|
-
end
|
384
|
-
}
|
385
|
-
end
|
386
|
-
|
387
|
-
rule c_attr_values
|
388
|
-
c_any '' {
|
389
|
-
def value(node)
|
390
|
-
[c_any.value(node)]
|
391
|
-
end
|
392
|
-
}
|
393
|
-
/ c_object more_co:(c_object '')* {
|
394
|
-
def value(node)
|
395
|
-
c_objects.map {|c| c.value(node)}
|
396
|
-
end
|
397
|
-
|
398
|
-
def c_objects
|
399
|
-
[c_object] + more_co.elements.map {|e| e.c_object }
|
400
|
-
end
|
401
|
-
}
|
402
|
-
end
|
403
|
-
|
404
|
-
rule c_includes
|
405
|
-
SYM_INCLUDE assertions {
|
406
|
-
def value
|
407
|
-
assertions.value
|
408
|
-
end
|
409
|
-
}
|
410
|
-
end
|
411
|
-
|
412
|
-
rule c_excludes
|
413
|
-
SYM_EXCLUDE assertions {
|
414
|
-
def value
|
415
|
-
assertions.value
|
416
|
-
end
|
417
|
-
}
|
418
|
-
end
|
419
|
-
|
420
|
-
rule c_existence
|
421
|
-
SYM_EXISTENCE SYM_MATCHES SYM_START_CBLOCK existence_spec SYM_END_CBLOCK space {
|
422
|
-
def value
|
423
|
-
existence_spec.value
|
424
|
-
end
|
425
|
-
}
|
426
|
-
end
|
427
|
-
|
428
|
-
rule existence_spec
|
429
|
-
lo:V_INTEGER SYM_ELLIPSIS up:V_INTEGER {
|
430
|
-
def value
|
431
|
-
OpenEHR::AssumedLibraryTypes::Interval.new(:lower => lo.value, :upper => up.value)
|
432
|
-
end
|
433
|
-
}
|
434
|
-
/ V_INTEGER '' {
|
435
|
-
def value
|
436
|
-
OpenEHR::AssumedLibraryTypes::Interval.new(:lower => V_INTEGER.value, :upper => V_INTEGER.value)
|
437
|
-
end
|
438
|
-
}
|
439
|
-
end
|
440
|
-
|
441
|
-
rule c_cardinality
|
442
|
-
SYM_CARDINALITY SYM_MATCHES SYM_START_CBLOCK cardinality_spec SYM_END_CBLOCK space {
|
443
|
-
def value
|
444
|
-
cardinality_spec.value
|
445
|
-
end
|
446
|
-
}
|
447
|
-
end
|
448
|
-
|
449
|
-
rule cardinality_spec
|
450
|
-
occurrence_spec ';' white_space SYM_ORDERED ';' white_space SYM_UNIQUE {
|
451
|
-
def value
|
452
|
-
OpenEHR::AM::Archetype::ConstraintModel::Cardinality.new(
|
453
|
-
:interval => occurrence_spec.value,
|
454
|
-
:is_unique => true,
|
455
|
-
:is_orderd => true)
|
456
|
-
end
|
457
|
-
}
|
458
|
-
/ occurrence_spec ';' white_space SYM_ORDERED {
|
459
|
-
def value
|
460
|
-
OpenEHR::AM::Archetype::ConstraintModel::Cardinality.new(
|
461
|
-
:interval => occurrence_spec.value,
|
462
|
-
:is_orderd => true)
|
463
|
-
end
|
464
|
-
}
|
465
|
-
/ occurrence_spec ';' white_space SYM_UNORDERD ';' white_space SYM_UNIQUE {
|
466
|
-
def value
|
467
|
-
OpenEHR::AM::Archetype::ConstraintModel::Cardinality.new(
|
468
|
-
:interval => occurrence_spec.value,
|
469
|
-
:is_unique => true,
|
470
|
-
:is_orderd => false)
|
471
|
-
end
|
472
|
-
}
|
473
|
-
/ occurrence_spec ';' white_space SYM_UNORDERD {
|
474
|
-
def value
|
475
|
-
OpenEHR::AM::Archetype::ConstraintModel::Cardinality.new(
|
476
|
-
:interval => occurrence_spec.value,
|
477
|
-
:is_orderd => false)
|
478
|
-
end
|
479
|
-
}
|
480
|
-
/ occurrence_spec SYM_UNIQUE ';' white_space SYM_ORDERED {
|
481
|
-
def value
|
482
|
-
OpenEHR::AM::Archetype::ConstraintModel::Cardinality.new(
|
483
|
-
:interval => occurrence_spec.value,
|
484
|
-
:is_unique => true,
|
485
|
-
:is_orderd => true)
|
486
|
-
end
|
487
|
-
}
|
488
|
-
/ occurrence_spec SYM_UNIQUE ';' white_space SYM_UNORDERD {
|
489
|
-
def value
|
490
|
-
OpenEHR::AM::Archetype::ConstraintModel::Cardinality.new(
|
491
|
-
:interval => occurrence_spec.value,
|
492
|
-
:is_unique => true,
|
493
|
-
:is_ordered => false)
|
494
|
-
end
|
495
|
-
}
|
496
|
-
/ occurrence_spec SYM_UNIQUE {
|
497
|
-
def value
|
498
|
-
OpenEHR::AM::Archetype::ConstraintModel::Cardinality.new(
|
499
|
-
:interval => occurrence_spec.value,
|
500
|
-
:is_unique => true)
|
501
|
-
end
|
502
|
-
}
|
503
|
-
/ occurrence_spec space {
|
504
|
-
def value
|
505
|
-
OpenEHR::AM::Archetype::ConstraintModel::Cardinality.new(
|
506
|
-
:interval => occurrence_spec.value)
|
507
|
-
end
|
508
|
-
}
|
509
|
-
end
|
510
|
-
|
511
|
-
rule c_occurrences
|
512
|
-
SYM_OCCURRENCES SYM_MATCHES SYM_START_CBLOCK occurrence_spec SYM_END_CBLOCK space {
|
513
|
-
def value
|
514
|
-
occurrence_spec.value
|
515
|
-
end
|
516
|
-
}
|
517
|
-
end
|
518
|
-
|
519
|
-
rule occurrence_spec
|
520
|
-
st:integer_value SYM_ELLIPSIS ed:cardinality_limit_value {
|
521
|
-
def value
|
522
|
-
if ed.value == '*'
|
523
|
-
OpenEHR::AssumedLibraryTypes::Interval.new(
|
524
|
-
:lower => st.value)
|
525
|
-
else
|
526
|
-
OpenEHR::AssumedLibraryTypes::Interval.new(
|
527
|
-
:lower => st.value,
|
528
|
-
:upper => ed.value)
|
529
|
-
end
|
530
|
-
end
|
531
|
-
}
|
532
|
-
/ cardinality_limit_value '' {
|
533
|
-
def value
|
534
|
-
OpenEHR::AssumedLibraryTypes::Interval.new(
|
535
|
-
:lower => cardinality_limit_value.value,
|
536
|
-
:upper => cardinality_limit_value.value)
|
537
|
-
end
|
538
|
-
}
|
539
|
-
end
|
540
|
-
|
541
|
-
rule cardinality_limit_value
|
542
|
-
integer_value '' {
|
543
|
-
def value
|
544
|
-
text_value.to_i
|
545
|
-
end
|
546
|
-
}
|
547
|
-
/ '*' {
|
548
|
-
def value
|
549
|
-
'*'
|
550
|
-
end
|
551
|
-
}
|
552
|
-
end
|
553
|
-
|
554
|
-
rule c_integer
|
555
|
-
c_integer_spec ';' white_space integer_value {
|
556
|
-
def value
|
557
|
-
args = c_integer_spec.value
|
558
|
-
args[:assumed_value] = integer_value.value
|
559
|
-
OpenEHR::AM::Archetype::ConstraintModel::Primitive::CInteger.new(args)
|
560
|
-
end
|
561
|
-
}
|
562
|
-
/ c_integer_spec '' {
|
563
|
-
def value
|
564
|
-
OpenEHR::AM::Archetype::ConstraintModel::Primitive::CInteger.new(
|
565
|
-
c_integer_spec.value)
|
566
|
-
end
|
567
|
-
}
|
568
|
-
end
|
569
|
-
|
570
|
-
rule c_integer_spec
|
571
|
-
integer_list_value '' {
|
572
|
-
def value
|
573
|
-
{:list => integer_list_value.value}
|
574
|
-
end
|
575
|
-
}
|
576
|
-
/ integer_interval_value '' {
|
577
|
-
def value
|
578
|
-
{:range => integer_interval_value.value}
|
579
|
-
end
|
580
|
-
}
|
581
|
-
/ integer_value !'..' '' {
|
582
|
-
def value
|
583
|
-
{:list => [integer_value.value]}
|
584
|
-
end
|
585
|
-
}
|
586
|
-
/ occurrence_spec '' {
|
587
|
-
def value
|
588
|
-
{:range => occurrence_spec.value}
|
589
|
-
end
|
590
|
-
}
|
591
|
-
end
|
592
|
-
|
593
|
-
rule c_real_spec
|
594
|
-
real_list_value '' {
|
595
|
-
def value
|
596
|
-
{:list => real_list_value.value}
|
597
|
-
end
|
598
|
-
}
|
599
|
-
/ real_interval_value '' {
|
600
|
-
def value
|
601
|
-
{:range => real_interval_value.value}
|
602
|
-
end
|
603
|
-
}
|
604
|
-
/ real_value '' {
|
605
|
-
def value
|
606
|
-
{:list => [real_value.value]}
|
607
|
-
end
|
608
|
-
}
|
609
|
-
end
|
610
|
-
|
611
|
-
rule c_real
|
612
|
-
c_real_spec ';' white_space real_value {
|
613
|
-
def value
|
614
|
-
args = c_real_spec.value
|
615
|
-
args[:assumed_value] = real_value.value
|
616
|
-
OpenEHR::AM::Archetype::ConstraintModel::Primitive::CReal.new(args)
|
617
|
-
end
|
618
|
-
}
|
619
|
-
/ c_real_spec '' {
|
620
|
-
def value
|
621
|
-
OpenEHR::AM::Archetype::ConstraintModel::Primitive::CReal.new(
|
622
|
-
c_real_spec.value)
|
623
|
-
end
|
624
|
-
}
|
625
|
-
end
|
626
|
-
|
627
|
-
rule c_date_constraint
|
628
|
-
date_interval_value '' {
|
629
|
-
def value
|
630
|
-
{:range => date_interval_value.value}
|
631
|
-
end
|
632
|
-
}
|
633
|
-
/ date_list_value '' {
|
634
|
-
def value
|
635
|
-
{:list => date_list_value.value}
|
636
|
-
end
|
637
|
-
}
|
638
|
-
/ date_value '' {
|
639
|
-
def value
|
640
|
-
{:list => [date_value.value]}
|
641
|
-
end
|
642
|
-
}
|
643
|
-
/ con:V_ISO8601_DATE_CONSTRAINT_PATTERN '' {
|
644
|
-
def value
|
645
|
-
{:pattern => con.text_value}
|
646
|
-
end
|
647
|
-
}
|
648
|
-
end
|
649
|
-
|
650
|
-
rule c_date
|
651
|
-
c_date_constraint ';' white_space date_value {
|
652
|
-
def value
|
653
|
-
args = c_date_constraint.value
|
654
|
-
args[:assumed_value] = date_value.value
|
655
|
-
OpenEHR::AM::Archetype::ConstraintModel::Primitive::CDate.new(
|
656
|
-
args)
|
657
|
-
end
|
658
|
-
}
|
659
|
-
/ c_date_constraint '' {
|
660
|
-
def value
|
661
|
-
OpenEHR::AM::Archetype::ConstraintModel::Primitive::CDate.new(
|
662
|
-
c_date_constraint.value)
|
663
|
-
end
|
664
|
-
}
|
665
|
-
end
|
666
|
-
|
667
|
-
rule c_time_constraint
|
668
|
-
time_interval_value '' {
|
669
|
-
def value
|
670
|
-
{:range => time_interval_value.value}
|
671
|
-
end
|
672
|
-
}
|
673
|
-
/ time_list_value '' {
|
674
|
-
def value
|
675
|
-
{:list => time_list_value.value}
|
676
|
-
end
|
677
|
-
}
|
678
|
-
/ time_value '' {
|
679
|
-
def value
|
680
|
-
{:list => [time_value.value]}
|
681
|
-
end
|
682
|
-
}
|
683
|
-
/ tc:V_ISO8601_TIME_CONSTRAINT_PATTERN '' {
|
684
|
-
def value
|
685
|
-
{:pattern => tc.text_value}
|
686
|
-
end
|
687
|
-
}
|
688
|
-
end
|
689
|
-
|
690
|
-
rule c_time
|
691
|
-
c_time_constraint ';' white_space time_value {
|
692
|
-
def value
|
693
|
-
args = c_time_constraint.value
|
694
|
-
args[:assumed_value] = time_value.value
|
695
|
-
OpenEHR::AM::Archetype::ConstraintModel::Primitive::CTime.new(
|
696
|
-
args)
|
697
|
-
end
|
698
|
-
}
|
699
|
-
/ c_time_constraint '' {
|
700
|
-
def value
|
701
|
-
OpenEHR::AM::Archetype::ConstraintModel::Primitive::CTime.new(
|
702
|
-
c_time_constraint.value)
|
703
|
-
end
|
704
|
-
}
|
705
|
-
end
|
706
|
-
|
707
|
-
rule c_date_time_constraint
|
708
|
-
date_time_interval_value '' {
|
709
|
-
def value
|
710
|
-
{:range => date_time_interval_value.value}
|
711
|
-
end
|
712
|
-
}
|
713
|
-
/ date_time_value '' {
|
714
|
-
def value
|
715
|
-
{:list => [date_time_value.value]}
|
716
|
-
end
|
717
|
-
}
|
718
|
-
/ dtc:V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN '' {
|
719
|
-
def value
|
720
|
-
{:pattern => dtc.text_value}
|
721
|
-
end
|
722
|
-
}
|
723
|
-
end
|
724
|
-
|
725
|
-
rule c_date_time
|
726
|
-
c_date_time_constraint ';' white_space date_time_value {
|
727
|
-
def value
|
728
|
-
args = c_date_time_constraint.value
|
729
|
-
args[:assumed_value] = date_time_value.value
|
730
|
-
OpenEHR::AM::Archetype::ConstraintModel::Primitive::CDateTime.new(
|
731
|
-
args)
|
732
|
-
end
|
733
|
-
}
|
734
|
-
/ c_date_time_constraint '' {
|
735
|
-
def value
|
736
|
-
OpenEHR::AM::Archetype::ConstraintModel::Primitive::CDateTime.new(
|
737
|
-
c_date_time_constraint.value)
|
738
|
-
end
|
739
|
-
}
|
740
|
-
end
|
741
|
-
|
742
|
-
rule c_duration_constraint
|
743
|
-
duration_pattern '/' duration_interval_value '' {
|
744
|
-
def value
|
745
|
-
{:pattern => duration_pattern.value}
|
746
|
-
end
|
747
|
-
}
|
748
|
-
/ duration_pattern '' {
|
749
|
-
def value
|
750
|
-
{:pattern => duration_pattern.value}
|
751
|
-
end
|
752
|
-
}
|
753
|
-
/ duration_interval_value '' {
|
754
|
-
def value
|
755
|
-
{:range => duration_interval_value.value}
|
756
|
-
end
|
757
|
-
}
|
758
|
-
/ duration_value '' {
|
759
|
-
def value
|
760
|
-
{:list => [duration_value.value]}
|
761
|
-
end
|
762
|
-
}
|
763
|
-
end
|
764
|
-
|
765
|
-
rule duration_pattern
|
766
|
-
dp:V_ISO8601_DURATION_CONSTRAINT_PATTERN '' {
|
767
|
-
def value
|
768
|
-
dp.text_value
|
769
|
-
end
|
770
|
-
}
|
771
|
-
end
|
772
|
-
|
773
|
-
rule c_duration
|
774
|
-
c_duration_constraint ';' white_space duration_value '' {
|
775
|
-
def value
|
776
|
-
args = c_duration_constraint.value
|
777
|
-
args[:assumed_value] = duration_value.value
|
778
|
-
OpenEHR::AM::Archetype::ConstraintModel::Primitive::CDuration.new(
|
779
|
-
args)
|
780
|
-
end
|
781
|
-
}
|
782
|
-
/ c_duration_constraint '' {
|
783
|
-
def value
|
784
|
-
OpenEHR::AM::Archetype::ConstraintModel::Primitive::CDuration.new(
|
785
|
-
c_duration_constraint.value)
|
786
|
-
end
|
787
|
-
}
|
788
|
-
end
|
789
|
-
|
790
|
-
rule c_string_spec
|
791
|
-
string_list_value ',' white_space SYM_LIST_CONTINUE {
|
792
|
-
def value
|
793
|
-
{:list => string_list_value.value}
|
794
|
-
end
|
795
|
-
}
|
796
|
-
/ string_list_value '' {
|
797
|
-
def value
|
798
|
-
{:list => string_list_value.value}
|
799
|
-
end
|
800
|
-
}
|
801
|
-
/ pat:V_REGEXP '' {
|
802
|
-
def value
|
803
|
-
{:pattern => pat.value}
|
804
|
-
end
|
805
|
-
}
|
806
|
-
/ str:V_STRING '' {
|
807
|
-
def value
|
808
|
-
{:list => [str.value]}
|
809
|
-
end
|
810
|
-
}
|
811
|
-
end
|
812
|
-
|
813
|
-
rule c_string
|
814
|
-
c_string_spec white_space ';' white_space string_value {
|
815
|
-
def value
|
816
|
-
args = c_string_spec.value
|
817
|
-
args[:assumed_value] = string_value.value
|
818
|
-
OpenEHR::AM::Archetype::ConstraintModel::Primitive::CString.new(
|
819
|
-
args)
|
820
|
-
end
|
821
|
-
}
|
822
|
-
/ c_string_spec '' {
|
823
|
-
def value
|
824
|
-
OpenEHR::AM::Archetype::ConstraintModel::Primitive::CString.new(
|
825
|
-
c_string_spec.value)
|
826
|
-
end
|
827
|
-
}
|
828
|
-
end
|
829
|
-
|
830
|
-
rule c_boolean_spec
|
831
|
-
SYM_TRUE ',' white_space SYM_FALSE {
|
832
|
-
def value
|
833
|
-
{:true_valid => true, :false_valid => true}
|
834
|
-
end
|
835
|
-
}
|
836
|
-
/ SYM_TRUE white_space '' {
|
837
|
-
def value
|
838
|
-
{:true_valid => true, :false_valid => false}
|
839
|
-
end
|
840
|
-
}
|
841
|
-
/ SYM_FALSE white_space ',' white_space SYM_TRUE {
|
842
|
-
def value
|
843
|
-
{:true_valid => true, :false_valid => true}
|
844
|
-
end
|
845
|
-
}
|
846
|
-
/ SYM_FALSE white_space '' {
|
847
|
-
def value
|
848
|
-
{:false_valid => true, :true_valid => false}
|
849
|
-
end
|
850
|
-
}
|
851
|
-
end
|
852
|
-
|
853
|
-
rule c_boolean
|
854
|
-
c_boolean_spec ';' white_space boolean_value {
|
855
|
-
def value
|
856
|
-
args = c_boolean_spec.value
|
857
|
-
args[:assumed_value] = boolean_value.value
|
858
|
-
OpenEHR::AM::Archetype::ConstraintModel::Primitive::CBoolean.new(
|
859
|
-
args)
|
860
|
-
end
|
861
|
-
}
|
862
|
-
/ c_boolean_spec '' {
|
863
|
-
def value
|
864
|
-
OpenEHR::AM::Archetype::ConstraintModel::Primitive::CBoolean.new(
|
865
|
-
c_boolean_spec.value)
|
866
|
-
end
|
867
|
-
}
|
868
|
-
end
|
869
|
-
|
870
|
-
rule constraint_ref
|
871
|
-
vltcr:V_LOCAL_TERM_CODE_REF '' {
|
872
|
-
def value(node)
|
873
|
-
OpenEHR::AM::Archetype::ConstraintModel::ConstraintRef.new(
|
874
|
-
:path => node.path,
|
875
|
-
:rm_type_name => 'ConstraintRef',
|
876
|
-
:occurrences => OpenEHR::AssumedLibraryTypes::Interval.new(:upper => 1, :lower => 1),
|
877
|
-
:reference => vltcr.value)
|
878
|
-
end
|
879
|
-
}
|
880
|
-
end
|
881
|
-
|
882
|
-
rule V_REGEXP
|
883
|
-
(('=' / '!') '~')? (('/' ('\/' / !'/' .)* '/') / ('^' (!'^' .)* '^') ) {
|
884
|
-
def value
|
885
|
-
text_value
|
886
|
-
end
|
887
|
-
}
|
888
|
-
end
|
889
|
-
|
890
|
-
rule code_string
|
891
|
-
NAMECHAR+ '' {
|
892
|
-
def value
|
893
|
-
text_value
|
894
|
-
end
|
895
|
-
}
|
896
|
-
end
|
897
|
-
|
898
|
-
rule code_string_list
|
899
|
-
first:code_string more:(',' space code_string)+ space {
|
900
|
-
def value
|
901
|
-
codes.map {|c| c.value}
|
902
|
-
end
|
903
|
-
|
904
|
-
def codes
|
905
|
-
[first] + more.elements.map {|e| e.code_string}
|
906
|
-
end
|
907
|
-
}
|
908
|
-
end
|
909
|
-
|
910
|
-
rule code_string_spec
|
911
|
-
code_string_list '' {
|
912
|
-
def value
|
913
|
-
code_string_list.value
|
914
|
-
end
|
915
|
-
}
|
916
|
-
/ code_string '' {
|
917
|
-
def value
|
918
|
-
[code_string.value]
|
919
|
-
end
|
920
|
-
}
|
921
|
-
end
|
922
|
-
|
923
|
-
rule c_code_phrase
|
924
|
-
ti:V_TERM_CODE code_string_spec ';' space code_string ']' space {
|
925
|
-
def value(node)
|
926
|
-
::OpenEHR::AM::OpenEHRProfile::DataTypes::Text::CCodePhrase.new(
|
927
|
-
:rm_type_name => 'CodePhrase',
|
928
|
-
:occurrences => OpenEHR::AssumedLibraryTypes::Interval.new(
|
929
|
-
:upper => 1, :lower => 1),
|
930
|
-
:terminology_id => ti.value, :code_list => code_string_spec.value,
|
931
|
-
:assumed_value => code_string.value,
|
932
|
-
:path => node.path)
|
933
|
-
end
|
934
|
-
}
|
935
|
-
/ ti:V_TERM_CODE code_string_spec ']' space {
|
936
|
-
def value(node)
|
937
|
-
::OpenEHR::AM::OpenEHRProfile::DataTypes::Text::CCodePhrase.new(
|
938
|
-
:rm_type_name => 'CodePhrase',
|
939
|
-
:occurrences => OpenEHR::AssumedLibraryTypes::Interval.new(
|
940
|
-
:upper => 1, :lower => 1),
|
941
|
-
:terminology_id => ti.value, :code_list => code_string_spec.value,
|
942
|
-
:path => node.path)
|
943
|
-
end
|
944
|
-
}
|
945
|
-
/ ti:V_TERM_CODE ']' space {
|
946
|
-
def value(node)
|
947
|
-
::OpenEHR::AM::OpenEHRProfile::DataTypes::Text::CCodePhrase.new(
|
948
|
-
:rm_type_name => 'CodePhrase',
|
949
|
-
:occurrences => OpenEHR::AssumedLibraryTypes::Interval.new(
|
950
|
-
:upper => 1, :lower => 1),
|
951
|
-
:terminology_id => ti.value, :code_list => [], :path => node.path)
|
952
|
-
end
|
953
|
-
}
|
954
|
-
end
|
955
|
-
|
956
|
-
rule SYM_C_DV_ORDINAL
|
957
|
-
'C_DV_ORDINAL' space
|
958
|
-
end
|
959
|
-
|
960
|
-
rule c_ordinal
|
961
|
-
c_ordinal_spec ';' space integer_value space {
|
962
|
-
def value
|
963
|
-
args = c_ordinal_spec.value
|
964
|
-
args[:assumed_value] = integer_value.value
|
965
|
-
args
|
966
|
-
end
|
967
|
-
}
|
968
|
-
/ c_ordinal_spec space '' {
|
969
|
-
def value
|
970
|
-
c_ordinal_spec.value
|
971
|
-
end
|
972
|
-
}
|
973
|
-
/ SYM_C_DV_ORDINAL SYM_LT white_space SYM_GT space {
|
974
|
-
def value
|
975
|
-
{:list => nil}
|
976
|
-
end
|
977
|
-
}
|
978
|
-
end
|
979
|
-
|
980
|
-
rule c_ordinal_spec
|
981
|
-
ordinal_list '' {
|
982
|
-
def value
|
983
|
-
{:list => ordinal_list.value}
|
984
|
-
end
|
985
|
-
}
|
986
|
-
/ ordinal '' {
|
987
|
-
def value
|
988
|
-
{:list => [ordinal.value]}
|
989
|
-
end
|
990
|
-
}
|
991
|
-
end
|
992
|
-
|
993
|
-
rule ordinal_list
|
994
|
-
first:ordinal more:(',' space ordinal)+ {
|
995
|
-
def value
|
996
|
-
ordinals.map {|o| o.value}
|
997
|
-
end
|
998
|
-
|
999
|
-
def ordinals
|
1000
|
-
[first] + more.elements.map {|e| e.ordinal}
|
1001
|
-
end
|
1002
|
-
}
|
1003
|
-
end
|
1004
|
-
|
1005
|
-
rule ordinal
|
1006
|
-
integer_value SYM_INTERVAL_DELIM vqtc:V_QUALIFIED_TERM_CODE_REF !SYM_INTERVAL_DELIM '' {
|
1007
|
-
def value
|
1008
|
-
symbol = ::OpenEHR::RM::DataTypes::Text::DvCodedText.new(
|
1009
|
-
:value => vqtc.text_value, :defining_code => vqtc.value)
|
1010
|
-
::OpenEHR::RM::DataTypes::Quantity::DvOrdinal.new(
|
1011
|
-
:value => integer_value.value,
|
1012
|
-
:symbol => symbol)
|
1013
|
-
end
|
1014
|
-
}
|
1015
|
-
end
|
1016
|
-
|
1017
|
-
rule c_dv_quantity
|
1018
|
-
SYM_C_DV_QUANTITY SYM_START_DBLOCK
|
1019
|
-
prop:property? ql:quantity_list? aqv:assumed_quantity_value?
|
1020
|
-
SYM_END_DBLOCK <CDvQuantityItems>
|
1021
|
-
/ SYM_C_DV_QUANTITY SYM_START_DBLOCK
|
1022
|
-
prop:property? aqv:assumed_quantity_value? ql:quantity_list?
|
1023
|
-
SYM_END_DBLOCK <CDvQuantityItems>
|
1024
|
-
/ SYM_C_DV_QUANTITY SYM_START_DBLOCK
|
1025
|
-
aqv:assumed_quantity_value? prop:property? ql:quantity_list?
|
1026
|
-
SYM_END_DBLOCK <CDvQuantityItems>
|
1027
|
-
/ SYM_C_DV_QUANTITY SYM_START_DBLOCK
|
1028
|
-
aqv:assumed_quantity_value? ql:quantity_list? prop:property?
|
1029
|
-
SYM_END_DBLOCK <CDvQuantityItems>
|
1030
|
-
/ SYM_C_DV_QUANTITY SYM_START_DBLOCK
|
1031
|
-
ql:quantity_list? aqv:assumed_quantity_value? prop:property?
|
1032
|
-
SYM_END_DBLOCK <CDvQuantityItems>
|
1033
|
-
/ SYM_C_DV_QUANTITY SYM_START_DBLOCK
|
1034
|
-
ql:quantity_list? prop:property? aqv:assumed_quantity_value?
|
1035
|
-
SYM_END_DBLOCK <CDvQuantityItems>
|
1036
|
-
end
|
1037
|
-
|
1038
|
-
rule SYM_C_DV_QUANTITY
|
1039
|
-
'C_DV_QUANTITY' space
|
1040
|
-
end
|
1041
|
-
|
1042
|
-
rule property
|
1043
|
-
SYM_PROPERTY SYM_EQ SYM_START_DBLOCK
|
1044
|
-
prop:V_QUALIFIED_TERM_CODE_REF SYM_END_DBLOCK {
|
1045
|
-
def value
|
1046
|
-
prop.value
|
1047
|
-
end
|
1048
|
-
}
|
1049
|
-
end
|
1050
|
-
|
1051
|
-
rule SYM_PROPERTY
|
1052
|
-
'property' space
|
1053
|
-
end
|
1054
|
-
|
1055
|
-
rule quantity_list
|
1056
|
-
SYM_QUANTITY_LIST SYM_EQ SYM_START_DBLOCK
|
1057
|
-
c_quantity_items SYM_END_DBLOCK {
|
1058
|
-
def value(node)
|
1059
|
-
c_quantity_items.value(node)
|
1060
|
-
end
|
1061
|
-
}
|
1062
|
-
end
|
1063
|
-
|
1064
|
-
rule assumed_quantity_value
|
1065
|
-
SYM_ASSUMED_VALUE SYM_EQ SYM_START_DBLOCK
|
1066
|
-
SYM_UNITS SYM_EQ SYM_START_DBLOCK units:V_STRING SYM_END_DBLOCK
|
1067
|
-
mag:(SYM_MAGNITUDE SYM_EQ SYM_START_DBLOCK val:real_value SYM_END_DBLOCK)?
|
1068
|
-
prec:(SYM_PRECISION SYM_EQ SYM_START_DBLOCK val:integer_value SYM_END_DBLOCK)?
|
1069
|
-
SYM_END_DBLOCK <AssumedValueItems>
|
1070
|
-
/ SYM_ASSUMED_VALUE SYM_EQ SYM_START_DBLOCK
|
1071
|
-
SYM_UNITS SYM_EQ SYM_START_DBLOCK units:V_STRING SYM_END_DBLOCK
|
1072
|
-
prec:(SYM_PRECISION SYM_EQ SYM_START_DBLOCK val:integer_value SYM_END_DBLOCK)?
|
1073
|
-
mag:(SYM_MAGNITUDE SYM_EQ SYM_START_DBLOCK val:real_value SYM_END_DBLOCK)?
|
1074
|
-
SYM_END_DBLOCK <AssumedValueItems>
|
1075
|
-
/ SYM_ASSUMED_VALUE SYM_EQ SYM_START_DBLOCK
|
1076
|
-
prec:(SYM_PRECISION SYM_EQ SYM_START_DBLOCK val:integer_value SYM_END_DBLOCK)?
|
1077
|
-
SYM_UNITS SYM_EQ SYM_START_DBLOCK units:V_STRING SYM_END_DBLOCK
|
1078
|
-
mag:(SYM_MAGNITUDE SYM_EQ SYM_START_DBLOCK val:real_value SYM_END_DBLOCK)?
|
1079
|
-
SYM_END_DBLOCK <AssumedValueItems>
|
1080
|
-
/ SYM_ASSUMED_VALUE SYM_EQ SYM_START_DBLOCK
|
1081
|
-
prec:(SYM_PRECISION SYM_EQ SYM_START_DBLOCK val:integer_value SYM_END_DBLOCK)?
|
1082
|
-
mag:(SYM_MAGNITUDE SYM_EQ SYM_START_DBLOCK val:real_value SYM_END_DBLOCK)?
|
1083
|
-
SYM_UNITS SYM_EQ SYM_START_DBLOCK units:V_STRING SYM_END_DBLOCK
|
1084
|
-
SYM_END_DBLOCK <AssumedValueItems>
|
1085
|
-
/ SYM_ASSUMED_VALUE SYM_EQ SYM_START_DBLOCK
|
1086
|
-
mag:(SYM_MAGNITUDE SYM_EQ SYM_START_DBLOCK val:real_value SYM_END_DBLOCK)?
|
1087
|
-
prec:(SYM_PRECISION SYM_EQ SYM_START_DBLOCK val:integer_value SYM_END_DBLOCK)?
|
1088
|
-
SYM_UNITS SYM_EQ SYM_START_DBLOCK units:V_STRING SYM_END_DBLOCK
|
1089
|
-
SYM_END_DBLOCK <AssumedValueItems>
|
1090
|
-
/ SYM_ASSUMED_VALUE SYM_EQ SYM_START_DBLOCK
|
1091
|
-
mag:(SYM_MAGNITUDE SYM_EQ SYM_START_DBLOCK val:real_value SYM_END_DBLOCK)?
|
1092
|
-
SYM_UNITS SYM_EQ SYM_START_DBLOCK units:V_STRING SYM_END_DBLOCK
|
1093
|
-
prec:(SYM_PRECISION SYM_EQ SYM_START_DBLOCK val:integer_value SYM_END_DBLOCK)?
|
1094
|
-
SYM_END_DBLOCK <AssumedValueItems>
|
1095
|
-
end
|
1096
|
-
|
1097
|
-
rule SYM_QUANTITY_LIST
|
1098
|
-
'list' space
|
1099
|
-
end
|
1100
|
-
|
1101
|
-
rule c_quantity_items
|
1102
|
-
c_quantity_item more_cdv:(c_quantity_item white_space)* {
|
1103
|
-
def value(node)
|
1104
|
-
quantities.map {|q| q.value(node)}
|
1105
|
-
end
|
1106
|
-
|
1107
|
-
def quantities
|
1108
|
-
[c_quantity_item] + more_cdv.elements.map {|e| e.c_quantity_item}
|
1109
|
-
end
|
1110
|
-
}
|
1111
|
-
end
|
1112
|
-
|
1113
|
-
rule c_quantity_item
|
1114
|
-
'[' V_STRING ']' white_space SYM_EQ SYM_START_DBLOCK
|
1115
|
-
SYM_UNITS SYM_EQ SYM_START_DBLOCK units:V_STRING SYM_END_DBLOCK
|
1116
|
-
mag:(SYM_MAGNITUDE SYM_EQ SYM_START_DBLOCK int:real_interval_value SYM_END_DBLOCK)?
|
1117
|
-
prec:(SYM_PRECISION SYM_EQ SYM_START_DBLOCK int:integer_interval_value SYM_END_DBLOCK)?
|
1118
|
-
SYM_END_DBLOCK {
|
1119
|
-
def value(node)
|
1120
|
-
magnitude, precision = nil
|
1121
|
-
magnitude = mag.int.value unless mag.empty?
|
1122
|
-
precision = prec.int.value unless prec.empty?
|
1123
|
-
OpenEHR::AM::OpenEHRProfile::DataTypes::Quantity::CQuantityItem.new(
|
1124
|
-
:path => node.path, :rm_type_name => 'DvQuantity',
|
1125
|
-
:occurrences => OpenEHR::AssumedLibraryTypes::Interval.new(
|
1126
|
-
:upper => 1, :lower => 1),
|
1127
|
-
:units => units.value,
|
1128
|
-
:magnitude => magnitude, :precision => precision)
|
1129
|
-
end
|
1130
|
-
}
|
1131
|
-
end
|
1132
|
-
|
1133
|
-
rule SYM_UNITS
|
1134
|
-
'units' space
|
1135
|
-
end
|
1136
|
-
|
1137
|
-
rule SYM_MAGNITUDE
|
1138
|
-
'magnitude' space
|
1139
|
-
end
|
1140
|
-
|
1141
|
-
rule SYM_PRECISION
|
1142
|
-
'precision' space
|
1143
|
-
end
|
1144
|
-
|
1145
|
-
rule SYM_ASSUMED_VALUE
|
1146
|
-
'assumed_value' space
|
1147
|
-
end
|
1148
|
-
|
1149
|
-
rule V_C_DOMAIN_TYPE
|
1150
|
-
'('? [A-Z] IDCHAR* ')'? [ \n]* '<' [^>]* '>'
|
1151
|
-
end
|
1152
|
-
|
1153
|
-
# assertion block
|
1154
|
-
|
1155
|
-
rule V_ASSERTION_TEXT
|
1156
|
-
assertions '' {
|
1157
|
-
def value
|
1158
|
-
assertions.value
|
1159
|
-
end
|
1160
|
-
}
|
1161
|
-
end
|
1162
|
-
|
1163
|
-
rule assertions
|
1164
|
-
assertion more_a:(assertion '')* {
|
1165
|
-
def value
|
1166
|
-
assertions.map {|a| a.value}
|
1167
|
-
end
|
1168
|
-
|
1169
|
-
def assertions
|
1170
|
-
[assertion] + more_a.elements.map {|a| a.assertion}
|
1171
|
-
end
|
1172
|
-
}
|
1173
|
-
end
|
1174
|
-
|
1175
|
-
rule assertion
|
1176
|
-
id:(any_identifier ':')? boolean_expression space {
|
1177
|
-
def value
|
1178
|
-
if (id && !id.empty?)
|
1179
|
-
OpenEHR::AM::Archetype::Assertion::Assertion.new(
|
1180
|
-
:tag => id.value, :expression => boolean_expression.value,
|
1181
|
-
:string_expression => id.text_value + boolean_expression.text_value)
|
1182
|
-
else
|
1183
|
-
OpenEHR::AM::Archetype::Assertion::Assertion.new(
|
1184
|
-
:expression => boolean_expression.value,
|
1185
|
-
:string_expression => boolean_expression.text_value)
|
1186
|
-
end
|
1187
|
-
end
|
1188
|
-
}
|
1189
|
-
end
|
1190
|
-
|
1191
|
-
rule boolean_expression
|
1192
|
-
boolean_node '' {
|
1193
|
-
def value
|
1194
|
-
boolean_node.value
|
1195
|
-
end
|
1196
|
-
}
|
1197
|
-
/ boolean_leaf '' {
|
1198
|
-
def value
|
1199
|
-
boolean_leaf.value
|
1200
|
-
end
|
1201
|
-
}
|
1202
|
-
end
|
1203
|
-
|
1204
|
-
rule boolean_node
|
1205
|
-
SYM_EXISTS absolute_path {
|
1206
|
-
def value
|
1207
|
-
item = OpenEHR::AM::Archetype::Assertion::ExprLeaf.new(
|
1208
|
-
:type => 'String',
|
1209
|
-
:item => absolute_path.value,
|
1210
|
-
:reference_type => 'CONSTANT')
|
1211
|
-
OpenEHR::AM::Archetype::Assertion::ExprUnaryOperator.new(
|
1212
|
-
:type => 'Boolean',
|
1213
|
-
:operator => OpenEHR::AM::Archetype::Assertion::OperatorKind::OP_EXISTS,
|
1214
|
-
:operand => item,
|
1215
|
-
:precedence_overridden => false)
|
1216
|
-
end
|
1217
|
-
}
|
1218
|
-
/ relative_path white_space SYM_MATCHES SYM_START_CBLOCK c_primitive SYM_END_CBLOCK {
|
1219
|
-
def value
|
1220
|
-
left_op = OpenEHR::AM::Archetype::Assertion::ExprLeaf.new(
|
1221
|
-
:type => 'String',
|
1222
|
-
:item => relative_path.value,
|
1223
|
-
:reference_type => 'Constant')
|
1224
|
-
right_op = OpenEHR::AM::Archetype::Assertion::ExprLeaf.new(
|
1225
|
-
:item => c_primitive.value,
|
1226
|
-
:type => c_primitive.value.type,
|
1227
|
-
:reference_type => 'Constant')
|
1228
|
-
op = OpenEHR::AM::Archetype::Assertion::OperatorKind::OP_MATCHES
|
1229
|
-
OpenEHR::AM::Archetype::Assertion::ExprBinaryOperator.new(
|
1230
|
-
:type => 'Boolean',
|
1231
|
-
:operator => op,
|
1232
|
-
:right_operand => right_op,
|
1233
|
-
:left_operand => left_op,
|
1234
|
-
:reference_type => 'Constraint')
|
1235
|
-
end
|
1236
|
-
}
|
1237
|
-
/ SYM_NOT boolean_leaf '' {
|
1238
|
-
def value
|
1239
|
-
OpenEHR::AM::Archetype::Assertion::ExprUnaryOperator.new(
|
1240
|
-
:type => 'Boolean',
|
1241
|
-
:operator => OpenEHR::AM::Archetype::Assertion::OperatorKind::OP_NOT,
|
1242
|
-
:operand => boolean_leaf.value,
|
1243
|
-
:precedence_overridden => false)
|
1244
|
-
end
|
1245
|
-
}
|
1246
|
-
/ arithmetic_leaf SYM_EQ arithmetic_expression {
|
1247
|
-
def value
|
1248
|
-
OpenEHR::AM::Archetype::Assertion::ExprBinaryOperator.new(
|
1249
|
-
:type => 'Boolean',
|
1250
|
-
:operator => OpenEHR::AM::Archetype::Assertion::OperatorKind::OP_EQ,
|
1251
|
-
:left_operand => arithmetic_leaf.value,
|
1252
|
-
:right_operand => arithmetic_expression.value,
|
1253
|
-
:reference_type => 'Constraint')
|
1254
|
-
end
|
1255
|
-
}
|
1256
|
-
/ arithmetic_leaf SYM_NE arithmetic_expression {
|
1257
|
-
def value
|
1258
|
-
OpenEHR::AM::Archetype::Assertion::ExprBinaryOperator.new(
|
1259
|
-
:type => 'Boolean',
|
1260
|
-
:operator => OpenEHR::AM::Archetype::Assertion::OperatorKind::OP_NE,
|
1261
|
-
:left_operand => arithmetic_leaf.value,
|
1262
|
-
:right_operand => arithmetic_expression.value,
|
1263
|
-
:reference_type => 'Constraint')
|
1264
|
-
end
|
1265
|
-
}
|
1266
|
-
/ arithmetic_leaf SYM_LT arithmetic_expression {
|
1267
|
-
def value
|
1268
|
-
OpenEHR::AM::Archetype::Assertion::ExprBinaryOperator.new(
|
1269
|
-
:type => 'Boolean',
|
1270
|
-
:operator => OpenEHR::AM::Archetype::Assertion::OperatorKind::OP_LT,
|
1271
|
-
:left_operand => arithmetic_leaf.value,
|
1272
|
-
:right_operand => arithmetic_expression.value,
|
1273
|
-
:reference_type => 'Constraint')
|
1274
|
-
end
|
1275
|
-
}
|
1276
|
-
/ arithmetic_leaf SYM_GT arithmetic_expression {
|
1277
|
-
def value
|
1278
|
-
OpenEHR::AM::Archetype::Assertion::ExprBinaryOperator.new(
|
1279
|
-
:type => 'Boolean',
|
1280
|
-
:operator => OpenEHR::AM::Archetype::Assertion::OperatorKind::OP_GT,
|
1281
|
-
:left_operand => arithmetic_leaf.value,
|
1282
|
-
:right_operand => arithmetic_expression.value,
|
1283
|
-
:reference_type => 'Constraint')
|
1284
|
-
end
|
1285
|
-
}
|
1286
|
-
/ arithmetic_leaf SYM_LE arithmetic_expression {
|
1287
|
-
def value
|
1288
|
-
OpenEHR::AM::Archetype::Assertion::ExprBinaryOperator.new(
|
1289
|
-
:type => 'Boolean',
|
1290
|
-
:operator => OpenEHR::AM::Archetype::Assertion::OperatorKind::OP_LE,
|
1291
|
-
:left_operand => arithmetic_leaf.value,
|
1292
|
-
:right_operand => arithmetic_expression.value,
|
1293
|
-
:reference_type => 'Constraint')
|
1294
|
-
end
|
1295
|
-
}
|
1296
|
-
/ arithmetic_leaf SYM_GE arithmetic_expression {
|
1297
|
-
def value
|
1298
|
-
OpenEHR::AM::Archetype::Assertion::ExprBinaryOperator.new(
|
1299
|
-
:type => 'Boolean',
|
1300
|
-
:operator => OpenEHR::AM::Archetype::Assertion::OperatorKind::OP_GE,
|
1301
|
-
:left_operand => arithmetic_leaf.value,
|
1302
|
-
:right_operand => arithmetic_expression.value,
|
1303
|
-
:reference_type => 'Constraint')
|
1304
|
-
end
|
1305
|
-
}
|
1306
|
-
/ boolean_leaf SYM_AND boolean_expression {
|
1307
|
-
def value
|
1308
|
-
OpenEHR::AM::Archetype::Assertion::ExprBinaryOperator.new(
|
1309
|
-
:type => 'Boolean',
|
1310
|
-
:operator => OpenEHR::AM::Archetype::Assertion::OperatorKind::OP_AND,
|
1311
|
-
:left_operand => boolean_leaf.value,
|
1312
|
-
:right_operand => boolean_expression.value,
|
1313
|
-
:reference_type => 'Constraint')
|
1314
|
-
end
|
1315
|
-
}
|
1316
|
-
/ boolean_leaf SYM_OR boolean_expression {
|
1317
|
-
def value
|
1318
|
-
OpenEHR::AM::Archetype::Assertion::ExprBinaryOperator.new(
|
1319
|
-
:type => 'Boolean',
|
1320
|
-
:operator => OpenEHR::AM::Archetype::Assertion::OperatorKind::OP_OR,
|
1321
|
-
:left_operand => boolean_leaf.value,
|
1322
|
-
:right_operand => boolean_expression.value,
|
1323
|
-
:reference_type => 'Constraint')
|
1324
|
-
end
|
1325
|
-
}
|
1326
|
-
/ boolean_leaf SYM_XOR boolean_expression {
|
1327
|
-
def value
|
1328
|
-
OpenEHR::AM::Archetype::Assertion::ExprBinaryOperator.new(
|
1329
|
-
:type => 'Boolean',
|
1330
|
-
:operator => OpenEHR::AM::Archetype::Assertion::OperatorKind::OP_XOR,
|
1331
|
-
:left_operand => boolean_leaf.value,
|
1332
|
-
:right_operand => boolean_expression.value,
|
1333
|
-
:reference_type => 'Constraint')
|
1334
|
-
end
|
1335
|
-
}
|
1336
|
-
/ boolean_leaf SYM_IMPLIES boolean_expression {
|
1337
|
-
def value
|
1338
|
-
OpenEHR::AM::Archetype::Assertion::ExprBinaryOperator.new(
|
1339
|
-
:type => 'Boolean',
|
1340
|
-
:operator => OpenEHR::AM::Archetype::Assertion::OperatorKind::OP_IMPLIES,
|
1341
|
-
:left_operand => boolean_leaf.value,
|
1342
|
-
:right_operand => boolean_expression.value,
|
1343
|
-
:reference_type => 'Constraint')
|
1344
|
-
end
|
1345
|
-
}
|
1346
|
-
end
|
1347
|
-
|
1348
|
-
rule boolean_leaf
|
1349
|
-
'(' boolean_expression ')' {
|
1350
|
-
def value
|
1351
|
-
boolean_expression.value
|
1352
|
-
end
|
1353
|
-
}
|
1354
|
-
/ SYM_TRUE '' {
|
1355
|
-
def value
|
1356
|
-
OpenEHR::AM::Archetype::Assertion::ExprLeaf.new(
|
1357
|
-
:type => 'Boolean',
|
1358
|
-
:item => true,
|
1359
|
-
:reference_type => 'CONSTANT')
|
1360
|
-
end
|
1361
|
-
}
|
1362
|
-
/ SYM_FALSE '' {
|
1363
|
-
def value
|
1364
|
-
OpenEHR::AM::Archetype::Assertion::ExprLeaf.new(
|
1365
|
-
:type => 'Boolean',
|
1366
|
-
:item => false,
|
1367
|
-
:reference_type => 'CONSTANT')
|
1368
|
-
end
|
1369
|
-
}
|
1370
|
-
end
|
1371
|
-
|
1372
|
-
rule arithmetic_expression
|
1373
|
-
arithmetic_node '' {
|
1374
|
-
def value
|
1375
|
-
arithmetic_node.value
|
1376
|
-
end
|
1377
|
-
}
|
1378
|
-
/ arithmetic_leaf '' {
|
1379
|
-
def value
|
1380
|
-
arithmetic_leaf.value
|
1381
|
-
end
|
1382
|
-
}
|
1383
|
-
end
|
1384
|
-
|
1385
|
-
rule arithmetic_node
|
1386
|
-
arithmetic_leaf '+' arithmetic_expression {
|
1387
|
-
def value
|
1388
|
-
OpenEHR::AM::Archetype::Assertion::ExprBinaryOperator.new(
|
1389
|
-
:type => 'Boolean',
|
1390
|
-
:operator => OpenEHR::AM::Archetype::Assertion::OperatorKind::OP_PLUS,
|
1391
|
-
:left_operand => arithmetic_leaf.value,
|
1392
|
-
:right_operand => arithmetic_expression.value,
|
1393
|
-
:reference_type => 'Constraint')
|
1394
|
-
end
|
1395
|
-
}
|
1396
|
-
/ arithmetic_leaf '-' arithmetic_expression {
|
1397
|
-
def value
|
1398
|
-
OpenEHR::AM::Archetype::Assertion::ExprBinaryOperator.new(
|
1399
|
-
:type => 'Boolean',
|
1400
|
-
:operator => OpenEHR::AM::Archetype::Assertion::OperatorKind::OP_MINUS,
|
1401
|
-
:left_operand => arithmetic_leaf.value,
|
1402
|
-
:right_operand => arithmetic_expression.value,
|
1403
|
-
:reference_type => 'Constraint')
|
1404
|
-
end
|
1405
|
-
}
|
1406
|
-
/ arithmetic_leaf '*' arithmetic_expression {
|
1407
|
-
def value
|
1408
|
-
OpenEHR::AM::Archetype::Assertion::ExprBinaryOperator.new(
|
1409
|
-
:type => 'Boolean',
|
1410
|
-
:operator => OpenEHR::AM::Archetype::Assertion::OperatorKind::OP_MULTIPLY,
|
1411
|
-
:left_operand => arithmetic_leaf.value,
|
1412
|
-
:right_operand => arithmetic_expression.value,
|
1413
|
-
:reference_type => 'Constraint')
|
1414
|
-
end
|
1415
|
-
}
|
1416
|
-
/ arithmetic_leaf '/' arithmetic_expression {
|
1417
|
-
def value
|
1418
|
-
OpenEHR::AM::Archetype::Assertion::ExprBinaryOperator.new(
|
1419
|
-
:type => 'Boolean',
|
1420
|
-
:operator => OpenEHR::AM::Archetype::Assertion::OperatorKind::OP_DIVIDE,
|
1421
|
-
:left_operand => arithmetic_leaf.value,
|
1422
|
-
:right_operand => arithmetic_expression.value,
|
1423
|
-
:reference_type => 'Constraint')
|
1424
|
-
end
|
1425
|
-
}
|
1426
|
-
/ arithmetic_leaf '^' arithmetic_expression {
|
1427
|
-
def value
|
1428
|
-
OpenEHR::AM::Archetype::Assertion::ExprBinaryOperator.new(
|
1429
|
-
:type => 'Boolean',
|
1430
|
-
:operator => OpenEHR::AM::Archetype::Assertion::OperatorKind::OP_EXP,
|
1431
|
-
:left_operand => arithmetic_leaf.value,
|
1432
|
-
:right_operand => arithmetic_expression.value,
|
1433
|
-
:reference_type => 'Constraint')
|
1434
|
-
end
|
1435
|
-
}
|
1436
|
-
end
|
1437
|
-
|
1438
|
-
rule arithmetic_leaf
|
1439
|
-
'(' arithmetic_expression ')' space {
|
1440
|
-
def value
|
1441
|
-
arithmetic_expression.value
|
1442
|
-
end
|
1443
|
-
}
|
1444
|
-
/ integer_value '' {
|
1445
|
-
def value
|
1446
|
-
OpenEHR::AM::Archetype::ConstraintModel::ExprLeaf.new(
|
1447
|
-
:type => 'Integer',
|
1448
|
-
:item => integer_value.value,
|
1449
|
-
:reference_type => 'CONSTANT')
|
1450
|
-
end
|
1451
|
-
}
|
1452
|
-
/ real_value '' {
|
1453
|
-
def value
|
1454
|
-
OpenEHR::AM::Archetype::ConstraintModel::ExprLeaf.new(
|
1455
|
-
:type => 'Real',
|
1456
|
-
:item => real_value.value,
|
1457
|
-
:reference_type => 'CONSTANT')
|
1458
|
-
end
|
1459
|
-
}
|
1460
|
-
/ absolute_path space {
|
1461
|
-
def value
|
1462
|
-
OpenEHR::AM::Archetype::ConstraintModel::ExprLeaf.new(
|
1463
|
-
:type => 'String',
|
1464
|
-
:item => absolute_path.value,
|
1465
|
-
:reference_type => 'CONSTANT')
|
1466
|
-
|
1467
|
-
end
|
1468
|
-
}
|
1469
|
-
end
|
1470
|
-
|
1471
|
-
# path block
|
1472
|
-
rule object_path
|
1473
|
-
movable_path '' {
|
1474
|
-
def value
|
1475
|
-
movable_path.value
|
1476
|
-
end
|
1477
|
-
}
|
1478
|
-
/ absolute_path '' {
|
1479
|
-
def value
|
1480
|
-
absolute_path.value
|
1481
|
-
end
|
1482
|
-
}
|
1483
|
-
/ relative_path '' {
|
1484
|
-
def value
|
1485
|
-
relative_path.value
|
1486
|
-
end
|
1487
|
-
}
|
1488
|
-
end
|
1489
|
-
|
1490
|
-
rule movable_path
|
1491
|
-
SYM_MOVABLE_LEADER relative_path '' {
|
1492
|
-
def value
|
1493
|
-
text_value
|
1494
|
-
end
|
1495
|
-
}
|
1496
|
-
end
|
1497
|
-
|
1498
|
-
rule absolute_path
|
1499
|
-
'/' relative_path? '' {
|
1500
|
-
def value
|
1501
|
-
text_value
|
1502
|
-
end
|
1503
|
-
}
|
1504
|
-
end
|
1505
|
-
|
1506
|
-
rule relative_path
|
1507
|
-
path_segment ('/' path_segment)* '' {
|
1508
|
-
def value
|
1509
|
-
text_value
|
1510
|
-
end
|
1511
|
-
}
|
1512
|
-
end
|
1513
|
-
|
1514
|
-
rule path_segment
|
1515
|
-
V_ATTRIBUTE_IDENTIFIER V_LOCAL_TERM_CODE_REF? '' {
|
1516
|
-
def value
|
1517
|
-
text_value
|
1518
|
-
end
|
1519
|
-
}
|
1520
|
-
end
|
1521
|
-
|
1522
|
-
rule SYM_MOVABLE_LEADER
|
1523
|
-
'//'
|
1524
|
-
end
|
1525
|
-
end
|
1526
|
-
end
|
1527
|
-
end
|