Skip to content

Commit

Permalink
Forward-port metashacl flag from pyshacl
Browse files Browse the repository at this point in the history
A follow-on patch will regenerate Make-managed files.

References:
* #74
* ucoProject/UCO#504

Signed-off-by: Alex Nelson <alexander.nelson@nist.gov>
  • Loading branch information
ajnelson-nist committed Nov 15, 2022
1 parent af48b83 commit 4c9d714
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
9 changes: 9 additions & 0 deletions case_utils/case_validate/__init__.py
Expand Up @@ -122,6 +122,14 @@ def main() -> None:
default="none",
help='(As with pyshacl CLI) Choose a type of inferencing to run against the Data Graph before validating. Default is "none".',
)
parser.add_argument(
"-m",
"--metashacl",
dest="metashacl",
action="store_true",
default=False,
help="(As with pyshacl CLI) Validate the SHACL Shapes graph against the shacl-shacl Shapes Graph before validating the Data Graph.",
)
parser.add_argument(
"-o",
"--output",
Expand Down Expand Up @@ -170,6 +178,7 @@ def main() -> None:
shacl_graph=ontology_graph,
ont_graph=ontology_graph,
inference=args.inference,
meta_shacl=args.metashacl,
abort_on_first=args.abort,
allow_infos=True if args.allow_infos else False,
allow_warnings=True if args.allow_warnings else False,
Expand Down
17 changes: 16 additions & 1 deletion tests/case_utils/case_validate/cli/Makefile
Expand Up @@ -41,7 +41,8 @@ files_to_generate := \
format_unspecified_output_txt.txt \
format_unspecified_output_unspecified.txt \
split_data_graph_PASS.txt \
split_data_graph_XFAIL.txt
split_data_graph_XFAIL.txt \
thing_metashacl_PASS.txt

all: \
$(files_to_generate)
Expand Down Expand Up @@ -216,3 +217,17 @@ split_data_graph_XFAIL.txt: \
> _$@ \
; rc=$$? ; test 1 -eq $$rc
mv _$@ $@

thing_metashacl_PASS.txt: \
$(tests_srcdir)/.venv.done.log \
$(top_srcdir)/.ontology.done.log \
$(top_srcdir)/case_utils/case_validate/__init__.py \
$(top_srcdir)/case_utils/ontology/__init__.py \
thing.ttl
rm -f _$@
source $(tests_srcdir)/venv/bin/activate \
&& case_validate \
--metashacl \
thing.ttl \
> _$@
mv _$@ $@
9 changes: 9 additions & 0 deletions tests/case_utils/case_validate/cli/thing.ttl
@@ -0,0 +1,9 @@
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

[]
a owl:Thing ;
.

0 comments on commit 4c9d714

Please sign in to comment.