You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Andy Seaborne (Jira)" <ji...@apache.org> on 2022/03/05 18:44:00 UTC

[jira] [Commented] (JENA-2301) Allow to activate/deactivate shapes

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

Andy Seaborne commented on JENA-2301:
-------------------------------------

A bit more context would be great - what's the reason behind this?

There are benefits to having immutable-once-built data structures (sharing, concurrency, putting in maps and sets).

I can think of several ways:
* Provide the validator with a set of "not this time" shapes.
* If its many shapes, copy/change the graph and reparse. Parsing the graph is fast.
* The other general approach is to provide "shape transforms". Shapes have the visitor pattern already, adding transformers like query syntax of query algebra is doable. It is a copy-on-write ... which works properly if the elements are immutable once built.


> Allow to activate/deactivate shapes
> -----------------------------------
>
>                 Key: JENA-2301
>                 URL: https://issues.apache.org/jira/browse/JENA-2301
>             Project: Apache Jena
>          Issue Type: Improvement
>          Components: SHACL
>            Reporter: Florian Kleedorfer
>            Priority: Trivial
>
> I have a use case in which I need to toggle a shape's 'deactivated` flag programatically.
> The current workaround I'm using is to extract the shape's subgraph, set the flag in the extracted graph, and then parse it again. If there is a simpler workaround, I'll be happy to use that. 
> Otherwise, here are my suggestions (for Shape.java):
> * Make the `deactivated` flag non-final and add a setter.
> * Provide a way to clone a shape and change the flag underway.
> Cheers!



--
This message was sent by Atlassian Jira
(v8.20.1#820001)