Skip to content

Commit

Permalink
Adopt, and adapt for, CASE 1.0.0
Browse files Browse the repository at this point in the history
One potential bug has been flagged with this shape, implemented in UCO
Issue 406:
`uco-owl:ObjectProperty-shacl-constraints-shape`

The `sh:PropertyShape` raising the bug has been given an IRI in order to
link a deactivation rationale.

A new shapes file `debug.ttl` has been added to disable that shape until
a test is written to confirm the CASE-Corpora shape is correct.

`Facet`s that were blank nodes have been given IRIs, per the
implementation of UCO Issue 430.  New `sh:Info`-severity violations are
reported for some URLs treated in the "URL as an `rdfs:Resource` manner,
which will not be given UUID endings.  `case_validate` is called with
`--allow-warnings`, but is intended to be called with `--alow-infos`;
that will have to wait for `case-utils` Issue 70 to resolve.

Imports of CASE and UCO ontologies now use their `owl:versionIRI`s,
implemented in UCO Issue 437.

A follow-on patch will regenerate Make-managed files.

References:
* casework/CASE-Utilities-Python#70
* ucoProject/UCO#406
* ucoProject/UCO#430
* ucoProject/UCO#437

Signed-off-by: Alex Nelson <alexander.nelson@nist.gov>
  • Loading branch information
ajnelson-nist committed Sep 2, 2022
1 parent 70e933e commit 325d464
Show file tree
Hide file tree
Showing 13 changed files with 124 additions and 66 deletions.
2 changes: 2 additions & 0 deletions catalog/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ validate-catalog.ttl: \
$(top_srcdir)/shapes/dcat.ttl \
$(top_srcdir)/shapes/dcat-us.ttl \
$(top_srcdir)/shapes/dct.ttl \
$(top_srcdir)/shapes/debug.ttl \
.catalog-example-dataset.ttl \
catalog.ttl
rm -f _$@
Expand All @@ -55,6 +56,7 @@ validate-catalog.ttl: \
--ontology-graph $(top_srcdir)/shapes/dcat.ttl \
--ontology-graph $(top_srcdir)/shapes/dcat-us.ttl \
--ontology-graph $(top_srcdir)/shapes/dct.ttl \
--ontology-graph $(top_srcdir)/shapes/debug.ttl \
--output _$@ \
catalog.ttl \
.catalog-example-dataset.ttl \
Expand Down
4 changes: 2 additions & 2 deletions catalog/catalog.ttl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# imports: http://www.w3.org/TR/skos-reference/skos-owl1-dl.rdf
# imports: http://www.w3.org/ns/dcat
# imports: https://ontology.caseontology.org/case/case
# imports: https://ontology.caseontology.org/case/case/1.0.0

@prefix case-corpora: <http://example.org/ontology/case/corpora/> .
@prefix dcat: <http://www.w3.org/ns/dcat#> .
Expand All @@ -20,7 +20,7 @@
owl:imports
<http://www.w3.org/TR/skos-reference/skos-owl1-dl.rdf> ,
<http://www.w3.org/ns/dcat> ,
<https://ontology.caseontology.org/case/case>
<https://ontology.caseontology.org/case/case/1.0.0>
;
owl:ontologyIRI <http://example.org/kb> ;
.
Expand Down
16 changes: 9 additions & 7 deletions catalog/datasets/crossover/supplemental.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
@prefix uco-identity: <https://ontology.unifiedcyberontology.org/uco/identity/> .
@prefix uco-observable: <https://ontology.unifiedcyberontology.org/uco/observable/> .
@prefix wd: <http://www.wikidata.org/entity/> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

kb:device-facet-1ee161fc-5b41-48e0-bbdc-69ffa8c03230
a uco-observable:DeviceFacet ;
uco-observable:manufacturer wd:Q20716 ;
uco-observable:model "SM-G925F" ;
uco-observable:serialNumber "RF8H31GS5SF" ;
.

kb:samsung-device-2b5e3fe8-09a7-4c36-859a-5f669e7a1610
a drafting:device-class-bd30761f-8ae3-4eb2-abac-428c824fb59e ;
uco-core:hasFacet [
a uco-observable:DeviceFacet ;
uco-observable:manufacturer wd:Q20716 ;
uco-observable:model "SM-G925F" ;
uco-observable:serialNumber "RF8H31GS5SF" ;
] ;
uco-core:hasFacet kb:device-facet-1ee161fc-5b41-48e0-bbdc-69ffa8c03230 ;
.

42 changes: 25 additions & 17 deletions catalog/datasets/dfrws2017-challenge/distribution.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix uco-core: <https://ontology.unifiedcyberontology.org/uco/core/> .
@prefix uco-observable: <https://ontology.unifiedcyberontology.org/uco/observable/> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

kb:dataset-9918b989-913c-42a8-ba9b-14bc73e318ac
case-corpora:hasDistribution
Expand Down Expand Up @@ -43,33 +43,41 @@ kb:distribution-dd871377-7b49-46d7-90ae-564dae8398f7

<https://github.com/dfrws/dfrws2017-challenge/blob/master/materials/004-Onhub-diagnostic-report>
a uco-observable:URL ;
uco-core:hasFacet [
a uco-observable:URLFacet ;
uco-observable:fullValue "https://github.com/dfrws/dfrws2017-challenge/blob/master/materials/004-Onhub-diagnostic-report" ;
] ;
uco-core:hasFacet kb:url-facet-2f2958a3-7e9d-4d14-b31f-4148d35ab52c ;
.

<https://github.com/dfrws/dfrws2017-challenge/blob/master/materials/005-Amazon-Echo-Alexa-Web-Scrape.zip>
a uco-observable:URL ;
uco-core:hasFacet [
a uco-observable:URLFacet ;
uco-observable:fullValue "https://github.com/dfrws/dfrws2017-challenge/blob/master/materials/005-Amazon-Echo-Alexa-Web-Scrape.zip" ;
] ;
uco-core:hasFacet kb:url-facet-785c662e-8261-4a17-8031-114f86f99af1 ;
.

<https://github.com/dfrws/dfrws2017-challenge/blob/master/materials/IoT_Net_Traffic.zip>
a uco-observable:URL ;
uco-core:hasFacet [
a uco-observable:URLFacet ;
uco-observable:fullValue "https://github.com/dfrws/dfrws2017-challenge/blob/master/materials/IoT_Net_Traffic.zip" ;
] ;
uco-core:hasFacet kb:url-facet-9b9d4a1a-059e-47f8-aee0-d93edf61b5f2 ;
.

<https://www.dropbox.com/s/vvkza954gn9sx89/001-SmartTV-RaspberryPi.zip?dl=0>
a uco-observable:URL ;
uco-core:hasFacet [
a uco-observable:URLFacet ;
uco-observable:fullValue "https://www.dropbox.com/s/vvkza954gn9sx89/001-SmartTV-RaspberryPi.zip?dl=0" ;
] ;
uco-core:hasFacet kb:url-facet-d9e4bbae-4b47-4d8c-b547-9e524d3a4ca0 ;
.

kb:url-facet-2f2958a3-7e9d-4d14-b31f-4148d35ab52c
a uco-observable:URLFacet ;
uco-observable:fullValue "https://github.com/dfrws/dfrws2017-challenge/blob/master/materials/004-Onhub-diagnostic-report" ;
.

kb:url-facet-785c662e-8261-4a17-8031-114f86f99af1
a uco-observable:URLFacet ;
uco-observable:fullValue "https://github.com/dfrws/dfrws2017-challenge/blob/master/materials/005-Amazon-Echo-Alexa-Web-Scrape.zip" ;
.

kb:url-facet-9b9d4a1a-059e-47f8-aee0-d93edf61b5f2
a uco-observable:URLFacet ;
uco-observable:fullValue "https://github.com/dfrws/dfrws2017-challenge/blob/master/materials/IoT_Net_Traffic.zip" ;
.

kb:url-facet-d9e4bbae-4b47-4d8c-b547-9e524d3a4ca0
a uco-observable:URLFacet ;
uco-observable:fullValue "https://www.dropbox.com/s/vvkza954gn9sx89/001-SmartTV-RaspberryPi.zip?dl=0" ;
.

36 changes: 21 additions & 15 deletions catalog/datasets/dfrws2017-challenge/supplemental.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,38 @@
kb:device-650599c6-701f-4f2e-becb-74398b366ba3
a uco-observable:Device ;
uco-core:description "Google OnHub wifi router connected to SmartThings Hub and IPTime switch" ;
uco-core:hasFacet [
a uco-observable:DeviceFacet ;
uco-observable:deviceType "OnHub wifi router" ;
uco-observable:manufacturer wd:Q95 ;
] ;
uco-core:hasFacet kb:device-facet-87b3668c-53ad-4a40-bcd3-eb64e426afaf ;
.

kb:device-6e718fd4-d876-4f81-8d58-10c21a741a70
a uco-observable:Device ;
rdfs:seeAlso <https://www.samsung.com/us/smart-home/smartthings/hubs/samsung-smartthings-hub-f-hub-us-2/> ;
uco-core:description "Samsung Smart things hub" ;
uco-core:hasFacet [
a uco-observable:DeviceFacet ;
uco-observable:deviceType "Smart things hub" ;
uco-observable:manufacturer wd:Q20716 ;
] ;
uco-core:hasFacet kb:device-facet-cc2f6193-85cc-47f1-b5cb-f2f8338daf03 ;
.

kb:device-8fe70491-26c5-4226-a735-ccda10e1a73a
a uco-observable:Device ;
uco-core:description "Raspberry Pi connected via HDMI to TV" ;
uco-core:hasFacet [
a uco-observable:DeviceFacet ;
uco-observable:deviceType "Raspberry Pi" ;
uco-observable:manufacturer wd:Q7295195 ;
] ;
uco-core:hasFacet kb:device-facet-f2390184-741a-4c0f-8187-0264ed056da0 ;
.

kb:device-facet-87b3668c-53ad-4a40-bcd3-eb64e426afaf
a uco-observable:DeviceFacet ;
uco-observable:deviceType "OnHub wifi router" ;
uco-observable:manufacturer wd:Q95 ;
.

kb:device-facet-cc2f6193-85cc-47f1-b5cb-f2f8338daf03
a uco-observable:DeviceFacet ;
uco-observable:deviceType "Smart things hub" ;
uco-observable:manufacturer wd:Q20716 ;
.

kb:device-facet-f2390184-741a-4c0f-8187-0264ed056da0
a uco-observable:DeviceFacet ;
uco-observable:deviceType "Raspberry Pi" ;
uco-observable:manufacturer wd:Q7295195 ;
.

kb:distribution-3ad744db-b926-40c1-8edf-2d5f46deb806
Expand Down
8 changes: 8 additions & 0 deletions catalog/postvisit.mk
Original file line number Diff line number Diff line change
Expand Up @@ -101,37 +101,45 @@ kb-datasets.ttl: \
rm __$@
mv _$@ $@

# TODO: Use --allow-infos after resolution of case-utils Issue 70.
# https://github.com/casework/CASE-Utilities-Python/issues/70
validate-kb-all.ttl: \
kb-all.ttl \
validate-kb-datasets.ttl
rm -f _$@
source $(top_srcdir)/venv/bin/activate \
&& case_validate \
--allow-warnings \
--format turtle \
--inference rdfs \
--ontology-graph $(top_srcdir)/dependencies/dependencies.ttl \
--ontology-graph $(top_srcdir)/shapes/case-corpora.ttl \
--ontology-graph $(top_srcdir)/shapes/dcat.ttl \
--ontology-graph $(top_srcdir)/shapes/dcat-us.ttl \
--ontology-graph $(top_srcdir)/shapes/dct.ttl \
--ontology-graph $(top_srcdir)/shapes/debug.ttl \
--output _$@ \
kb-all.ttl \
|| (cat _$@ ; exit 1)
mv _$@ $@

# TODO: Use --allow-infos after resolution of case-utils Issue 70.
# https://github.com/casework/CASE-Utilities-Python/issues/70
validate-kb-datasets.ttl: \
kb-datasets.ttl \
validate-catalog.ttl
rm -f _$@
source $(top_srcdir)/venv/bin/activate \
&& case_validate \
--allow-warnings \
--format turtle \
--inference rdfs \
--ontology-graph $(top_srcdir)/dependencies/dependencies.ttl \
--ontology-graph $(top_srcdir)/shapes/case-corpora.ttl \
--ontology-graph $(top_srcdir)/shapes/dcat.ttl \
--ontology-graph $(top_srcdir)/shapes/dcat-us.ttl \
--ontology-graph $(top_srcdir)/shapes/dct.ttl \
--ontology-graph $(top_srcdir)/shapes/debug.ttl \
--output _$@ \
kb-datasets.ttl \
|| (cat _$@ ; exit 1)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
case-prov >= 0.4.0, < 0.5.0
case-prov >= 0.5.0, < 0.6.0
44 changes: 23 additions & 21 deletions shapes/case-corpora.ttl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# imports: http://www.w3.org/ns/dcat
# imports: https://ontology.unifiedcyberontology.org/uco/core
# imports: https://ontology.unifiedcyberontology.org/uco/observable
# imports: https://ontology.unifiedcyberontology.org/uco/core/1.0.0
# imports: https://ontology.unifiedcyberontology.org/uco/observable/1.0.0

@prefix case-corpora: <http://example.org/ontology/case/corpora/> .
@prefix dcat: <http://www.w3.org/ns/dcat#> .
Expand All @@ -21,8 +21,8 @@
rdfs:comment "This ontology serves to join the versions of CASE and DCAT used to populate CASE-Corpora, bringing analogous properties and classes together and defining SHACL shapes to maintain data quality-control rules."@en ;
owl:imports
<http://www.w3.org/ns/dcat> ,
<https://ontology.unifiedcyberontology.org/uco/core> ,
<https://ontology.unifiedcyberontology.org/uco/observable>
<https://ontology.unifiedcyberontology.org/uco/core/1.0.0> ,
<https://ontology.unifiedcyberontology.org/uco/observable/1.0.0>
;
sh:declare
[
Expand Down Expand Up @@ -128,23 +128,7 @@ case-corpora:Distribution
uco-observable:ObservableObject
;
sh:property
[
a sh:PropertyShape ;
sh:class uco-observable:URL ;
sh:description "CASE-Corpora requires any referenced Distribution have a downloadable URL, stored in the fullValue of a URLFacet."@en ;
sh:minCount "1"^^xsd:integer ;
sh:nodeKind sh:IRI ;
sh:path case-corpora:hasDownloadURL ;
sh:qualifiedMinCount "1"^^xsd:integer ;
sh:qualifiedValueShape [
sh:datatype xsd:string ;
sh:nodeKind sh:Literal ;
sh:path (
uco-core:hasFacet
uco-observable:fullValue
) ;
] ;
] ,
case-corpora:Distribution-URL-hasFacet-fullValue-shape ,
[
a sh:PropertyShape ;
sh:description "CASE-Corpora requests any referenced Distribution include one or more media types. If none are known, use mime:application/octet-stream."@en ;
Expand All @@ -157,6 +141,24 @@ case-corpora:Distribution
sh:targetClass case-corpora:Distribution ;
.

case-corpora:Distribution-URL-hasFacet-fullValue-shape
a sh:PropertyShape ;
sh:class uco-observable:URL ;
sh:description "CASE-Corpora requires any referenced Distribution have a downloadable URL, stored in the fullValue of a URLFacet."@en ;
sh:minCount "1"^^xsd:integer ;
sh:nodeKind sh:IRI ;
sh:path case-corpora:hasDownloadURL ;
sh:qualifiedMinCount "1"^^xsd:integer ;
sh:qualifiedValueShape [
sh:datatype xsd:string ;
sh:nodeKind sh:Literal ;
sh:path (
uco-core:hasFacet
uco-observable:fullValue
) ;
] ;
.

case-corpora:contact-00000000-0000-0000-0000-000000000000
a vcard:Contact ;
rdfs:comment "This named individual is provided as a stand-in to make explict that no point of contact is available, linked, or otherwise represented for a dataset."@en ;
Expand Down
20 changes: 20 additions & 0 deletions shapes/debug.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@prefix case-corpora: <http://example.org/ontology/case/corpora/> .
@prefix case-corpora-debug: <urn:example:case-corpora:debug/> .
@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 uco-owl: <https://ontology.unifiedcyberontology.org/owl/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<urn:example:case-corpora:debug>
a owl:Ontology ;
rdfs:comment "This ontology is provided to hold stopgap fixes."@en ;
.

uco-owl:ObjectProperty-shacl-constraints-shape
rdfs:comment "This may be erroneous in light of a shape thought to be correctly implemented."@en ;
rdfs:seeAlso case-corpora:Distribution-URL-hasFacet-fullValue-shape ;
sh:deactivated "true"^^xsd:boolean ;
.

10 changes: 10 additions & 0 deletions src/dataset.mk
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,21 @@ check-case_prov_check: \
--allow-warnings \
kb.ttl

# TODO: Use --allow-infos after resolution of case-utils Issue 70.
# https://github.com/casework/CASE-Utilities-Python/issues/70
check-case_validate: \
$(top_srcdir)/taxonomy/devices/drafting.ttl \
kb.ttl
source $(top_srcdir)/venv/bin/activate \
&& case_validate \
--allow-warnings \
--inference rdfs \
--ontology-graph $(top_srcdir)/dependencies/dependencies.ttl \
--ontology-graph $(top_srcdir)/shapes/case-corpora.ttl \
--ontology-graph $(top_srcdir)/shapes/dcat.ttl \
--ontology-graph $(top_srcdir)/shapes/dcat-us.ttl \
--ontology-graph $(top_srcdir)/shapes/dct.ttl \
--ontology-graph $(top_srcdir)/shapes/debug.ttl \
--ontology-graph $(top_srcdir)/taxonomy/devices/drafting.ttl \
kb.ttl

Expand Down Expand Up @@ -131,13 +135,16 @@ generated-prov.ttl: \
rm __$@
mv _$@ $@

# TODO: Use --allow-infos after resolution of case-utils Issue 70.
# https://github.com/casework/CASE-Utilities-Python/issues/70
kb_validation-CASE-develop.ttl: \
$(top_srcdir)/dependencies/CASE-develop.ttl \
$(top_srcdir)/taxonomy/devices/drafting.ttl \
kb.ttl
rm -f __$@ _$@
source $(top_srcdir)/venv/bin/activate \
&& case_validate \
--allow-warnings \
--built-version none \
--format turtle \
--inference rdfs \
Expand All @@ -159,13 +166,16 @@ kb_validation-CASE-develop.ttl: \
rm __$@
mv _$@ $@

# TODO: Use --allow-infos after resolution of case-utils Issue 70.
# https://github.com/casework/CASE-Utilities-Python/issues/70
kb_validation-CASE-unstable.ttl: \
$(top_srcdir)/dependencies/CASE-unstable.ttl \
$(top_srcdir)/taxonomy/devices/drafting.ttl \
kb.ttl
rm -f __$@ _$@
source $(top_srcdir)/venv/bin/activate \
&& case_validate \
--allow-warnings \
--built-version none \
--format turtle \
--inference rdfs \
Expand Down

0 comments on commit 325d464

Please sign in to comment.