Using wildcard in REST URL queries
![]()
Hello everyone!
I am attempting an extension of RTC 3.X through java and Apache html services. I understand that constructing a query is generally based on the discovery process and finding the query base, so an example of a query might look like: https://jazz:9443/ccm/oslc/contexts/_2CA0ws94EeZfSNEzEw148g/workitems?oslc_cm.query&oslc.searchTerms="Donor" The above returns a list of work items that contain the word 'Donor'. However, a query shaped like: https://jazz:9443/ccm/oslc/contexts/_2CA0ws94EeZfSNEzEw148g/workitems?oslc_cm.query&oslc.searchTerms="*Donor" or https://jazz:9443/ccm/oslc/contexts/_2CA0ws94EeZfSNEzEw148g/workitems?oslc_cm.query&oslc.searchTerms="*" Would not work. Is there a way to implement wildcard functionality with OSLC 2.0 / REST? I can't seem to figure out, or find a solid resource for, is how to query with wildcard symbols (such as '*' or '?'). I'm also having trouble making any of the OSLC query examples work, for whatever reason. I'd appreciate some feedback on this issue! If you have any questions, please let me know. An example of this not working would be when I try to return specific parameters in a query (i.e., shaping the resource that is returned with oslc_cm.properties=""). Thanks! |
Accepted answer
![]()
Hi John,
If you could describe the query (e.g. all work item with 'foo' in the title property), I could give you an example query. Note, the wildcard is only supported in oslc.where for the property (or identifier) of the term. For example: ?oslc.where=*="foo" John Rath selected this answer as the correct answer
|
4 other answers
![]()
Wildcards are only supported in the oslc.where and oslc.select query paramters (see http://open-services.net/bin/view/Main/OSLCCoreSpecQuery). However, oslc.searchTerms performs a full text search, so you only need to include the smallest or partial search term.
|
![]()
Hi Paul,
Thanks for the help. I see now that I really need to utilize oslc.where. I'm looking at the BNF syntax of the where query and it looks like I should be able to construct a query that looks something like (going from simplest term to most complex, following the BNF grammar): 1. oslc.where=compound_term 2. oslc.where=simple_term 3. oslc.where=scoped_term 4. oslc.where=identifier_wc "{" compound_term "}" 5. oslc.where= * "{"compound_term"}" 6. oslc.where= * "{"simple_term"}" 7. oslc.where=* "{"term"}" 8. oslc.where=* "{"id_wc comp_op value"}" 9. oslc.where=* "{"dc:terms=1"}" So I could then use this small string, attach it to my base query URI, and then search with a wildcard. However, if I try and do this with, for example: https://localhost:9443/ccm/oslc/contexts/_XgxZqrc1EeGj6YO0Z9wHKQ/workitems?oslc.where=*{dc:id=%221%22} I receive an internal error (status code 500). So what exactly am I doing wrong? Did I misinterpret the BNF? Thanks everyone, I appreciate the help in advance. |