Skip to content

Commit

Permalink
Merge branch 'master' into drop_37
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
#	CITATION.cff
#	Dockerfile
#	poetry.lock
#	pyproject.toml
#	pyshacl/__init__.py
  • Loading branch information
ashleysommer committed Nov 23, 2023
2 parents 89ce3a5 + accd55e commit 4d3a7c1
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 10 deletions.
14 changes: 10 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Python PEP 440 Versioning](https://www.python.org/d
## [Unreleased]
- Nothing yet...

## [0.25.0] - 2023-11-16
## [0.25.0] - 2023-11-23
### Changed
- Dropped support for Python 3.7
- Note, for compatibility with RDFLib 7.0, we specify a minimum Python version of v3.8.1
Expand All @@ -20,10 +20,15 @@ and this project adheres to [Python PEP 440 Versioning](https://www.python.org/d
### Fixed
- Do not hard-pin to importlib-metadata. Fixes #214

## [0.24.1] - 2023-11-23
## Note - The 0.24.x series is the last to support Python 3.7
### RDFLib v7.0.0 and some other dependencies already don't support 3.7, so PySHACL will drop it from 0.25+
### Fixed
- Shape can have multiple values for `sh:not`. Fixes #217

## [0.24.0] - 2023-11-08
## Note - This is the last version to support Python 3.7
### RDFLib v7.0.0 and some other dependencies already don't support 3.7, so PySHACL will drop it after this release.
## Note - The 0.24.x series is the last to support Python 3.7
### RDFLib v7.0.0 and some other dependencies already don't support 3.7, so PySHACL will drop it from 0.25+
### Added
- Compatibility with RDFLib v7.0.0 - Closes #197
### Fixed
Expand Down Expand Up @@ -1087,7 +1092,8 @@ just leaves the files open. Now it is up to the command-line client to close the
- Initial version, limited functionality

[Unreleased]: https://github.com/RDFLib/pySHACL/compare/v0.25.0...HEAD
[0.25.0]: https://github.com/RDFLib/pySHACL/compare/v0.24.0...v0.25.0
[0.25.0]: https://github.com/RDFLib/pySHACL/compare/v0.24.1...v0.25.0
[0.24.1]: https://github.com/RDFLib/pySHACL/compare/v0.24.0...v0.24.1
[0.24.0]: https://github.com/RDFLib/pySHACL/compare/v0.23.0...v0.24.0
[0.23.0]: https://github.com/RDFLib/pySHACL/compare/v0.22.2...v0.23.0
[0.22.2]: https://github.com/RDFLib/pySHACL/compare/v0.22.1...v0.22.2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ usage: pyshacl [-h] [-s [SHACL]] [-e [ONT]] [-i {none,rdfs,owlrl,both}] [-m]
[-ef {auto,turtle,xml,json-ld,nt,n3}] [-V] [-o [OUTPUT]]
DataGraph

PySHACL 0.24.0 command line tool.
PySHACL 0.25.0 command line tool.

positional arguments:
DataGraph The file containing the Target Data Graph.
Expand Down
5 changes: 0 additions & 5 deletions pyshacl/constraints/core/logical_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ def __init__(self, shape):
"NotConstraintComponent must have at least one sh:not predicate.",
"https://www.w3.org/TR/shacl/#NotConstraintComponent",
)
if len(not_list) > 1:
raise ConstraintLoadError(
"NotConstraintComponent must have at most one sh:not predicate.",
"https://www.w3.org/TR/shacl/#NotConstraintComponent",
)
self.not_list = not_list

@classmethod
Expand Down
73 changes: 73 additions & 0 deletions test/issues/test_217.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# -*- coding: utf-8 -*-
#
"""
https://github.com/RDFLib/pySHACL/issues/217
"""
import rdflib
import pyshacl
import sys

shapes_data = '''\
@prefix ex: <http://example.org/ontology/> .
@prefix sh-ex: <http://example.org/shapes/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
sh-ex:ClassC-shape
a sh:NodeShape ;
sh:not
[
a sh:NodeShape ;
sh:class ex:ClassA ;
] ,
[
a sh:NodeShape ;
sh:class ex:ClassB ;
]
;
sh:targetClass ex:ClassC ;
.
'''

data_g_text = '''\
@prefix ex: <http://example.org/ontology/> .
@prefix kb: <http://example.org/kb/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
kb:Thing-1
a
ex:ClassA ,
ex:ClassB
;
rdfs:comment "This individual is consistent per OWL and should validate with SHACL."@en ;
.
kb:Thing-2
a
ex:ClassA ,
ex:ClassC
;
rdfs:comment "This individual is inconsistent per OWL and should not validate with SHACL."@en ;
.
kb:Thing-3
a
ex:ClassB ,
ex:ClassC
;
rdfs:comment "This individual is inconsistent per OWL and should not validate with SHACL."@en ;
.
'''


def test_217():
shape_g = rdflib.Graph().parse(data=shapes_data, format='turtle')
data_g = rdflib.Graph().parse(data=data_g_text, format="turtle")
conforms, results_graph, results_text = pyshacl.validate(
data_g, shacl_graph=shape_g, debug=True, meta_shacl=False,
)
assert not conforms
assert "Node kb:Thing-2 conforms to shape" in results_text and "Node kb:Thing-3 conforms to shape" in results_text


if __name__ == "__main__":
sys.exit(test_217())

0 comments on commit 4d3a7c1

Please sign in to comment.