Package org.eclipse.lyo.core.query
Class QueryUtils
- java.lang.Object
-
- org.eclipse.lyo.core.query.QueryUtils
-
public class QueryUtils extends Object
Utility methods for parsing various OSLC HTTP query parameter clauses; e.g.oslc.where
-
-
Field Summary
Fields Modifier and Type Field Description static Properties
WILDCARD_PROPERTY_LIST
A property list that selects all properties
-
Constructor Summary
Constructors Constructor Description QueryUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,Object>
invertSelectedProperties(Properties properties)
Create a map representation of theProperties
returned from parsingoslc.properties
oroslc.select
URL query parameters suitable for generating a property result from an HTTP GET request.static OrderByClause
parseOrderBy(String orderByExpression, Map<String,String> prefixMap)
Parse a oslc.orderBy expressionstatic Map<String,String>
parsePrefixes(String prefixExpression)
Parse a oslc.prefix clause into a map between prefixes and corresponding URIsstatic PropertiesClause
parseProperties(String propertiesExpression, Map<String,String> prefixMap)
Parse a oslc.properties expressionstatic SearchTermsClause
parseSearchTerms(String searchTermsExpression)
Parse anoslc.searchTerms
expressionstatic SelectClause
parseSelect(String selectExpression, Map<String,String> prefixMap)
Parse a oslc.select expressionstatic WhereClause
parseWhere(String whereExpression, Map<String,String> prefixMap)
Parse a oslc.where expression
-
-
-
Field Detail
-
WILDCARD_PROPERTY_LIST
public static final Properties WILDCARD_PROPERTY_LIST
A property list that selects all properties
-
-
Method Detail
-
parsePrefixes
public static Map<String,String> parsePrefixes(String prefixExpression) throws ParseException
Parse a oslc.prefix clause into a map between prefixes and corresponding URIsNote:
Object.toString()
of result has been overridden to return input expression.- Parameters:
prefixExpression
- the oslc.prefix expression- Returns:
- the prefix map
- Throws:
ParseException
-
parseWhere
public static WhereClause parseWhere(String whereExpression, Map<String,String> prefixMap) throws ParseException
Parse a oslc.where expression- Parameters:
whereExpression
- contents of an oslc.where HTTP query parameterprefixMap
- map between XML namespace prefixes and associated URLs- Returns:
- the parsed where clause
- Throws:
ParseException
-
parseSelect
public static SelectClause parseSelect(String selectExpression, Map<String,String> prefixMap) throws ParseException
Parse a oslc.select expression- Parameters:
selectExpression
- contents of an oslc.select HTTP query parameterprefixMap
- map between XML namespace prefixes and associated URLs- Returns:
- the parsed select clause
- Throws:
ParseException
-
parseProperties
public static PropertiesClause parseProperties(String propertiesExpression, Map<String,String> prefixMap) throws ParseException
Parse a oslc.properties expression- Parameters:
propertiesExpression
- contents of an oslc.properties HTTP query parameterprefixMap
- map between XML namespace prefixes and associated URLs- Returns:
- the parsed properties clause
- Throws:
ParseException
-
parseOrderBy
public static OrderByClause parseOrderBy(String orderByExpression, Map<String,String> prefixMap) throws ParseException
Parse a oslc.orderBy expression- Parameters:
orderByExpression
- contents of an oslc.orderBy HTTP query parameterprefixMap
- map between XML namespace prefixes and associated URLs- Returns:
- the parsed order by clause
- Throws:
ParseException
-
invertSelectedProperties
public static Map<String,Object> invertSelectedProperties(Properties properties)
Create a map representation of theProperties
returned from parsingoslc.properties
oroslc.select
URL query parameters suitable for generating a property result from an HTTP GET request.The map keys are the property names; i.e. the local name of the property concatenated to the XML namespace of the property. The values of the map are:
- Wildcard, if all properties at this level are to be output. No recursion below this level is to be done.
-
OSLC4JConstants.OSL4J_PROPERTY_SINGLETON
- if only the named property is to be output, without recursion - a nested property list to recurse through
- Parameters:
properties
-- Returns:
- the property map
-
parseSearchTerms
public static SearchTermsClause parseSearchTerms(String searchTermsExpression) throws ParseException
Parse anoslc.searchTerms
expressionNote:
Object.toString()
of result has been overridden to return input expression.- Parameters:
searchTermsExpression
- contents of anoslc.searchTerms
HTTP query parameter- Returns:
- the parsed search terms clause
- Throws:
ParseException
-
-