// Generated by cimgen — do not edit by hand.
#![allow(clippy::all, dead_code, unused)]
use cimdecoder::CimDataset;
use crate::Violation;
use crate::helpers::*;
pub fn validate_p61970_600_2_equipment_ap_con_complex_shacl(dataset: &CimDataset) -> Vec<Violation> {
let mut v = Vec::new();
v.extend(check_p61970_600_2_equipment_ap_con_complex_shacl_geographical_region_type_max_count(dataset));
v.extend(check_p61970_600_2_equipment_ap_con_complex_shacl_synchronous_machine_rotating_machine_rated_s_re_etc(dataset));
v.extend(check_p61970_600_2_equipment_ap_con_complex_shacl_asynchronous_machine_rotating_machine_rated_s_r_etc(dataset));
v
}
pub fn check_p61970_600_2_equipment_ap_con_complex_shacl_geographical_region_type_max_count(dataset: &CimDataset) -> Vec<Violation> {
let count = dataset.by_type.get("GeographicalRegion").map_or(0, |v| v.len());
let mut violations = Vec::new();
if count > 1 {
violations.push(Violation {
object_id: String::new(),
rule_id: "eq600:GeographicalRegion-EQ__4".to_string(),
class: "GeographicalRegion".to_string(),
property: "C:600:EQ:GeographicalRegion:EQ__4".to_string(),
message: "Muliple GeographicalRegion-s are present.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:600:EQ:GeographicalRegion:EQ__4".to_string(),
description: "Only one GeographicalRegion shall be exchanged per MAS. In case multiple Model Authority have a need to have the same GeographicalRegion (i.e. multiple TSOs in a country) the class GeographicalRegion shall be present in all Model Authority models and shall have different rdf:ID, but can have same name/description. There is no specific naming convention defined. Note that this is mainly applicable for exchanging transmission data. Additional clarifications when dealing with distribution data are not defined currently.".to_string(),
});
}
violations
}
pub fn check_p61970_600_2_equipment_ap_con_complex_shacl_synchronous_machine_rotating_machine_rated_s_re_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SynchronousMachine").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SynchronousMachine>() {
Some(o) => o, None => continue,
};
if obj.base.rated_s.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "eq600:RotatingMachine.ratedS-required".to_string(),
class: "SynchronousMachine".to_string(),
property: "RotatingMachine.ratedS".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "C:600:EQ:RotatingMachine.ratedS:required".to_string(),
description: "RotatingMachine.ratedS is required.".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_equipment_ap_con_complex_shacl_asynchronous_machine_rotating_machine_rated_s_r_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("AsynchronousMachine").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::AsynchronousMachine>() {
Some(o) => o, None => continue,
};
if obj.base.rated_s.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "eq600:RotatingMachine.ratedS-required".to_string(),
class: "AsynchronousMachine".to_string(),
property: "RotatingMachine.ratedS".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "C:600:EQ:RotatingMachine.ratedS:required".to_string(),
description: "RotatingMachine.ratedS is required.".to_string(),
});
}
}
violations
}