Ontology Version: 2.2.0

cacontology-registry:RegistrationDateValidationShape leaf node


URI

https://cacontology.projectvic.org/sex-offender-registry#RegistrationDateValidationShape

Label

Registration Date Validation Shape

Description

Validates that registration dates are logical and consistent.

Shape Properties

Instances of cacontology-registry:RegistrationRecord can have the following properties:

PROPERTY

MIN COUNT

MAX COUNT

TYPE

cacontology-registry:RegistrationRecord
cacontology-registry:expirationDate 0 1 xsd:date
cacontology-registry:lifetimeRegistration 1 1 xsd:boolean
cacontology-registry:registrationDate 1 1 xsd:date
cacontology-registry:registrationNumber 1 1 xsd:string
cacontology-registry:tier 1 1 xsd:integer

Implementation

@prefix cacontology-registry: <https://cacontology.projectvic.org/sex-offender-registry#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
cacontology-registry:RegistrationDateValidationShape a sh:NodeShape ;
    rdfs:label "Registration Date Validation Shape"@en ;
    rdfs:comment "Validates that registration dates are logical and consistent."@en ;
    sh:sparql [ sh:message "Registration date must be after conviction date."@en ;
            sh:select """
            SELECT $this
            WHERE {
                $this a cacontology-registry:RegistrationRecord ;
                      cacontology-registry:registrationDate ?regDate ;
                      cacontology-registry:basedOnOffense ?offense .
                ?offense cacontology-registry:convictionDate ?convDate .
                FILTER (?regDate < ?convDate)
            }
        """ ],
        [ sh:message "Expiration date must be after registration date when specified."@en ;
            sh:select """
            SELECT $this
            WHERE {
                $this cacontology-registry:registrationDate ?regDate ;
                      cacontology-registry:expirationDate ?expDate .
                FILTER (?expDate <= ?regDate)
            }
        """ ] ;
    sh:targetClass cacontology-registry:RegistrationRecord .