1use std::collections::HashMap;
2
3use super::family::Family;
4
5pub const CGMES_VERSION_3_0_0: &str = "3.0.0";
6
7pub const DATA_TYPE_STRING: &str = "String";
8pub const DATA_TYPE_INTEGER: &str = "Integer";
9pub const DATA_TYPE_BOOLEAN: &str = "Boolean";
10pub const DATA_TYPE_FLOAT: &str = "Float";
11pub const DATA_TYPE_DATE: &str = "Date";
12pub const DATA_TYPE_DATE_TIME: &str = "DateTime";
13pub const DATA_TYPE_DECIMAL: &str = "Decimal";
14pub const DATA_TYPE_MONTH_DAY: &str = "MonthDay";
15
16#[derive(Debug, Default, Clone)]
17#[allow(dead_code)]
18pub struct CimAttribute {
19 pub id: String,
20 pub label: String,
21 pub namespace: String,
22 pub comment: String,
23 pub cim_multiplicity: String,
24 pub is_list: bool,
25 pub cim_association_used: String,
26 pub is_association_used: bool,
27 pub cim_is_fixed: String,
28 pub is_fixed: bool,
29 pub cim_inverse_role: String,
30 pub has_inverse_role: bool,
31 pub inverse_role_attribute: String,
32 pub is_inverse_role_attribute_list: bool,
33 pub cim_stereotype: String,
34 pub rdf_range: String,
35 pub cim_data_type: String,
36 pub data_type: String,
37 pub is_primitive: bool,
38 pub rdf_domain: String,
39 pub rdf_type: String,
40 pub default_value: String,
41 pub is_enum_value: bool,
42 pub lang_type: String,
43 pub is_cim_datatype: bool,
44 pub is_class: bool,
45 pub use_id_reference: bool,
46 pub origin: String,
47 pub origins: Vec<String>,
48 pub cim_categories: Vec<String>,
49}
50
51#[derive(Debug, Default, Clone)]
52#[allow(dead_code)]
53pub struct CimType {
54 pub id: String,
55 pub label: String,
56 pub namespace: String,
57 pub comment: String,
58 pub cim_stereotype: String,
59 pub rdf_type: String,
60 pub super_type: String,
61 pub has_class_attributes: bool,
62 pub primitive_types: Vec<String>,
63 pub cim_datatypes: Vec<String>,
64 pub enum_types: Vec<String>,
65 pub origin: String,
66 pub origins: Vec<String>,
67 pub concrete_in: Vec<String>,
72 pub cim_categories: Vec<String>,
73 pub attributes: Vec<CimAttribute>,
74}
75
76#[derive(Debug, Default, Clone)]
77#[allow(dead_code)]
78pub struct CimDatatype {
79 pub id: String,
80 pub label: String,
81 pub namespace: String,
82 pub comment: String,
83 pub cim_stereotype: String,
84 pub rdf_type: String,
85 pub lang_type: String,
86 pub primitive_type: String,
87 pub cim_category: String,
88 pub attributes: Vec<CimAttribute>,
89}
90
91#[derive(Debug, Default, Clone)]
92#[allow(dead_code)]
93pub struct CimPrimitive {
94 pub id: String,
95 pub label: String,
96 pub namespace: String,
97 pub comment: String,
98 pub cim_stereotype: String,
99 pub rdf_type: String,
100 pub data_type: String,
101 pub lang_type: String,
102}
103
104#[derive(Debug, Default, Clone)]
105#[allow(dead_code)]
106pub struct CimEnum {
107 pub id: String,
108 pub label: String,
109 pub namespace: String,
110 pub comment: String,
111 pub cim_stereotype: String,
112 pub rdf_type: String,
113 pub origin: String,
114 pub origins: Vec<String>,
115 pub values: Vec<CimEnumValue>,
116}
117
118#[derive(Debug, Default, Clone)]
119#[allow(dead_code)]
120pub struct CimEnumValue {
121 pub id: String,
122 pub label: String,
123 pub comment: String,
124 pub cim_stereotype: String,
125 pub rdf_type: String,
126}
127
128#[derive(Debug, Default, Clone)]
129#[allow(dead_code)]
130pub struct CimOntology {
131 pub id: String,
132 pub namespace: String,
133 pub owl_version_iri: String,
134 pub owl_version_info: String,
135 pub keyword: String,
136 pub rdf_type: String,
137 pub name: String,
138 pub priority: u32,
139}
140
141#[derive(Debug)]
142pub struct CimSpecification {
143 pub family: &'static Family,
145 pub specification_namespaces: HashMap<String, String>,
146 pub profile_namespaces: HashMap<String, String>,
147 pub ontologies: HashMap<String, CimOntology>,
148 pub ontology_list: Vec<String>,
149 pub types: HashMap<String, CimType>,
150 pub enums: HashMap<String, CimEnum>,
151 pub primitive_types: HashMap<String, CimPrimitive>,
152 pub cim_datatypes: HashMap<String, CimDatatype>,
153 pub cgmes_version: String,
154}
155
156impl CimSpecification {
157 pub fn new(family: &'static Family) -> Self {
158 CimSpecification {
159 family,
160 specification_namespaces: HashMap::new(),
161 profile_namespaces: HashMap::new(),
162 ontologies: HashMap::new(),
163 ontology_list: Vec::new(),
164 types: HashMap::new(),
165 enums: HashMap::new(),
166 primitive_types: HashMap::new(),
167 cim_datatypes: HashMap::new(),
168 cgmes_version: CGMES_VERSION_3_0_0.to_string(),
169 }
170 }
171}