Skip to content

Release 0.7.0 #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1029468
Merge pull request #61 from casework/release-0.6.0
kchason Jun 17, 2022
0bf8595
Clean end-of-line whitespace
ajnelson-nist Jul 12, 2022
ee8ea66
Adjust package name to PyPI practice
ajnelson-nist Jul 12, 2022
d4e0378
Bump rdflib requirement to new release
ajnelson-nist Jul 27, 2022
fcecda1
Change exclude pattern
ajnelson-nist Jul 27, 2022
89a3d49
Test with mypy --strict
ajnelson-nist Jul 27, 2022
6e88e4a
Merge pull request #62 from casework/test_mypy_strict
kchason Jul 28, 2022
dab39b0
Build CASE 0.7.1 monolithic .ttl files
ajnelson-nist Sep 1, 2022
bf9b2ab
Update CASE ontology pointer to version 0.7.1
ajnelson-nist Sep 1, 2022
b16d082
Regenerate Make-managed files
ajnelson-nist Sep 1, 2022
faeafe2
Merge pull request #63 from casework/add_case_0.7.1
kchason Sep 1, 2022
a49b62c
Use URIRefs for Facets
ajnelson-nist Sep 1, 2022
33ebd89
Regenerate Make-managed files
ajnelson-nist Sep 1, 2022
d78453d
Merge pull request #64 from casework/use_urirefs_for_facets
kchason Sep 1, 2022
3cc7c59
Build CASE 1.0.0 monolithic .ttl files
ajnelson-nist Sep 1, 2022
a2c0ad4
Add copy of monolithic CASE build for a UCO test
ajnelson-nist Sep 1, 2022
0e1054e
Apply suggested node identifier practice
ajnelson-nist Sep 1, 2022
f4280b6
Regenerate Make-managed files
ajnelson-nist Sep 1, 2022
c26db47
Move repeated file references into Make variable
ajnelson-nist Sep 1, 2022
135ddd3
Update CASE ontology pointer to version 1.0.0
ajnelson-nist Sep 1, 2022
87d4a2a
Regenerate Make-managed files
ajnelson-nist Sep 1, 2022
44d8029
Review UCO pytest with mypy --strict
ajnelson-nist Sep 1, 2022
1e9e3ae
Merge pull request #65 from casework/add_case_1.0.0
ajnelson-nist Sep 2, 2022
d491815
Clean errant list fragment
ajnelson-nist Sep 2, 2022
ae0bace
Replace glom_graph.py with rdfpipe
ajnelson-nist Sep 2, 2022
21e4978
Add RDFS, OWL, and other Namespaces new to UCO 1.0.0
ajnelson-nist Sep 2, 2022
fa59d06
Merge pull request #66 from casework/Feature-UCO-Issue-424
ajnelson-nist Sep 2, 2022
ebee1a2
Merge pull request #67 from casework/add_namespaces
ajnelson-nist Sep 2, 2022
6fd7919
Bump version
ajnelson-nist Sep 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ check: \

clean:
@$(MAKE) \
PYTHON3=$(PYTHON3) \
--directory tests \
clean
@rm -f \
Expand Down Expand Up @@ -123,5 +124,6 @@ distclean: \
download: \
.git_submodule_init.done.log
$(MAKE) \
PYTHON3=$(PYTHON3) \
--directory tests \
download
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ This repository can be installed from PyPI or from source.
### Installing from PyPI

```bash
pip install case_utils
pip install case-utils
```

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.)


### Installing from source

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

1. Clone this repository.
2. (Optional) Create and activate a virtual environment.
Expand Down
2 changes: 1 addition & 1 deletion case_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
#
# We would appreciate acknowledgement if the software is used.

__version__ = "0.6.0"
__version__ = "0.7.0"

from . import local_uuid # noqa: F401
16 changes: 10 additions & 6 deletions case_utils/case_file/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
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.
"""

__version__ = "0.3.2"
__version__ = "0.4.0"

import argparse
import datetime
Expand All @@ -25,7 +25,7 @@
import typing
import warnings

import rdflib # type: ignore
import rdflib

import case_utils
from case_utils.namespace import (
Expand Down Expand Up @@ -82,17 +82,19 @@ def create_file_node(
:returns: The File Observable Object's node.
:rtype: rdflib.URIRef
"""
node_namespace = rdflib.Namespace(node_prefix)

if node_iri is None:
node_slug = "file-" + case_utils.local_uuid.local_uuid()
node_iri = rdflib.Namespace(node_prefix)[node_slug]
node_iri = node_namespace[node_slug]
n_file = rdflib.URIRef(node_iri)
graph.add((n_file, NS_RDF.type, NS_UCO_OBSERVABLE.File))

basename = os.path.basename(filepath)
literal_basename = rdflib.Literal(basename)

file_stat = os.stat(filepath)
n_file_facet = rdflib.BNode()
n_file_facet = node_namespace["file-facet-" + case_utils.local_uuid.local_uuid()]
graph.add(
(
n_file_facet,
Expand All @@ -119,7 +121,9 @@ def create_file_node(
graph.add((n_file_facet, NS_UCO_OBSERVABLE.modifiedTime, literal_mtime))

if not disable_hashes:
n_contentdata_facet = rdflib.BNode()
n_contentdata_facet = node_namespace[
"content-data-facet-" + case_utils.local_uuid.local_uuid()
]
graph.add((n_file, NS_UCO_CORE.hasFacet, n_contentdata_facet))
graph.add(
(n_contentdata_facet, NS_RDF.type, NS_UCO_OBSERVABLE.ContentDataFacet)
Expand Down Expand Up @@ -191,7 +195,7 @@ def create_file_node(
for key in successful_hashdict._fields:
if key not in ("md5", "sha1", "sha256", "sha512"):
continue
n_hash = rdflib.BNode()
n_hash = node_namespace["hash-" + case_utils.local_uuid.local_uuid()]
graph.add((n_contentdata_facet, NS_UCO_OBSERVABLE.hash, n_hash))
graph.add((n_hash, NS_RDF.type, NS_UCO_TYPES.Hash))
graph.add(
Expand Down
6 changes: 3 additions & 3 deletions case_utils/case_sparql_construct/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
This script executes a SPARQL CONSTRUCT query, returning a graph of the generated triples.
"""

__version__ = "0.2.2"
__version__ = "0.2.3"

import argparse
import logging
import os
import sys
import typing

import rdflib.plugins.sparql # type: ignore
import rdflib.plugins.sparql

import case_utils.ontology
from case_utils.ontology.version_info import (
Expand Down Expand Up @@ -90,7 +90,7 @@ def main() -> None:
in_graph, built_version=args.built_version
)

construct_query_object = rdflib.plugins.sparql.prepareQuery(
construct_query_object = rdflib.plugins.sparql.processor.prepareQuery(
construct_query_text, initNs=nsdict
)

Expand Down
6 changes: 3 additions & 3 deletions case_utils/case_sparql_select/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
Should a more complex query be necessary, an outer, wrapping SELECT query would let this script continue to function.
"""

__version__ = "0.4.2"
__version__ = "0.4.3"

import argparse
import binascii
Expand All @@ -35,7 +35,7 @@
import sys

import pandas as pd # type: ignore
import rdflib.plugins.sparql # type: ignore
import rdflib.plugins.sparql

import case_utils.ontology
from case_utils.ontology.version_info import (
Expand Down Expand Up @@ -107,7 +107,7 @@ def main() -> None:

tally = 0
records = []
select_query_object = rdflib.plugins.sparql.prepareQuery(
select_query_object = rdflib.plugins.sparql.processor.prepareQuery(
select_query_text, initNs=nsdict
)
for (row_no, row) in enumerate(graph.query(select_query_object)):
Expand Down
4 changes: 2 additions & 2 deletions case_utils/case_validate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
details.)
"""

__version__ = "0.1.2"
__version__ = "0.1.3"

import argparse
import importlib.resources
Expand All @@ -39,7 +39,7 @@
import typing

import pyshacl # type: ignore
import rdflib.util # type: ignore
import rdflib.util

import case_utils.ontology
from case_utils.ontology.version_info import (
Expand Down
12 changes: 9 additions & 3 deletions case_utils/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
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.
"""

__version__ = "0.1.0"
__version__ = "0.2.0"

import rdflib # type: ignore
import rdflib

NS_SH = rdflib.SH
NS_OWL = rdflib.OWL
NS_RDF = rdflib.RDF
NS_RDFS = rdflib.RDFS
NS_SH = rdflib.SH
NS_XSD = rdflib.XSD

NS_CASE_INVESTIGATION = rdflib.Namespace(
Expand All @@ -31,9 +33,13 @@
NS_CASE_VOCABULARY = rdflib.Namespace(
"https://ontology.caseontology.org/case/vocabulary/"
)
NS_CO = rdflib.Namespace("http://purl.org/co/")
NS_UCO_ACTION = rdflib.Namespace(
"https://ontology.unifiedcyberontology.org/uco/action/"
)
NS_UCO_CONFIGURATION = rdflib.Namespace(
"https://ontology.unifiedcyberontology.org/uco/configuration/"
)
NS_UCO_CORE = rdflib.Namespace("https://ontology.unifiedcyberontology.org/uco/core/")
NS_UCO_IDENTITY = rdflib.Namespace(
"https://ontology.unifiedcyberontology.org/uco/identity/"
Expand Down
Loading