1 | module OpenEHR
|
---|
2 | module AM
|
---|
3 | module Archetype
|
---|
4 | module Ontology
|
---|
5 | class ArchetypeOntology
|
---|
6 | attr_accessor :constraint_definitions, :specialisation_depth
|
---|
7 | attr_accessor :term_attribute_names, :term_bindings
|
---|
8 | attr_reader :terminologies_available, :term_definitions
|
---|
9 |
|
---|
10 | def initialize(args = { })
|
---|
11 | self.specialisation_depth = args[:specialisation_depth]
|
---|
12 | self.term_definitions = args[:term_definitions]
|
---|
13 | self.constraint_definitions = args[:constraint_definitions]
|
---|
14 | self.term_bindings = args[:term_bindings]
|
---|
15 | end
|
---|
16 |
|
---|
17 | def term_definitions=(term_definitions)
|
---|
18 | if term_definitions.nil?
|
---|
19 | raise ArgumentError, 'term_definitions is mandatory'
|
---|
20 | end
|
---|
21 | @term_definitions = term_definitions
|
---|
22 | end
|
---|
23 |
|
---|
24 | def term_codes
|
---|
25 | return @term_definitions.values.collect {|value|
|
---|
26 | value.collect {|term| term.code}}.flatten.uniq
|
---|
27 | end
|
---|
28 |
|
---|
29 | def constraint_codes
|
---|
30 | if @constraint_definitions.nil?
|
---|
31 | return nil
|
---|
32 | else
|
---|
33 | return @constraint_definitions.values.collect {|value|
|
---|
34 | value.collect {|term| term.code}}.flatten.uniq
|
---|
35 | end
|
---|
36 | end
|
---|
37 |
|
---|
38 | def terminologies_available
|
---|
39 | return @term_bindings.keys
|
---|
40 | end
|
---|
41 |
|
---|
42 | def constraint_binding(a_terminology, a_code)
|
---|
43 | end
|
---|
44 |
|
---|
45 | def constraint_definition(a_lang, a_code)
|
---|
46 | end
|
---|
47 |
|
---|
48 | def has_language?(a_lang)
|
---|
49 | end
|
---|
50 |
|
---|
51 | def has_terminology?(a_terminology)
|
---|
52 | end
|
---|
53 |
|
---|
54 | def term_binding(a_terminology, a_code)
|
---|
55 | end
|
---|
56 |
|
---|
57 | def term_definition(a_lang, a_code)
|
---|
58 | end
|
---|
59 | end
|
---|
60 |
|
---|
61 | class ARCHETYPE_ONTOLOGY < ArchetypeOntology
|
---|
62 |
|
---|
63 | end
|
---|
64 |
|
---|
65 | class ArchetypeTerm
|
---|
66 | attr_accessor :items
|
---|
67 | attr_reader :code
|
---|
68 |
|
---|
69 | def initialize(args = { })
|
---|
70 | self.code = args[:code]
|
---|
71 | self.items =args[:items]
|
---|
72 | end
|
---|
73 |
|
---|
74 | def code=(code)
|
---|
75 | if code.nil? or code.empty?
|
---|
76 | raise ArgumentError, 'code is mandatory'
|
---|
77 | end
|
---|
78 | @code = code
|
---|
79 | end
|
---|
80 |
|
---|
81 | def keys
|
---|
82 | if items.nil?
|
---|
83 | return Set.new
|
---|
84 | else
|
---|
85 | return Set.new(@items.keys)
|
---|
86 | end
|
---|
87 | end
|
---|
88 | end
|
---|
89 |
|
---|
90 | class ARCHETYPE_TERM < ArchetypeTerm
|
---|
91 |
|
---|
92 | end
|
---|
93 | end # end of Ontology
|
---|
94 | end # end of Archetype
|
---|
95 | end # end of AM
|
---|
96 | end # end of OpenEHR
|
---|
97 |
|
---|