org.eclipse.lyo.core.query
Class QueryUtils

java.lang.Object
  extended by 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
static Properties WILDCARD_PROPERTY_LIST
          A property list that selects all properties
 
Constructor Summary
QueryUtils()
           
 
Method Summary
static Map<String,Object> invertSelectedProperties(Properties properties)
          Create a map representation of the Properties returned from parsing oslc.properties or olsc.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 expression
static Map<String,String> parsePrefixes(String prefixExpression)
          Parse a oslc.prefix clause into a map between prefixes and corresponding URIs
static PropertiesClause parseProperties(String propertiesExpression, Map<String,String> prefixMap)
          Parse a oslc.properties expression
static SearchTermsClause parseSearchTerms(String searchTermsExpression)
          Parse a oslc.searchTerms expression
static SelectClause parseSelect(String selectExpression, Map<String,String> prefixMap)
          Parse a oslc.select expression
static WhereClause parseWhere(String whereExpression, Map<String,String> prefixMap)
          Parse a oslc.where expression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WILDCARD_PROPERTY_LIST

public static final Properties WILDCARD_PROPERTY_LIST
A property list that selects all properties

Constructor Detail

QueryUtils

public QueryUtils()
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 URIs

Note: 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 parameter
prefixMap - 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 parameter
prefixMap - 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 parameter
prefixMap - 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 parameter
prefixMap - 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 the Properties returned from parsing oslc.properties or olsc.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:

Parameters:
properties -
Returns:
the property map

parseSearchTerms

public static SearchTermsClause parseSearchTerms(String searchTermsExpression)
                                          throws ParseException
Parse a oslc.searchTerms expression

Note: Object.toString() of result has been overridden to return input expression.

Parameters:
searchTermsExpression - contents of an oslc.searchTerms HTTP query parameter
Returns:
the parsed search terms clause
Throws:
ParseException


Copyright © 2013. All rights reserved.