Ontology Version: 3.1.0

cacontology-synthesis-shapes:DistributionObservationShape leaf node


URI

https://cacontology.projectvic.org/synthesis/shapes#DistributionObservationShape

Label

Distribution Observation Shape

Node Constraints

sh:or ( sh:property [sh:datatype xsd:integer, sh:minCount 1, sh:minInclusive 0, sh:path cacontology-synthesis:count, sh:severity sh:Violation] | sh:property [sh:datatype xsd:integer, sh:minCount 1, sh:minInclusive 1, sh:path cacontology-synthesis:rank, sh:severity sh:Violation] )

Property Constraints (1)

Focus nodes of this shape (cacontology-synthesis:DistributionObservation) can have the following properties:

PROPERTY DESCRIPTION MIN MAX VALUE TYPE OTHER CONSTRAINTS
cacontology-synthesis:category Links a distribution observation to its category (type/operation/objective/locus).
sh:message DistributionObservation must have a category (IRI).
1 * sh:IRI
sh:severity sh:Violation

Implementation

@prefix cacontology-synthesis: <https://cacontology.projectvic.org/synthesis#> .
@prefix cacontology-synthesis-shapes: <https://cacontology.projectvic.org/synthesis/shapes#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
cacontology-synthesis-shapes:DistributionObservationShape a sh:NodeShape ;
    rdfs:label "Distribution Observation Shape"@en ;
    sh:or ( [ sh:property [ sh:datatype xsd:integer ;
                        sh:message "If using count, count must be an integer >= 0."@en ;
                        sh:minCount 1 ;
                        sh:minInclusive 0 ;
                        sh:path cacontology-synthesis:count ;
                        sh:severity sh:Violation ] ] [ sh:property [ sh:datatype xsd:integer ;
                        sh:message "If using rank, rank must be an integer >= 1."@en ;
                        sh:minCount 1 ;
                        sh:minInclusive 1 ;
                        sh:path cacontology-synthesis:rank ;
                        sh:severity sh:Violation ] ] ) ;
    sh:property [ sh:message "DistributionObservation must have a category (IRI)."@en ;
            sh:minCount 1 ;
            sh:nodeKind sh:IRI ;
            sh:path cacontology-synthesis:category ;
            sh:severity sh:Violation ] ;
    sh:sparql [ sh:message "denominator should only be present when count is present."@en ;
            sh:select """
          SELECT $this
          WHERE {
            $this cacontology-synthesis:denominator ?d .
            FILTER NOT EXISTS { $this cacontology-synthesis:count ?c . }
          }
        """ ;
            sh:severity sh:Warning ],
        [ sh:message "When denominator is present, it must be >= count."@en ;
            sh:select """
          SELECT $this
          WHERE {
            $this cacontology-synthesis:count ?c ;
                  cacontology-synthesis:denominator ?d .
            FILTER (?d < ?c)
          }
        """ ;
            sh:severity sh:Warning ] ;
    sh:targetClass cacontology-synthesis:DistributionObservation .