Skip to content

Commit

Permalink
Merge pull request #126 from casework/release-1.1.0
Browse files Browse the repository at this point in the history
Release 1.1.0
  • Loading branch information
b0bkaT authored Nov 22, 2022
2 parents 82d96f6 + 10a7fcc commit 0d0f0dd
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ name: Continuous Integration

on:
push:
branches: [ master, develop ]
branches: [ master, develop*, unstable* ]
pull_request:
branches: [ master, develop ]
branches: [ master, develop*, unstable* ]

jobs:
build:
Expand Down
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2022-11-22
* ONT-491: Release CASE 1.1.0, with release notes at https://caseontology.org/releases/1.1.0/

2022-11-18
* (9922288) Issue 119: Test for concept-membership of used design vocabularies
* (137fff8) UCO Issue 491: Bump UCO to remove owl:ontologyIRI concept review
* (48e9d58) UCO Issue 493: Trigger CI on all branches starting with "develop" and "unstable"
* (ae27b42) UCO Issue 504: Test monolithic build with SHACL-SHACL

2022-08-31
* ONT-295: Release CASE 1.0.0, with release notes at https://caseontology.org/releases/1.0.0/
* (761b058): Adopt UCO 1.0.0
Expand Down
2 changes: 1 addition & 1 deletion dependencies/UCO
Submodule UCO updated 44 files
+2 −2 .github/workflows/ci.yml
+3 −3 README.md
+6 −5 ontology/co/co.ttl
+68 −112 ontology/owl/owl.ttl
+13 −14 ontology/uco/action/action.ttl
+142 −0 ontology/uco/analysis/analysis.ttl
+5 −4 ontology/uco/configuration/configuration.ttl
+3 −4 ontology/uco/core/core.ttl
+7 −8 ontology/uco/identity/identity.ttl
+5 −6 ontology/uco/location/location.ttl
+5 −6 ontology/uco/marking/marking.ttl
+38 −37 ontology/uco/master/uco.ttl
+189 −28 ontology/uco/observable/observable.ttl
+5 −6 ontology/uco/pattern/pattern.ttl
+5 −6 ontology/uco/role/role.ttl
+5 −6 ontology/uco/time/time.ttl
+7 −8 ontology/uco/tool/tool.ttl
+9 −10 ontology/uco/types/types.ttl
+5 −6 ontology/uco/victim/victim.ttl
+3 −4 ontology/uco/vocabulary/vocabulary.ttl
+13 −2 tests/Makefile
+4 −0 tests/examples/Makefile
+68 −0 tests/examples/database_records_PASS.json
+11 −0 tests/examples/database_records_PASS_validation.ttl
+35 −0 tests/examples/database_records_XFAIL.json
+46 −0 tests/examples/database_records_XFAIL_validation.ttl
+16 −0 tests/examples/test_validation.py
+240 −53 tests/shapes/examples_uco_owl/owl_incompatibleWith_shape_PASS.ttl
+126 −102 tests/shapes/examples_uco_owl/owl_incompatibleWith_shape_PASS_validation.ttl
+0 −18 tests/shapes/examples_uco_owl/owl_ontologyIRI_uniqueness_shape_PASS.ttl
+0 −68 tests/shapes/examples_uco_owl/owl_ontologyIRI_uniqueness_shape_PASS_validation.ttl
+1 −1 tests/shapes/examples_uco_owl/owl_ontologyIRI_versionIRI_prerequisite_shape_XFAIL.ttl
+13 −3 tests/shapes/examples_uco_owl/owl_ontologyIRI_versionIRI_prerequisite_shape_XFAIL_validation.ttl
+0 −20 tests/shapes/examples_uco_owl/owl_ontologyIRI_versionIRI_uniqueness_shape_PASS.ttl
+0 −68 tests/shapes/examples_uco_owl/owl_ontologyIRI_versionIRI_uniqueness_shape_PASS_validation.ttl
+28 −0 tests/shapes/examples_uco_owl/owl_shacl_paths_PASS.ttl
+11 −0 tests/shapes/examples_uco_owl/owl_shacl_paths_PASS_validation.ttl
+0 −1 tests/shapes/examples_uco_owl/owl_versionIRI_multiversion_shape_PASS.ttl
+0 −3 tests/shapes/examples_uco_qc/owl_Ontology_shape_property_owl_versionIRI_PASS.ttl
+0 −3 tests/shapes/examples_uco_qc/owl_Ontology_shape_property_owl_versionIRI_XFAIL.ttl
+1 −5 tests/shapes/examples_uco_qc/owl_Ontology_shape_sparql_imports_XFAIL.ttl
+82 −44 tests/shapes/test_qc_shapes.py
+67 −1 tests/test_uco_monolithic.py
+9 −0 tests/thing.ttl
19 changes: 9 additions & 10 deletions ontology/investigation/investigation.ttl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# imports: https://ontology.caseontology.org/case/vocabulary/1.0.0
# imports: https://ontology.unifiedcyberontology.org/uco/action/1.0.0
# imports: https://ontology.unifiedcyberontology.org/uco/role/1.0.0
# imports: https://ontology.caseontology.org/case/vocabulary/1.1.0
# imports: https://ontology.unifiedcyberontology.org/uco/action/1.1.0
# imports: https://ontology.unifiedcyberontology.org/uco/role/1.1.0

@prefix investigation: <https://ontology.caseontology.org/case/investigation/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
Expand All @@ -17,15 +17,14 @@
a owl:Ontology ;
rdfs:label "investigation"@en ;
rdfs:comment "This ontology defines key concepts, and their associated properties and relationships, for characterizing cyber-investigations in the broadest range of contexts, including security incidents, criminal investigations, civil and regulatory matters, intelligence operations, international disputes, accident inquiries, policy violations, and others." ;
owl:backwardCompatibleWith investigation:1.0.0 ;
owl:imports
vocabulary:1.0.0 ,
uco-action:1.0.0 ,
uco-role:1.0.0
vocabulary:1.1.0 ,
uco-action:1.1.0 ,
uco-role:1.1.0
;
owl:incompatibleWith investigation:0.7.1 ;
owl:ontologyIRI <https://ontology.caseontology.org/case/investigation> ;
owl:priorVersion investigation:0.7.1 ;
owl:versionIRI investigation:1.0.0 ;
owl:priorVersion investigation:1.0.0 ;
owl:versionIRI investigation:1.1.0 ;
.

investigation:Attorney
Expand Down
21 changes: 10 additions & 11 deletions ontology/master/case.ttl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# imports: https://ontology.caseontology.org/case/investigation/1.0.0
# imports: https://ontology.caseontology.org/case/vocabulary/1.0.0
# imports: https://ontology.unifiedcyberontology.org/uco/uco/1.0.0
# imports: https://ontology.caseontology.org/case/investigation/1.1.0
# imports: https://ontology.caseontology.org/case/vocabulary/1.1.0
# imports: https://ontology.unifiedcyberontology.org/uco/uco/1.1.0

@prefix dct: <http://purl.org/dc/terms/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
Expand All @@ -16,15 +16,14 @@
rdfs:label "case-master"@en ;
rdfs:comment "The Cyber-investigation Analysis Standard Expression (CASE) ontology is a community-developed standard that defines concepts used in a broad range of cyber-investigation domains, including digital forensic science, incident response, counter-terrorism, criminal justice, forensic intelligence, and situational awareness. CASE includes all aspects of the digital forensic process, from evidence-gathering and chain of custody, to generating a final report. The goal is to increase sharing and interoperability of cyber-investigation information among organizations and between forensic analytic tools. CASE aligns with and extends the Unified Cyber Ontology (UCO). The preferred namespace abbreviation for this ontology is: case-master."@en ;
dct:title "Cyber-investigation Analysis Standard Expression (CASE)"@en ;
owl:backwardCompatibleWith <https://ontology.caseontology.org/case/case/1.0.0> ;
owl:imports
<https://ontology.caseontology.org/case/investigation/1.0.0> ,
<https://ontology.caseontology.org/case/vocabulary/1.0.0> ,
<https://ontology.unifiedcyberontology.org/uco/uco/1.0.0>
<https://ontology.caseontology.org/case/investigation/1.1.0> ,
<https://ontology.caseontology.org/case/vocabulary/1.1.0> ,
<https://ontology.unifiedcyberontology.org/uco/uco/1.1.0>
;
owl:incompatibleWith <https://ontology.caseontology.org/case/case/0.7.1> ;
owl:ontologyIRI <https://ontology.caseontology.org/case/case> ;
owl:priorVersion <https://ontology.caseontology.org/case/case/0.7.1> ;
owl:versionIRI <https://ontology.caseontology.org/case/case/1.0.0> ;
owl:versionInfo "1.0.0" ;
owl:priorVersion <https://ontology.caseontology.org/case/case/1.0.0> ;
owl:versionIRI <https://ontology.caseontology.org/case/case/1.1.0> ;
owl:versionInfo "1.1.0" ;
.

7 changes: 3 additions & 4 deletions ontology/vocabulary/vocabulary.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
<https://ontology.caseontology.org/case/vocabulary>
a owl:Ontology ;
rdfs:label "vocabularies"@en ;
owl:incompatibleWith vocab:0.7.1 ;
owl:ontologyIRI <https://ontology.caseontology.org/case/vocabulary> ;
owl:priorVersion vocab:0.7.1 ;
owl:versionIRI vocab:1.0.0 ;
owl:backwardCompatibleWith vocab:1.0.0 ;
owl:priorVersion vocab:1.0.0 ;
owl:versionIRI vocab:1.1.0 ;
.

vocab:InvestigationFormVocab
Expand Down
17 changes: 16 additions & 1 deletion tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ all:

case_monolithic.ttl: \
$(top_srcdir)/.lib.done.log \
$(top_srcdir)/dependencies/UCO/tests/thing.ttl \
$(case_turtle_files) \
$(uco_turtle_files) \
.shapes.done.log
Expand All @@ -83,7 +84,17 @@ case_monolithic.ttl: \
--shacl $(top_srcdir)/dependencies/UCO/tests/shapes/uco-closure-qc.ttl \
--shacl-file-format turtle \
___$@
# Test has passed; remove closure file.
# Review CASE closure with SHACL-SHACL.
source venv/bin/activate \
&& pyshacl \
--data-file-format turtle \
--format turtle \
--inference none \
--metashacl \
--shacl ___$@ \
--shacl-file-format turtle \
$(top_srcdir)/dependencies/UCO/tests/thing.ttl
# Closure tests have passed; remove closure file.
rm ___$@
# Review CASE for practice conformance.
source venv/bin/activate \
Expand Down Expand Up @@ -124,6 +135,10 @@ case_monolithic.ttl: \
check: \
inheritance_review.ttl \
case_monolithic.ttl
source venv/bin/activate \
&& pytest \
--ignore examples \
--log-level=DEBUG
$(MAKE) \
--directory examples \
check
Expand Down
95 changes: 95 additions & 0 deletions tests/test_case_monolithic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#!/usr/bin/env python3

# 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 and is in the public domain. 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.

import os
from typing import Generator, Optional, Set

import pytest
from rdflib import Graph, Namespace, OWL, RDF, RDFS, SH, URIRef


@pytest.fixture(scope="module")
def graph() -> Generator[Graph, None, None]:
graph = Graph()
graph.parse(os.path.join(os.path.dirname(__file__), "case_monolithic.ttl"))
assert len(graph) > 0, "Failed to load case_monolithic.ttl."
yield graph


def test_rdf_design_vocabularies_defined(graph: Graph) -> None:
"""
(This test is copied verbatim from UCO. Alternative methods of
importing the review from UCO are welcome.)
This test performs a typo review of RDF-, RDFS-, and OWL-namespaced concepts.
The mechanism used is rdflib's ClosedNamespace. The imported
objects RDF, RDFS, and OWL are instances of this Python class.
"""

expected: Set[URIRef] = set() # This set is intentionally empty.
computed: Set[URIRef] = set()

concepts_used: Set[URIRef] = set()
for triple in graph.triples((None, None, None)):
for triple_member in triple:
if not isinstance(triple_member, URIRef):
continue
concepts_used.add(triple_member)

OWL_str = str(OWL)
RDF_str = str(RDF)
RDFS_str = str(RDFS)
SH_str = str(SH)

def _concept_in_design_vocabulary(concept: URIRef) -> Optional[bool]:
"""
Return True -> Concept is defined in some design vocabulary.
Return False -> Concept is not defined in design vocabulary.
Return None -> N/A.
"""
design_vocabulary: Namespace
if concept.startswith(OWL_str):
concept_fragment = concept.replace(OWL_str, "")
design_vocabulary = OWL
elif concept.startswith(RDF_str):
concept_fragment = concept.replace(RDF_str, "")
design_vocabulary = RDF
elif concept.startswith(RDFS_str):
concept_fragment = concept.replace(RDFS_str, "")
design_vocabulary = RDFS
elif concept.startswith(SH_str):
concept_fragment = concept.replace(SH_str, "")
design_vocabulary = SH
else:
return None

try:
_ = design_vocabulary[concept_fragment]
except AttributeError:
return False

assert (
_concept_in_design_vocabulary(
URIRef(
"http://www.w3.org/2002/07/owl#NonExistentConcept-f287fb8b-433b-45a2-82b8-9b53bfa35c64"
)
)
is False
), "ClosedNamespace functionality used in this test did not detect a known-erroneous value. This test needs revising."

for concept_used in concepts_used:
if _concept_in_design_vocabulary(concept_used) is False:
computed.add(concept_used)

assert expected == computed

0 comments on commit 0d0f0dd

Please sign in to comment.