Skip to content

Commit 822d2a1

Browse files
committed
Test case_validate multi-data-graph handling
References: * [AC-210] Add validation command to CASE-Utilities-Python Signed-off-by: Alex Nelson <alexander.nelson@nist.gov>
1 parent e0ca0ce commit 822d2a1

File tree

5 files changed

+75
-1
lines changed

5 files changed

+75
-1
lines changed

tests/case_utils/case_validate/cli/Makefile

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ files_to_generate := \
3939
format_unspecified_output_jsonld.jsonld \
4040
format_unspecified_output_turtle.ttl \
4141
format_unspecified_output_txt.txt \
42-
format_unspecified_output_unspecified.txt
42+
format_unspecified_output_unspecified.txt \
43+
split_data_graph_PASS.txt \
44+
split_data_graph_XFAIL.txt
4345

4446
all: \
4547
$(files_to_generate)
@@ -183,3 +185,34 @@ format_unspecified_output_unspecified.txt: \
183185
$< \
184186
> _$@
185187
mv _$@ $@
188+
189+
split_data_graph_PASS.txt: \
190+
$(tests_srcdir)/.venv.done.log \
191+
$(top_srcdir)/.ontology.done.log \
192+
$(top_srcdir)/case_utils/case_validate/__init__.py \
193+
$(top_srcdir)/case_utils/ontology/__init__.py \
194+
split_data_graph_1.json \
195+
split_data_graph_2.json
196+
rm -f _$@
197+
source $(tests_srcdir)/venv/bin/activate \
198+
&& case_validate \
199+
--debug \
200+
split_data_graph_1.json \
201+
split_data_graph_2.json \
202+
> _$@
203+
mv _$@ $@
204+
205+
split_data_graph_XFAIL.txt: \
206+
$(tests_srcdir)/.venv.done.log \
207+
$(top_srcdir)/.ontology.done.log \
208+
$(top_srcdir)/case_utils/case_validate/__init__.py \
209+
$(top_srcdir)/case_utils/ontology/__init__.py \
210+
split_data_graph_1.json
211+
rm -f _$@
212+
source $(tests_srcdir)/venv/bin/activate \
213+
&& case_validate \
214+
--debug \
215+
split_data_graph_1.json \
216+
> _$@ \
217+
; rc=$$? ; test 1 -eq $$rc
218+
mv _$@ $@
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"@context": {
3+
"kb": "http://example.org/kb/",
4+
"case-investigation": "https://ontology.caseontology.org/case/investigation/",
5+
"uco-core": "https://unifiedcyberontology.org/ontology/uco/core#"
6+
},
7+
"@graph": [
8+
{
9+
"@id": "kb:provenance-record-1",
10+
"@type": "case-investigation:ProvenanceRecord",
11+
"uco-core:object": {
12+
"@id": "kb:file-1"
13+
}
14+
}
15+
]
16+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"@context": {
3+
"kb": "http://example.org/kb/",
4+
"uco-observable": "https://unifiedcyberontology.org/ontology/uco/observable#"
5+
},
6+
"@graph": [
7+
{
8+
"@id": "kb:file-1",
9+
"@type": "uco-observable:File"
10+
}
11+
]
12+
}
13+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Validation Report
2+
Conforms: True
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Validation Report
2+
Conforms: False
3+
Results (1):
4+
Constraint Violation in ClassConstraintComponent (http://www.w3.org/ns/shacl#ClassConstraintComponent):
5+
Severity: sh:Violation
6+
Source Shape: [ sh:class core:UcoObject ; sh:minCount Literal("1", datatype=xsd:integer) ; sh:nodeKind sh:BlankNodeOrIRI ; sh:path core:object ]
7+
Focus Node: kb:provenance-record-1
8+
Value Node: kb:file-1
9+
Result Path: core:object
10+
Message: Value does not have class core:UcoObject

0 commit comments

Comments
 (0)