Skip to content

Commit

Permalink
Merge pull request #61 from casework/release-0.6.0
Browse files Browse the repository at this point in the history
Release 0.6.0
  • Loading branch information
ajnelson-nist authored Dec 9, 2022
2 parents bfb38b5 + e7f663b commit 7179c54
Show file tree
Hide file tree
Showing 71 changed files with 3,927 additions and 1,606 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
matrix:
python-version:
- '3.7'
- '3.10'
- '3.11'

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

repos:
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 4.0.1
rev: 5.0.4
hooks:
- id: flake8
- repo: https://github.com/pycqa/isort
Expand Down
2 changes: 1 addition & 1 deletion case_prov/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
#
# We would appreciate acknowledgement if the software is used.

__version__ = "0.5.0"
__version__ = "0.6.0"
31 changes: 16 additions & 15 deletions case_prov/case_prov_dot.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# get quoted. This turns out to be a dot syntax error. Need to report
# this upstream to pydot.

__version__ = "0.3.0"
__version__ = "0.4.0"

import argparse
import collections
Expand All @@ -41,7 +41,7 @@

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

NS_PROV = rdflib.Namespace("http://www.w3.org/ns/prov#")
NS_PROV = rdflib.PROV
NS_RDFS = rdflib.RDFS

# This one isn't among the prov constants.
Expand Down Expand Up @@ -74,12 +74,6 @@ def iri_to_gv_node_id(iri: str) -> str:
return "_" + hasher.hexdigest()


def iri_to_short_iri(iri: str) -> str:
return iri.replace("http://example.org/kb/", "kb:").replace(
"http://www.w3.org/ns/prov#", "prov:"
)


def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("--debug", action="store_true")
Expand Down Expand Up @@ -145,7 +139,7 @@ def main() -> None:
filter_iris: typing.Optional[typing.Set[str]] = None
if args.from_empty_set:
filter_iris = set()
filter_iris.add("http://www.w3.org/ns/prov#EmptyCollection")
filter_iris.add(str(NS_PROV.EmptyCollection))
select_query_actions_text = """\
SELECT ?nDerivingAction
WHERE {
Expand Down Expand Up @@ -325,7 +319,7 @@ def main() -> None:
for record in graph.query(select_query_object):
(n_agent, l_label, l_comment) = record
agent_iri = n_agent.toPython()
dot_label = "ID - " + iri_to_short_iri(agent_iri)
dot_label = "ID - " + graph.namespace_manager.qname(agent_iri)
if l_label is not None:
dot_label += "\n" + l_label.toPython()
if l_comment is not None:
Expand All @@ -339,7 +333,7 @@ def main() -> None:
# _logger.debug("nodes = %s." % pprint.pformat(nodes))

# Find Collections, to adjust Entity rendering in the next block.
collection_iris = {"http://www.w3.org/ns/prov#EmptyCollection"}
collection_iris: typing.Set[str] = {str(NS_PROV.EmptyCollection)}
select_query_text = """\
SELECT ?nCollection
WHERE {
Expand All @@ -357,9 +351,16 @@ def main() -> None:

# Render Entities.
# This loop operates differently from the others, to insert prov:EmptyCollection.
entity_iri_to_label_comment = dict()
entity_iri_to_label_comment: typing.Dict[
str,
typing.Tuple[
typing.Optional[str],
typing.Optional[str],
typing.Optional[str],
],
] = dict()
if not args.omit_empty_set:
entity_iri_to_label_comment["http://www.w3.org/ns/prov#EmptyCollection"] = (
entity_iri_to_label_comment[str(NS_PROV.EmptyCollection)] = (
None,
None,
None,
Expand Down Expand Up @@ -391,7 +392,7 @@ def main() -> None:
entity_iri_to_label_comment[entity_iri] = (l_label, l_comment, l_exhibit_number)
for entity_iri in sorted(entity_iri_to_label_comment):
(l_label, l_comment, l_exhibit_number) = entity_iri_to_label_comment[entity_iri]
dot_label = "ID - " + iri_to_short_iri(entity_iri)
dot_label = "ID - " + graph.namespace_manager.qname(entity_iri)
if l_exhibit_number is not None:
dot_label += "\nExhibit - " + l_exhibit_number.toPython()
if l_label is not None:
Expand Down Expand Up @@ -437,7 +438,7 @@ def main() -> None:
for record in graph.query(select_query_object):
(n_activity, l_label, l_comment, l_start_time, l_end_time) = record
activity_iri = n_activity.toPython()
dot_label = "ID - " + iri_to_short_iri(activity_iri)
dot_label = "ID - " + graph.namespace_manager.qname(activity_iri)
if l_label is not None:
dot_label += "\n" + l_label.toPython()
if l_start_time is not None or l_end_time is not None:
Expand Down
4 changes: 2 additions & 2 deletions case_prov/case_prov_rdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
This script executes CONSTRUCT queries, returning a supplemental graph.
"""

__version__ = "0.2.1"
__version__ = "0.3.0"

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

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

NS_PROV = rdflib.Namespace("http://www.w3.org/ns/prov#")
NS_PROV = rdflib.PROV


def main() -> None:
Expand Down
2 changes: 2 additions & 0 deletions case_prov/queries/construct-wasDerivedFrom-map.sparql
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

CONSTRUCT {
?x prov:wasDerivedFrom ?y .
?x a prov:Entity .
?y a prov:Entity .
}
WHERE {
?x case-investigation:wasDerivedFrom ?y .
Expand Down
2 changes: 2 additions & 0 deletions case_prov/queries/construct-wasInformedBy-map.sparql
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

CONSTRUCT {
?x prov:wasInformedBy ?y .
?x a prov:Activity .
?y a prov:Activity .
}
WHERE {
?x case-investigation:wasInformedBy ?y .
Expand Down
2 changes: 1 addition & 1 deletion dependencies/CASE-Examples-QC
Submodule CASE-Examples-QC updated 119 files
10 changes: 5 additions & 5 deletions figures/readme-activities.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 16 additions & 16 deletions figures/readme-attribution.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 12 additions & 12 deletions figures/readme-provenance-records.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ license_files =
[options]
include_package_data = true
install_requires =
case_utils >=0.7.0,< 0.8.0
case_utils >=0.9.0,< 0.10.0
prov
pydot
packages = find:
Expand Down
8 changes: 8 additions & 0 deletions tests/CASE-Examples/examples/illustrations/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@

SHELL := /bin/bash

top_srcdir := $(shell cd ../../../.. ; pwd)

illustrations_srcdir := $(top_srcdir)/dependencies/CASE-Examples-QC/dependencies/CASE-Examples/examples/illustrations

illdirs := $(shell find * -maxdepth 0 -type d | sort | egrep -v '^src$$')

all_targets := $(foreach illdir,$(illdirs),all-$(illdir))
Expand All @@ -28,6 +32,10 @@ all-%:

check: \
$(check_targets)
@diff \
<(ls */prov-constraints.log | while read x; do dirname $$x ; done) \
<(cd $(illustrations_srcdir) ; ls */*.json | while read x; do dirname $$x ; done | sort | uniq) \
|| (echo "ERROR:Makefile:The illustrations listed above do not have evaluation directories under $(top_srcdir)/tests/CASE-Examples/examples/illustrations." >&2 ; exit 1)

check-%:
$(MAKE) \
Expand Down
8 changes: 3 additions & 5 deletions tests/CASE-Examples/examples/illustrations/Oresteia/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ all:
$<
mv _$@ $@

# TODO: Fix constraints errors, then uncomment the recipe to enforce unit testing.
check:
@echo "ERROR:PROV constraints reports errors for forensic_lifecycle.json, which need fixing." >&2
# $(MAKE) \
# --file ../src/illustration.mk \
# check
$(MAKE) \
--file ../src/illustration.mk \
check

clean:
@$(MAKE) \
Expand Down
Loading

0 comments on commit 7179c54

Please sign in to comment.