Skip to content
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

Release 0.12.0 #61

Merged
merged 9 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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)
13 changes: 6 additions & 7 deletions case_gnu_time/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,22 @@
This library parses the output of GNU Time into a UCO Process graph node.
"""

__version__ = "0.11.0"
__version__ = "0.12.0"

import argparse
import datetime
import logging
import os
import typing

import case_utils
import case_utils.inherent_uuid
import cdo_local_uuid
import dateutil
import dateutil.parser
import dateutil.relativedelta
import rdflib.util
from case_utils.namespace import NS_RDF, NS_UCO_CORE, NS_UCO_OBSERVABLE, NS_XSD
from cdo_local_uuid import local_uuid

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

Expand All @@ -56,7 +57,7 @@ def __init__(
self._use_deterministic_uuids = use_deterministic_uuids

# Guarantee at least one triple enters the graph.
self._node = ns_base[prefix_slug + case_utils.local_uuid.local_uuid()]
self._node = ns_base[prefix_slug + local_uuid()]
self.graph.add((self.node, NS_RDF.type, NS_UCO_OBSERVABLE.Process))

self._n_process_facet: typing.Optional[rdflib.URIRef] = None
Expand Down Expand Up @@ -180,9 +181,7 @@ def n_process_facet(self) -> rdflib.URIRef:
namespace=self.ns_base,
)
else:
self._n_process_facet = self.ns_base[
"ProcessFacet-" + case_utils.local_uuid.local_uuid()
]
self._n_process_facet = self.ns_base["ProcessFacet-" + local_uuid()]
self.graph.add(
(self._n_process_facet, NS_RDF.type, NS_UCO_OBSERVABLE.ProcessFacet)
)
Expand Down Expand Up @@ -232,7 +231,7 @@ def build_process_object(

The optional argument prefix_slug is a short prefix to add to the node's in-namespace identifier, ending with "-". If absent, the ProcessUCOObject will supply a default of "Process-".
"""
case_utils.local_uuid.configure()
cdo_local_uuid.configure()

process_object_kwargs: typing.Dict[str, typing.Any] = {
"use_deterministic_uuids": use_deterministic_uuids,
Expand Down
2 changes: 1 addition & 1 deletion dependencies/CASE-Utilities-Python
Submodule CASE-Utilities-Python updated 49 files
+20 −15 .github/workflows/cicd.yml
+42 −0 .github/workflows/prerelease.yml
+3 −3 .pre-commit-config.yaml
+24 −6 Makefile
+4 −2 README.md
+10 −9 case_utils/__init__.py
+18 −15 case_utils/case_file/__init__.py
+10 −7 case_utils/case_sparql_construct/__init__.py
+10 −7 case_utils/case_sparql_select/__init__.py
+121 −133 case_utils/case_validate/__init__.py
+51 −0 case_utils/case_validate/validate_types.py
+206 −0 case_utils/case_validate/validate_utils.py
+11 −8 case_utils/inherent_uuid.py
+18 −137 case_utils/local_uuid.py
+10 −7 case_utils/namespace.py
+9 −6 case_utils/ontology/Makefile
+10 −7 case_utils/ontology/__init__.py
+10 −7 case_utils/ontology/src/ontology_and_version_iris.py
+10 −7 case_utils/ontology/src/subclasses_ttl.py
+10 −7 case_utils/ontology/version_info.py
+9 −6 case_utils/py.typed
+4 −3 setup.cfg
+9 −6 setup.py
+19 −11 tests/Makefile
+9 −6 tests/case_utils/Makefile
+16 −14 tests/case_utils/case_file/Makefile
+9 −6 tests/case_utils/case_file/sample_txt.py
+9 −6 tests/case_utils/case_file/test_case_file.py
+9 −6 tests/case_utils/case_sparql_construct/Makefile
+9 −6 tests/case_utils/case_sparql_construct/test_case_sparql_construct.py
+1 −0 tests/case_utils/case_sparql_select/.check-w3-output-with_header-without_index-orient-records.json
+1 −0 tests/case_utils/case_sparql_select/.check-w3-output-with_header-without_index-orient-values.json
+1 −0 tests/case_utils/case_sparql_select/.check-w3-output-without_header-without_index-orient-records.json
+1 −0 tests/case_utils/case_sparql_select/.check-w3-output-without_header-without_index-orient-values.json
+9 −6 tests/case_utils/case_sparql_select/Makefile
+24 −9 tests/case_utils/case_sparql_select/test_data_frame_to_table_text_json.py
+9 −6 tests/case_utils/case_validate/Makefile
+11 −6 tests/case_utils/case_validate/case_test_examples/Makefile
+29 −21 tests/case_utils/case_validate/cli/Makefile
+9 −6 tests/case_utils/case_validate/cli/test_format_output_flags.py
+15 −6 tests/case_utils/case_validate/shape_disabling/Makefile
+74 −9 tests/case_utils/case_validate/uco_test_examples/Makefile
+9 −6 tests/case_utils/ontology/test_version_info.py
+9 −6 tests/case_utils/test_guess_format.py
+0 −34 tests/case_utils/test_local_uuid.py
+9 −6 tests/hexbinary/test_hexbinary.py
+9 −6 tests/isomorphic_diff/Makefile
+10 −7 tests/src/compact.py
+10 −7 tests/src/isomorphic_diff.py
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/as_import/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ process.ttl: \
echo.txt.done.log \
echo.txt.time.log
rm -f _$@ __$@
export CASE_DEMO_NONRANDOM_UUID_BASE=$(top_srcdir) \
export CDO_DEMO_NONRANDOM_UUID_BASE=$(top_srcdir) \
&& source $(tests_srcdir)/venv/bin/activate \
&& python consumer.py \
--done-log echo.txt.done.log \
Expand Down
6 changes: 3 additions & 3 deletions tests/as_import/process.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"@graph": [
{
"@id": "kb:ProcessFacet-febe39f1-082e-5804-a98a-95552c482bd3",
"@id": "kb:ProcessFacet-1c061412-e2ca-5f0c-a728-df4c82d6a36c",
"@type": "uco-observable:ProcessFacet",
"uco-observable:exitStatus": {
"@type": "xsd:integer",
Expand All @@ -24,10 +24,10 @@
}
},
{
"@id": "kb:custom-b8c7cbdd-8e0f-55e5-8132-5aa1f1f65841",
"@id": "kb:custom-3d60c688-14ed-5563-ba9b-5935a0e752ae",
"@type": "uco-observable:Process",
"uco-core:hasFacet": {
"@id": "kb:ProcessFacet-febe39f1-082e-5804-a98a-95552c482bd3"
"@id": "kb:ProcessFacet-1c061412-e2ca-5f0c-a728-df4c82d6a36c"
}
}
]
Expand Down
6 changes: 3 additions & 3 deletions tests/as_import/process.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
@prefix uco-observable: <https://ontology.unifiedcyberontology.org/uco/observable/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

kb:ProcessFacet-febe39f1-082e-5804-a98a-95552c482bd3
kb:ProcessFacet-1c061412-e2ca-5f0c-a728-df4c82d6a36c
a uco-observable:ProcessFacet ;
uco-observable:exitStatus "0"^^xsd:integer ;
uco-observable:exitTime "2020-10-14T14:07:39.267912-04:00"^^xsd:dateTime ;
uco-observable:observableCreatedTime "2020-10-14T14:07:39.267912-04:00"^^xsd:dateTime ;
.

kb:custom-b8c7cbdd-8e0f-55e5-8132-5aa1f1f65841
kb:custom-3d60c688-14ed-5563-ba9b-5935a0e752ae
a uco-observable:Process ;
uco-core:hasFacet kb:ProcessFacet-febe39f1-082e-5804-a98a-95552c482bd3 ;
uco-core:hasFacet kb:ProcessFacet-1c061412-e2ca-5f0c-a728-df4c82d6a36c ;
.

2 changes: 1 addition & 1 deletion tests/from_pip/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ process.ttl: \
echo.txt.done.log \
echo.txt.time.log
rm -f _$@ __$@
export CASE_DEMO_NONRANDOM_UUID_BASE=$(top_srcdir) \
export CDO_DEMO_NONRANDOM_UUID_BASE=$(top_srcdir) \
&& source $(tests_srcdir)/venv/bin/activate \
&& case_gnu_time \
--done-log echo.txt.done.log \
Expand Down
10 changes: 6 additions & 4 deletions tests/gtime_and_done_log/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

SHELL := /bin/bash

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

top_srcdir := $(shell cd $(top_srcdir_relative) ; pwd)

tests_srcdir := $(top_srcdir)/tests

Expand Down Expand Up @@ -72,7 +74,7 @@ process.json: \
--target __$@ \
--target-format json-ld
source $(tests_srcdir)/venv_minimal/bin/activate \
&& python3 $(top_srcdir)/dependencies/CASE-Utilities-Python/tests/src/compact.py \
&& python3 $(top_srcdir_relative)/dependencies/CASE-Utilities-Python/tests/src/compact.py \
_$@ \
__$@
source $(tests_srcdir)/venv_minimal/bin/activate \
Expand All @@ -88,9 +90,9 @@ process.ttl: \
echo.txt.done.log \
echo.txt.time.log
rm -f _$@ __$@
export CASE_DEMO_NONRANDOM_UUID_BASE=$(top_srcdir) \
export CDO_DEMO_NONRANDOM_UUID_BASE=$(top_srcdir) \
&& source $(tests_srcdir)/venv_minimal/bin/activate \
&& python $(top_srcdir)/case_gnu_time/__init__.py \
&& python $(top_srcdir_relative)/case_gnu_time/__init__.py \
--use-deterministic-uuids \
--done-log echo.txt.done.log \
echo.txt.time.log \
Expand Down
6 changes: 3 additions & 3 deletions tests/gtime_and_done_log/process.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
},
"@graph": [
{
"@id": "kb:Process-4219d007-bb66-5a42-9f87-23df6719ccd7",
"@id": "kb:Process-52accca8-fd44-5ce7-aa32-29bbaeb1f8ab",
"@type": "uco-observable:Process",
"uco-core:hasFacet": {
"@id": "kb:ProcessFacet-cfbb7c77-7147-51e3-80ea-436f41321263"
"@id": "kb:ProcessFacet-30d66625-1d57-59ef-a0ac-9b351498d4c7"
}
},
{
"@id": "kb:ProcessFacet-cfbb7c77-7147-51e3-80ea-436f41321263",
"@id": "kb:ProcessFacet-30d66625-1d57-59ef-a0ac-9b351498d4c7",
"@type": "uco-observable:ProcessFacet",
"uco-observable:exitStatus": {
"@type": "xsd:integer",
Expand Down
6 changes: 3 additions & 3 deletions tests/gtime_and_done_log/process.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
@prefix uco-observable: <https://ontology.unifiedcyberontology.org/uco/observable/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

kb:Process-4219d007-bb66-5a42-9f87-23df6719ccd7
kb:Process-52accca8-fd44-5ce7-aa32-29bbaeb1f8ab
a uco-observable:Process ;
uco-core:hasFacet kb:ProcessFacet-cfbb7c77-7147-51e3-80ea-436f41321263 ;
uco-core:hasFacet kb:ProcessFacet-30d66625-1d57-59ef-a0ac-9b351498d4c7 ;
.

kb:ProcessFacet-cfbb7c77-7147-51e3-80ea-436f41321263
kb:ProcessFacet-30d66625-1d57-59ef-a0ac-9b351498d4c7
a uco-observable:ProcessFacet ;
uco-observable:exitStatus "0"^^xsd:integer ;
uco-observable:exitTime "2020-10-14T14:07:39.267912-04:00"^^xsd:dateTime ;
Expand Down
8 changes: 5 additions & 3 deletions tests/gtime_log/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

SHELL := /bin/bash

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

top_srcdir := $(shell cd $(top_srcdir_relative) ; pwd)

tests_srcdir := $(top_srcdir)/tests

Expand Down Expand Up @@ -76,9 +78,9 @@ process.ttl: \
$(top_srcdir)/case_gnu_time/__init__.py \
echo.txt.time.log
rm -f _$@ __$@
export CASE_DEMO_NONRANDOM_UUID_BASE=$(top_srcdir) \
export CDO_DEMO_NONRANDOM_UUID_BASE=$(top_srcdir) \
&& source $(tests_srcdir)/venv_minimal/bin/activate \
&& python $(top_srcdir)/case_gnu_time/__init__.py \
&& python $(top_srcdir_relative)/case_gnu_time/__init__.py \
--use-deterministic-uuids \
echo.txt.time.log \
__$@
Expand Down
10 changes: 5 additions & 5 deletions tests/gtime_log/process.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@
},
"@graph": [
{
"@id": "kb:Process-50c15694-b966-5564-8301-e6981197616e",
"@id": "kb:Process-e83152fe-c1e3-5efc-815b-a40b7b9c0bfd",
"@type": "uco-observable:Process",
"uco-core:hasFacet": {
"@id": "kb:ProcessFacet-4b5a3bc7-6784-5dfd-856b-4660a54e1a24"
"@id": "kb:ProcessFacet-d39f7c77-3e2e-529b-96e9-66fbcab4d65a"
}
},
{
"@id": "kb:ProcessFacet-4b5a3bc7-6784-5dfd-856b-4660a54e1a24",
"@id": "kb:ProcessFacet-d39f7c77-3e2e-529b-96e9-66fbcab4d65a",
"@type": "uco-observable:ProcessFacet",
"uco-observable:exitStatus": {
"@type": "xsd:integer",
"@value": "0"
},
"uco-observable:exitTime": {
"@type": "xsd:dateTime",
"@value": "2023-06-21T13:21:25.031279+00:00"
"@value": "2023-04-25T22:21:27.353879+00:00"
},
"uco-observable:observableCreatedTime": {
"@type": "xsd:dateTime",
"@value": "2023-06-21T13:21:25.031279+00:00"
"@value": "2023-04-25T22:21:27.353879+00:00"
}
}
]
Expand Down
10 changes: 5 additions & 5 deletions tests/gtime_log/process.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
@prefix uco-observable: <https://ontology.unifiedcyberontology.org/uco/observable/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

kb:Process-50c15694-b966-5564-8301-e6981197616e
kb:Process-e83152fe-c1e3-5efc-815b-a40b7b9c0bfd
a uco-observable:Process ;
uco-core:hasFacet kb:ProcessFacet-4b5a3bc7-6784-5dfd-856b-4660a54e1a24 ;
uco-core:hasFacet kb:ProcessFacet-d39f7c77-3e2e-529b-96e9-66fbcab4d65a ;
.

kb:ProcessFacet-4b5a3bc7-6784-5dfd-856b-4660a54e1a24
kb:ProcessFacet-d39f7c77-3e2e-529b-96e9-66fbcab4d65a
a uco-observable:ProcessFacet ;
uco-observable:exitStatus "0"^^xsd:integer ;
uco-observable:exitTime "2023-06-21T13:21:25.031279+00:00"^^xsd:dateTime ;
uco-observable:observableCreatedTime "2023-06-21T13:21:25.031279+00:00"^^xsd:dateTime ;
uco-observable:exitTime "2023-04-25T22:21:27.353879+00:00"^^xsd:dateTime ;
uco-observable:observableCreatedTime "2023-04-25T22:21:27.353879+00:00"^^xsd:dateTime ;
.

Loading