Demo4 Telemark 120 - statnett/Talk2PowerSystem GitHub Wiki
Competency questions that can be answered from [Dataset Telemark 120], in particular Classes Unique to Telemark-120.
Important note: we cannot answer any questions before this is resolved: Talk2PowerSystem#37 missing ontology terms used in Telemark-120.
Find product models with price
Find product models with unit price and return the name and price
Paraphrase:
Find product models with cost, return the name and cost
PREFIX cim: <https://cim.ucaiug.io/ns#>
select ?productName ?cost {
?product a cim:ProductAssetModel;
cim:IdentifiedObject.name ?productName;
cim:ProductAssetModel.AssetModelCatalogueItem/
cim:AssetModelCatalogueItem.unitCost ?cost
}
Get Assets and related PSRs
List all assets with name, optional description, criticality, lifecycle and in-use state, price, and the related PSRs (with name and description)
PREFIX cim: <https://cim.ucaiug.io/ns#>
select ?name ?descr ?critical ?lifecycleState ?inUseState ?price ?psrName ?psrDescr {
?asset a cim:Asset; cim:IdentifiedObject.name ?name;
optional {?asset cim:IdentifiedObject.description ?descr}
optional {?asset cim:Asset.critical ?critical}
optional {?asset cim:Asset.lifecycleState ?lifecycleState}
optional {?asset cim:Asset.inUseState ?inUseState}
optional {?asset cim:Asset.purchasePrice ?price}
optional {
?asset cim:Asset.PowerSystemResources ?psr; cim:IdentifiedObject.name ?psrName;
optional {?asset cim:IdentifiedObject.description ?psrDescr}
}
}
Find Remote units and Communication Links
Find Remote units and return name and description, and optionally type and Communication link (again with name and description)
PREFIX cim: <https://cim.ucaiug.io/ns#>
select ?remoteUnitName ?remoteUnitDescr ?remoteUnitType ?commLinkName ?commLinkDescr {
?remoteUnit a cim:RemoteUnit; cim:IdentifiedObject.name ?remoteUnitName
optional {?remoteUnit cim:IdentifiedObject.description ?remoteUnitDescr}
optional {?remoteUnit cim:RemoteUnit.remoteUnitType ?remoteUnitType}
optional {
?commLink cim:CommunicationLink.RemoteUnits ?remoteUnit;
cim:IdentifiedObject.name ?commLinkName
optional {?commLink cim:IdentifiedObject.description ?commLinkDescr}
}
}
Fnid Remote units with Remote source
Find remote sources with remote units. Return name and description, type, and sensor characteristics (deadband, scan details, minimum, maximum)
PREFIX cim: <https://cim.ucaiug.io/ns#>
select ?remoteSourceName ?remoteSourceDescr ?deadband ?scanInterval ?minimum ?maximum ?remoteUnitName ?remoteUnitDescr ?remoteUnitType {
?remoteSource a cim:RemoteSource; cim:IdentifiedObject.name ?remoteSourceName
optional {?remoteSource cim:IdentifiedObject.description ?remoteSourceDescr}
optional {?remoteSource cim:RemoteSource.deadband ?deadband}
optional {?remoteSource cim:RemoteSource.scanInterval ?scanInterval}
optional {?remoteSource cim:RemoteSource.sensorMinimum ?minimum}
optional {?remoteSource cim:RemoteSource.sensorMaximum ?maximum}
?remoteSource cim:RemotePoint.RemoteUnit ?remoteUnit.
?remoteUnit a cim:RemoteUnit; cim:IdentifiedObject.name ?remoteUnitName
optional {?remoteUnit cim:IdentifiedObject.description ?remoteUnitDescr}
optional {?remoteUnit cim:RemoteUnit.remoteUnitType ?remoteUnitType}
}
Find all reading types
Return all reading types, with name, description and exact match to EU reference data
prefix cim: <https://cim.ucaiug.io/ns#>
prefix skos: <http://www.w3.org/2004/02/skos/core#>
select ?type ?typeName ?typeDescr ?exactMatch {
?type a cim:ReadingType; cim:IdentifiedObject.name ?typeName
optional {?type cim:IdentifiedObject.description ?typeDescr}
optional {?type skos:exactMatch ?exactMatch}
}
Items with SKOS links to external data
Return all items that have a SKOS link to some external thesaurus/enumeration. Also return name and optional description
Paraphrase:
Find items that have a SKOS mapping relation. Also return name and optional description
prefix skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX cim: <https://cim.ucaiug.io/ns#>
select ?name ?descr ?prop ?relatedTo where {
values ?prop {skos:exactMatch skos:closeMatch skos:relatedMatch skos:broadMatch skos:narrowMatch}
?x ?prop ?relatedTo; cim:IdentifiedObject.name ?name.
optional {?x cim:IdentifiedObject.description ?descr}
}
Examples:
- "1.4.0" "EndDevice Data collection related AlarmFlag" skos:exactMatch http://energy.referencedata.eu/ReadingQualityType/1.4.0
- "0.0.2.1.1.1.12.0.0.0.0.0.0.0.0.3.72.0" "fifteenMinute bulkQuantity forward electricitySecondaryMetered energy (kWh)" skos:exactMatch http://data.europa.eu/energy/ReadingType/0.0.2.1.1.1.12.0.0.0.0.0.0.0.0.3.72.0
Histogram of diagram objects with style, and the respective PSR type
Tabulate a count of diagram object styles, and the direct types of the diagram object and the respective PSR that it depicts
Paraphrase
Count of diagram styles, and the respective diagram object and electrical object types
PREFIX sesame: <http://www.openrdf.org/schema/sesame#>
PREFIX cim: <https://cim.ucaiug.io/ns#>
select ?style ?diagType ?psrType (count(*) as ?c) {
?diag sesame:directType ?diagType; cim:DiagramObject.DiagramObjectStyle/cim:IdentifiedObject.name ?style.
optional {?diag cim:DiagramObject.IdentifiedObject/sesame:directType ?psrType}
} group by ?diagType ?style ?psrType order by ?diagType ?style
style | diagType | psrType | c |
---|---|---|---|
ACLineSegment | cim:DiagramObject | cim:ACLineSegment | 1 |
Breaker | cim:DiagramObject | cim:LoadBreakSwitch | 2 |
Bus | cim:DiagramObject | cim:ConnectivityNode | 7 |
Disconnector | cim:DiagramObject | cim:Breaker | 1 |
Impedance | cim:DiagramObject | cim:ACLineSegment | 2 |
Load | cim:DiagramObject | cim:EquivalentInjection | 1 |
NeighborSubstation | cim:DiagramObject | cim:Substation | 1 |
PinLink | cim:DiagramObject | cim:Terminal | 13 |
Transformer2W_10 | cim:DiagramObject | cim:PowerTransformer | 1 |
BusBarNameDisplay | cim:TextDiagramObject | 2 | |
DiagramLineName | cim:TextDiagramObject | 1 | |
DiagramObjectName | cim:TextDiagramObject | 15 | |
NodeNameDisplay | cim:TextDiagramObject | 7 |
It would be ok if it omits TextDiagramObject
because the question doesn't ask for "diagram or text diagram objects",
and because those have no respective PSRs.
Made of aluminum
What is made of aluminum?
Note: this depends on proper definition of these asset-related enum values,
and the "Key value" tool:
cim:CableShieldMaterialKind.aluminum, cim:WireMaterialKind.aluminum
.
Possible query where $aluminum
is bound to the two values above using autocomplete:
select ?mrid ?name ?descr ?prop {
values ?aluminum {cim:CableShieldMaterialKind.aluminum cim:WireMaterialKind.aluminum}
?x ?prop ?aluminum;
cim:IdentifiedObject.name ?name;
cim:IdentifiedObject.mRID ?mrid.
optional {?x cim:IdentifiedObject.description ?descr}
}
This would be a good answer (see urn:uuid:d25f35ca-69fb-4c06-905b-67ec532e5f14
):
In the cable model
PFXP_1x4x95_Al 1 kV
(PFXP underground cable with dimension 1x4x95 and aluminum conductor for low voltage grid), both the cable shield and wire are made of aluminum
Find UsagePoints
List all usage points, with their rated current, rated power, estimated load and AMI readiness
PREFIX cim: <https://cim.ucaiug.io/ns#>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX uom: <http://www.opengis.net/def/uom/OGC/1.0/>
SELECT * WHERE {
bind("POLYGON((9.781351089477539 60.718296868537124,9.816219806671143 59.94741379052206,12.15358257293701 59.92807630232278,12.245099544525145 60.7278039605813,9.781351089477539 60.718296868537124))"^^geo:wktLiteral as ?wkt) .
?psr2 geo:hasGeometry ?geo2 ;
cim:IdentifiedObject.name ?name2 .
?geo2 geo:asWKT ?wkt2 .
?geo2 geo:sfIntersects ?wkt .
}
PREFIX cim: <https://cim.ucaiug.io/ns#>
select * {
?usagePoint a cim:UsagePoint; cim:IdentifiedObject.name ?name;
optional {?usagePoint cim:IdentifiedObject.description ?descr}
?usagePoint cim:UsagePoint.ratedCurrent ?current;
cim:UsagePoint.ratedPower ?power;
cim:UsagePoint.estimatedLoad ?load;
cim:UsagePoint.amiBillingReady ?amiReady.
}
Equipment in a Voltage Level
What is in the VoltageLevel "NEDENES 04" "Secondary Substation LV"? List the complete hierarchy of containers and equipments with type, name and description
Query without reasoning:
PREFIX cim: <https://cim.ucaiug.io/ns#>
select ?type ?name ?descr {
?voltageLevel cim:IdentifiedObject.name "NEDENES 04".
?part (cim:Equipment.EquipmentContainer|cim:Bay.VoltageLevel)+ ?voltageLevel;
sesame:directType ?type; cim:IdentifiedObject.name ?name.
optional {?part cim:IdentifiedObject.description ?descr}
}
Query with reasoning and without unnecessary variables:
PREFIX cim: <https://cim.ucaiug.io/ns#>
select ?type ?name ?descr {
[] cim:IdentifiedObject.name "NEDENES 04"; cimr:hasPartTransitive ?part.
?part sesame:directType ?type; cim:IdentifiedObject.name ?name.
optional {?part cim:IdentifiedObject.description ?descr}
}
Obstacles to Aviation
List all obstacles to aviation, with name, description, lighting and marking kind, dimensions (length, width, height etc), WKT coordinates, location method
PREFIX cim: <https://cim.ucaiug.io/ns#>
PREFIX nc-no: <https://cim4.eu/ns/nc-no#>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
select ?name ?descr ?lighting ?marking ?length ?spanLength ?maxWidth ?height ?maxHeight ?coords ?wkt ?locationMethod {
?x cim:IdentifiedObject.name ?name;
nc-no:Guy.aviationObstacleLightingKind|nc-no:ACLineSegmentSpan.aviationObstacleLightingKind|nc-no:OverheadStructure.aviationObstacleLightingKind ?lighting;
nc-no:Guy.aviationObstacleMarkingKind|nc-no:ACLineSegmentSpan.aviationObstacleMarkingKind|nc-no:OverheadStructure.aviationObstacleMarkingKind ?marking;
geo:hasGeometry/geo:asWKT ?wkt.
optional {?x cim:IdentifiedObject.description ?descr}
optional {?x nc-no:Guy.length ?length}
optional {?x nc-no:OverheadStructure.height ?height}
optional {?x nc-no:Guy.maxHeight|nc-no:ACLineSegmentSpan.maxHeight|nc-no:OverheadStructure.maxHeight ?maxHeight}
optional {?x nc-no:Guy.maxWidth|nc-no:ACLineSegmentSpan.maxWidth ?maxWidth}
optional {?x nc-no:ACLineSegmentSpan.spanWireLength ?spanLength}
optional {?x nc-no:PowerSystemResource.locationMethod|nc-no:LocationResource.locationMethod ?locationMethod}
}
Note: this query is complex, reflecting modeling problems:
CIM4NoUtility#383 Obstacles to Aviation is not well modeled (need superclass AviationObstacle).
If not fixed in NC-NO, we should add superprops in cimr
.
Compute Substation Kinds
Is there some way to distinguish between large (TSO) and small (DSO) substations? There's no such CIM flag, so we have to do it by Base Voltage.
For all Substaions, compute a kind: HV if it has base voltages greater than 22kV, LV if it has voltages less than or equal to 22kV. Please mind that a substation may have both kinds, so return all applicable kinds as a space-separated string
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX cim: <https://cim.ucaiug.io/ns#>
PREFIX nc-no: <https://cim4.eu/ns/nc-no#>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
select ?sub ?name (group_concat(?kind) as ?kinds) {
{select distinct ?sub ?name ?kind {
?sub a cim:Substation; cim:IdentifiedObject.name ?name.
?voltageLevel cim:VoltageLevel.Substation ?sub; cim:VoltageLevel.BaseVoltage/cim:BaseVoltage.nominalVoltage ?voltage
bind(if(?voltage<=22,"LV","HV") as ?kind)
}}
} group by ?sub ?name order by ?name
In the Nordic44+Telemark120 dataset:
- 46 are HV
- 8 are LV
- Only 1 (urn:uuid:681a1e15-5a55-11eb-a658-74e5f963e191 "ENGENE") is both: "LV HV"
- It has voltages 0.23, 22, 132 and 135kV
Geospatial Queries
TODO:
- #145 Blog: Mapping Electrical Resources with GeoSPARQL: add the question here
- more geospatial queries
Geometries in RDF using WKT
Geometry of urn:uuid:f1769c68-9aeb-11e5-91da-b8763fd99c5f
<urn:uuid:f1769c68-9aeb-11e5-91da-b8763fd99c5f> a cim:ACLineSegment, geo:Feature ;
cim:IdentifiedObject.name "300OSLO-ASKER" ;
geo:hasGeometry urn:uuid:0ecda9c5-8ead-4a46-9c85-0ee083cff821 ;
.
<urn:uuid:0ecda9c5-8ead-4a46-9c85-0ee083cff821>
a cim:Location, geo:Geometry .
geo:asWKT "LINESTRING(10.5884369676798 59.9186412503614, 10.7850931467799 59.9405454311513)"^^geo:wktLiteral
- WKT Playground for decodeing and constructing WKT literals.
- GDB documentation on GeoSPARQL support
Query to see all objects with geometries in CIM
PREFIX sesame: <http://www.openrdf.org/schema/sesame#>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX cim: <https://cim.ucaiug.io/ns#>
select ?t (count(*) as ?c) {
?x sesame:directType ?t ; cim:IdentifiedObject.name ?name ; geo:hasGeometry []
filter(!sameTerm(?t,geo:Feature))
} group by ?t) for objects with geometry in CIM
Display with YASGui
- We use a opensource external SPARQL client for visualisations
- Works only with public repos
- for CIM, point to ` Query
Computations with GEO SPARQL
objects within 50 km of Sandefjord
Show them on the map using yasGUI
Objects within a given area
Notes:
- The area should be identified using autocomplete (Identify object tool).
We don't expect the LLM to find it by the precise name
"Sandefjord_business_and_industry_area"@en
as below. - Using YasGUI, how can we color the PSRs by type? If there are only Substations then color by Kind (see above)
- YasGUI [documentation](https://docs.triply.cc/yasgui/#geo-triplydb-plugin image.png )
NOTE that:
- GD supports two modes of geometrical computations ijn sparql - functions and magic predicates. The predicates emulate the existance of a relation between objects for which a function is true.
- functions use prefix
geof:
(<http://www.opengis.net/def/function/geosparql/>
) - magic predicates use
geo:
(<http://www.opengis.net/ont/geosparql#>
) - functions operate on WKT literals
- magic predicates operate on
geo:Geometry
nodes - it is however possible to use magic predicates wuth a WKT litteral stated in the SPAQRL quey (see example)
Using the function geof:sfIntersects
PREFIX cim: <https://cim.ucaiug.io/ns#>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT * WHERE {
bind(<urn:uuid:4e51e598-8948-4c85-b151-f44ffddc5545> as ?psr1) #Sandefjord_business_and_industry_area
?psr1 a geo:Feature ;
geo:hasGeometry ?loc1 .
?loc1 a geo:Geometry;
geo:asWKT ?wkt1 .
?psr2 a geo:Feature ;
geo:hasGeometry ?loc2 ;
cim:IdentifiedObject.name ?name2 .
?loc2 a geo:Geometry;
geo:asWKT ?wkt2 ;
filter(geof:sfIntersects(?wkt1,?wkt2))
}
using the magic predicate geo:sfIntersects
PREFIX cim: <https://cim.ucaiug.io/ns#>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT * WHERE {
bind(<urn:uuid:4e51e598-8948-4c85-b151-f44ffddc5545> as ?psr1) #Sandefjord_business_and_industry_area
?psr1 a geo:Feature ;
geo:hasGeometry ?loc1 .
?loc1 a geo:Geometry;
geo:asWKT ?wkt1 .
?psr2 a geo:Feature ;
geo:hasGeometry ?loc2 ;
cim:IdentifiedObject.name ?name2 .
?loc2 a geo:Geometry;
geo:asWKT ?wkt2 .
?loc1 geo:sfIntersects ?loc2 .
}
Same but stating a polygon directly in the query
PREFIX cim: <https://cim.ucaiug.io/ns#>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT * WHERE {
bind("POLYGON((9.781351089477539 60.718296868537124,9.816219806671143 59.94741379052206,12.15358257293701 59.92807630232278,12.245099544525145 60.7278039605813,9.781351089477539 60.718296868537124))"^^geo:wktLiteral as ?wkt) .
?psr2 geo:hasGeometry ?geo2 ;
cim:IdentifiedObject.name ?name2 .
?geo2 geo:asWKT ?wkt2 .
filter(geof:sfIntersects(?wkt,?wkt2))
}
using the predicate geo:sfIntersects
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX cim: <https://cim.ucaiug.io/ns#>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX uom: <http://www.opengis.net/def/uom/OGC/1.0/>
SELECT * WHERE {
bind("POLYGON((9.781351089477539 60.718296868537124,9.816219806671143 59.94741379052206,12.15358257293701 59.92807630232278,12.245099544525145 60.7278039605813,9.781351089477539 60.718296868537124))"^^geo:wktLiteral as ?wkt) .
?psr2 geo:hasGeometry ?geo2 ;
cim:IdentifiedObject.name ?name2 .
?geo2 geo:asWKT ?wkt2 .
?geo2 geo:sfIntersects ?wkt .
}