Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions ontology/uco/action/action.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,31 @@ action:ArrayOfAction
sh:targetClass action:ArrayOfAction ;
.

action:Technique
a
owl:Class ,
sh:NodeShape
;
rdfs:subClassOf core:UcoType ;
rdfs:label "Technique"@en ;
rdfs:comment "A technique is a class of actions joined by some common characteristics. uco-action:Technique itself is a metaclass. A Technique instance is an owl:Class that is a subclass of uco-action:Action."@en ;
sh:property
[
rdfs:comment "This shape confirms a Technique is an eventual subclass of Action. The Action class itself is not a Technique."@en ;
sh:hasValue action:Action ;
sh:path [
sh:oneOrMorePath rdfs:subClassOf ;
] ;
] ,
[
rdfs:comment "This shape will find violations after RDFS or OWL-RL inferencing, but might not find some violations without inferencing."@en ;
sh:nodeKind sh:Literal ;
sh:path action:techniqueID ;
]
;
sh:targetClass action:Technique ;
.

action:action
a owl:ObjectProperty ;
rdfs:label "action"@en ;
Expand Down Expand Up @@ -511,6 +536,20 @@ action:subaction
rdfs:range action:Action ;
.

action:techniqueID
a owl:DatatypeProperty ;
rdfs:label "techniqueID"@en ;
rdfs:comment "An identifier for a technique within some cataloguing system. At the general level of UCO, techniqueID is left optional and minimally-described aside from needing to be Literal-valued. Specializations of Technique should also consider specializing a corresponding subproperty of techniqueID to enable support of global review of technique identifiers."@en ;
rdfs:domain action:Technique ;
.

action:techniqueID-subjects-shape
a sh:NodeShape ;
rdfs:comment "This shape enforces that action:techniqueID is only used on Techniques."@en ;
sh:class action:Technique ;
sh:targetSubjectsOf action:techniqueID ;
.

action:trend
a owl:DatatypeProperty ;
rdfs:label "trend"@en ;
Expand Down
31 changes: 30 additions & 1 deletion ontology/uco/core/core.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ core:UcoThing
;
rdfs:subClassOf owl:Thing ;
rdfs:label "UcoThing"@en ;
rdfs:comment "UcoThing is the top-level class within UCO."@en ;
rdfs:comment "UcoThing is the top-level class for individuals within UCO."@en ;
rdfs:seeAlso core:UcoThing-identifier-regex-shape ;
sh:sparql [
a sh:SPARQLConstraint ;
Expand All @@ -505,6 +505,16 @@ core:UcoThing
sh:targetClass core:UcoThing ;
.

core:UcoThing-disjointWith-UcoType-shape
a sh:NodeShape ;
sh:message "core:UcoThing and core:UcoType are disjoint classes."@en ;
sh:not [
a sh:NodeShape ;
sh:class core:UcoType ;
] ;
sh:targetClass core:UcoThing ;
.

core:UcoThing-identifier-regex-shape
a sh:NodeShape ;
rdfs:comment "This shape is given an independent IRI for applications that have sufficient controls in place to deactivate this advisory of node identification practice."@en ;
Expand Down Expand Up @@ -533,6 +543,25 @@ core:UcoThing-identifier-regex-shape
sh:targetClass core:UcoThing ;
.

core:UcoType
a
owl:Class ,
sh:NodeShape
;
rdfs:subClassOf owl:Thing ;
rdfs:label "UcoType"@en ;
rdfs:comment "UcoThing is the top-level class for metaclasses within UCO. An instance of core:UcoType is also an instance of owl:Class, and is or specializes core:UcoThing."@en ;
owl:disjointWith core:UcoThing ;
sh:class owl:Class ;
sh:property [
sh:hasValue core:UcoThing ;
sh:path [
sh:zeroOrMorePath rdfs:subClassOf ;
] ;
] ;
sh:targetClass core:UcoType ;
.

core:confidence
a owl:DatatypeProperty ;
rdfs:label "confidence"@en ;
Expand Down
35 changes: 32 additions & 3 deletions tests/examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ all: \
action_inheritance_PASS_validation.ttl \
action_inheritance_XFAIL_validation.ttl \
action_result_PASS_validation.ttl \
all-technique \
alternate_data_stream_PASS_validation.ttl \
co_PASS_validation.ttl \
co_XFAIL_validation.ttl \
Expand Down Expand Up @@ -58,7 +59,14 @@ all: \
relationship_XFAIL_validation.ttl \
thread_PASS_validation.ttl \
thread_XFAIL_validation.ttl \
uco_thing_XFAIL_validation.ttl
uco_thing_XFAIL_validation.ttl \
uco_type_PASS_validation.ttl \
uco_type_XFAIL_validation.ttl

.PHONY: \
all-technique \
check-technique \
clean-technique

.PRECIOUS: \
%_validation.ttl
Expand Down Expand Up @@ -98,11 +106,18 @@ all: \
rm __$@
mv _$@ $@

all-technique: \
$(top_srcdir)/.venv.done.log \
$(tests_srcdir)/uco_monolithic.ttl
$(MAKE) \
--directory technique

check: \
action_inheritance_PASS_validation.ttl \
action_inheritance_XFAIL_validation.ttl \
action_result_PASS_validation.ttl \
alternate_data_stream_PASS_validation.ttl \
check-technique \
co_PASS_validation.ttl \
co_XFAIL_validation.ttl \
configuration_setting_PASS_validation.ttl \
Expand Down Expand Up @@ -136,11 +151,25 @@ check: \
relationship_XFAIL_validation.ttl \
thread_PASS_validation.ttl \
thread_XFAIL_validation.ttl \
uco_thing_XFAIL_validation.ttl
uco_thing_XFAIL_validation.ttl \
uco_type_PASS_validation.ttl \
uco_type_XFAIL_validation.ttl
source $(top_srcdir)/venv/bin/activate \
&& pytest \
--log-level=DEBUG

clean:
check-technique: \
all-technique
$(MAKE) \
--directory technique \
check

clean: \
clean-technique
@rm -f \
*_validation.ttl

clean-technique:
@$(MAKE) \
--directory technique \
clean
1 change: 1 addition & 0 deletions tests/examples/technique/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
generated-*
196 changes: 196 additions & 0 deletions tests/examples/technique/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
#!/usr/bin/make -f

# Portions of this file contributed by NIST are governed by the
# following statement:
#
# This software was developed at the National Institute of Standards
# and Technology by employees of the Federal Government in the course
# of their official duties. Pursuant to Title 17 Section 105 of the
# United States Code, this software is not subject to copyright
# protection within the United States. NIST assumes no responsibility
# whatsoever for its use by other parties, and makes no guarantees,
# expressed or implied, about its quality, reliability, or any other
# characteristic.
#
# We would appreciate acknowledgement if the software is used.

SHELL := /bin/bash

top_srcdir := $(shell cd ../../.. ; pwd)

all: \
check

check: \
technique_ontology_XFAIL_validation.ttl \
technique_ontology_XFAIL_rdfs_validation.ttl \
technique_ontology_XFAIL_owlrl_validation.ttl \
technique_data_PASS_validation.ttl \
technique_data_XFAIL_validation.ttl

clean:
@rm -f \
_* \
generated-*

generated-shapes.ttl: \
$(top_srcdir)/.venv.done.log \
$(top_srcdir)/tests/uco_monolithic.ttl \
$(top_srcdir)/tests/thing.ttl \
technique_shapes_PASS.ttl
source $(top_srcdir)/venv/bin/activate \
&& rdfpipe \
--output-format turtle \
$(top_srcdir)/tests/uco_monolithic.ttl \
technique_shapes_PASS.ttl \
> _$@
source $(top_srcdir)/venv/bin/activate \
&& pyshacl \
--format turtle \
--metashacl \
--shacl _$@ \
$(top_srcdir)/tests/thing.ttl
mv _$@ $@

generated-tbox.ttl: \
$(top_srcdir)/.venv.done.log \
$(top_srcdir)/tests/uco_monolithic.ttl \
generated-shapes.ttl \
technique_ontology_PASS.ttl
source $(top_srcdir)/venv/bin/activate \
&& rdfpipe \
--output-format turtle \
$(top_srcdir)/tests/uco_monolithic.ttl \
technique_ontology_PASS.ttl \
> _$@
source $(top_srcdir)/venv/bin/activate \
&& pyshacl \
--format turtle \
--shacl generated-shapes.ttl \
_$@
mv _$@ $@

technique_data_PASS_validation.ttl: \
generated-tbox.ttl \
technique_data_PASS.json
source $(top_srcdir)/venv/bin/activate \
&& pyshacl \
--format turtle \
--ont-graph generated-tbox.ttl \
--output __$@ \
--shacl generated-shapes.ttl \
technique_data_PASS.json
java -jar $(top_srcdir)/lib/rdf-toolkit.jar \
--inline-blank-nodes \
--source __$@ \
--source-format turtle \
--target _$@ \
--target-format turtle
rm __$@
mv _$@ $@

technique_data_XFAIL_validation.ttl: \
generated-tbox.ttl \
technique_data_XFAIL.json
source $(top_srcdir)/venv/bin/activate \
&& pyshacl \
--format turtle \
--ont-graph generated-tbox.ttl \
--output __$@ \
--shacl generated-shapes.ttl \
technique_data_XFAIL.json \
; test 1 -eq $$?
java -jar $(top_srcdir)/lib/rdf-toolkit.jar \
--inline-blank-nodes \
--source __$@ \
--source-format turtle \
--target _$@ \
--target-format turtle
rm __$@
mv _$@ $@

technique_ontology_XFAIL_owlrl_validation.ttl: \
$(top_srcdir)/.venv.done.log \
$(top_srcdir)/tests/uco_monolithic.ttl \
generated-shapes.ttl \
technique_ontology_XFAIL.ttl
source $(top_srcdir)/venv/bin/activate \
&& rdfpipe \
--output-format turtle \
$(top_srcdir)/tests/uco_monolithic.ttl \
technique_ontology_XFAIL.ttl \
> _$@
source $(top_srcdir)/venv/bin/activate \
&& pyshacl \
--format turtle \
--inference owlrl \
--output __$@ \
--shacl generated-shapes.ttl \
_$@ \
; test 1 -eq $$?
rm _$@
java -jar $(top_srcdir)/lib/rdf-toolkit.jar \
--inline-blank-nodes \
--source __$@ \
--source-format turtle \
--target _$@ \
--target-format turtle
rm __$@
mv _$@ $@

technique_ontology_XFAIL_rdfs_validation.ttl: \
$(top_srcdir)/.venv.done.log \
$(top_srcdir)/tests/uco_monolithic.ttl \
generated-shapes.ttl \
technique_ontology_XFAIL.ttl
source $(top_srcdir)/venv/bin/activate \
&& rdfpipe \
--output-format turtle \
$(top_srcdir)/tests/uco_monolithic.ttl \
technique_ontology_XFAIL.ttl \
> _$@
source $(top_srcdir)/venv/bin/activate \
&& pyshacl \
--format turtle \
--inference rdfs \
--output __$@ \
--shacl generated-shapes.ttl \
_$@ \
; test 1 -eq $$?
rm _$@
java -jar $(top_srcdir)/lib/rdf-toolkit.jar \
--inline-blank-nodes \
--source __$@ \
--source-format turtle \
--target _$@ \
--target-format turtle
rm __$@
mv _$@ $@

technique_ontology_XFAIL_validation.ttl: \
$(top_srcdir)/.venv.done.log \
$(top_srcdir)/tests/uco_monolithic.ttl \
generated-shapes.ttl \
technique_ontology_XFAIL.ttl
source $(top_srcdir)/venv/bin/activate \
&& rdfpipe \
--output-format turtle \
$(top_srcdir)/tests/uco_monolithic.ttl \
technique_ontology_XFAIL.ttl \
> _$@
source $(top_srcdir)/venv/bin/activate \
&& pyshacl \
--format turtle \
--output __$@ \
--shacl generated-shapes.ttl \
_$@ \
; test 1 -eq $$?
rm _$@
java -jar $(top_srcdir)/lib/rdf-toolkit.jar \
--inline-blank-nodes \
--source __$@ \
--source-format turtle \
--target _$@ \
--target-format turtle
rm __$@
mv _$@ $@
22 changes: 22 additions & 0 deletions tests/examples/technique/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Tests of Technique metaclass

The test matrix for PASS conditions is as follows:

* `uco-action:Technique` is:

- Not specialized (see `ex0:Technique-A`)
- Specialized (see `ex1:Technique`, `ex2:AdaptedTechnique`)

* Each of the above degrees of `Technique` specialization is instantiated with some `Action` subclass.

- No specialization (see `ex0:Technique-A`)
- One level of specialization (see `ex1:Technique-T0001`, `ex2:AT-0001`)
- Two levels of specialization, using the same Technique-subclass (see `ex1:T0002`)
- Two levels of specialization, using different Technique-subclasses (see `ex2:AT-0099`)

* Each of the above instantiations by some degree of `Technique` specialization is instantiated.

- No specialization (see `kb:Action-a34208f4-31ea-4d78-95c9-153a73fbb628`)
- One level of specialization (see `kb:Action-c44d57af-a6c3-4350-b08b-0dac5f3b7aca`)
- Two levels of specialization, using the same Technique-subclass (see `kb:Action-8f84a98c-2ab5-454d-9c2f-443fe64b7158`)
- Two levels of specialization, using different Technique-subclasses (see `kb:Action-f6625d7d-978d-4562-83d7-23d9ac398073`)
Loading
Loading