Skip to content

Commit

Permalink
Upgrade pyshacl and replace Validator with validate function (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
crisely09 authored Sep 30, 2023
1 parent fc6177c commit cece1ce
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
5 changes: 2 additions & 3 deletions kgforge/specializations/models/rdf/directory_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from pathlib import Path
from typing import Dict, Tuple

from pyshacl import Validator
from pyshacl import validate
from rdflib import Graph, URIRef
from rdflib.util import guess_format

Expand Down Expand Up @@ -44,8 +44,7 @@ def materialize(self, iri: URIRef) -> NodeProperties:
return NodeProperties(**attrs)

def _validate(self, iri: str, data_graph: Graph) -> Tuple[bool, Graph, str]:
validator = Validator(data_graph, shacl_graph=self._graph)
return validator.run()
return validate(data_graph, shacl_graph=self._graph)

def resolve_context(self, iri: str) -> Dict:
if iri in self._context_cache:
Expand Down
5 changes: 2 additions & 3 deletions kgforge/specializations/models/rdf/store_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import json

from pyshacl import Validator
from pyshacl import validate

from kgforge.core import Resource
from kgforge.core.commons.exceptions import RetrievalError
Expand Down Expand Up @@ -60,8 +60,7 @@ def materialize(self, iri: URIRef) -> NodeProperties:
def _validate(self, iri: str, data_graph: Graph) -> Tuple[bool, Graph, str]:
# _type_shape will make sure all the shapes for this type are in the graph
self._type_shape(iri)
validator = Validator(data_graph, shacl_graph=self._graph)
return validator.run()
return validate(data_graph, shacl_graph=self._graph)

def resolve_context(self, iri: str) -> Dict:
if iri in self._context_cache:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
"pandas",
"nexus-sdk",
"aiohttp",
"rdflib==6.2.0",
"rdflib==6.3.2",
"pyLD",
"pyshacl==v0.17.2",
"pyshacl==v0.23.0",
"nest-asyncio>=1.5.1",
"pyparsing>=2.0.2",
"owlrl>=5.2.3",
Expand Down

0 comments on commit cece1ce

Please sign in to comment.