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

SHACL: add String-based constraints #1109

Closed
abrokenjester opened this issue Oct 9, 2018 · 7 comments
Closed

SHACL: add String-based constraints #1109

abrokenjester opened this issue Oct 9, 2018 · 7 comments
Assignees
Labels
M1 Fixed in milestone 1 📦 SHACL affects the SHACL validator
Milestone

Comments

@abrokenjester
Copy link
Contributor

From @barthanssens on March 5, 2018 10:40

SHACL 4.4, most of the string-based constraints are probably fairly easy to add: minLength / maxLength / pattern / languageIn

(uniqueLang is more difficult / resource intensive)

See also https://www.w3.org/TR/shacl/#core-components-string

Copied from original issue: eclipse/rdf4j-storage#49

@abrokenjester abrokenjester added the 📦 SHACL affects the SHACL validator label Oct 9, 2018
@abrokenjester
Copy link
Contributor Author

From @hmottestad on March 13, 2018 7:14

Datatype based restrictions are also useful and as simple as string based ones.

@abrokenjester
Copy link
Contributor Author

From @hmottestad on March 13, 2018 7:30

The plan for validating such data should kick in (requiresEvalutation()) if:

  • a node of type targetClass is added
  • a statement that matches the path is added

The plan should handle the following cases:

  1. data added, type statement and path in added
  2. data added, path in added, type statement in underlying store
  3. data added, type statement added, path in underlying store

Note that it is possible with combinations of these cases.

Case 1 can easily degrade into case 3 by adding in the statements matching path for added nodes of type targetClass. This can then degrade into case 2 by filtering on the type statement from the underlying store.

@abrokenjester
Copy link
Contributor Author

From @barthanssens on March 13, 2018 7:30

Indeed. I think I've managed the string constraints working, but probably suboptimal (seem to run more than they should)

@abrokenjester
Copy link
Contributor Author

From @hmottestad on March 13, 2018 7:31

That's great. Do you have a branch?

@abrokenjester
Copy link
Contributor Author

From @barthanssens on March 13, 2018 7:45

https://github.com/fedict/rdf4j-storage/tree/issues/%2349-shacl-stringconstraints

Still pretty much work in progress, I'll check this evening if the code on github is actually the latest version of the I'm working on.
I did some renaming and code rework (factories in separate classes e.g).

Currently I'm checking minLength,maxLength and pattern in 1 single check, although I'm not sure that is the best option - or at least it may require additional return values - if there is a need to also implement the sh:ValidationReport reports.

@abrokenjester
Copy link
Contributor Author

From @hmottestad on March 14, 2018 8:34

I had a quick look now. Lots of nice cleanup :)

A couple of things I would like to keep though. Factory classes in the classes they belong to, makes it easier to understand and find, having them outside doubles the number of files and makes it harder to figure out which factory is for which class. Also a pain when renaming things later. Also, the queries with the binds, point here was to be able to track which statements in the database were used in evaluating a shacl rule, so that we can give an “explanation”. Currently this is being logged.

Try to make some tests for your added rules. Remember that shacl rules with target class trigger for two cases, when an rdf:type statement is added or when a statement matching the path is added (for min count also when removed, but that’s not applicable here).

@abrokenjester
Copy link
Contributor Author

From @barthanssens on March 19, 2018 19:39

Thanks for the review :-)
I'll move the factories back into the original file, and I'll try to keep working on it (if time permits...)

hmottestad added a commit to eclipse-rdf4j/rdf4j-storage that referenced this issue Jan 17, 2019
hmottestad added a commit to eclipse-rdf4j/rdf4j-storage that referenced this issue Jan 17, 2019
hmottestad added a commit to eclipse-rdf4j/rdf4j-storage that referenced this issue Jan 17, 2019
hmottestad added a commit to eclipse-rdf4j/rdf4j-storage that referenced this issue Jan 17, 2019
@hmottestad hmottestad self-assigned this Jan 17, 2019
hmottestad added a commit to eclipse-rdf4j/rdf4j-storage that referenced this issue Jan 18, 2019
hmottestad added a commit to eclipse-rdf4j/rdf4j-storage that referenced this issue Jan 18, 2019
hmottestad added a commit to eclipse-rdf4j/rdf4j-storage that referenced this issue Jan 18, 2019
hmottestad added a commit to eclipse-rdf4j/rdf4j-storage that referenced this issue Jan 19, 2019
hmottestad added a commit to eclipse-rdf4j/rdf4j-storage that referenced this issue Jan 19, 2019
hmottestad added a commit to eclipse-rdf4j/rdf4j-storage that referenced this issue Jan 19, 2019
hmottestad added a commit to eclipse-rdf4j/rdf4j-storage that referenced this issue Jan 19, 2019
hmottestad added a commit to eclipse-rdf4j/rdf4j-storage that referenced this issue Jan 19, 2019
hmottestad added a commit to eclipse-rdf4j/rdf4j-storage that referenced this issue Jan 19, 2019
hmottestad added a commit to eclipse-rdf4j/rdf4j-storage that referenced this issue Jan 19, 2019
hmottestad added a commit to eclipse-rdf4j/rdf4j-storage that referenced this issue Jan 19, 2019
hmottestad added a commit to eclipse-rdf4j/rdf4j-storage that referenced this issue Jan 19, 2019
@abrokenjester abrokenjester added this to the 2.5.0 milestone Jan 20, 2019
hmottestad added a commit to eclipse-rdf4j/rdf4j-storage that referenced this issue Jan 28, 2019
* develop: (54 commits)
  setting version to 3.0-SNAPSHOT
  Use diamond inference Signed-off-by:Bart Hanssens <[email protected]>
  eclipse-rdf4j/rdf4j#998 simplify tests
  Upgraded assertj-core
  eclipse-rdf4j/rdf4j#998 list supported shacl predicates, with test to make sure the list is kept up-to-date
  eclipse-rdf4j/rdf4j#998 configurations for enabling logging of diagnostic info and better javadoc
  optimize imports
  various cleanup and fix for sh:or
  eclipse-rdf4j/rdf4j#1113 added config and factory class for ShaclSail
  eclipse-rdf4j/rdf4j#1113 moved graph name constant and fixed compliance test setup
  fixes after rebase
  eclipse-rdf4j/rdf4j#1247 support implicit and
  eclipse-rdf4j/rdf4j#1110 support nodeKind
  eclipse-rdf4j/rdf4j#1109 support for language in
  eclipse-rdf4j/rdf4j#1109 support for pattern
  eclipse-rdf4j/rdf4j#1109 reuse plan from datatype to implement minLength and maxLength
  eclipse-rdf4j/rdf4j#998 support for nested validation results
  eclipse-rdf4j/rdf4j#998 support sh:or better
  eclipse-rdf4j/rdf4j#998 support SHACL RDF report format
  eclipse-rdf4j/rdf4j#998 log which shape caused the issue
  ...

Signed-off-by: Håvard Ottestad <[email protected]>

# Conflicts:
#	shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/Utils.java
hmottestad added a commit to eclipse-rdf4j/rdf4j-storage that referenced this issue Jan 29, 2019
* master: (30 commits)
  very premature implementation of the w3c shacl tests with what seems like some bugs (since they don't run correctly) and also most of this isn't even supported
  eclipse-rdf4j/rdf4j#1268 add config for setting behavior when target is undefined
  eclipse-rdf4j/rdf4j#1266 some logging issues found while writing documentation
  solr embedded now uses managed schema by default - reintroduced necessary config files
  Use diamond inference Signed-off-by:Bart Hanssens <[email protected]>
  eclipse-rdf4j/rdf4j#998 simplify tests
  Upgraded assertj-core
  eclipse-rdf4j/rdf4j#998 list supported shacl predicates, with test to make sure the list is kept up-to-date
  eclipse-rdf4j/rdf4j#998 configurations for enabling logging of diagnostic info and better javadoc
  optimize imports
  various cleanup and fix for sh:or
  eclipse-rdf4j/rdf4j#1113 added config and factory class for ShaclSail
  eclipse-rdf4j/rdf4j#1113 moved graph name constant and fixed compliance test setup
  fixes after rebase
  eclipse-rdf4j/rdf4j#1247 support implicit and
  eclipse-rdf4j/rdf4j#1110 support nodeKind
  eclipse-rdf4j/rdf4j#1109 support for language in
  eclipse-rdf4j/rdf4j#1109 support for pattern
  eclipse-rdf4j/rdf4j#1109 reuse plan from datatype to implement minLength and maxLength
  eclipse-rdf4j/rdf4j#998 support for nested validation results
  ...

Signed-off-by: Håvard Ottestad <[email protected]>

# Conflicts:
#	shacl/src/main/java/org/eclipse/rdf4j/sail/shacl/ShaclSailConnection.java
#	shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShaclTest.java
@abrokenjester abrokenjester added the M1 Fixed in milestone 1 label Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M1 Fixed in milestone 1 📦 SHACL affects the SHACL validator
Projects
None yet
Development

No branches or pull requests

2 participants