[
https://issues.apache.org/jira/browse/JENA-2301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17501817#comment-17501817
]
Florian Kleedorfer commented on JENA-2301:
------------------------------------------
For context: I am writing a framework that expects a domain description, part
of which is a vocabulary and a shapes graph containing the shapes for
validating the different entities the vocabulary is designed for. Some shapes,
however, have no direct use for validation, and as they might be quite
expensive to evaluate, the suggested 'idiom' is to deactivate them (a bit
hacky, but this way, the shapes remain usable by any SHACL interpreter). At a
certain point in the program these shapes should be evaluated. In that
situation, I'd love to just use the parsed Shapes, activate the shapes I need
and evaluate them.
As to the suggestions:
1. for my exact case, It would suffice to be able to tell the evaluator to
ignore the `deactivated` flag. Simple but weirdly specific in a general
framework like jena.
2. that's what I'm doing. It works. It's not beautiful, though
3. that sounds *awesome* but also very involved for my current needs. Having
said that: given how incredibly useful SHACL is, this is definitely something
worth considering. I've used transforms on the query algebra and I've used the
shape visitor pattern quite a bit so I might be able to help with
implementation. Basically visit the shape's tree structure recursively, pass a
stack around for context information and put the transform results there. With
the results, create a new Shapes object containing all the shapes (maybe allow
filtering to get a subset).
Have you had other cases in which such a subsystem would have been handy?
> 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)