It's all about the answers!

Ask a question

Using wildcard in REST URL queries


0
1
John Rath (3124) | asked Aug 01 '12, 11:39 a.m.
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


permanent link
Paul Slauenwhite (8.4k12) | answered Aug 30 '12, 8:16 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
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



permanent link
Paul Slauenwhite (8.4k12) | answered Aug 02 '12, 6:08 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
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.

permanent link
John Rath (3124) | answered Aug 28 '12, 5:01 p.m.
edited Aug 28 '12, 5:04 p.m.
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.

permanent link
Paul Slauenwhite (8.4k12) | answered Aug 29 '12, 8:45 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
I am not clear on what you are trying to query.  Could you explain more?

I would suggest looking at the examples in http://open-services.net/bin/view/Main/OSLCCoreSpecQuery?sortcol=table;up=#oslc_where.

Comments
John Rath commented Aug 29 '12, 9:36 a.m.

Thank you for the link, but I've already looked this over and am still stuck.

I'll try to explain, as well as ask for an example - that might work better.

I need to implement wildcard functionality into an extension of RTC. I would like to use the 'where' clause of the OSLC Query spec to do this. The problem I'm running into is actually using '*' in my queries. When I try and query (through the Firefox rest client or an httpclient via java) I either receive an error that complains about the syntax of the query, or I receive, for example, work item one, instead of, say, 1, 11, 12, 13, etc.


permanent link
John Rath (3124) | answered Aug 30 '12, 9:05 a.m.
That actually answered my question, thank you!

Comments
Rosa Naranjo commented Sep 20 '13, 12:13 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

John, how did your question get answered? How did you achieve what you were looking for which was a wildcard search using oslc.where?

Your answer


Register or to post your answer.