afs commented on a change in pull request #804:
URL: https://github.com/apache/jena/pull/804#discussion_r499551523
##########
File path:
jena-shacl/src/main/java/org/apache/jena/shacl/engine/SparqlConstraints.java
##########
@@ -91,6 +94,27 @@ public static Constraint parseSparqlConstraint(Graph
shapesGraph, Node shape, No
throw new ShaclParseException("SPARQL parse error:
"+ex.getMessage()+"\n"+qs);
}
}
+
+ /**
+ * Test for zero or one occurrences of a tripel pattern that is expected
to be
+ * Returns false for zero, true for one.
+ * Throws an exception on two or more.
+ */
+ private static boolean absentOrOne(Graph g, Node s, Node p, Node o) {
+ ExtendedIterator<Triple> iter = G.find(g, s, p, null);
+ try {
+ if ( ! iter.hasNext() )
+ return false;
+ iter.next();
+ if ( ! iter.hasNext() )
+ return true;
+ long x = Iter.count(G.find(g, s, p, null));
+ throw new ShaclParseException("More then one (" + x + ") of " +
String.format("(%s %s %s)", s, p, o));
Review comment:
Done
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]