types:Dictionary-keyUniqueness-shape leaf node


URI

https://ontology.unifiedcyberontology.org/uco/types/Dictionary-keyUniqueness-shape

Label

Dictionary-keyUniqueness-shape

Target Classes (1)

Shape Properties

Instances of types:Dictionary can have the following properties:

PROPERTY

MIN COUNT

MAX COUNT

TYPE

types:Dictionary
types:entry types:DictionaryEntry

Implementation

@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix types: <https://ontology.unifiedcyberontology.org/uco/types/> .

types:Dictionary-keyUniqueness-shape a sh:NodeShape ;
    sh:description "This shape is separated from the types:Dictionary class-shape in order to associate a warning-severity SPARQL-based shape."@en ;
    sh:severity sh:Warning ;
    sh:sparql [ a sh:SPARQLConstraint ;
            sh:message "A key in a dictionary should appear no more than once.  The value literal does.  Please consider using the types:ImproperDictionary class and types:repeatsKey property."@en ;
            sh:select """
			PREFIX types: <https://ontology.unifiedcyberontology.org/uco/types/>
			SELECT $this ?value
			WHERE {
				$this
					types:entry/types:key ?value ;
					.
				FILTER NOT EXISTS {
					$this
						a types:ImproperDictionary ;
						.
				}
				FILTER NOT EXISTS {
					$this
						a types:ProperDictionary ;
						.
				}
			}
			GROUP BY ?value
			HAVING (COUNT(?value) > 1)
			""" ] ;
    sh:targetClass types:Dictionary .