Skip to content

Forward-port metashacl flag from pyshacl #76

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 2 commits into from
Nov 16, 2022
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
9 changes: 9 additions & 0 deletions case_utils/case_validate/__init__.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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 ;
.

2 changes: 2 additions & 0 deletions tests/case_utils/case_validate/cli/thing_metashacl_PASS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Validation Report
Conforms: True