0

I am using an IBM wrapper solution around SPARQL to get information from our database. I set a triple variable to act as a filter but it doesnt return an exact match, only a 'contains' match.

More specifically, we are looking at requirements that live in a collection. The SPARQL query returns all requirement objects and the collection that they live in. Each collection has a unique identifier associated with it which is accessed via the predicate 'dcterms:identifier'. The exact line in the SPARQL code which does this is:

?oslc_rm_RequirementCollection1_uri dcterms:identifier ?oslc_rm_RequirementCollection1_identifier

This works as expected. In the output I get a table containing each collection with the list of requirements associated with each one.

The problem arises when I want to look at requirements in only a specific collection. To do this I set the variable oslc_rm_RequirementCollection1_identifier in IBM's wrapper, and it generally works. If I enter '18732' it only shows me requirements from the collection with id 18732. However, this is not an exact match only a contains. For example if I enter '867', I am shown two collections: 867 and 38674.

How can I modify this to exclude 38674 and only show the exact match? I cannot use a string literal because the wrapper does not allow this.

TallTed
  • 9,069
  • 2
  • 22
  • 37
  • I'm not familiar with the "IBM wrapper" - what is this? And you enter "18732" where? It looks a like a tool specific behaviour and nobody knows the tool. Clearly, in SPARQL anything is exact match at a first glance until you use filter expressions like `contains` or `regex`. And it sounds like there is a fulltext index on top of whatever? So what kind of tool or framework do you use? – UninformedUser Jun 21 '19 at 07:53
  • We are using IBM's Jazz products for requriements management. They have a tool called 'Reporting Service: Report Builder' which uses SPARQL behind the scenes to extract information from a database. When running the query, you have no access to the SPARQL code itself, but Report Builder allows you to set any values which are written in the SELECT query pattern - this acts as a filter. This is where "18732" and "867" are being entered. – Harrison Vince Jun 23 '19 at 22:37
  • oh, ok. So you're not running a SPARQL query by yourself, your just using some filter fields to enter the ID? Hm, I never used this framework, but is there any chance that you have access to the queries? Maybe by what is mentioned here: https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/W0d4284fb304f_4f39_9e4b_92a8424e5f6c/page/The%20SPARQL%20Reporting%20Gateway%20application ? or is this the wrong tool? Can you edit existing queries there maybe? – UninformedUser Jun 24 '19 at 04:11
  • At least, you can register your own SPARQL queries and then use it via REST API as far as I understood. Some maybe related question here: https://stackoverflow.com/questions/30587567/querying-jazz-rtc-work-items-via-oslc – UninformedUser Jun 24 '19 at 04:15
  • Thanks for persisting with this. You are correct, you can modify the SPARQL query. Hard coding the id is not ideal for us as we are running the query for a number of different id's each time. We would like to do this in an automated way using the wrapper. I think I will have to use a slight workaround at this point, where I filter the already filtered values externally (which contain 867 and 38674 at this point) and ensure that I am only looking at 867. This gives a slight performance hit but is acceptable. – Harrison Vince Jun 25 '19 at 05:22

0 Answers0