[ 
https://issues.apache.org/jira/browse/JENA-1947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17184099#comment-17184099
 ] 

Andy Seaborne commented on JENA-1947:
-------------------------------------

The fix is to remove the line {{sh:and(af-s:AFS_0000001) ;}} . Going by the 
{{dct:description}}, it isn't intended. When it says "All Allotrope shapes MUST 
reference the debug shape" they mean "All ... except the debug shape itself"!

In a property shape, then the intention might be to walk the path applying a 
test every time. That is a possible legitimate usage of recursion.

Jena is a "compiler" style - it reads the shapes, builds an execution tree and 
prints or executes that; {{sh:deactivated}] happens at execution.

Other engines are an "interpreter" style. They process the RDF description 
while executing - and {{sh:deactivated}} may apply. But I'd not be surprised if 
they loop forever if this debug node shape is activated.

Also:
 # They don't need to use an "and" of one, {{sh:and(af-s:AFS_0000001)}}, 
because that's {{sh:node}} if the target of "and" is a node shape.
 # A simpler "always triggers" shape is:

{noformat}
 :shape2 rdf:type sh:NodeShape ;
    sh:targetNode 1 ;
    sh:message "ALWAYS" ;
    sh:hasValue 2 ;
    sh:deactivated true;
    .
{noformat}
which is a test that 1 = 2 , which it isn't; or
{noformat}
 :shape2 rdf:type sh:NodeShape ;
    sh:targetNode [] ;
    sh:message "ALWAYS" ;
    sh:hasValue [] ;
    sh:deactivated true;
    .
{noformat}
because the 2 {{[]}} blank nodes are different.

The current SPARQL test does not trigger on an empty graph when data and shapes 
are in separate graphs but maybe that is intentional.

> SHACL validator: Stack overflow on recursive shapes even if deactivated
> -----------------------------------------------------------------------
>
>                 Key: JENA-1947
>                 URL: https://issues.apache.org/jira/browse/JENA-1947
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: SHACL
>            Reporter: Jan Rosecky
>            Priority: Major
>
> I'm trying to validate using a set of shapes including: 
> [http://purl.allotrope.org/shapes/adm/core/REC/2020/06/common.shapes] . 
> af-s:AFS_0000001 has a recursive sh:and(af-s:AFS_0000001) clause, which 
> causes a stack overflow exception - even though the shape is sh:deactivated.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to