>
> Hi Holger,
>
> Thanks again for the answers, it has been of great help.
>
> I understand the commercial pressures.
>
> But, here I found the best answers, since there is a lack of material on 
> SHACL.
>
>
> I believe that I finally got to the solution to my problem.
>
>
> - I rewrote the comparison using the URI, as you indicated:
>
>  for (; node.value! == "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil";;) 
> {...}
>
>
> - $minSize must be declared with sh:parameter in the shape.
>
> I did this and created a ConstraintComponent, removing the restriction 
> from nodeShape.
>
>
> I leave here my test files, in case anyone else needs it.
>
> The final code of the function is this:
>
>  function myMinOccur ($this, $minSize) {
>     // Defines an array for the return
>     var results = [];
>     // Defines the the IRIs of the target node
>     var propertyName = TermFactory.namedNode(
> "http://www.example.org#coordinates";);  
>     var rest = TermFactory.namedNode(
> "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest";);  
>     var nil = TermFactory.namedNode(
> "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil";);   
>
>
>     // Finds the object defined by the target node
>     var propertyObject = $data.find($this, propertyName, null) ;
>
>
>     // Navigate the target node graph
>     for (var t = propertyObject.next(); t; t = propertyObject.next()) {
>        // Each instance is a Javascript object
>        var node = t.object;
>        var head = node;
>        var length = 0;
>        // This loop runs thorugh the list and 
>        // counts how many elements are in the list.
>        for ( ; node.value !== 
> "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil";; ) {
>             length++;
>             var next = $data.find(node,rest,null).next();
>             node = next ? next.object : nil; // Get object if triple
>        }
>        // If the list length < 2 ($minSize), then it is an outlier.
>        if (length < $minSize.lex ) {
>           results.push({
>           value : head 
>        });
>      }
>    }
>  return results;
> }
>
>
> And the result of the validation was:
>
> [ a            sh:ValidationReport ;
>   sh:conforms  false ; 
>   sh:result    [ a                             sh:ValidationResult ; 
>                  sh:focusNode                  ex:MyExample_04 ; 
>                  sh:resultMessage              "Value does not have shape 
> ex:PointShape" ; 
>                  sh:resultPath                 ex:p_name_3 ; 
>                  sh:resultSeverity             sh:Violation ; 
>                  sh:sourceConstraintComponent  sh:NodeConstraintComponent 
> ; 
>                  sh:sourceShape                []  ; 
>                  sh:value                      ex:point_4 
>                ] ; 
>
>   sh:result    [ a                             sh:ValidationResult ; 
>                  sh:focusNode                  ex:point_4 ; 
>                  sh:resultMessage              "Verify minOccur in 
> coordinates!!!" ; 
>                  sh:resultPath                 ex:coordinates ;   # Have 
> only one element in rdf:list
>                  sh:resultSeverity             sh:Violation ; 
>                  sh:sourceConstraintComponent  ex:
> MinOccurConstraintComponent ; 
>                  sh:sourceShape                []  ; 
>                  sh:value                      []  
>                ] 
> ] .
>
>
>
> Hugs,
>
>
> Angelo
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to topbraid-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/a15ae485-4655-41a8-acf1-2b1820290864%40googlegroups.com.

Attachment: Case_1-DataGraph.ttl
Description: Binary data

Attachment: Case_1-ShapeGraph.ttl
Description: Binary data

Reply via email to