Skip to content

Commit

Permalink
Merge pull request #51 from casework/release-0.10.0
Browse files Browse the repository at this point in the history
Release 0.10.0
  • Loading branch information
ajnelson-nist authored Jan 10, 2024
2 parents 6e86107 + 7343c0a commit 852b94b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 35 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
repos:
- repo: https://github.com/psf/black
rev: 23.11.0
rev: 23.12.1
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
48 changes: 18 additions & 30 deletions case_exiftool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
This tool parses the RDF output of ExifTool, mapping it into UCO properties and relationships-of-assumption. An analyst should later annotate the output with their beliefs on its verity.
"""

__version__ = "0.9.0"
__version__ = "0.10.0"

import argparse
import contextlib
Expand All @@ -24,6 +24,7 @@
import typing

import case_utils.inherent_uuid
import cdo_local_uuid
import rdflib.plugins.sparql
import rdflib.util
from case_utils.namespace import (
Expand All @@ -36,6 +37,7 @@
NS_UCO_TYPES,
NS_XSD,
)
from cdo_local_uuid import local_uuid

_logger = logging.getLogger(os.path.basename(__file__))

Expand Down Expand Up @@ -85,9 +87,7 @@ def controlled_dictionary_object_to_node(
ns_base: rdflib.Namespace,
controlled_dict: typing.Dict[str, rdflib.Literal],
) -> rdflib.URIRef:
n_controlled_dictionary = ns_base[
"ControlledDictionary-" + case_utils.local_uuid.local_uuid()
]
n_controlled_dictionary = ns_base["ControlledDictionary-" + local_uuid()]
graph.add((n_controlled_dictionary, NS_RDF.type, NS_UCO_TYPES.ControlledDictionary))
for key in sorted(controlled_dict.keys()):
v_value = controlled_dict[key]
Expand All @@ -96,9 +96,7 @@ def controlled_dictionary_object_to_node(
except AssertionError:
_logger.info("v_value = %r." % v_value)
raise
n_entry = ns_base[
"ControlledDictionaryEntry-" + case_utils.local_uuid.local_uuid()
]
n_entry = ns_base["ControlledDictionaryEntry-" + local_uuid()]
graph.add((n_controlled_dictionary, NS_UCO_TYPES.entry, n_entry))
graph.add((n_entry, NS_RDF.type, NS_UCO_TYPES.ControlledDictionaryEntry))
graph.add((n_entry, NS_UCO_TYPES.key, rdflib.Literal(key)))
Expand All @@ -119,7 +117,7 @@ def manufacturer_name_to_node(
"""
n_manufacturer: typing.Optional[rdflib.URIRef] = None
if printconv_name is not None or raw_name is not None:
n_manufacturer = ns_base["Identity-" + case_utils.local_uuid.local_uuid()]
n_manufacturer = ns_base["Identity-" + local_uuid()]
graph.add((n_manufacturer, NS_RDF.type, NS_UCO_IDENTITY.Identity))

if printconv_name is not None:
Expand Down Expand Up @@ -523,9 +521,7 @@ def n_camera_object(self) -> rdflib.URIRef:
Initialized on first access.
"""
if self._n_camera_object is None:
self._n_camera_object = self.ns_base[
"Device-" + case_utils.local_uuid.local_uuid()
]
self._n_camera_object = self.ns_base["Device-" + local_uuid()]
self.graph.add(
(self._n_camera_object, NS_RDF.type, NS_UCO_OBSERVABLE.ObservableObject)
)
Expand All @@ -547,7 +543,7 @@ def n_camera_object_device_facet(self) -> rdflib.URIRef:
)
else:
self._n_camera_object_device_facet = self.ns_base[
"DeviceFacet-" + case_utils.local_uuid.local_uuid()
"DeviceFacet-" + local_uuid()
]
self.graph.add(
(
Expand Down Expand Up @@ -579,7 +575,7 @@ def n_content_data_facet(self) -> rdflib.URIRef:
)
else:
self._n_content_data_facet = self.ns_base[
"ContentDataFacet-" + case_utils.local_uuid.local_uuid()
"ContentDataFacet-" + local_uuid()
]
self.graph.add(
(
Expand Down Expand Up @@ -628,9 +624,7 @@ def n_exif_facet(self) -> rdflib.URIRef:
namespace=self.ns_base,
)
else:
self._n_exif_facet = self.ns_base[
"EXIFFacet-" + case_utils.local_uuid.local_uuid()
]
self._n_exif_facet = self.ns_base["EXIFFacet-" + local_uuid()]
self.graph.add(
(self._n_exif_facet, NS_RDF.type, NS_UCO_OBSERVABLE.EXIFFacet)
)
Expand All @@ -652,9 +646,7 @@ def n_file_facet(self) -> rdflib.URIRef:
namespace=self.ns_base,
)
else:
self._n_file_facet = self.ns_base[
"FileFacet-" + case_utils.local_uuid.local_uuid()
]
self._n_file_facet = self.ns_base["FileFacet-" + local_uuid()]
self.graph.add(
(self._n_file_facet, NS_RDF.type, NS_UCO_OBSERVABLE.FileFacet)
)
Expand All @@ -669,9 +661,7 @@ def n_location_object(self) -> rdflib.URIRef:
Initialized on first access.
"""
if self._n_location_object is None:
self._n_location_object = self.ns_base[
"Location-" + case_utils.local_uuid.local_uuid()
]
self._n_location_object = self.ns_base["Location-" + local_uuid()]
self.graph.add(
(self._n_location_object, NS_RDF.type, NS_UCO_LOCATION.Location)
)
Expand All @@ -693,7 +683,7 @@ def n_location_object_latlong_facet(self) -> rdflib.URIRef:
)
else:
self._n_location_object_latlong_facet = self.ns_base[
"LatLongCoordinatesFacet-" + case_utils.local_uuid.local_uuid()
"LatLongCoordinatesFacet-" + local_uuid()
]
self.graph.add(
(
Expand All @@ -718,9 +708,7 @@ def n_observable_object(self) -> rdflib.URIRef:
"""
if self._n_observable_object is None:
assert isinstance(self.oo_slug, str)
self._n_observable_object = self.ns_base[
self.oo_slug + case_utils.local_uuid.local_uuid()
]
self._n_observable_object = self.ns_base[self.oo_slug + local_uuid()]
# TODO Prepare list of more interesting types on adoption of the UCO release providing the ObservableObject subclass hierarchy.
self.graph.add(
(
Expand All @@ -747,7 +735,7 @@ def n_raster_picture_facet(self) -> rdflib.URIRef:
)
else:
self._n_raster_picture_facet = self.ns_base[
"RasterPictureFacet-" + case_utils.local_uuid.local_uuid()
"RasterPictureFacet-" + local_uuid()
]
self.graph.add(
(
Expand All @@ -772,7 +760,7 @@ def n_relationship_object_location(self) -> rdflib.URIRef:
"""
if self._n_relationship_object_location is None:
self._n_relationship_object_location = self.ns_base[
"Relationship-" + case_utils.local_uuid.local_uuid()
"Relationship-" + local_uuid()
]
self.graph.add(
(
Expand Down Expand Up @@ -827,7 +815,7 @@ def n_unix_file_permissions_facet(self) -> rdflib.URIRef:
)
else:
self._n_unix_file_permissions_facet = self.ns_base[
"UNIXFilePermissionsFacet-" + case_utils.local_uuid.local_uuid()
"UNIXFilePermissionsFacet-" + local_uuid()
]
self.graph.add(
(
Expand Down Expand Up @@ -872,7 +860,7 @@ def use_deterministic_uuids(self) -> bool:


def main() -> None:
case_utils.local_uuid.configure()
cdo_local_uuid.configure()

args = argument_parser.parse_args()
logging.basicConfig(level=logging.DEBUG if args.debug else logging.INFO)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ classifiers =

[options]
install_requires =
case_utils >= 0.14.0, < 0.15.0
case_utils >= 0.15.0, < 0.16.0
python-dateutil
packages = find:
python_requires = >=3.9
Expand Down
2 changes: 1 addition & 1 deletion tests/govdocs1/files/799/987/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ analysis.ttl: \
$(top_srcdir)/case_exiftool/__init__.py \
799987_printConv.xml \
799987_raw.xml
export CASE_DEMO_NONRANDOM_UUID_BASE=$(top_srcdir) \
export CDO_DEMO_NONRANDOM_UUID_BASE=$(top_srcdir) \
&& source $(top_srcdir)/tests/venv/bin/activate \
&& case_exiftool \
--output-format turtle \
Expand Down

0 comments on commit 852b94b

Please sign in to comment.