Skip to content

Commit

Permalink
Merge pull request #218 from RDFLib/fix_217
Browse files Browse the repository at this point in the history
Fix 217, stage v0.24.1
  • Loading branch information
ashleysommer authored Nov 23, 2023
2 parents 056a756 + 28dfbf5 commit accd55e
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 26 deletions.
12 changes: 9 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ and this project adheres to [Python PEP 440 Versioning](https://www.python.org/d
## [Unreleased]
- Nothing yet...

## [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 @@ -1073,7 +1078,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.24.0...HEAD
[Unreleased]: https://github.com/RDFLib/pySHACL/compare/v0.24.1...HEAD
[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 CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ authors:
given-names: "Nicholas"
orcid: "http://orcid.org/0000-0002-8742-7730"
title: "pySHACL"
version: 0.24.0
version: 0.24.1
doi: 10.5281/zenodo.4750840
license: Apache-2.0
date-released: 2022-01-13
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ WORKDIR /home/pyshacl
RUN addgroup -g 1000 -S pyshacl &&\
adduser --disabled-password --gecos "" --home "$(pwd)" --ingroup "pyshacl" --no-create-home --uid 1000 pyshacl
WORKDIR /app
LABEL org.opencontainers.image.version="0.24.0"
LABEL org.opencontainers.image.version="0.24.1"
COPY . .
RUN chown -R pyshacl:pyshacl /home/pyshacl /app && chmod -R 775 /home/pyshacl /app
USER pyshacl
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.24.1 command line tool.

positional arguments:
DataGraph The file containing the Target Data Graph.
Expand Down
26 changes: 13 additions & 13 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "pyshacl"
version = "0.24.0"
version = "0.24.1"
# Don't forget to change the version number in __init__.py, Dockerfile, and CITATION.cff along with this one
description = "Python SHACL Validator"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion pyshacl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .validate import Validator, validate

# version compliant with https://www.python.org/dev/peps/pep-0440/
__version__ = '0.24.0'
__version__ = '0.24.1'
# Don't forget to change the version number in pyproject.toml, Dockerfile, and CITATION.cff along with this one

__all__ = ['validate', 'Validator', '__version__', 'Shape', 'ShapesGraph']
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 accd55e

Please sign in to comment.