Skip to content
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

sh:pattern not evaluated correctly #492

Closed
berezovskyi opened this issue Feb 12, 2022 · 3 comments
Closed

sh:pattern not evaluated correctly #492

berezovskyi opened this issue Feb 12, 2022 · 3 comments

Comments

@berezovskyi
Copy link
Contributor

shaclex 0.1.103
jena 4.4.0
jdk 11 temurin
eclipse lyo 5.0.0-snapshot

We disabled our validation module build during the JDK 11 migration in Eclipse Lyo and now after enabling it and updating to latest ShaclEx we discovered that a number of old passing test cases now fail. For example:

ValidationResult [resultPath=http://www.sampledomain.org/sam#aStringProperty, focusNode=null, message=pattern violation. Expected "Between" to match '^B', resultSeverity=http://www.w3.org/ns/shacl#Violation]

The spec says to follow the SPARQL patterns: https://www.w3.org/TR/shacl/#PatternConstraintComponent Which in turn gives us almost the same regex as an example: https://www.w3.org/TR/sparql11-query/#func-regex

When we change the annotation on the property from @ShaclPattern("^B") to @ShaclPattern("^B.*"), all tests pass.

I have two thoughts: either it's due to Jena 4 migration or cough someone may have introduced a regression in weso/utils#148. However, I don't think that going back to Xerces is a good idea, so we may want to replicate whatever Jena does to evaluate regexps in a SPARQL-compliant way.

@ericprud
Copy link

Relevant spec section: 5.4.4 XML Schema String Facet Constraints, which references XPath 5.6.1 Regular expression syntax. The examples in 5.6.3 fn:matches indicate that your reading is correct.

The expression fn:matches("abracadabra", "bra") returns true().

This also suggests that we need a test.

@berezovskyi
Copy link
Contributor Author

Hello, I haven't had time to follow the SHaclEX developments and today I tried to upgrade to SHaclEX 0.2.2 and all tests passed without having to modify the regex.

It seems like ShEx module re-introduced the Xerces dependency, which we tried to exclude and it works so far (we only call the SHACL). Also, we found that there is a fair number of dependencies wihin SHaclEX with mismatched version numbers, which we were forced to duct tape due to our maven-enforcer-plugin settings: https://github.com/eclipse/lyo/pull/248/files#diff-f5751dbd520a10ddcb49fe2ab71c084c779c3e2cf88765b9cc00593b5e50208cR105

Cautiously, I could say that this issue could be closed given that the other two issues don't impact sh:pattern evaluation directly.

@labra
Copy link
Member

labra commented Apr 20, 2023

Thanks for the update. I think we can close this issue.

About the other topics, it would be great if add specific issues for them.

One possibility to clean the dependencies a bit more if you are only using SHACL is that you consider to depend on SHACL-S which is specific about SHACL...at this moment, SHaclEX is an umbrella project which invokes either ShEx-s o SHACL-s depending on which type of RDF validation you use, so depending on them may avoid to use some extra dependencies which you don't need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants