|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.exist.fluent.QueryService
public class QueryService
Provides facilities for performing queries on a database. It cannot be instantiated directly; you must obtain an instance from a resource or the database.
Nested Class Summary | |
---|---|
static class |
QueryService.QueryAnalysis
An access point for running various analyses on a query. |
static class |
QueryService.Statistics
|
Method Summary | |
---|---|
ItemList |
all(String query,
Object... params)
Get all items that match the given query in the context of this object. |
QueryService.QueryAnalysis |
analyze(String query,
Object... params)
Statically analyze a query for various properties. |
QueryService |
clone()
|
QueryService |
clone(NamespaceMap nsBindingsOverride,
Map<QName,?> varBindingsOverride)
Clone this query service, optionally overriding the clone's namespace and variable bindings. |
Database |
database()
Return the database to which the resource that provides the context for this query service belongs. |
boolean |
exists(String query,
Object... params)
Return whether at least one item matches the given query in the context of this object. |
boolean |
flag(String query,
boolean defaultValue)
|
QueryService |
importModule(Document module)
Import an XQuery library module from the given document. |
QueryService |
importSameModulesAs(QueryService that)
Import the same modules into this query service as imported by the given query service. |
QueryService |
let(QName variableName,
Object value)
Bind a variable to the given value within all query expression evaluated subsequently. |
QueryService |
let(String variableName,
Object value)
Bind a variable to the given value within all query expression evaluated subsequently. |
QueryService |
limitRootDocuments(Collection<XMLDocument> rootDocs)
Limit the root documents accessible to the query to the given list, overriding the any set derived from the query's context. |
QueryService |
limitRootDocuments(XMLDocument... rootDocs)
Limit the root documents accessible to the query to the given list, overriding the any set derived from the query's context. |
QueryService |
namespace(String key,
String uri)
Declare a namespace binding within the scope of this query. |
NamespaceMap |
namespaceBindings()
Return this query service's namespace bindings for inspection or modification. |
Item |
optional(String query,
Object... params)
Get no more than one item that matches the given query in the context of this object. |
QueryService |
presub()
Pre-substitute variables of the form '$n' where n is an integer in all query expressions evaluated subsequently. |
void |
run(String query,
Object... params)
Run the given query, ignoring the results. |
Item |
single(String query,
Object... params)
Get the one and only item that matches the given query in the context of this object. |
static QueryService.Statistics |
statistics()
Get the process-wide performance statistics gathering facet. |
ItemList |
unordered(String query,
Object... params)
Get all items that match the given query in the context of this object, without regard for the order of the results. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static QueryService.Statistics statistics()
public Database database()
public QueryService let(String variableName, Object value)
variableName
- the qualified name of the variable to bind;
prefixes are taken from the namespace mappings of the folder that provided this service;
if the name starts with a $
, it will be stripped automaticallyvalue
- the value the variable should take
public QueryService let(QName variableName, Object value)
variableName
- the qualified name of the variable to bindvalue
- the value the variable should take
public QueryService namespace(String key, String uri)
key
- the key to binduri
- the namespace uri
public NamespaceMap namespaceBindings()
public QueryService importModule(Document module)
module
- the non-XML document that holds the library module's source
DatabaseException
- if the module is an XML document, or the module declaration
cannot be found at the top of the documentpublic QueryService importSameModulesAs(QueryService that)
that
- the query service to copy module imports from
public QueryService limitRootDocuments(XMLDocument... rootDocs)
rootDocs
- the list of root documents to limit the query to
public QueryService limitRootDocuments(Collection<XMLDocument> rootDocs)
rootDocs
- the list of root documents to limit the query to
public QueryService presub()
public QueryService clone()
clone
in class Object
public QueryService clone(NamespaceMap nsBindingsOverride, Map<QName,?> varBindingsOverride)
nsBindingsOverride
- the namespace bindings to clone, or null
to clone from the originalvarBindingsOverride
- the variable bindings to clone, or null
to clone from the original
public ItemList all(String query, Object... params)
query
- the query to matchparams
- parameters to the query, will be substituted for $_1, $_2, etc.
public void run(String query, Object... params)
query
- the query to runparams
- parameters to the query, will be substituted for $_1, $_2, etc.public ItemList unordered(String query, Object... params)
query
- the query to matchparams
-
public Item single(String query, Object... params)
query
- the query to matchparams
-
public Item optional(String query, Object... params)
query
- the query to matchparams
-
Item.NULL
if nonepublic boolean flag(String query, boolean defaultValue)
public boolean exists(String query, Object... params)
query
- the query to matchparams
-
true
if at least one item matches, false
otherwisepublic QueryService.QueryAnalysis analyze(String query, Object... params)
query
- the query to analyzeparams
- parameters for the query; if necessary parameters are left out they will be listed as required variables in the analysis
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |