How can I write a SPARQL query to check for a double word in an artifact?
I cannot seem to find a way to do this other than to write a custom SPARQL query in JRS using a REGEX of some kind to find all artifacts in a given module that have the same word in it twice.
What I want to do is look through my requirement artifacts in my module and identify ALL artifacts with the word "shall" in the artifact twice. - these should really be 2 different requirements.
2 answers
You can use the report builder (/rs) to build a report on all artifacts of the type. Then add a filter under "Set Conditions" for Primary Text contains an asterisk. Then on the Format Results Screen, click Advanced and Edit Query. Then replace the line similar to this:
FILTER(regex(str(?YourVariable_primaryText), "","i"))
with something like this:
FILTER(regex(str(?YourVariable_primaryText),"shall.*shall","s"))
Changing the flag from i to s will allow it to find multiple uses of shall across different lines.
On 6.0.6, I can only create the filter on Primary Text if I declare a specific artifact type, instead of the generic "Requirement." To handle all types of artifacts, you can create a similar query for all types but without the filter, and merge the SPARQL statements together to create a Primary Text filter without the Artifact Type constraint.