-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #607 from ucoProject/Feature-Issue-602-NewDictiona…
…ries Issue 602: Add review mechanisms for key-uniqueness in types:Dictionary
- Loading branch information
Showing
8 changed files
with
588 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
{ | ||
"@context": { | ||
"kb": "http://example.org/kb/", | ||
"rdfs": "http://www.w3.org/2000/01/rdf-schema#", | ||
"types": "https://ontology.unifiedcyberontology.org/uco/types/" | ||
}, | ||
"@graph": [ | ||
{ | ||
"@id": "kb:Dictionary-3bb38b3e-d47a-43c8-8a77-afc0e6655ce1", | ||
"@type": "types:Dictionary", | ||
"types:entry": [ | ||
{ | ||
"@id": "kb:DictionaryEntry-b8a01d49-53c1-440f-a2d5-618b58801d37", | ||
"@type": "types:DictionaryEntry", | ||
"types:key": "x", | ||
"types:value": "1" | ||
}, | ||
{ | ||
"@id": "kb:DictionaryEntry-6cac6c2c-5d4e-45f5-b784-c029c9f9fb6d", | ||
"@type": "types:DictionaryEntry", | ||
"types:key": "y", | ||
"types:value": "2" | ||
} | ||
] | ||
}, | ||
{ | ||
"@id": "kb:ProperDictionary-eaded28e-0bf8-4df1-aee8-84d22c09702c", | ||
"@type": "types:ProperDictionary", | ||
"types:entry": [ | ||
{ | ||
"@id": "kb:DictionaryEntry-314212eb-39c4-4bf3-be3a-f07c38f0eae8", | ||
"@type": "types:DictionaryEntry", | ||
"types:key": "x", | ||
"types:value": "1" | ||
}, | ||
{ | ||
"@id": "kb:DictionaryEntry-9ec24a1a-7e99-41c9-ba7d-9d23f11babb4", | ||
"@type": "types:DictionaryEntry", | ||
"types:key": "y", | ||
"types:value": "2" | ||
} | ||
] | ||
}, | ||
{ | ||
"@id": "kb:ImproperDictionary-a8e5e8e1-b3de-4ac4-99dd-e36f96beea4d", | ||
"@type": "types:ImproperDictionary", | ||
"types:repeatsKey": "x", | ||
"types:entry": [ | ||
{ | ||
"@id": "kb:DictionaryEntry-55786f64-534d-4e8c-8a64-616f708ea4d3", | ||
"@type": "types:DictionaryEntry", | ||
"types:key": "x", | ||
"types:value": "1" | ||
}, | ||
{ | ||
"@id": "kb:DictionaryEntry-d1a83c3d-cbe6-40b0-bb26-3527c47a01d8", | ||
"@type": "types:DictionaryEntry", | ||
"types:key": "x", | ||
"types:value": "2" | ||
} | ||
] | ||
}, | ||
{ | ||
"@id": "kb:Dictionary-e9adf6c1-0287-4290-95a9-c94a128d7ff6", | ||
"@type": "types:Dictionary", | ||
"rdfs:comment": "This dictionary, not being typed as a ProperDictionary, will not trigger a warning from having two entries keyed with value 'x'.", | ||
"types:entry": [ | ||
{ | ||
"@id": "kb:DictionaryEntry-20431f00-64a3-4c0f-94a4-1eb09f8a6b6a", | ||
"@type": "types:DictionaryEntry", | ||
"types:key": "x", | ||
"types:value": "1" | ||
}, | ||
{ | ||
"@id": "kb:DictionaryEntry-f187ee7f-12fb-4580-966d-47bf1afd4975", | ||
"@type": "types:DictionaryEntry", | ||
"types:key": "x", | ||
"types:value": "1" | ||
} | ||
] | ||
}, | ||
{ | ||
"@id": "kb:ImproperDictionary-7fa3ea45-6426-4ad3-bb5f-7559e07adeb4", | ||
"@type": "types:ImproperDictionary", | ||
"repeatsKey": "z" | ||
}, | ||
{ | ||
"@id": "kb:ImproperDictionary-14e28425-00c1-4f11-b2ed-21390fc0749a", | ||
"@type": "types:ImproperDictionary", | ||
"types:entry": [ | ||
{ | ||
"@id": "kb:DictionaryEntry-09f23642-389b-4553-b5be-283a6160f534", | ||
"@type": "types:DictionaryEntry", | ||
"types:key": "x", | ||
"types:value": "1" | ||
}, | ||
{ | ||
"@id": "kb:DictionaryEntry-7a84a0d6-d1cd-4291-afb4-c834d611898d", | ||
"@type": "types:DictionaryEntry", | ||
"types:key": "x", | ||
"types:value": "2" | ||
} | ||
] | ||
}, | ||
{ | ||
"@id": "kb:ImproperDictionary-cbc1c80d-1bad-4947-8459-c53ff61e8bfa", | ||
"@type": "types:ImproperDictionary", | ||
"rdfs:comment": "This improper dictionary has no repeated key or assertion of a repeated key. This should not trigger a data error, because the information in the graph could merely be incomplete.", | ||
"types:entry": [ | ||
{ | ||
"@id": "kb:DictionaryEntry-ca1910ab-fa26-402a-86bb-229f490dd89a", | ||
"@type": "types:DictionaryEntry", | ||
"types:key": "x", | ||
"types:value": "1" | ||
}, | ||
{ | ||
"@id": "kb:DictionaryEntry-2a13e674-5e95-4a7a-9fac-c90417dcd97c", | ||
"@type": "types:DictionaryEntry", | ||
"types:key": "y", | ||
"types:value": "2" | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
@prefix owl: <http://www.w3.org/2002/07/owl#> . | ||
@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 types: <https://ontology.unifiedcyberontology.org/uco/types/> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
|
||
[] | ||
a sh:ValidationReport ; | ||
sh:conforms "true"^^xsd:boolean ; | ||
sh:result [ | ||
a sh:ValidationResult ; | ||
sh:focusNode <http://example.org/kb/Dictionary-e9adf6c1-0287-4290-95a9-c94a128d7ff6> ; | ||
sh:resultMessage "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." ; | ||
sh:resultSeverity sh:Warning ; | ||
sh:sourceConstraint [ | ||
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:sourceConstraintComponent sh:SPARQLConstraintComponent ; | ||
sh:sourceShape types:Dictionary-keyUniqueness-shape ; | ||
sh:value "x" ; | ||
] ; | ||
. | ||
|
Oops, something went wrong.