This activity queries a resource/collection exposed by an XMLDB data service resource using an XQuery expression.
It has no input and one output - the query result in XML. The format of the output is OGSA-DAI specific XML. For example:
- Author:
- The OGSA-DAI Project Team
Field Summary |
private static?java.lang.String |
COPYRIGHT_NOTICE
??????????Copyright statement |
private ?java.lang.String |
mCollectionName
??????????Name of collection to query |
private ?java.lang.String |
mExpression
??????????XQuery expression |
private ?java.util.Map |
mNamespaces
??????????Namespace bindings used in the XQuery expression |
private ?java.lang.String |
mResourceName
??????????Name of resource to query |
?
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.Activity |
|
?
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent |
|
?
Constructor Summary |
XQuery()
??????????Constructs an XQuery query request. |
XQuery(java.lang.String?expression)
??????????Constructs a request to query a resource/collection using XQuery. |
?
Method Summary |
protected ?java.lang.String |
generateXML()
??????????Generates the XML representing the activity. |
?ActivityOutput |
getOutput()
??????????Gets the activity's only output - the XQuery query result. |
?org.xmldb.api.base.ResourceSet |
getResourceSet()
??????????Get the results of the query as a ResourceSet . |
?void |
setCollectionName(java.lang.String?collectionName)
??????????Set the collection name. |
?void |
setExpression(java.lang.String?expression)
??????????Set the XQuery expression. |
?void |
setNamespaceBinding(java.lang.String?prefix, java.lang.String?url)
??????????Add a binding from a namespace prefix used within the XQuery query to a namespace URL. |
?void |
setNamespaceBindings(java.util.Map?bindings)
??????????Add a collection of bindings from namespace prefixes used within the XQuery query to namespace URLs. |
?void |
setResourceName(java.lang.String?resourceName)
??????????Set the resource name. |
?
?
?
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
?
COPYRIGHT_NOTICE
private static final java.lang.String COPYRIGHT_NOTICE
-
Copyright statement
- See Also:
- Constant Field Values
mExpression
private java.lang.String mExpression
-
XQuery expression
mResourceName
private java.lang.String mResourceName
-
Name of resource to query
mCollectionName
private java.lang.String mCollectionName
-
Name of collection to query
mNamespaces
private java.util.Map mNamespaces
-
Namespace bindings used in the XQuery expression
XQuery
public XQuery()
-
Constructs an XQuery query request. The query expression must be set using
setExpression
All resources in the base collection and its sub-collections will be queried.
XQuery
public XQuery(java.lang.String?expression)
-
Constructs a request to query a resource/collection using XQuery. All resources in the base collection and its sub-collections will be queried.
- Parameters:
-
expression
- XQuery query expression.
- Throws:
-
java.lang.IllegalArgumentException
- If expression
is null
setExpression
public void setExpression(java.lang.String?expression)
-
Set the XQuery expression.
-
- Parameters:
-
expression
- XQuery query expression.
- Throws:
-
java.lang.IllegalArgumentException
- If expression
is null
setResourceName
public void setResourceName(java.lang.String?resourceName)
-
Set the resource name. The query will be executed on this resource. If this is set to
null
then the query will be executed on all the resources in the selected collection.
-
- Parameters:
-
resourceName
- The name of the resource or null
.
setCollectionName
public void setCollectionName(java.lang.String?collectionName)
-
Set the collection name. The query will be executed within this collection. If this is set to
null
then the query will be executed within the base collection.
-
- Parameters:
-
collectionName
- The name of the collection or null
.
setNamespaceBinding
public void setNamespaceBinding(java.lang.String?prefix,
java.lang.String?url)
-
Add a binding from a namespace prefix used within the XQuery query to a namespace URL.
-
- Parameters:
-
prefix
- A namespace prefix.
-
url
- A legal URL e.g. http://www.org/test
- Throws:
-
java.lang.IllegalArgumentException
- If prefix
or url
are null
or url
is not a legal URL.
setNamespaceBindings
public void setNamespaceBindings(java.util.Map?bindings)
-
Add a collection of bindings from namespace prefixes used within the XQuery query to namespace URLs.
-
- Parameters:
-
bindings
- A collection of mappings from prefix strings to URL strings.
- Throws:
-
java.lang.IllegalArgumentException
- If bindings
is null
or contains entries whose prefix or URL are null
or whose URLs are not legal.
- See Also:
If prefix
or url
are null
or url
is not a legal URL.
getOutput
public ActivityOutput getOutput()
-
Gets the activity's only output - the XQuery query result.
-
- Returns:
- the activity output.
getResourceSet
public org.xmldb.api.base.ResourceSet getResourceSet()
throws NoActivityOutputException,
DataFormatException
-
Get the results of the query as a
ResourceSet
.
-
- Returns:
-
ResourceSet
.
- Throws:
-
NoActivityOutputException
- if there is no output data or the data has not yet been processed to this output or the activity that generates this output has not yet been executed.
-
DataFormatException
- if the output from the activity cannot be parsed into a ResourceSet
.
generateXML
protected java.lang.String generateXML()
- Description copied from class:
RequestComponent
-
Generates the XML representing the activity. This XML can then be inserted into a perform document that is sent to a data service.
-
- Specified by:
-
generateXML
in class Activity
-
- Returns:
- the XML for the activity