Skip to content

Commit f47bd6c

Browse files
authored
Merge pull request #106 from casework/release-0.10.0
Release 0.10.0
2 parents 102c9a0 + 3deb63d commit f47bd6c

File tree

24 files changed

+21131
-58
lines changed

24 files changed

+21131
-58
lines changed

.github/workflows/cicd.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ on:
2323
release:
2424
types:
2525
- published
26+
schedule:
27+
- cron: '15 5 * * TUE'
2628

2729
jobs:
2830
build:
@@ -31,7 +33,7 @@ jobs:
3133
strategy:
3234
matrix:
3335
python-version:
34-
- '3.7'
36+
- '3.8'
3537
- '3.11'
3638

3739
steps:

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
repos:
22
- repo: https://github.com/psf/black
3-
rev: 22.10.0
3+
rev: 23.1.0
44
hooks:
55
- id: black
66
- repo: https://github.com/pycqa/flake8
7-
rev: 5.0.4
7+
rev: 6.0.0
88
hooks:
99
- id: flake8
1010
- repo: https://github.com/pycqa/isort
11-
rev: 5.10.1
11+
rev: 5.12.0
1212
hooks:
1313
- id: isort
1414
name: isort (python)

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.9.0"
14+
__version__ = "0.10.0"
1515

1616
from . import local_uuid # noqa: F401

case_utils/case_file/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
DEFAULT_PREFIX = "http://example.org/kb/"
4141

42+
4243
# Shortcut syntax for defining an immutable named tuple is noted here:
4344
# https://docs.python.org/3/library/typing.html#typing.NamedTuple
4445
# via the "See also" box here: https://docs.python.org/3/library/collections.html#collections.namedtuple

case_utils/case_sparql_construct/__init__.py

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

18-
__version__ = "0.2.4"
18+
__version__ = "0.2.5"
1919

2020
import argparse
2121
import logging
@@ -98,10 +98,11 @@ def main() -> None:
9898
construct_query_result = in_graph.query(construct_query_object)
9999
_logger.debug("type(construct_query_result) = %r." % type(construct_query_result))
100100
_logger.debug("len(construct_query_result) = %d." % len(construct_query_result))
101-
for (row_no, row) in enumerate(construct_query_result):
101+
for row_no, row in enumerate(construct_query_result):
102+
assert isinstance(row, tuple)
102103
if row_no == 0:
103104
_logger.debug("row[0] = %r." % (row,))
104-
out_graph.add(row)
105+
out_graph.add((row[0], row[1], row[2]))
105106

106107
output_format = None
107108
if args.output_format is None:

case_utils/case_sparql_select/__init__.py

Lines changed: 13 additions & 12 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.5.0"
29+
__version__ = "0.5.1"
3030

3131
import argparse
3232
import binascii
@@ -86,26 +86,27 @@ def graph_and_query_to_data_frame(
8686
select_query_object = rdflib.plugins.sparql.processor.prepareQuery(
8787
select_query_text, initNs=nsdict
8888
)
89-
for (row_no, row) in enumerate(_graph.query(select_query_object)):
89+
for row_no, row in enumerate(_graph.query(select_query_object)):
90+
assert isinstance(row, rdflib.query.ResultRow)
9091
tally = row_no + 1
9192
record = []
92-
for (column_no, column) in enumerate(row):
93+
for column_no, column in enumerate(row):
9394
if column is None:
9495
column_value = ""
95-
elif (
96-
isinstance(column, rdflib.term.Literal)
97-
and column.datatype == NS_XSD.hexBinary
98-
):
99-
# Use hexlify to convert xsd:hexBinary to ASCII.
100-
# The render to ASCII is in support of this script rendering results for website viewing.
101-
# .decode() is because hexlify returns bytes.
102-
column_value = binascii.hexlify(column.toPython()).decode()
96+
elif isinstance(column, rdflib.term.Literal):
97+
if column.datatype == NS_XSD.hexBinary:
98+
# Use hexlify to convert xsd:hexBinary to ASCII.
99+
# The render to ASCII is in support of this script rendering results for website viewing.
100+
# .decode() is because hexlify returns bytes.
101+
column_value = binascii.hexlify(column.toPython()).decode()
102+
else:
103+
column_value = column.toPython()
103104
elif isinstance(column, rdflib.URIRef):
104105
if use_prefixes:
105106
column_value = graph.namespace_manager.qname(column.toPython())
106107
else:
107108
column_value = column.toPython()
108-
else:
109+
elif isinstance(column, rdflib.BNode):
109110
column_value = column.toPython()
110111
if row_no == 0:
111112
_logger.debug("row[0]column[%d] = %r." % (column_no, column_value))

case_utils/local_uuid.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
This library is a wrapper for uuid, provided to generate repeatable UUIDs if requested.
1616
"""
1717

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

2020
import logging
2121
import os
@@ -33,6 +33,9 @@
3333

3434

3535
def configure() -> None:
36+
"""
37+
This function is part of setting up demo_uuid() to generate non-random UUIDs. See demo_uuid() documentation for further setup notes.
38+
"""
3639
global DEMO_UUID_BASE
3740

3841
if os.getenv("DEMO_UUID_REQUESTING_NONRANDOM") == "NONRANDOM_REQUESTED":
@@ -112,7 +115,10 @@ def demo_uuid() -> str:
112115
113116
WARNING: This function was developed for use ONLY for reducing (but not eliminating) version-control edits to identifiers when generating sample data. It creates UUIDs that are decidedly NOT random, and should remain consistent on repeated calls to the importing script.
114117
115-
To prevent accidental non-random UUID usage, an environment variable, CASE_DEMO_NONRANDOM_UUID_BASE, must be set to a string provided by the caller. The variable's required value is the path to some directory. The variable's recommended value is the equivalent of the Make variable "top_srcdir" - that is, the root directory of the containing Git repository, some parent of the current process's current working directory.
118+
To prevent accidental non-random UUID usage, two setup steps need to be done before calling this function:
119+
120+
* An environment variable, CASE_DEMO_NONRANDOM_UUID_BASE, must be set to a string provided by the caller. The variable's required value is the path to some directory. The variable's recommended value is the equivalent of the Make variable "top_srcdir" - that is, the root directory of the containing Git repository, some parent of the current process's current working directory.
121+
* The configure() function in this module must be called.
116122
"""
117123
global DEMO_UUID_BASE
118124
global DEMO_UUID_COUNTER

case_utils/ontology/Makefile

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,16 @@ all: \
2929
.PRECIOUS: \
3030
case-$(case_version).ttl
3131

32+
$(case_srcdir)/.venv.done.log: \
33+
$(top_srcdir)/.git_submodule_init.done.log
34+
$(MAKE) \
35+
--directory $(case_srcdir) \
36+
.venv.done.log
37+
touch -c $@
38+
test -r $@
39+
3240
case-$(case_version).ttl: \
33-
$(top_srcdir)/.git_submodule_init.done.log \
41+
$(case_srcdir)/.venv.done.log \
3442
$(RDF_TOOLKIT_JAR)
3543
$(MAKE) \
3644
--directory $(case_srcdir)/tests \
@@ -47,10 +55,7 @@ case-$(case_version)-subclasses.ttl: \
4755
# release is being made, that step will have been skipped.
4856
# This recursive Make call guarantees the virtual environment is
4957
# set up.
50-
$(MAKE) \
51-
--directory $(case_srcdir)/tests \
52-
.venv.done.log
53-
source $(case_srcdir)/tests/venv/bin/activate \
58+
source $(case_srcdir)/venv/bin/activate \
5459
&& python3 src/subclasses_ttl.py \
5560
__$@ \
5661
$<
@@ -70,11 +75,7 @@ clean:
7075
ontology_and_version_iris.txt: \
7176
src/ontology_and_version_iris.py \
7277
case-$(case_version)-subclasses.ttl
73-
# Guarantee venv is built. (Same rationale as in the subclasses.ttl recipe.)
74-
$(MAKE) \
75-
--directory $(case_srcdir)/tests \
76-
.venv.done.log
77-
source $(case_srcdir)/tests/venv/bin/activate \
78+
source $(case_srcdir)/venv/bin/activate \
7879
&& python3 src/ontology_and_version_iris.py \
7980
_$@ \
8081
case-*.ttl

0 commit comments

Comments
 (0)