From 3fdba5eca2b9c1e8fe7076364fbc8336fb4b221c Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Wed, 4 May 2022 16:34:10 -0400 Subject: [PATCH] Add example of shorter JSON MIME object usage c/o Context Dictionary feature A follow-on patch will generate a Make-managed file. References: * https://github.com/ucoProject/UCO/issues/363 Signed-off-by: Alex Nelson --- tests/examples/Makefile | 2 ++ tests/examples/mime_prefix_PASS.json | 36 ++++++++++++++++++++++++++++ tests/examples/test_validation.py | 7 ++++++ 3 files changed, 45 insertions(+) create mode 100644 tests/examples/mime_prefix_PASS.json diff --git a/tests/examples/Makefile b/tests/examples/Makefile index d15ab098..1075937c 100644 --- a/tests/examples/Makefile +++ b/tests/examples/Makefile @@ -27,6 +27,7 @@ all: \ location_XFAIL_validation.ttl \ mime_PASS_validation.ttl \ mime_XFAIL_validation.ttl \ + mime_prefix_PASS_validation.ttl \ relationship_PASS_validation.ttl \ relationship_XFAIL_validation.ttl @@ -78,6 +79,7 @@ check: \ location_XFAIL_validation.ttl \ mime_PASS_validation.ttl \ mime_XFAIL_validation.ttl \ + mime_prefix_PASS_validation.ttl \ relationship_PASS_validation.ttl \ relationship_XFAIL_validation.ttl source $(tests_srcdir)/venv/bin/activate \ diff --git a/tests/examples/mime_prefix_PASS.json b/tests/examples/mime_prefix_PASS.json new file mode 100644 index 00000000..047ba475 --- /dev/null +++ b/tests/examples/mime_prefix_PASS.json @@ -0,0 +1,36 @@ +{ + "@context": { + "core": "https://ontology.unifiedcyberontology.org/uco/core/", + "ex-mime": "urn:example:mime:custom:", + "kb": "http://example.org/kb/", + "observable": "https://ontology.unifiedcyberontology.org/uco/observable/", + "observable:mimeType": { + "@type": "@id" + }, + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "skos": "http://www.w3.org/2004/02/skos/core#", + "types": "https://ontology.unifiedcyberontology.org/uco/types/" + }, + "@graph": [ + { + "@id": "ex-mime:application/gzip", + "@type": "types:IANAMediaType", + "rdfs:comment": "This is a custom media type individual, designed for just this unit test. A larger taxonomy of individuals should be used outside of testing contexts.", + "skos:notation": "application/gzip" + }, + { + "@id": "kb:file-8", + "@type": "observable:File", + "core:hasFacet": [ + { + "@type": "observable:ContentDataFacet", + "observable:mimeType": "ex-mime:application/gzip" + }, + { + "@type": "observable:FileFacet", + "observable:fileName": "8.gz" + } + ] + } + ] +} diff --git a/tests/examples/test_validation.py b/tests/examples/test_validation.py index 2c3e5da6..eecebc7a 100644 --- a/tests/examples/test_validation.py +++ b/tests/examples/test_validation.py @@ -212,6 +212,13 @@ def test_mime_XFAIL_validation() -> None: } ) +def test_mime_prefix_PASS_validation() -> None: + confirm_validation_results( + "mime_prefix_PASS_validation.ttl", + True, + expected_focus_node_severities=set() + ) + def test_relationship_PASS_partial() -> None: """ This test should be replaced with test_relationship_XFAIL_full when the semi-open vocabulary design current as of UCO 0.8.0 is re-done.