Skip to content

SHACL: Avoid Fake Target Nodes #59

@VladimirAlexiev

Description

@VladimirAlexiev

https://github.com/Sveino/Inst4CIM-KG/tree/develop/shacl-improved#avoid-fake-target-nodes
Some rules are triggered by sh:targetNode, where the node is fake (i.e. used only to attach the shape to it, and does not exist in real data).
Such rules:

  • may fail to fire if the node doesn't exist in the Data Graph (the node being mentioned in the Shape Graph doesn't count)
  • do not support incremental validation
  • they cannot "blame" the real node that causes the violation

@griddigit-ci

this is used in 6 place in all CGMES v3 constraints and eventually these will be cleaned but we need a go-approval for another version.

I find 5 problems:

grep targetNode */CurrentRelease/SHACL/*

# problems
CGMES/CurrentRelease/SHACL/61970-301_DiagramLayout-AP-Con-Complex-SHACL.ttl:      
  sh:targetNode  cim:TextDiagramObjectDiagramObject .
CGMES/CurrentRelease/SHACL/61970-456_SteadyStateHypothesis-AP-Con-Complex-NotSolvedMAS-SHACL.ttl:      
  sh:targetNode   cim:AllGeneratingUnit.
CGMES/CurrentRelease/SHACL/61970-600-1_AllProfiles-AP-Con-Complex-SHACL.ttl:     
  sh:targetNode   cim:IDuniqueness.
CGMES/CurrentRelease/SHACL/61970-600-1_AllProfiles-AP-Con-Complex-SHACL.ttl:     
  sh:targetNode   cim:IDchecks.
CGMES/CurrentRelease/SHACL/61970-600-1_AllProfiles-AP-Con-Complex-SHACL.ttl:     
  sh:targetNode   cim:FloatSpecialValues .
CGMES/CurrentRelease/SHACL/61970-600-2_Equipment-AP-Con-Complex-SHACL.ttl:    
  sh:targetNode  cim:SubstationCount.
NCP/CurrentRelease/SHACL/EquipmentReliability-AP-Con-Simple-SHACL.ttl:   
  sh:targetNode  cc:ClassCount .

Other:

  • This is fine, it triggers off a class.
CGMES/CurrentRelease/SHACL/61970-600-2_Equipment-AP-Con-Complex-SHACL.ttl:     
  sh:targetNode cim:GeographicalRegion .
  • This is fine, it triggers off a class.
    • But I suggest to rename sv456:TopologicalIslandCountShape to sv456:TopologicalIslandExistenceShape
CGMES/CurrentRelease/SHACL/61970-456_StateVariables-AP-Con-Complex-SHACL.ttl:     
  sh:targetNode cim:TopologicalIsland .
CGMES/CurrentRelease/SHACL/61970-456_AllProfiles-AP-Con-Complex-SolvedMAS-SHACL.ttl:      
  sh:targetNode  cim:AngleReference  .
CGMES/CurrentRelease/SHACL/61970-600-1_AllProfiles-AP-Con-Complex-SHACL.ttl:      
  sh:or           (sh:targetNode  md:FullModel  sh:targetNode  dm:DifferenceModel). # see next issue
  • commented out
CGMES/CurrentRelease/SHACL/61970-453_DiagramLayout-AP-Con-Complex-Explicit-CrossProfile-SHACL.ttl:        #sh:targetNode  cim:DiagramObjectIdentifiedObject  . 

@griddigit-ci

They work, but we know that this is not good and maybe SHACL implementation library specific; initial advice to use that came from semantic people working on W3C SHACL spec. We are changing, it is no longer used in the NC profiles current versions.

They should not work unless the validator mixes up the Shapes graph and the Data graph.

  • Triggering off existing CIM classes is ok (see 2 examples above)
  • Triggering off fake nodes that occur only in Shapes is not ok

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions