#![allow(clippy::all, dead_code, unused)]
use cimdecoder::CimDataset;
use crate::Violation;
use crate::helpers::*;
pub fn validate_p61970_600_2_statevariables_ap_con_simple_shacl(dataset: &CimDataset) -> Vec<Violation> {
let mut v = Vec::new();
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_cs_converter_cs_converter_alpha_required(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_cs_converter_acdc_converter_udc_required(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_cs_converter_acdc_converter_pole_loss_p_req_etc(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_cs_converter_acdc_converter_uc_required(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_cs_converter_cs_converter_gamma_required(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_cs_converter_acdc_converter_idc_required(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_dc_topological_island_identified_object_nam_etc(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_dc_topological_island_identified_object_m_r_etc(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_dc_topological_island_dc_topological_island_etc(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_injection_sv_injection_q_injection_max_c_etc(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_injection_sv_injection_topological_node_etc(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_injection_sv_injection_p_injection_required(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_power_flow_sv_power_flow_p_required(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_power_flow_sv_power_flow_q_required(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_power_flow_sv_power_flow_terminal_required(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_shunt_compensator_sections_sv_shunt_comp_etc(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_shunt_compensator_sections_sv_shunt_comp_etc_2(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_status_sv_status_conducting_equipment_re_etc(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_status_sv_status_in_service_required(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_status_sv_status_conducting_equipment_in(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_switch_sv_switch_open_required(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_switch_sv_switch_switch_required(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_tap_step_sv_tap_step_tap_changer_required(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_tap_step_sv_tap_step_position_required(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_voltage_sv_voltage_topological_node_requ_etc(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_voltage_sv_voltage_angle_required(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_voltage_sv_voltage_v_required(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_topological_island_identified_object_name_r_etc(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_topological_island_identified_object_m_rid_etc(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_topological_island_topological_island_topol_etc(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_topological_island_topological_island_angle_etc(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_vs_converter_vs_converter_uv_required(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_vs_converter_vs_converter_delta_required(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_vs_converter_acdc_converter_udc_required(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_vs_converter_acdc_converter_uc_required(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_vs_converter_acdc_converter_idc_required(dataset));
v.extend(check_p61970_600_2_statevariables_ap_con_simple_shacl_vs_converter_acdc_converter_pole_loss_p_req_etc(dataset));
v
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_cs_converter_cs_converter_alpha_required(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CsConverter>() {
Some(o) => o, None => continue,
};
if obj.alpha.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:CsConverter.alpha-cardinality".to_string(),
class: "CsConverter".to_string(),
property: "CsConverter.alpha".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "CsConverter.alpha-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_cs_converter_acdc_converter_udc_required(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.udc.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:ACDCConverter.udc-cardinality".to_string(),
class: "CsConverter".to_string(),
property: "ACDCConverter.udc".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "ACDCConverter.udc-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_cs_converter_acdc_converter_pole_loss_p_req_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.pole_loss_p.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:ACDCConverter.poleLossP-cardinality".to_string(),
class: "CsConverter".to_string(),
property: "ACDCConverter.poleLossP".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "ACDCConverter.poleLossP-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_cs_converter_acdc_converter_uc_required(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.uc.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:ACDCConverter.uc-cardinality".to_string(),
class: "CsConverter".to_string(),
property: "ACDCConverter.uc".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "ACDCConverter.uc-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_cs_converter_cs_converter_gamma_required(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CsConverter>() {
Some(o) => o, None => continue,
};
if obj.gamma.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:CsConverter.gamma-cardinality".to_string(),
class: "CsConverter".to_string(),
property: "CsConverter.gamma".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "CsConverter.gamma-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_cs_converter_acdc_converter_idc_required(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.idc.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:ACDCConverter.idc-cardinality".to_string(),
class: "CsConverter".to_string(),
property: "ACDCConverter.idc".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "ACDCConverter.idc-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_dc_topological_island_identified_object_nam_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCTopologicalIsland").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::DCTopologicalIsland>() {
Some(o) => o, None => continue,
};
if obj.base.name.is_empty() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "ido:IdentifiedObject.name-cardinality".to_string(),
class: "DCTopologicalIsland".to_string(),
property: "IdentifiedObject.name".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "IdentifiedObject.name-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_dc_topological_island_identified_object_m_r_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCTopologicalIsland").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::DCTopologicalIsland>() {
Some(o) => o, None => continue,
};
if obj.base.m_rid.is_empty() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "ido:IdentifiedObject.mRID-cardinality".to_string(),
class: "DCTopologicalIsland".to_string(),
property: "IdentifiedObject.mRID".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "IdentifiedObject.mRID-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_dc_topological_island_dc_topological_island_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCTopologicalIsland").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::DCTopologicalIsland>() {
Some(o) => o, None => continue,
};
if obj.dc_topological_nodes.is_empty() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:DCTopologicalIsland.DCTopologicalNodes-cardinality".to_string(),
class: "DCTopologicalIsland".to_string(),
property: "DCTopologicalIsland.DCTopologicalNodes".to_string(),
message: "Cardinality violation. Lower bound shall be 1".to_string(),
severity: "sh:Violation".to_string(),
name: "DCTopologicalIsland.DCTopologicalNodes-cardinality".to_string(),
description: "This constraint validates the cardinality of the association at the used direction.".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_injection_sv_injection_q_injection_max_c_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SvInjection").into_iter().flatten() {
if dataset.entries[mrid].block.duplicate_fields.contains("SvInjection.qInjection") {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:SvInjection.qInjection-cardinality".to_string(),
class: "SvInjection".to_string(),
property: "SvInjection.qInjection".to_string(),
message: "Cardinality violation. Upper bound shall be 1".to_string(),
severity: "sh:Violation".to_string(),
name: "SvInjection.qInjection-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_injection_sv_injection_topological_node_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SvInjection").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SvInjection>() {
Some(o) => o, None => continue,
};
if obj.topological_node.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:SvInjection.TopologicalNode-cardinality".to_string(),
class: "SvInjection".to_string(),
property: "SvInjection.TopologicalNode".to_string(),
message: "Missing required association.".to_string(),
severity: "sh:Violation".to_string(),
name: "SvInjection.TopologicalNode-cardinality".to_string(),
description: "This constraint validates the cardinality of the association at the used direction.".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_injection_sv_injection_p_injection_required(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SvInjection").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SvInjection>() {
Some(o) => o, None => continue,
};
if obj.p_injection.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:SvInjection.pInjection-cardinality".to_string(),
class: "SvInjection".to_string(),
property: "SvInjection.pInjection".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "SvInjection.pInjection-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_power_flow_sv_power_flow_p_required(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SvPowerFlow").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SvPowerFlow>() {
Some(o) => o, None => continue,
};
if obj.p.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:SvPowerFlow.p-cardinality".to_string(),
class: "SvPowerFlow".to_string(),
property: "SvPowerFlow.p".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "SvPowerFlow.p-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_power_flow_sv_power_flow_q_required(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SvPowerFlow").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SvPowerFlow>() {
Some(o) => o, None => continue,
};
if obj.q.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:SvPowerFlow.q-cardinality".to_string(),
class: "SvPowerFlow".to_string(),
property: "SvPowerFlow.q".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "SvPowerFlow.q-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_power_flow_sv_power_flow_terminal_required(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SvPowerFlow").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SvPowerFlow>() {
Some(o) => o, None => continue,
};
if obj.terminal.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:SvPowerFlow.Terminal-cardinality".to_string(),
class: "SvPowerFlow".to_string(),
property: "SvPowerFlow.Terminal".to_string(),
message: "Missing required association.".to_string(),
severity: "sh:Violation".to_string(),
name: "SvPowerFlow.Terminal-cardinality".to_string(),
description: "This constraint validates the cardinality of the association at the used direction.".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_shunt_compensator_sections_sv_shunt_comp_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SvShuntCompensatorSections").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SvShuntCompensatorSections>() {
Some(o) => o, None => continue,
};
if obj.shunt_compensator.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:SvShuntCompensatorSections.ShuntCompensator-cardinality".to_string(),
class: "SvShuntCompensatorSections".to_string(),
property: "SvShuntCompensatorSections.ShuntCompensator".to_string(),
message: "Missing required association.".to_string(),
severity: "sh:Violation".to_string(),
name: "SvShuntCompensatorSections.ShuntCompensator-cardinality".to_string(),
description: "This constraint validates the cardinality of the association at the used direction.".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_shunt_compensator_sections_sv_shunt_comp_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SvShuntCompensatorSections").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SvShuntCompensatorSections>() {
Some(o) => o, None => continue,
};
if obj.sections.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:SvShuntCompensatorSections.sections-cardinality".to_string(),
class: "SvShuntCompensatorSections".to_string(),
property: "SvShuntCompensatorSections.sections".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "SvShuntCompensatorSections.sections-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_status_sv_status_conducting_equipment_re_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SvStatus").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SvStatus>() {
Some(o) => o, None => continue,
};
if obj.conducting_equipment.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:SvStatus.ConductingEquipment-cardinality".to_string(),
class: "SvStatus".to_string(),
property: "SvStatus.ConductingEquipment".to_string(),
message: "Missing required association.".to_string(),
severity: "sh:Violation".to_string(),
name: "SvStatus.ConductingEquipment-cardinality".to_string(),
description: "This constraint validates the cardinality of the association at the used direction.".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_status_sv_status_in_service_required(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SvStatus").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SvStatus>() {
Some(o) => o, None => continue,
};
if obj.in_service.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:SvStatus.inService-cardinality".to_string(),
class: "SvStatus".to_string(),
property: "SvStatus.inService".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "SvStatus.inService-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_status_sv_status_conducting_equipment_in(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SvStatus").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SvStatus>() {
Some(o) => o, None => continue,
};
let ref_mrid = match obj.conducting_equipment.as_ref() {
Some(r) => r.mrid.trim_start_matches('#'), None => continue,
};
if let Some(ref_entry) = dataset.entries.get(ref_mrid) {
let allowed: &[&str] = &["CsConverter", "VsConverter"];
if !allowed.contains(&ref_entry.element.type_name()) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:SvStatus.ConductingEquipment-valueType".to_string(),
class: "SvStatus".to_string(),
property: "SvStatus.ConductingEquipment".to_string(),
message: "One of the following occurs: 1) The value type is not IRI; 2) The value type is not the right class.".to_string(),
severity: "sh:Violation".to_string(),
name: "SvStatus.ConductingEquipment-valueType".to_string(),
description: "This constraint validates the value type of the association at the used direction.".to_string(),
});
}
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_switch_sv_switch_open_required(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SvSwitch").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SvSwitch>() {
Some(o) => o, None => continue,
};
if obj.open.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:SvSwitch.open-cardinality".to_string(),
class: "SvSwitch".to_string(),
property: "SvSwitch.open".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "SvSwitch.open-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_switch_sv_switch_switch_required(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SvSwitch").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SvSwitch>() {
Some(o) => o, None => continue,
};
if obj.switch.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:SvSwitch.Switch-cardinality".to_string(),
class: "SvSwitch".to_string(),
property: "SvSwitch.Switch".to_string(),
message: "Missing required association.".to_string(),
severity: "sh:Violation".to_string(),
name: "SvSwitch.Switch-cardinality".to_string(),
description: "This constraint validates the cardinality of the association at the used direction.".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_tap_step_sv_tap_step_tap_changer_required(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SvTapStep").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SvTapStep>() {
Some(o) => o, None => continue,
};
if obj.tap_changer.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:SvTapStep.TapChanger-cardinality".to_string(),
class: "SvTapStep".to_string(),
property: "SvTapStep.TapChanger".to_string(),
message: "Missing required association.".to_string(),
severity: "sh:Violation".to_string(),
name: "SvTapStep.TapChanger-cardinality".to_string(),
description: "This constraint validates the cardinality of the association at the used direction.".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_tap_step_sv_tap_step_position_required(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SvTapStep").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SvTapStep>() {
Some(o) => o, None => continue,
};
if obj.position.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:SvTapStep.position-cardinality".to_string(),
class: "SvTapStep".to_string(),
property: "SvTapStep.position".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "SvTapStep.position-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_voltage_sv_voltage_topological_node_requ_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SvVoltage").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SvVoltage>() {
Some(o) => o, None => continue,
};
if obj.topological_node.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:SvVoltage.TopologicalNode-cardinality".to_string(),
class: "SvVoltage".to_string(),
property: "SvVoltage.TopologicalNode".to_string(),
message: "Missing required association.".to_string(),
severity: "sh:Violation".to_string(),
name: "SvVoltage.TopologicalNode-cardinality".to_string(),
description: "This constraint validates the cardinality of the association at the used direction.".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_voltage_sv_voltage_angle_required(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SvVoltage").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SvVoltage>() {
Some(o) => o, None => continue,
};
if obj.angle.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:SvVoltage.angle-cardinality".to_string(),
class: "SvVoltage".to_string(),
property: "SvVoltage.angle".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "SvVoltage.angle-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_sv_voltage_sv_voltage_v_required(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SvVoltage").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SvVoltage>() {
Some(o) => o, None => continue,
};
if obj.v.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:SvVoltage.v-cardinality".to_string(),
class: "SvVoltage".to_string(),
property: "SvVoltage.v".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "SvVoltage.v-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_topological_island_identified_object_name_r_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("TopologicalIsland").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::TopologicalIsland>() {
Some(o) => o, None => continue,
};
if obj.base.name.is_empty() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "ido:IdentifiedObject.name-cardinality".to_string(),
class: "TopologicalIsland".to_string(),
property: "IdentifiedObject.name".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "IdentifiedObject.name-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_topological_island_identified_object_m_rid_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("TopologicalIsland").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::TopologicalIsland>() {
Some(o) => o, None => continue,
};
if obj.base.m_rid.is_empty() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "ido:IdentifiedObject.mRID-cardinality".to_string(),
class: "TopologicalIsland".to_string(),
property: "IdentifiedObject.mRID".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "IdentifiedObject.mRID-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_topological_island_topological_island_topol_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("TopologicalIsland").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::TopologicalIsland>() {
Some(o) => o, None => continue,
};
if obj.topological_nodes.is_empty() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:TopologicalIsland.TopologicalNodes-cardinality".to_string(),
class: "TopologicalIsland".to_string(),
property: "TopologicalIsland.TopologicalNodes".to_string(),
message: "Cardinality violation. Lower bound shall be 1".to_string(),
severity: "sh:Violation".to_string(),
name: "TopologicalIsland.TopologicalNodes-cardinality".to_string(),
description: "This constraint validates the cardinality of the association at the used direction.".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_topological_island_topological_island_angle_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("TopologicalIsland").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::TopologicalIsland>() {
Some(o) => o, None => continue,
};
if obj.angle_ref_topological_node.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:TopologicalIsland.AngleRefTopologicalNode-cardinality".to_string(),
class: "TopologicalIsland".to_string(),
property: "TopologicalIsland.AngleRefTopologicalNode".to_string(),
message: "Missing required association.".to_string(),
severity: "sh:Violation".to_string(),
name: "TopologicalIsland.AngleRefTopologicalNode-cardinality".to_string(),
description: "This constraint validates the cardinality of the association at the used direction.".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_vs_converter_vs_converter_uv_required(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("VsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::VsConverter>() {
Some(o) => o, None => continue,
};
if obj.uv.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:VsConverter.uv-cardinality".to_string(),
class: "VsConverter".to_string(),
property: "VsConverter.uv".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "VsConverter.uv-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_vs_converter_vs_converter_delta_required(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("VsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::VsConverter>() {
Some(o) => o, None => continue,
};
if obj.delta.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:VsConverter.delta-cardinality".to_string(),
class: "VsConverter".to_string(),
property: "VsConverter.delta".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "VsConverter.delta-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_vs_converter_acdc_converter_udc_required(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("VsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::VsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.udc.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:ACDCConverter.udc-cardinality".to_string(),
class: "VsConverter".to_string(),
property: "ACDCConverter.udc".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "ACDCConverter.udc-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_vs_converter_acdc_converter_uc_required(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("VsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::VsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.uc.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:ACDCConverter.uc-cardinality".to_string(),
class: "VsConverter".to_string(),
property: "ACDCConverter.uc".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "ACDCConverter.uc-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_vs_converter_acdc_converter_idc_required(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("VsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::VsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.idc.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:ACDCConverter.idc-cardinality".to_string(),
class: "VsConverter".to_string(),
property: "ACDCConverter.idc".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "ACDCConverter.idc-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}
pub fn check_p61970_600_2_statevariables_ap_con_simple_shacl_vs_converter_acdc_converter_pole_loss_p_req_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("VsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::VsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.pole_loss_p.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "sv:ACDCConverter.poleLossP-cardinality".to_string(),
class: "VsConverter".to_string(),
property: "ACDCConverter.poleLossP".to_string(),
message: "Missing required property (attribute).".to_string(),
severity: "sh:Violation".to_string(),
name: "ACDCConverter.poleLossP-cardinality".to_string(),
description: "This constraint validates the cardinality of the property (attribute).".to_string(),
});
}
}
violations
}