How to output multiple types in Sparql? With minimal system load

74 Views Asked by At

Using this code, the system takes a long time to boot. With three types, the processing was 23 minutes. How to simplify it? So that the system can process the request faster.

PREFIX cim: <http://iec.ch/TC57/2014/CIM-schema-cim16#>

SELECT ?type (COUNT(?type) AS ?num)
WHERE {
    ?terminal_2 rdf:type cim:Terminal.
    ?terminal_2 cim:Terminal.ConductingEquipment ?conducting_equipment_2.
    ?conducting_equipment_2 rdf:type ?type.
    FILTER (?conducting_equipment_1 = ?conducting_equipment_2).
    MINUS {?terminal_2 cim:Terminal.ConnectivityNode ?not_connectivityNode_2}.
    VALUES ?type {cim:ACLineSegment cim:Breaker cim:Disconnector cim:Fuse cim:Jumper cim:LoadBreakSwitch cim:Recloser}.
        {
        SELECT ?conducting_equipment_1
        WHERE {
        ?terminal_1 rdf:type cim:Terminal.
        ?terminal_1 cim:Terminal.ConductingEquipment ?conducting_equipment_1.
        MINUS {?terminal_1 cim:Terminal.ConnectivityNode ?not_connectivityNode_1}.
        }              
    }
}
GROUP BY ?type

result

This is the table I want to end up with. Only with more types.

0

There are 0 best solutions below