source: ruby/trunk/lib/open_ehr/am/archetype/ontology.rb@ 412

Last change on this file since 412 was 412, checked in by KOBAYASHI, Shinji, 14 years ago

implemented adl_serializer ontology spec

File size: 2.5 KB
RevLine 
[372]1module OpenEHR
[4]2 module AM
3 module Archetype
4 module Ontology
[372]5 class ArchetypeOntology
[411]6 attr_accessor :constraint_definitions, :specialisation_depth
7 attr_accessor :term_attribute_names, :term_bindings
8 attr_reader :terminologies_available, :term_definitions
[23]9
[403]10 def initialize(args = { })
11 self.specialisation_depth = args[:specialisation_depth]
[411]12 self.term_definitions = args[:term_definitions]
13 self.constraint_definitions = args[:constraint_definitions]
14 self.term_bindings = args[:term_bindings]
[403]15 end
16
[411]17 def term_definitions=(term_definitions)
18 if term_definitions.nil?
19 raise ArgumentError, 'term_definitions is mandatory'
[403]20 end
[411]21 @term_definitions = term_definitions
[403]22 end
23
[411]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
[412]38 def terminologies_available
39 return @term_bindings.keys
40 end
41
[4]42 def constraint_binding(a_terminology, a_code)
43 end
[23]44
[4]45 def constraint_definition(a_lang, a_code)
46 end
[23]47
[4]48 def has_language?(a_lang)
49 end
[23]50
[4]51 def has_terminology?(a_terminology)
52 end
[23]53
[4]54 def term_binding(a_terminology, a_code)
55 end
[23]56
[4]57 def term_definition(a_lang, a_code)
58 end
59 end
[23]60
[402]61 class ARCHETYPE_ONTOLOGY < ArchetypeOntology
[23]62
[402]63 end
64
65 class ArchetypeTerm
66 attr_accessor :items
67 attr_reader :code
68
[23]69 def initialize(args = { })
[402]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
[4]79 end
[23]80
[4]81 def keys
[402]82 if items.nil?
83 return Set.new
84 else
85 return Set.new(@items.keys)
86 end
[4]87 end
88 end
[402]89
90 class ARCHETYPE_TERM < ArchetypeTerm
91
92 end
[4]93 end # end of Ontology
94 end # end of Archetype
95 end # end of AM
96end # end of OpenEHR
97
Note: See TracBrowser for help on using the repository browser.