Skip to content

Commit 3daebe6

Browse files
Merge pull request #68 from casework/release-0.7.0
Release 0.7.0
2 parents 5073694 + 6fd7919 commit 3daebe6

File tree

61 files changed

+40448
-549
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+40448
-549
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ check: \
8888

8989
clean:
9090
@$(MAKE) \
91+
PYTHON3=$(PYTHON3) \
9192
--directory tests \
9293
clean
9394
@rm -f \
@@ -123,5 +124,6 @@ distclean: \
123124
download: \
124125
.git_submodule_init.done.log
125126
$(MAKE) \
127+
PYTHON3=$(PYTHON3) \
126128
--directory tests \
127129
download

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ This repository can be installed from PyPI or from source.
1616
### Installing from PyPI
1717

1818
```bash
19-
pip install case_utils
19+
pip install case-utils
2020
```
2121

2222
Users who wish to install from PyPI should be aware that while CASE's ontology is in its pre-1.0.0 release state, backwards-incompatible ontology changes may occur. This may manifest as [`case_validate`](#case_validate) reporting data review errors after installing an updated `case_utils` version. Users may wish to pin `case_utils` within any dependent code bases to be less than the next unreleased SEMVER-minor version. (E.g. if `case_utils` version `0.8.0` is currently available, a newly adopting project might wish to track `case_utils<0.9.0` among its dependencies.)
2323

2424

2525
### Installing from source
2626

27-
Users who wish to install pre-release versions and/or make improvements to the code base should install in this manner.
27+
Users who wish to install pre-release versions and/or make improvements to the code base should install in this manner.
2828

2929
1. Clone this repository.
3030
2. (Optional) Create and activate a virtual environment.

case_utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
#
1212
# We would appreciate acknowledgement if the software is used.
1313

14-
__version__ = "0.6.0"
14+
__version__ = "0.7.0"
1515

1616
from . import local_uuid # noqa: F401

case_utils/case_file/__init__.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
This module creates a graph object that provides a basic UCO characterization of a single file. The gathered metadata is among the more "durable" file characteristics, i.e. characteristics that would remain consistent when transferring a file between locations.
1616
"""
1717

18-
__version__ = "0.3.2"
18+
__version__ = "0.4.0"
1919

2020
import argparse
2121
import datetime
@@ -25,7 +25,7 @@
2525
import typing
2626
import warnings
2727

28-
import rdflib # type: ignore
28+
import rdflib
2929

3030
import case_utils
3131
from case_utils.namespace import (
@@ -82,17 +82,19 @@ def create_file_node(
8282
:returns: The File Observable Object's node.
8383
:rtype: rdflib.URIRef
8484
"""
85+
node_namespace = rdflib.Namespace(node_prefix)
86+
8587
if node_iri is None:
8688
node_slug = "file-" + case_utils.local_uuid.local_uuid()
87-
node_iri = rdflib.Namespace(node_prefix)[node_slug]
89+
node_iri = node_namespace[node_slug]
8890
n_file = rdflib.URIRef(node_iri)
8991
graph.add((n_file, NS_RDF.type, NS_UCO_OBSERVABLE.File))
9092

9193
basename = os.path.basename(filepath)
9294
literal_basename = rdflib.Literal(basename)
9395

9496
file_stat = os.stat(filepath)
95-
n_file_facet = rdflib.BNode()
97+
n_file_facet = node_namespace["file-facet-" + case_utils.local_uuid.local_uuid()]
9698
graph.add(
9799
(
98100
n_file_facet,
@@ -119,7 +121,9 @@ def create_file_node(
119121
graph.add((n_file_facet, NS_UCO_OBSERVABLE.modifiedTime, literal_mtime))
120122

121123
if not disable_hashes:
122-
n_contentdata_facet = rdflib.BNode()
124+
n_contentdata_facet = node_namespace[
125+
"content-data-facet-" + case_utils.local_uuid.local_uuid()
126+
]
123127
graph.add((n_file, NS_UCO_CORE.hasFacet, n_contentdata_facet))
124128
graph.add(
125129
(n_contentdata_facet, NS_RDF.type, NS_UCO_OBSERVABLE.ContentDataFacet)
@@ -191,7 +195,7 @@ def create_file_node(
191195
for key in successful_hashdict._fields:
192196
if key not in ("md5", "sha1", "sha256", "sha512"):
193197
continue
194-
n_hash = rdflib.BNode()
198+
n_hash = node_namespace["hash-" + case_utils.local_uuid.local_uuid()]
195199
graph.add((n_contentdata_facet, NS_UCO_OBSERVABLE.hash, n_hash))
196200
graph.add((n_hash, NS_RDF.type, NS_UCO_TYPES.Hash))
197201
graph.add(

case_utils/case_sparql_construct/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
This script executes a SPARQL CONSTRUCT query, returning a graph of the generated triples.
1616
"""
1717

18-
__version__ = "0.2.2"
18+
__version__ = "0.2.3"
1919

2020
import argparse
2121
import logging
2222
import os
2323
import sys
2424
import typing
2525

26-
import rdflib.plugins.sparql # type: ignore
26+
import rdflib.plugins.sparql
2727

2828
import case_utils.ontology
2929
from case_utils.ontology.version_info import (
@@ -90,7 +90,7 @@ def main() -> None:
9090
in_graph, built_version=args.built_version
9191
)
9292

93-
construct_query_object = rdflib.plugins.sparql.prepareQuery(
93+
construct_query_object = rdflib.plugins.sparql.processor.prepareQuery(
9494
construct_query_text, initNs=nsdict
9595
)
9696

case_utils/case_sparql_select/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
Should a more complex query be necessary, an outer, wrapping SELECT query would let this script continue to function.
2727
"""
2828

29-
__version__ = "0.4.2"
29+
__version__ = "0.4.3"
3030

3131
import argparse
3232
import binascii
@@ -35,7 +35,7 @@
3535
import sys
3636

3737
import pandas as pd # type: ignore
38-
import rdflib.plugins.sparql # type: ignore
38+
import rdflib.plugins.sparql
3939

4040
import case_utils.ontology
4141
from case_utils.ontology.version_info import (
@@ -107,7 +107,7 @@ def main() -> None:
107107

108108
tally = 0
109109
records = []
110-
select_query_object = rdflib.plugins.sparql.prepareQuery(
110+
select_query_object = rdflib.plugins.sparql.processor.prepareQuery(
111111
select_query_text, initNs=nsdict
112112
)
113113
for (row_no, row) in enumerate(graph.query(select_query_object)):

case_utils/case_validate/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
details.)
3030
"""
3131

32-
__version__ = "0.1.2"
32+
__version__ = "0.1.3"
3333

3434
import argparse
3535
import importlib.resources
@@ -39,7 +39,7 @@
3939
import typing
4040

4141
import pyshacl # type: ignore
42-
import rdflib.util # type: ignore
42+
import rdflib.util
4343

4444
import case_utils.ontology
4545
from case_utils.ontology.version_info import (

case_utils/namespace.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
To use, add "from case_utils.namespace import *". Namespace variables starting with "NS_" are imported. As needs are demonstrated in CASE tooling (both in case_utils and from downstream requests), namespaces will also be imported from rdflib for a consistent "NS_*" spelling.
1818
"""
1919

20-
__version__ = "0.1.0"
20+
__version__ = "0.2.0"
2121

22-
import rdflib # type: ignore
22+
import rdflib
2323

24-
NS_SH = rdflib.SH
24+
NS_OWL = rdflib.OWL
2525
NS_RDF = rdflib.RDF
26+
NS_RDFS = rdflib.RDFS
27+
NS_SH = rdflib.SH
2628
NS_XSD = rdflib.XSD
2729

2830
NS_CASE_INVESTIGATION = rdflib.Namespace(
@@ -31,9 +33,13 @@
3133
NS_CASE_VOCABULARY = rdflib.Namespace(
3234
"https://ontology.caseontology.org/case/vocabulary/"
3335
)
36+
NS_CO = rdflib.Namespace("http://purl.org/co/")
3437
NS_UCO_ACTION = rdflib.Namespace(
3538
"https://ontology.unifiedcyberontology.org/uco/action/"
3639
)
40+
NS_UCO_CONFIGURATION = rdflib.Namespace(
41+
"https://ontology.unifiedcyberontology.org/uco/configuration/"
42+
)
3743
NS_UCO_CORE = rdflib.Namespace("https://ontology.unifiedcyberontology.org/uco/core/")
3844
NS_UCO_IDENTITY = rdflib.Namespace(
3945
"https://ontology.unifiedcyberontology.org/uco/identity/"

0 commit comments

Comments
 (0)