Skip to content

Use typing symbols directly #119

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 1 commit into from
Jul 25, 2023
Merged
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
12 changes: 5 additions & 7 deletions case_utils/case_validate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
import logging
import os
import sys
import typing
import warnings
from typing import Dict, Set, Tuple, Union

import pyshacl # type: ignore
import rdflib
Expand Down Expand Up @@ -182,7 +182,7 @@ def main() -> None:
ontology_graph.parse(arg_ontology_graph)

# Construct set of CDO concepts for data graph concept-existence review.
cdo_concepts: typing.Set[rdflib.URIRef] = set()
cdo_concepts: Set[rdflib.URIRef] = set()

for n_structural_class in [
NS_OWL.Class,
Expand Down Expand Up @@ -230,7 +230,7 @@ def main() -> None:
continue
cdo_concepts.add(rdflib.URIRef(cleaned_line))

data_cdo_concepts: typing.Set[rdflib.URIRef] = set()
data_cdo_concepts: 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):
Expand All @@ -255,13 +255,11 @@ def main() -> None:
# determination by output file extension. case_validate will defer
# to pySHACL behavior, as other CASE tools don't (at the time of
# this writing) have the value "human" as an output format.
validator_kwargs: typing.Dict[str, str] = dict()
validator_kwargs: Dict[str, str] = dict()
if args.format != "human":
validator_kwargs["serialize_report_graph"] = args.format

validate_result: typing.Tuple[
bool, typing.Union[Exception, bytes, str, rdflib.Graph], str
]
validate_result: Tuple[bool, Union[Exception, bytes, str, rdflib.Graph], str]
validate_result = pyshacl.validate(
data_graph,
shacl_graph=ontology_graph,
Expand Down