It's all about the answers!

Ask a question

How can I write a SPARQL query to check for a double word in an artifact?


David Clark (2341150) | asked Feb 21 '19, 2:10 p.m.

 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



permanent link
Andrew Takahashi (133) | answered Mar 06 '19, 3:17 p.m.

 I think custom query is the way to go.


permanent link
Preston Berkeley (1212) | answered Mar 04 '19, 5:02 p.m.

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.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.