-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: autoformat sparql through pre-commit
- Loading branch information
Showing
55 changed files
with
1,142 additions
and
1,112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ pip-log.txt | |
nosetests.xml | ||
coverage.xml | ||
htmlcov | ||
**/pytest.log | ||
|
||
# Translations | ||
*.mo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[format] | ||
where_new_line = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
# Name: Add MRID | ||
PREFIX cim: <${cim}> | ||
insert {graph ${g} {?s cim:IdentifiedObject.mRID ?mrid}} | ||
where { | ||
graph ${g} {?s a ${rdf_type}} | ||
filter (not exists {?s cim:IdentifiedObject.mRID ?mrid}) | ||
bind(str(?s) as ?mrid) | ||
INSERT {GRAPH ${g} {?s cim:IdentifiedObject.mRID ?mrid} .} | ||
WHERE { | ||
GRAPH ${g} { ?s a $ {rdf_type}} | ||
FILTER NOT EXISTS { | ||
?s cim:IdentifiedObject.mRID ?mrid . | ||
} | ||
BIND (STR(?s) AS ?mrid) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
# Name: Associated switches | ||
PREFIX cim: <${cim}> | ||
|
||
select (SAMPLE(?equipment_mrid) as ?mrid) (SAMPLE(?name) as ?name) (GROUP_CONCAT(?switch_mrid; SEPARATOR=',') as ?switch_mrids) (GROUP_CONCAT(?switch_name; SEPARATOR=',') as ?switch_names) where { | ||
{ | ||
?equipment ^cim:Terminal.ConductingEquipment/cim:Terminal.ConnectivityNode/^cim:Terminal.ConnectivityNode/cim:Terminal.ConductingEquipment ?switch; | ||
cim:IdentifiedObject.name ?name ; | ||
cim:IdentifiedObject.mRID ?equipment_mrid . | ||
?switch cim:Switch.normalOpen ?_normalOpen; | ||
cim:IdentifiedObject.mRID ?switch_mrid ; | ||
cim:IdentifiedObject.name ?switch_name ; | ||
# Only included switches that has a "second" terminal. There are switches | ||
# that only have one terminal. These switches can not connect/disconnect anything | ||
^cim:Terminal.ConductingEquipment/cim:ACDCTerminal.sequenceNumber 2 . | ||
} minus { | ||
?equipment cim:Switch.normalOpen ?_open | ||
} | ||
|
||
} group by ?equipment | ||
SELECT (SAMPLE(?equipment_mrid) AS ?mrid) (SAMPLE(?name) AS ?name) (GROUP_CONCAT(?switch_mrid;SEPARATOR=',') AS ?switch_mrids) (GROUP_CONCAT(?switch_name;SEPARATOR=',') AS ?switch_names) | ||
WHERE { | ||
{ | ||
?equipment ^cim:Terminal.ConductingEquipment/cim:Terminal.ConnectivityNode/^cim:Terminal.ConnectivityNode/cim:Terminal.ConductingEquipment ?switch ; | ||
cim:IdentifiedObject.name ?name ; | ||
cim:IdentifiedObject.mRID ?equipment_mrid . | ||
?switch cim:Switch.normalOpen ?_normalOpen ; | ||
cim:IdentifiedObject.mRID ?switch_mrid ; | ||
cim:IdentifiedObject.name ?switch_name ; | ||
# Only included switches that has a "second" terminal. | ||
There are switches | ||
# that only have one terminal. | ||
These switches can not connect/disconnect anything ^cim:Terminal.ConductingEquipment/cim:ACDCTerminal.sequenceNumber 2 . | ||
} | ||
MINUS { | ||
?equipment cim:Switch.normalOpen ?_open . | ||
} | ||
} | ||
GROUP BY ?equipment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
# Name: Base voltage | ||
PREFIX cim: <${cim}> | ||
PREFIX xsd: <${xsd}> | ||
|
||
select ?mrid ?un ?operating_voltage { | ||
{ | ||
select ?base_voltage (avg(xsd:double(str(?voltage))) as ?operating_voltage) { | ||
?top_node ^cim:SvVoltage.TopologicalNode/cim:SvVoltage.v ?voltage; | ||
cim:TopologicalNode.BaseVoltage ?base_voltage . | ||
filter(xsd:double(str(?voltage)) > 0.0) | ||
} group by ?base_voltage | ||
SELECT ?mrid ?un ?operating_voltage | ||
WHERE { | ||
{ | ||
SELECT ?base_voltage (AVG(xsd:double(STR(?voltage))) AS ?operating_voltage) | ||
WHERE { | ||
?top_node ^cim:SvVoltage.TopologicalNode/cim:SvVoltage.v ?voltage ; | ||
cim:TopologicalNode.BaseVoltage ?base_voltage . | ||
FILTER (xsd:double(STR(?voltage)) > 0.0) | ||
} | ||
|
||
?_eq_subject <http://entsoe.eu/CIM/EquipmentCore/3/1> ?eq_repo . | ||
service ?eq_repo { | ||
# Find the nominal voltage from the base voltage associated with the topological node | ||
?base_voltage cim:BaseVoltage.nominalVoltage ?un ; | ||
cim:IdentifiedObject.mRID ?mrid | ||
} | ||
GROUP BY ?base_voltage | ||
} | ||
?_eq_subject <http://entsoe.eu/CIM/EquipmentCore/3/1> ?eq_repo . | ||
SERVICE ?eq_repo { | ||
# Find the nominal voltage from the base voltage associated with the topological node | ||
?base_voltage cim:BaseVoltage.nominalVoltage ?un ; | ||
cim:IdentifiedObject.mRID ?mrid . | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
# Name: Borders | ||
PREFIX cim:<${cim}> | ||
PREFIX SN:<${SN}> | ||
select ?mrid ?name ?market_code ?area_1 ?area_2 ?t_mrid_1 ?t_mrid_2 | ||
where { | ||
PREFIX cim: <${cim}> | ||
PREFIX SN: <${SN}> | ||
SELECT ?mrid ?name ?market_code ?area_1 ?area_2 ?t_mrid_1 ?t_mrid_2 | ||
WHERE { | ||
# Extract mRID, name and optionally market_code for aclines | ||
?acline a cim:ACLineSegment; | ||
cim:IdentifiedObject.mRID ?mrid; | ||
cim:IdentifiedObject.name ?name. | ||
optional {?acline cim:Equipment.EquipmentContainer/SN:Line.marketCode ?market_code} . | ||
optional {?acline SN:Equipment.networkAnalysisEnable ?_analysis_enabled .} | ||
|
||
?acline a cim:ACLineSegment ; | ||
cim:IdentifiedObject.mRID ?mrid ; | ||
cim:IdentifiedObject.name ?name . | ||
OPTIONAL { | ||
?acline cim:Equipment.EquipmentContainer/SN:Line.marketCode ?market_code . | ||
} | ||
OPTIONAL { | ||
?acline SN:Equipment.networkAnalysisEnable ?_analysis_enabled . | ||
} | ||
# Extract properties for the terminal connected to one end of the acline (sequenceNumber 1) | ||
?terminal1 a cim:Terminal; | ||
cim:Terminal.ConductingEquipment ?acline; | ||
cim:Terminal.sequenceNumber|cim:ACDCTerminal.sequenceNumber 1; | ||
cim:Terminal.ConnectivityNode/cim:ConnectivityNode.ConnectivityNodeContainer/cim:VoltageLevel.Substation/cim:Substation.Region/cim:SubGeographicalRegion.Region/cim:IdentifiedObject.name ?area_1; | ||
cim:IdentifiedObject.mRID ?t_mrid_1 . | ||
|
||
?terminal1 a cim:Terminal ; | ||
cim:Terminal.ConductingEquipment ?acline ; | ||
cim:Terminal.sequenceNumber | cim:ACDCTerminal.sequenceNumber 1 ; | ||
cim:Terminal.ConnectivityNode/cim:ConnectivityNode.ConnectivityNodeContainer/cim:VoltageLevel.Substation/cim:Substation.Region/cim:SubGeographicalRegion.Region/cim:IdentifiedObject.name ?area_1 ; | ||
cim:IdentifiedObject.mRID ?t_mrid_1 . | ||
# Extract properties for the terminal connected to the other end of the acline (sequenceNumber 2) | ||
?terminal2 a cim:Terminal; | ||
cim:Terminal.ConductingEquipment ?acline; | ||
cim:Terminal.sequenceNumber|cim:ACDCTerminal.sequenceNumber 2; | ||
cim:Terminal.ConnectivityNode/cim:ConnectivityNode.ConnectivityNodeContainer/cim:VoltageLevel.Substation/cim:Substation.Region/cim:SubGeographicalRegion.Region/cim:IdentifiedObject.name ?area_2 ; | ||
cim:IdentifiedObject.mRID ?t_mrid_2 . | ||
|
||
filter (?area_1 != ?area_2) | ||
filter (regex(?area_1, '${region}') || regex(?area_2, '${region}')) | ||
filter (!regex(?name, 'HVDC')) # Ignore HVDC | ||
bind(coalesce(?_analysis_enabled, True) as ?analysis_enabled) | ||
filter(?analysis_enabled) | ||
?terminal2 a cim:Terminal ; | ||
cim:Terminal.ConductingEquipment ?acline ; | ||
cim:Terminal.sequenceNumber | cim:ACDCTerminal.sequenceNumber 2 ; | ||
cim:Terminal.ConnectivityNode/cim:ConnectivityNode.ConnectivityNodeContainer/cim:VoltageLevel.Substation/cim:Substation.Region/cim:SubGeographicalRegion.Region/cim:IdentifiedObject.name ?area_2 ; | ||
cim:IdentifiedObject.mRID ?t_mrid_2 . | ||
FILTER (?area_1 != ?area_2) | ||
FILTER (REGEX(?area_1,'${region}') || REGEX(?area_2,'${region}')) | ||
FILTER (!regex(?name, 'HVDC')) | ||
BIND (COALESCE(?_analysis_enabled, true) AS ?analysis_enabled) | ||
# Ignore HVDC | ||
FILTER (?analysis_enabled = true) | ||
} |
Oops, something went wrong.