Package org.basex.query
Class QueryResources
java.lang.Object
org.basex.query.QueryResources
This class provides access to all kinds of resources (databases, documents, database connections,
sessions) used by an XQuery expression.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Method Summary
Modifier and TypeMethodDescriptionvoidadd(InputStream input) Adds an input stream reference.voidaddCollection(String name, String[] paths, StaticContext sc) Adds a collection with the specified paths.voidaddDoc(String name, String path, StaticContext sc) Adds a document with the specified path.voidaddResource(String uri, String... strings) Adds a resource with the specified path.collection(QueryInput qi, InputInfo ii) Evaluatesfn:collection(): opens an existing collection, or creates a new data reference.Opens a new database or returns a reference to an already opened database.doc(QueryInput qi, InputInfo ii) Evaluatesfn:doc(): opens an existing database document, or creates a new database and node.voidAttaches full-text maps.<R extends QueryResource>
RReturns or creates an external resource of the specified class.modules()Returns the module loader.voidremove(InputStream input) Closes and removes an input stream reference.voidRemoves and closes the specified database.String[]Returns the document path of a textual resource and its encoding.
-
Method Details
-
index
Returns or creates an external resource of the specified class.- Type Parameters:
R- resource- Parameters:
resource- external resource- Returns:
- resource
-
add
Adds an input stream reference.- Parameters:
input- input stream
-
remove
Closes and removes an input stream reference.- Parameters:
input- input stream- Throws:
IOException- I/O exception
-
database
Opens a new database or returns a reference to an already opened database.- Parameters:
name- name of databaseii- input info- Returns:
- database instance
- Throws:
QueryException- query exception
-
doc
Evaluatesfn:doc(): opens an existing database document, or creates a new database and node.- Parameters:
qi- query inputii- input info- Returns:
- document
- Throws:
QueryException- query exception
-
collection
Evaluatesfn:collection(): opens an existing collection, or creates a new data reference.- Parameters:
qi- query input (set tonullif default collection is requested)ii- input info- Returns:
- collection
- Throws:
QueryException- query exception
-
modules
Returns the module loader. Called during parsing.- Returns:
- module loader
-
remove
Removes and closes the specified database. Called during updates.- Parameters:
name- name of database to be removed
-
text
Returns the document path of a textual resource and its encoding. Only required for test APIs.- Parameters:
uri- resource uri- Returns:
- path and encoding or
null
-
addDoc
Adds a document with the specified path. Only called from the test APIs.- Parameters:
name- document identifier (may benull)path- document pathsc- static context (can benull)- Throws:
QueryException- query exception
-
addResource
Adds a resource with the specified path. Only called from the test APIs.- Parameters:
uri- resource uristrings- resource strings (path, encoding)
-
addCollection
Adds a collection with the specified paths. Only called from the test APIs.- Parameters:
name- name of collection (can be empty string)paths- documents pathssc- static context (can benull)- Throws:
QueryException- query exception
-
ftmaps
Attaches full-text maps. Only called from the test APIs.- Parameters:
sw- stop wordsth- thesaurus
-