@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix qudt: <http://qudt.org/schema/qudt/> .
@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#> .

qudt:ValidateQuantityHasUnitShape a owl:Class,
        sh:NodeShape ;
    rdfs:label "Validate Quantity has Unit Shape" ;
    dcterms:description """
  <p>Specifies and checks an optional property for a quantified value.
  </p>"""^^rdf:HTML ;
    rdfs:isDefinedBy <http://qudt.org/3.2.0/schema/datatype>,
        <http://qudt.org/3.2.0/schema/shacl/qudt> ;
    rdfs:subClassOf [ a owl:Restriction ;
            owl:maxCardinality 1 ;
            owl:onProperty qudt:quantity ],
        [ a owl:Restriction ;
            owl:maxCardinality 1 ;
            owl:onProperty qudt:hasUnit ] ;
    sh:property qudt:MaybeQuantityPropertyShape,
        qudt:MaybeUnitPropertyShape ;
    sh:severity sh:Warning ;
    sh:sparql [ sh:message "Quantity \"{$this}\" must have a unit." ;
            sh:prefixes <http://qudt.org/3.2.0/schema/shacl/datatype> ;
            sh:select """
        SELECT $this
        WHERE {
             $this qudt:quantity ?quantity .
             FILTER NOT EXISTS {?quantity qudt:hasUnit ?unit} 
             }
        """ ] ;
    sh:targetClass qudt:Array,
        qudt:List,
        qudt:Quantity,
        qudt:Vector .

