From a55ceac6c4cd497f9d612c817c40b6701275a9b8 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Wed, 16 Nov 2022 15:50:30 -0500 Subject: [PATCH 1/5] Add CDO concept typo-checker based on set-differencing URIRefs using CDO prefixes A follow-on patch will regenerate Make-managed files. References: * https://github.com/casework/CASE-Utilities-Python/issues/40 Signed-off-by: Alex Nelson --- case_utils/case_validate/__init__.py | 82 ++++++++++++++++++- tests/case_utils/case_validate/cli/Makefile | 32 ++++++++ .../case_validate/cli/errant_cdo_concept.ttl | 17 ++++ 3 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 tests/case_utils/case_validate/cli/errant_cdo_concept.ttl diff --git a/case_utils/case_validate/__init__.py b/case_utils/case_validate/__init__.py index e80079f..cce4492 100644 --- a/case_utils/case_validate/__init__.py +++ b/case_utils/case_validate/__init__.py @@ -37,9 +37,10 @@ import os import sys import typing +import warnings import pyshacl # type: ignore -import rdflib.util +import rdflib import case_utils.ontology from case_utils.ontology.version_info import ( @@ -47,9 +48,28 @@ built_version_choices_list, ) +NS_OWL = rdflib.OWL +NS_RDF = rdflib.RDF +NS_RDFS = rdflib.RDFS + _logger = logging.getLogger(os.path.basename(__file__)) +class NonExistentCDOConceptWarning(UserWarning): + """ + This class is used when a concept is encountered in the data graph that is not part of CDO ontologies, according to the --built-version flags and --ontology-graph flags. + """ + + pass + + +def concept_is_cdo_concept(n_concept: rdflib.URIRef) -> bool: + concept_iri = str(n_concept) + return concept_iri.startswith( + "https://ontology.unifiedcyberontology.org/" + ) or concept_iri.startswith("https://ontology.caseontology.org/") + + def main() -> None: parser = argparse.ArgumentParser( description="CASE wrapper to pySHACL command line tool." @@ -160,6 +180,59 @@ def main() -> None: _logger.debug("arg_ontology_graph = %r.", arg_ontology_graph) ontology_graph.parse(arg_ontology_graph) + cdo_concepts: typing.Set[rdflib.URIRef] = set() + for n_structural_class in [ + NS_OWL.Class, + NS_OWL.AnnotationProperty, + NS_OWL.DatatypeProperty, + NS_OWL.ObjectProperty, + NS_RDFS.Datatype, + ]: + for ontology_triple in ontology_graph.triples( + (None, NS_RDF.type, n_structural_class) + ): + if not isinstance(ontology_triple[0], rdflib.URIRef): + continue + if concept_is_cdo_concept(ontology_triple[0]): + cdo_concepts.add(ontology_triple[0]) + for n_ontology_predicate in [ + NS_OWL.backwardCompatibleWith, + NS_OWL.imports, + NS_OWL.incompatibleWith, + NS_OWL.priorVersion, + NS_OWL.versionIRI, + ]: + for ontology_triple in ontology_graph.triples( + (None, n_ontology_predicate, None) + ): + assert isinstance(ontology_triple[0], rdflib.URIRef) + assert isinstance(ontology_triple[2], rdflib.URIRef) + cdo_concepts.add(ontology_triple[0]) + cdo_concepts.add(ontology_triple[2]) + for ontology_triple in ontology_graph.triples((None, NS_RDF.type, NS_OWL.Ontology)): + if not isinstance(ontology_triple[0], rdflib.URIRef): + continue + cdo_concepts.add(ontology_triple[0]) + + data_cdo_concepts: typing.Set[rdflib.URIRef] = set() + for data_triple in data_graph.triples((None, None, None)): + for data_triple_member in data_triple: + if isinstance(data_triple_member, rdflib.URIRef): + if concept_is_cdo_concept(data_triple_member): + data_cdo_concepts.add(data_triple_member) + elif isinstance(data_triple_member, rdflib.Literal): + if isinstance(data_triple_member.datatype, rdflib.URIRef): + if concept_is_cdo_concept(data_triple_member.datatype): + data_cdo_concepts.add(data_triple_member.datatype) + + undefined_cdo_concepts = data_cdo_concepts - cdo_concepts + for undefined_cdo_concept in sorted(undefined_cdo_concepts): + warnings.warn(undefined_cdo_concept, NonExistentCDOConceptWarning) + undefined_cdo_concepts_message = ( + "There were %d concepts with CDO IRIs in the data graph that are not in the ontology graph." + % len(undefined_cdo_concepts) + ) + # Determine output format. # pySHACL's determination of output formatting is handled solely # through the -f flag. Other CASE CLI tools handle format @@ -214,6 +287,13 @@ def main() -> None: % type(validation_graph) ) + if len(undefined_cdo_concepts) > 0: + warnings.warn(undefined_cdo_concepts_message) + if not args.allow_warnings: + undefined_cdo_concepts_alleviation_message = "The data graph is SHACL-conformant with the CDO ontologies, but nonexistent-concept references raise Warnings with this tool. Please either correct the concept names in the data graph; use the --ontology-graph flag to pass a corrected CDO ontology file, also using --built-version none; or, use the --allow-warnings flag." + warnings.warn(undefined_cdo_concepts_alleviation_message) + conforms = False + sys.exit(0 if conforms else 1) diff --git a/tests/case_utils/case_validate/cli/Makefile b/tests/case_utils/case_validate/cli/Makefile index 22c5fe1..8a453e5 100644 --- a/tests/case_utils/case_validate/cli/Makefile +++ b/tests/case_utils/case_validate/cli/Makefile @@ -24,6 +24,8 @@ tests_srcdir := $(top_srcdir)/tests RDF_TOOLKIT_JAR := $(case_srcdir)/lib/rdf-toolkit.jar files_to_generate := \ + errant_cdo_concept_PASS.txt \ + errant_cdo_concept_XFAIL.txt \ format_human_output_jsonld.jsonld \ format_human_output_turtle.ttl \ format_human_output_txt.txt \ @@ -57,6 +59,36 @@ clean: @rm -f \ $(files_to_generate) +errant_cdo_concept_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 \ + errant_cdo_concept.ttl + rm -f _$@ + source $(tests_srcdir)/venv/bin/activate \ + && case_validate \ + --allow-warnings \ + --debug \ + errant_cdo_concept.ttl \ + > _$@ + mv _$@ $@ + +errant_cdo_concept_XFAIL.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 \ + errant_cdo_concept.ttl + rm -f _$@ + source $(tests_srcdir)/venv/bin/activate \ + && case_validate \ + errant_cdo_concept.ttl \ + --debug \ + > _$@ \ + ; test 1 -eq $$? + mv _$@ $@ + format_human_output_%: \ $(examples_srcdir)/investigative_action_PASS_validation.ttl \ $(tests_srcdir)/.venv.done.log \ diff --git a/tests/case_utils/case_validate/cli/errant_cdo_concept.ttl b/tests/case_utils/case_validate/cli/errant_cdo_concept.ttl new file mode 100644 index 0000000..c15783a --- /dev/null +++ b/tests/case_utils/case_validate/cli/errant_cdo_concept.ttl @@ -0,0 +1,17 @@ +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix uco-core: . +@prefix uco-vocabulary: . +@prefix xsd: . + + + a uco-core:UcoThing ; + uco-core:nonExistentProperty1 "test 1 - raises 1 warning."@en ; + . + + + a uco-core:UcoThing ; + uco-core:nonExistentProperty2 "test 2 - raises 2 warnings."^^uco-vocabulary:NonExistentVocabulary1 ; + . + From dfcd1fa5eac94307e44fe53cce22281eaeede977 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Wed, 16 Nov 2022 17:08:25 -0500 Subject: [PATCH 2/5] Confirm output is generated in XFAIL case Syntax errors or other code halts will cause _$@ to be empty. Signed-off-by: Alex Nelson --- tests/case_utils/case_validate/cli/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/case_utils/case_validate/cli/Makefile b/tests/case_utils/case_validate/cli/Makefile index 8a453e5..0655184 100644 --- a/tests/case_utils/case_validate/cli/Makefile +++ b/tests/case_utils/case_validate/cli/Makefile @@ -87,6 +87,7 @@ errant_cdo_concept_XFAIL.txt: \ --debug \ > _$@ \ ; test 1 -eq $$? + test -s _$@ mv _$@ $@ format_human_output_%: \ @@ -248,6 +249,7 @@ split_data_graph_XFAIL.txt: \ split_data_graph_1.json \ > _$@ \ ; rc=$$? ; test 1 -eq $$rc + test -s _$@ mv _$@ $@ thing_metashacl_PASS.txt: \ From 4941189e5115eee86ca3ba187bd204799b116eb9 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Wed, 16 Nov 2022 17:14:09 -0500 Subject: [PATCH 3/5] Generate Make-managed file This file records the history of CDO IRIs that are ontology IRIs or somehow related to ontology versioning. A follow-on patch will add the scripts that generated this file. For CI and git-bisect purposes, the patch storing the generated file needs to be committed first. References: * https://github.com/casework/CASE-Utilities-Python/issues/40 Signed-off-by: Alex Nelson --- .../ontology/ontology_and_version_iris.txt | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 case_utils/ontology/ontology_and_version_iris.txt diff --git a/case_utils/ontology/ontology_and_version_iris.txt b/case_utils/ontology/ontology_and_version_iris.txt new file mode 100644 index 0000000..3fa7d2b --- /dev/null +++ b/case_utils/ontology/ontology_and_version_iris.txt @@ -0,0 +1,72 @@ +http://case.example.org/core +https://ontology.caseontology.org/case/case +https://ontology.caseontology.org/case/case/0.7.1 +https://ontology.caseontology.org/case/case/1.0.0 +https://ontology.caseontology.org/case/investigation +https://ontology.caseontology.org/case/investigation/0.7.1 +https://ontology.caseontology.org/case/investigation/1.0.0 +https://ontology.caseontology.org/case/vocabulary +https://ontology.caseontology.org/case/vocabulary/0.7.1 +https://ontology.caseontology.org/case/vocabulary/1.0.0 +https://ontology.unifiedcyberontology.org/co +https://ontology.unifiedcyberontology.org/co/1.0.0 +https://ontology.unifiedcyberontology.org/owl +https://ontology.unifiedcyberontology.org/owl/1.0.0 +https://ontology.unifiedcyberontology.org/uco/action +https://ontology.unifiedcyberontology.org/uco/action/0.9.1 +https://ontology.unifiedcyberontology.org/uco/action/1.0.0 +https://ontology.unifiedcyberontology.org/uco/configuration +https://ontology.unifiedcyberontology.org/uco/configuration/1.0.0 +https://ontology.unifiedcyberontology.org/uco/core +https://ontology.unifiedcyberontology.org/uco/core/0.9.1 +https://ontology.unifiedcyberontology.org/uco/core/1.0.0 +https://ontology.unifiedcyberontology.org/uco/identity +https://ontology.unifiedcyberontology.org/uco/identity/0.9.1 +https://ontology.unifiedcyberontology.org/uco/identity/1.0.0 +https://ontology.unifiedcyberontology.org/uco/location +https://ontology.unifiedcyberontology.org/uco/location/0.9.1 +https://ontology.unifiedcyberontology.org/uco/location/1.0.0 +https://ontology.unifiedcyberontology.org/uco/marking +https://ontology.unifiedcyberontology.org/uco/marking/0.9.1 +https://ontology.unifiedcyberontology.org/uco/marking/1.0.0 +https://ontology.unifiedcyberontology.org/uco/observable +https://ontology.unifiedcyberontology.org/uco/observable/0.9.1 +https://ontology.unifiedcyberontology.org/uco/observable/1.0.0 +https://ontology.unifiedcyberontology.org/uco/pattern +https://ontology.unifiedcyberontology.org/uco/pattern/0.9.1 +https://ontology.unifiedcyberontology.org/uco/pattern/1.0.0 +https://ontology.unifiedcyberontology.org/uco/role +https://ontology.unifiedcyberontology.org/uco/role/0.9.1 +https://ontology.unifiedcyberontology.org/uco/role/1.0.0 +https://ontology.unifiedcyberontology.org/uco/time +https://ontology.unifiedcyberontology.org/uco/time/0.9.1 +https://ontology.unifiedcyberontology.org/uco/time/1.0.0 +https://ontology.unifiedcyberontology.org/uco/tool +https://ontology.unifiedcyberontology.org/uco/tool/0.9.1 +https://ontology.unifiedcyberontology.org/uco/tool/1.0.0 +https://ontology.unifiedcyberontology.org/uco/types +https://ontology.unifiedcyberontology.org/uco/types/0.9.1 +https://ontology.unifiedcyberontology.org/uco/types/1.0.0 +https://ontology.unifiedcyberontology.org/uco/uco +https://ontology.unifiedcyberontology.org/uco/uco/0.9.1 +https://ontology.unifiedcyberontology.org/uco/uco/1.0.0 +https://ontology.unifiedcyberontology.org/uco/victim +https://ontology.unifiedcyberontology.org/uco/victim/0.9.1 +https://ontology.unifiedcyberontology.org/uco/victim/1.0.0 +https://ontology.unifiedcyberontology.org/uco/vocabulary +https://ontology.unifiedcyberontology.org/uco/vocabulary/0.9.1 +https://ontology.unifiedcyberontology.org/uco/vocabulary/1.0.0 +https://unifiedcyberontology.org/ontology/uco/action +https://unifiedcyberontology.org/ontology/uco/core +https://unifiedcyberontology.org/ontology/uco/identity +https://unifiedcyberontology.org/ontology/uco/location +https://unifiedcyberontology.org/ontology/uco/marking +https://unifiedcyberontology.org/ontology/uco/observable +https://unifiedcyberontology.org/ontology/uco/pattern +https://unifiedcyberontology.org/ontology/uco/role +https://unifiedcyberontology.org/ontology/uco/time +https://unifiedcyberontology.org/ontology/uco/tool +https://unifiedcyberontology.org/ontology/uco/types +https://unifiedcyberontology.org/ontology/uco/uco +https://unifiedcyberontology.org/ontology/uco/victim +https://unifiedcyberontology.org/ontology/uco/vocabulary From 2a908c729f4798560c102c32f1112ec419a7420c Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Wed, 16 Nov 2022 17:17:27 -0500 Subject: [PATCH 4/5] Add past CDO ontology and version IRIs to existing-concept review A follow-on patch will regenerate Make-managed files. References: * https://github.com/casework/CASE-Utilities-Python/issues/40 Signed-off-by: Alex Nelson --- CONTRIBUTE.md | 6 +- case_utils/case_validate/__init__.py | 12 +++ case_utils/ontology/Makefile | 15 +++- .../ontology/src/ontology_and_version_iris.py | 90 +++++++++++++++++++ tests/case_utils/case_validate/cli/Makefile | 32 +++++++ .../cli/past_version_reference_PASS.ttl | 12 +++ .../cli/past_version_reference_XFAIL.ttl | 12 +++ 7 files changed, 176 insertions(+), 3 deletions(-) create mode 100644 case_utils/ontology/src/ontology_and_version_iris.py create mode 100644 tests/case_utils/case_validate/cli/past_version_reference_PASS.ttl create mode 100644 tests/case_utils/case_validate/cli/past_version_reference_XFAIL.ttl diff --git a/CONTRIBUTE.md b/CONTRIBUTE.md index 2e73b90..ec539b9 100644 --- a/CONTRIBUTE.md +++ b/CONTRIBUTE.md @@ -27,10 +27,12 @@ pushd case_utils/ontology git add case-0.6.0.ttl # Assuming CASE 0.6.0 was just released. # and/or git add uco-0.8.0.ttl # Assuming UCO 0.8.0 was adopted in CASE 0.6.0. + + git add ontology_and_version_iris.txt popd make check # Assuming `make check` passes: -git commit -m "Build CASE 0.6.0 monolithic .ttl files" case_utils/ontology/case-0.6.0-subclasses.ttl case_utils/ontology/case-0.6.0.ttl +git commit -m "Build CASE 0.6.0 monolithic .ttl files" case_utils/ontology/case-0.6.0-subclasses.ttl case_utils/ontology/case-0.6.0.ttl case_utils/ontology/ontology_and_version_iris.txt git commit -m "Update CASE ontology pointer to version 0.6.0" dependencies/CASE case_utils/ontology/version_info.py ``` @@ -43,4 +45,4 @@ pre-commit --version The `pre-commit` tool hooks into Git's commit machinery to run a set of linters and static analyzers over each change. To install `pre-commit` into Git's hooks, run: ```bash pre-commit install -``` \ No newline at end of file +``` diff --git a/case_utils/case_validate/__init__.py b/case_utils/case_validate/__init__.py index cce4492..c278fee 100644 --- a/case_utils/case_validate/__init__.py +++ b/case_utils/case_validate/__init__.py @@ -180,7 +180,9 @@ def main() -> None: _logger.debug("arg_ontology_graph = %r.", arg_ontology_graph) ontology_graph.parse(arg_ontology_graph) + # Construct set of CDO concepts for data graph concept-existence review. cdo_concepts: typing.Set[rdflib.URIRef] = set() + for n_structural_class in [ NS_OWL.Class, NS_OWL.AnnotationProperty, @@ -214,6 +216,16 @@ def main() -> None: continue cdo_concepts.add(ontology_triple[0]) + # Also load historical ontology and version IRIs. + ontology_and_version_iris_data = importlib.resources.read_text( + case_utils.ontology, "ontology_and_version_iris.txt" + ) + for line in ontology_and_version_iris_data.split("\n"): + cleaned_line = line.strip() + if cleaned_line == "": + continue + cdo_concepts.add(rdflib.URIRef(cleaned_line)) + data_cdo_concepts: typing.Set[rdflib.URIRef] = set() for data_triple in data_graph.triples((None, None, None)): for data_triple_member in data_triple: diff --git a/case_utils/ontology/Makefile b/case_utils/ontology/Makefile index a01b9a7..44cec68 100644 --- a/case_utils/ontology/Makefile +++ b/case_utils/ontology/Makefile @@ -24,7 +24,7 @@ RDF_TOOLKIT_JAR := $(uco_srcdir)/lib/rdf-toolkit.jar case_version := $(shell python3 version_info.py) all: \ - case-$(case_version)-subclasses.ttl + ontology_and_version_iris.txt .PRECIOUS: \ case-$(case_version).ttl @@ -79,3 +79,16 @@ case-$(case_version)-subclasses.ttl: \ clean: @rm -f \ case-$(case_version)*.ttl + +ontology_and_version_iris.txt: \ + src/ontology_and_version_iris.py \ + case-$(case_version)-subclasses.ttl + # Guarantee venv is built. (Same rationale as in the subclasses.ttl recipe.) + $(MAKE) \ + --directory $(case_srcdir)/tests \ + .venv.done.log + source $(case_srcdir)/tests/venv/bin/activate \ + && python3 src/ontology_and_version_iris.py \ + _$@ \ + case-*.ttl + mv _$@ $@ diff --git a/case_utils/ontology/src/ontology_and_version_iris.py b/case_utils/ontology/src/ontology_and_version_iris.py new file mode 100644 index 0000000..74f2304 --- /dev/null +++ b/case_utils/ontology/src/ontology_and_version_iris.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python3 + +# This software was developed at the National Institute of Standards +# and Technology by employees of the Federal Government in the course +# of their official duties. Pursuant to title 17 Section 105 of the +# United States Code this software is not subject to copyright +# protection and is in the public domain. NIST assumes no +# responsibility whatsoever for its use by other parties, and makes +# no guarantees, expressed or implied, about its quality, +# reliability, or any other characteristic. +# +# We would appreciate acknowledgement if the software is used. + +""" +This script creates a list of all ontology and version IRIs that have ever existed in a CDO ontology to describe a CDO ontology. I.e. the subject of triples with owl:Ontology as predicate are included, as are the objects of version-referencing triples (owl:versionIRI, owl:incompatibleWith, etc.). +""" + +__version__ = "0.1.0" + +import argparse +import typing + +import rdflib + +NS_OWL = rdflib.OWL +NS_RDF = rdflib.RDF + + +def concept_is_cdo_concept(n_concept: rdflib.URIRef) -> bool: + """ + This function is purposefully distinct from the function used in case_validate. Within this script, the publishing history of CASE and UCO is reviewed.""" + concept_iri = str(n_concept) + return ( + concept_iri.startswith("https://ontology.unifiedcyberontology.org/") + or concept_iri.startswith("https://ontology.caseontology.org/") + or concept_iri.startswith("https://unifiedcyberontology.org/ontology/") + or concept_iri.startswith("https://caseontology.org/ontology/") + or concept_iri == "http://case.example.org/core" + ) + + +def extract_ontology_iris(ontology_graph: rdflib.Graph) -> typing.Set[rdflib.URIRef]: + """ + Return all concepts describing the OWL Ontology in the input graph. This does not return classes, properties, etc. defined within the ontology; instead, it only returns the ontology IRI and annotations about the ontology. + """ + ontology_concepts: typing.Set[rdflib.URIRef] = set() + for n_ontology_predicate in [ + NS_OWL.backwardCompatibleWith, + NS_OWL.imports, + NS_OWL.incompatibleWith, + NS_OWL.priorVersion, + NS_OWL.versionIRI, + ]: + for ontology_triple in ontology_graph.triples( + (None, n_ontology_predicate, None) + ): + assert isinstance(ontology_triple[0], rdflib.URIRef) + assert isinstance(ontology_triple[2], rdflib.URIRef) + ontology_concepts.add(ontology_triple[0]) + ontology_concepts.add(ontology_triple[2]) + for ontology_triple in ontology_graph.triples((None, NS_RDF.type, NS_OWL.Ontology)): + if not isinstance(ontology_triple[0], rdflib.URIRef): + continue + if concept_is_cdo_concept(ontology_triple[0]): + ontology_concepts.add(ontology_triple[0]) + return ontology_concepts + + +def main() -> None: + parser = argparse.ArgumentParser() + parser.add_argument("out_txt") + parser.add_argument("in_ttl", nargs="+") + args = parser.parse_args() + + cdo_concepts: typing.Set[rdflib.URIRef] = set() + for in_ttl in args.in_ttl: + ontology_graph = rdflib.Graph() + ontology_graph.parse(in_ttl) + ontology_concepts = extract_ontology_iris(ontology_graph) + for ontology_concept in ontology_concepts: + if concept_is_cdo_concept(ontology_concept): + cdo_concepts.add(ontology_concept) + + with open(args.out_txt, "w") as out_fh: + for cdo_concept in sorted(cdo_concepts): + print(cdo_concept, file=out_fh) + + +if __name__ == "__main__": + main() diff --git a/tests/case_utils/case_validate/cli/Makefile b/tests/case_utils/case_validate/cli/Makefile index 0655184..dc78c50 100644 --- a/tests/case_utils/case_validate/cli/Makefile +++ b/tests/case_utils/case_validate/cli/Makefile @@ -42,6 +42,8 @@ files_to_generate := \ format_unspecified_output_turtle.ttl \ format_unspecified_output_txt.txt \ format_unspecified_output_unspecified.txt \ + past_version_reference_PASS.txt \ + past_version_reference_XFAIL.txt \ split_data_graph_PASS.txt \ split_data_graph_XFAIL.txt \ thing_metashacl_PASS.txt @@ -220,6 +222,36 @@ format_unspecified_output_unspecified.txt: \ > _$@ mv _$@ $@ +past_version_reference_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 \ + $(top_srcdir)/case_utils/ontology/ontology_and_version_iris.txt \ + past_version_reference_PASS.ttl + rm -f _$@ + source $(tests_srcdir)/venv/bin/activate \ + && case_validate \ + past_version_reference_PASS.ttl \ + > _$@ + mv _$@ $@ + +past_version_reference_XFAIL.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 \ + $(top_srcdir)/case_utils/ontology/ontology_and_version_iris.txt \ + past_version_reference_XFAIL.ttl + rm -f _$@ + source $(tests_srcdir)/venv/bin/activate \ + && case_validate \ + past_version_reference_XFAIL.ttl \ + > _$@ \ + ; rc=$$? ; test 1 -eq $$rc + test -s _$@ + mv _$@ $@ + split_data_graph_PASS.txt: \ $(tests_srcdir)/.venv.done.log \ $(top_srcdir)/.ontology.done.log \ diff --git a/tests/case_utils/case_validate/cli/past_version_reference_PASS.ttl b/tests/case_utils/case_validate/cli/past_version_reference_PASS.ttl new file mode 100644 index 0000000..322f4f2 --- /dev/null +++ b/tests/case_utils/case_validate/cli/past_version_reference_PASS.ttl @@ -0,0 +1,12 @@ +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix uco-core: . +@prefix xsd: . + + + a uco-core:UcoThing ; + rdfs:comment "This node maintains a historic reference to 0.9.1 of the UCO namespace. This must not trigger an undefined-concept warning."@en ; + rdfs:seeAlso uco-core:0.9.1 ; + . + diff --git a/tests/case_utils/case_validate/cli/past_version_reference_XFAIL.ttl b/tests/case_utils/case_validate/cli/past_version_reference_XFAIL.ttl new file mode 100644 index 0000000..1a6892a --- /dev/null +++ b/tests/case_utils/case_validate/cli/past_version_reference_XFAIL.ttl @@ -0,0 +1,12 @@ +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix uco-core: . +@prefix xsd: . + + + a uco-core:UcoThing ; + rdfs:comment "This node references a never-published UCO Core namespace version. This is expected to trigger a warning."@en ; + rdfs:seeAlso uco-core:0.0.1 ; + . + From 9bd90a1467d9fb99f1288857dffceb18fa176f0d Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Wed, 16 Nov 2022 17:17:51 -0500 Subject: [PATCH 5/5] Regenerate Make-managed files References: * https://github.com/casework/CASE-Utilities-Python/issues/40 Signed-off-by: Alex Nelson --- tests/case_utils/case_validate/cli/errant_cdo_concept_PASS.txt | 2 ++ tests/case_utils/case_validate/cli/errant_cdo_concept_XFAIL.txt | 2 ++ .../case_validate/cli/past_version_reference_PASS.txt | 2 ++ .../case_validate/cli/past_version_reference_XFAIL.txt | 2 ++ 4 files changed, 8 insertions(+) create mode 100644 tests/case_utils/case_validate/cli/errant_cdo_concept_PASS.txt create mode 100644 tests/case_utils/case_validate/cli/errant_cdo_concept_XFAIL.txt create mode 100644 tests/case_utils/case_validate/cli/past_version_reference_PASS.txt create mode 100644 tests/case_utils/case_validate/cli/past_version_reference_XFAIL.txt diff --git a/tests/case_utils/case_validate/cli/errant_cdo_concept_PASS.txt b/tests/case_utils/case_validate/cli/errant_cdo_concept_PASS.txt new file mode 100644 index 0000000..0c16da6 --- /dev/null +++ b/tests/case_utils/case_validate/cli/errant_cdo_concept_PASS.txt @@ -0,0 +1,2 @@ +Validation Report +Conforms: True diff --git a/tests/case_utils/case_validate/cli/errant_cdo_concept_XFAIL.txt b/tests/case_utils/case_validate/cli/errant_cdo_concept_XFAIL.txt new file mode 100644 index 0000000..0c16da6 --- /dev/null +++ b/tests/case_utils/case_validate/cli/errant_cdo_concept_XFAIL.txt @@ -0,0 +1,2 @@ +Validation Report +Conforms: True diff --git a/tests/case_utils/case_validate/cli/past_version_reference_PASS.txt b/tests/case_utils/case_validate/cli/past_version_reference_PASS.txt new file mode 100644 index 0000000..0c16da6 --- /dev/null +++ b/tests/case_utils/case_validate/cli/past_version_reference_PASS.txt @@ -0,0 +1,2 @@ +Validation Report +Conforms: True diff --git a/tests/case_utils/case_validate/cli/past_version_reference_XFAIL.txt b/tests/case_utils/case_validate/cli/past_version_reference_XFAIL.txt new file mode 100644 index 0000000..0c16da6 --- /dev/null +++ b/tests/case_utils/case_validate/cli/past_version_reference_XFAIL.txt @@ -0,0 +1,2 @@ +Validation Report +Conforms: True