Visual Graph - statnett/Talk2PowerSystem GitHub Wiki
Visual Graphs in GraphDB
Visual Graph are a straightforward way to explore and inspect particular sub-graphs of a given Knowledge Graph. They are constructed via a dedicated page in the GraphDB workbench by expressing a series of SPARQL queries, declaring
- Starting point: the initial state of the graph
- Graph expansion:
CONSTRUCT
query expressing how the graph is to be expanded - Node and edge basics and extras: what labels to show in the nodes and relations
Refer to the documentation for a full walkthrough
The CONSTRUCT query in the graph expansion can contain arbitraty logic and express triples, that are not present in the data. This leads to visual graphs which may differ from the original data.
This is very useful for the purpose of illustration and simplification and is used here.
In Both examples below, the ^cim:Terminal.ConnectivityNode/cim:Terminal.ConnectivityNode
property path
between various equipment nodes and cim:ConnectivityNode
,
is shortened as cimr:connectedTo
, effectively omitting cim:Terminal
nodes from the visual graph.
For CIM RDF this is the node basics query
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX cim: <https://cim.ucaiug.io/ns#>
PREFIX sesame: <http://www.openrdf.org/schema/sesame#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
select * {
?node sesame:directType ?type . ?type rdfs:label ?type_label
optional {?node cim:IdentifiedObject.name ?name.
bind(concat(?type_label,"\n",?name) as ?label)
}
optional {?node cim:IdentifiedObject.description ?comment}
filter(!sameterm(?type,owl:Thing))
}
Note the difference between advanced graph configurations and saved graphs:
- advanced graph configurations are sets of queries determining how a graph is constructed They are dependent on a fixed or user provided input and are laid out automatically by a layout algorithm.
- saved graphs are visualizations which once generated are graphically laid out by hand.
Nordic44 visual graphs
Currently several configurations and associated saved graphs, based on Nordic44, are visible on cim.ontotext.com.
Voltage Level Diagram
The Voltage Level Diagram
visual graph configuration
displays the equipment and connections within a particular voltage level.
The expansion is based on the following CONSTRUCT query,
where ?node
is bound to a node of type cim:VoltageLevel
PREFIX cim: <https://cim.ucaiug.io/ns#>
PREFIX cimr: <https://cim.ucaiug.io/rules#>
construct {
?cn cimr:connectedTo ?eq .
}
where {
?node a cim:VoltageLevel .
?cn cim:ConnectivityNode.ConnectivityNodeContainer ?node .
?t cim:Terminal.ConnectivityNode ?cn ;
cim:Terminal.ConductingEquipment ?eq .
}
Most intersting are those voltage levels which have two cim:BusbarSection
elements, such as
KRISTIAN 300 and
ARENDAL 300
The KRISTIAN 300 saved graph shows the equipment in the KRISTIAN 300 voltage level and corresponds to the following connectivity diagram:
Lines and Voltage Levels
The Lines and Voltage Level saved graph shows connectivity on the macro level.
It represents how different voltage levels are connected through AC lines.
The graph is constructed using the following CONSTRUCT
query:
PREFIX cim: <https://cim.ucaiug.io/ns#>
PREFIX cimr: <https://cim.ucaiug.io/rules#>
construct {
?line cimr:connectedTo ?vl.
} where {
?line a cim:ACLineSegment ;
cim:IdentifiedObject.name ?name ;
^cim:Terminal.ConductingEquipment/cim:Terminal.ConnectivityNode ?cn .
?cn cim:ConnectivityNode.ConnectivityNodeContainer ?vl
}
Note how the diagram has two unconnected components, corresponding to the 300kV and 420kV voltage levels.