This is an automated email from the ASF dual-hosted git repository.

andy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jena.git


The following commit(s) were added to refs/heads/master by this push:
     new 13e1932  JENA-1787: Refine improved performance of 
ValidationProc.simpleValidationNode
13e1932 is described below

commit 13e193237600680de0c0a314a61193710c6e0549
Author: Andy Seaborne <[email protected]>
AuthorDate: Sun Dec 1 17:23:34 2019 +0000

    JENA-1787: Refine improved performance of 
ValidationProc.simpleValidationNode
---
 .../jena/shacl/validation/ValidationProc.java      | 28 +++++++++++++++-------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git 
a/jena-shacl/src/main/java/org/apache/jena/shacl/validation/ValidationProc.java 
b/jena-shacl/src/main/java/org/apache/jena/shacl/validation/ValidationProc.java
index 7c3fa50..12e1027 100644
--- 
a/jena-shacl/src/main/java/org/apache/jena/shacl/validation/ValidationProc.java
+++ 
b/jena-shacl/src/main/java/org/apache/jena/shacl/validation/ValidationProc.java
@@ -116,11 +116,11 @@ public class ValidationProc {
     }
 
     public static void simpleValidation(ValidationContext vCxt, Graph data, 
Shape shape) {
-        simpleValidationInternal(vCxt, data, getFocusNodes(data, shape), 
shape);
+        simpleValidationInternal(vCxt, data, null, shape);
     }
     
     // ---- Single node.
-    
+
     public static ValidationReport simpleValidationNode(Shapes shapes, Graph 
data, Node node, boolean verbose) {
         int x = out.getAbsoluteIndent();
         try {
@@ -131,7 +131,6 @@ public class ValidationProc {
         } finally { out.setAbsoluteIndent(x); }
     }
 
-    
     private static ValidationReport simpleValidationNode(ValidationContext 
vCxt, Shapes shapes, Node node, Graph data) {
         //vCxt.setVerbose(true);
         for ( Shape shape : shapes ) {
@@ -144,14 +143,27 @@ public class ValidationProc {
     }
 
     private static void simpleValidationNode(ValidationContext vCxt, Graph 
data, Node node, Shape shape) {
-        if (isFocusNode(shape, node, data)) {
-            simpleValidationInternal(vCxt, data, Collections.singleton(node), 
shape);
-        }
-
+        simpleValidationInternal(vCxt, data, node, shape);
     }
 
     // --- Top of process
-    private static void simpleValidationInternal(ValidationContext vCxt, Graph 
data, Collection<Node> focusNodes, Shape shape) {
+    
+    /**
+     * Validation process.
+     * Either all focusNode for the shape (argument node == null)
+     * or just for one node of the focusNodes of the shape.
+     */
+    private static void simpleValidationInternal(ValidationContext vCxt, Graph 
data, Node node, Shape shape) {
+        Collection<Node> focusNodes;
+   
+        if ( node != null ) {
+            if (! isFocusNode(shape, node, data))
+                return ;
+            focusNodes = Collections.singleton(node);
+        } else {
+            focusNodes = getFocusNodes(data, shape);
+        }
+        
         if ( vCxt.isVerbose() ) {
             out.println(shape.toString());
             out.printf("N: FocusNodes(%d): %s\n", focusNodes.size(), 
focusNodes);

Reply via email to