Question: Why is GraphDB rejecting the OGC GeoSparql SHACL constraints?
Background
GraphDB supports SHACL validation against incoming & existing data. OGC provides shapes for the GeoSparql standard and included passing & non-passing data in the shapes file.
My repository is set up with SHACL enabled, the GeoSparql Plugin is enabled, and the default named graph is being used for shapes.
While inserting the shapes into the default named graph for shapes, http://rdf4j.org/schema/rdf4j#SHACLShapeGraph
, I'm running across the following exception and stack trace
org.eclipse.rdf4j.repository.RepositoryException: org.eclipse.rdf4j.sail.SailException: Invalid shacl constraint pattern: "^\s*$|^\s*({)(.*)(})\s*$"^^<http://www.w3.org/2001/XMLSchema#string>
I don't actually see that pattern in the shapes, which is where my confusions starts. I was also able to process the shapes using pyshacl without issue, so I'm curious if this may be a bug somewhere within GraphDB.
21:01:53.284 [repository-manager-6] INFO c.o.rio.parallel.ParallelLoader - Using 1 threads for inference
21:01:53.350 [repository-manager-6] INFO o.eclipse.rdf4j.sail.shacl.ShaclSail - Shapes will be persisted in: /Users/thomas/Library/Application Support/GraphDB/data/repositories/GeoSPARQL-SHACL-Test/shapes-graph/
21:01:58.359 [repositories/GeoSPARQL-SHACL-Test] INFO o.e.r.h.s.r.n.NamespacesController - GET namespace list
21:01:58.359 [repositories/GeoSPARQL-SHACL-Test] INFO o.e.r.h.s.r.n.NamespacesController - GET namespace list
21:01:58.363 [repositories/GeoSPARQL-SHACL-Test] INFO o.e.r.h.s.r.TupleQueryResultView - Request for query 3392903 is finished
21:01:58.364 [repositories/GeoSPARQL-SHACL-Test] INFO o.e.r.h.s.r.TupleQueryResultView - Request for query 3392903 is finished
21:02:15.760 [import-task-GeoSPARQL-SHACL-Test-1] ERROR c.o.f.impex.StringImportRunnableTask - Could not import file
org.eclipse.rdf4j.repository.RepositoryException: org.eclipse.rdf4j.sail.SailException: Invalid shacl constraint pattern: "^\s*$|^\s*({)(.*)(})\s*$"^^<http://www.w3.org/2001/XMLSchema#string>
at org.eclipse.rdf4j.repository.sail.SailRepositoryConnection.addWithoutCommit(SailRepositoryConnection.java:398)
at com.ontotext.trree.monitorRepository.MonitorRepositoryConnection.addWithoutCommit(MonitorRepositoryConnection.java:367)
at org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection.add(AbstractRepositoryConnection.java:436)
at org.eclipse.rdf4j.repository.util.RDFInserter.addStatement(RDFInserter.java:64)
at org.eclipse.rdf4j.repository.util.AbstractRDFInserter.handleStatement(AbstractRDFInserter.java:184)
at org.eclipse.rdf4j.rio.turtle.TurtleParser.reportStatement(TurtleParser.java:1123)
at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseObject(TurtleParser.java:454)
at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseObjectList(TurtleParser.java:375)
at org.eclipse.rdf4j.rio.turtle.TurtleParser.parsePredicateObjectList(TurtleParser.java:370)
at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseTriples(TurtleParser.java:335)
at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseStatement(TurtleParser.java:203)
at org.eclipse.rdf4j.rio.turtle.TurtleParser.parse(TurtleParser.java:165)
at org.eclipse.rdf4j.repository.util.RDFLoader.loadInputStreamOrReader(RDFLoader.java:304)
at org.eclipse.rdf4j.repository.util.RDFLoader.load(RDFLoader.java:249)
at org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection.add(AbstractRepositoryConnection.java:351)
at com.ontotext.trree.monitorRepository.MonitorRepositoryConnection.add(MonitorRepositoryConnection.java:175)
at com.ontotext.trree.parallel.InterruptableConnectionWrapper.add(InterruptableConnectionWrapper.java:60)
at com.ontotext.forest.impex.ParallelAwareImporter.lambda$add$3(ParallelAwareImporter.java:96)
at com.ontotext.forest.impex.ParallelAwareImporter.wrapInBeginCommit(ParallelAwareImporter.java:143)
at com.ontotext.forest.impex.ParallelAwareImporter.add(ParallelAwareImporter.java:96)
at com.ontotext.forest.impex.StringImportRunnableTask.load(StringImportRunnableTask.java:34)
at com.ontotext.forest.impex.ImportRunnableTask.run(ImportRunnableTask.java:85)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.eclipse.rdf4j.sail.SailException: Invalid shacl constraint pattern: "^\s*$|^\s*({)(.*)(})\s*$"^^<http://www.w3.org/2001/XMLSchema#string>
at org.eclipse.rdf4j.sail.shacl.GraphDBShaclSailConnection.validateShaclPattern(GraphDBShaclSailConnection.java:119)
at org.eclipse.rdf4j.sail.shacl.GraphDBShaclSailConnection.addStatement(GraphDBShaclSailConnection.java:74)
at org.eclipse.rdf4j.repository.sail.SailRepositoryConnection.addWithoutCommit(SailRepositoryConnection.java:394)
... 26 common frames omitted
Caused by: java.util.regex.PatternSyntaxException: Illegal repetition near index 12
^\s*$|^\s*({)(.*)(})\s*$
^
at java.base/java.util.regex.Pattern.error(Unknown Source)
at java.base/java.util.regex.Pattern.closure(Unknown Source)
at java.base/java.util.regex.Pattern.sequence(Unknown Source)
at java.base/java.util.regex.Pattern.expr(Unknown Source)
at java.base/java.util.regex.Pattern.group0(Unknown Source)
at java.base/java.util.regex.Pattern.sequence(Unknown Source)
at java.base/java.util.regex.Pattern.expr(Unknown Source)
at java.base/java.util.regex.Pattern.compile(Unknown Source)
at java.base/java.util.regex.Pattern.<init>(Unknown Source)
at java.base/java.util.regex.Pattern.compile(Unknown Source)
at org.eclipse.rdf4j.sail.shacl.GraphDBShaclSailConnection.validateShaclPattern(GraphDBShaclSailConnection.java:116)
... 28 common frames omitted
As mentioned by UninformedUser, the regex provided by OGC isn't compatible with Java's regex parser. Furthermore, GraphDB currently doesn't support the OGC GeoSPARQL 1.1 SHACL syntax.