Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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.

0 votes



2 answers

Permanent link

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.

0 votes


Permanent link

 I think custom query is the way to go.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,019

Question asked: Feb 21 '19, 2:10 p.m.

Question was seen: 2,731 times

Last updated: Mar 06 '19, 3:17 p.m.

Confirmation Cancel Confirm