Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.basex.api.xmldb
Class BXQueryService

    java.lang.Object
      org.basex.api.xmldb.BXQueryService

All Implemented Interfaces:
  BXXMLDBText, Configurable, Service, XPathQueryService

    public final class BXQueryService

extends java.lang.Object
implements XPathQueryService, BXXMLDBText

Abstract QueryService definition for the XMLDB:API.

Author:
  Workgroup DBIS, University of Konstanz 2005-08, ISC License, Andreas Weiler

Field Summary

Fields inherited from interface org.basex.api.xmldb.BXXMLDBText
`CONFORMANCE_LEVEL, DBURI, ERR_BINARY, ERR_CONT, ERR_DOC, ERR_EMPTY, ERR_ID, ERR_INV, ERR_ITER, ERR_NSURI, ERR_PROP, ERR_RES, ERR_TYPE, ERR_UNKNOWN, ERR_URI, LOCALHOST, XMLDB, XMLDBURI`

Constructor Summary
`BXQueryService(BXCollection c, java.lang.String n, java.lang.String v)` Standard constructor.

Method Summary
`void` | `clearNamespaces()` Removes all namespace mappings stored in the internal namespace map.
`java.lang.String` | `getName()` Returns the name associated with the Service instance.
`java.lang.String` | `getNamespace(java.lang.String pre)` Returns the URI string associated with `prefix` from the internal namespace map.
`java.lang.String` | `getProperty(java.lang.String nm)` Returns the value of the property identified by `name`.
`java.lang.String` | `getVersion()` Gets the Version attribute of the Service object
`ResourceSet` | `query(java.lang.String query)` Run an XPath query against the `Collection`.
`ResourceSet` | `queryResource(java.lang.String id, java.lang.String query)` Run an XPath query against an XML resource stored in the `Collection` associated with this service.
`void` | `removeNamespace(java.lang.String pre)` Removes the namespace mapping associated with `prefix` from the internal namespace map.
`void` | `setCollection(Collection col)` Sets the Collection attribute of the Service object
`void` | `setNamespace(java.lang.String pre, java.lang.String uri)` Sets a namespace mapping in the internal namespace map used to evaluate queries.
`void` | `setProperty(java.lang.String nm, java.lang.String value)` Sets the property `name` to have the value provided in `value`.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BXQueryService

    public BXQueryService(BXCollection c,
                          java.lang.String n,
                          java.lang.String v)

  Standard constructor.

  Parameters:
    `c` - for collection reference
    `n` - service name
    `v` - version

Method Detail

### setNamespace

    public void setNamespace(java.lang.String pre,
                             java.lang.String uri)
                      throws XMLDBException

  Description copied from interface: `XPathQueryService`
  Sets a namespace mapping in the internal namespace map used to evaluate queries. If `prefix` is null or empty the default namespace is associated with the provided URI. A null or empty `uri` results in an exception being thrown.

  Specified by:
    `setNamespace` in interface `XPathQueryService`
  Parameters:
    `pre` - The prefix to set in the map. If `prefix` is empty or null the default namespace will be associated with the provided URI.
    `uri` - The URI for the namespace to be associated with prefix.
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

### getNamespace

    public java.lang.String getNamespace(java.lang.String pre)

  Description copied from interface: `XPathQueryService`
  Returns the URI string associated with `prefix` from the internal namespace map. If `prefix` is null or empty the URI for the default namespace will be returned. If a mapping for the `prefix` can not be found null is returned.

  Specified by:
    `getNamespace` in interface `XPathQueryService`
  Parameters:
    `pre` - The prefix to retrieve from the namespace map.
  Returns:
    The URI associated with `prefix`

### removeNamespace

    public void removeNamespace(java.lang.String pre)

  Description copied from interface: `XPathQueryService`
  Removes the namespace mapping associated with `prefix` from the internal namespace map. If `prefix` is null or empty the mapping for the default namespace will be removed.

  Specified by:
    `removeNamespace` in interface `XPathQueryService`
  Parameters:
    `pre` - The prefix to remove from the namespace map. If `prefix` is null or empty the mapping for the default namespace will be removed.

### clearNamespaces

    public void clearNamespaces()

  Description copied from interface: `XPathQueryService`
  Removes all namespace mappings stored in the internal namespace map.

  Specified by:
    `clearNamespaces` in interface `XPathQueryService`

### query

    public ResourceSet query(java.lang.String query)
                      throws XMLDBException

  Description copied from interface: `XPathQueryService`
  Run an XPath query against the `Collection`. The XPath will be applied to all XML resources stored in the `Collection`. The result is a `ResourceSet` containing the results of the query. Any namespaces used in the `query` string will be evaluated using the mappings setup using `setNamespace`.

  Specified by:
    `query` in interface `XPathQueryService`
  Parameters:
    `query` - The XPath query string to use.
  Returns:
    A `ResourceSet` containing the results of the query.
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

### queryResource

    public ResourceSet queryResource(java.lang.String id,
                                     java.lang.String query)
                              throws XMLDBException

  Description copied from interface: `XPathQueryService`
  Run an XPath query against an XML resource stored in the `Collection` associated with this service. The result is a `ResourceSet` containing the results of the query. Any namespaces used in the `query` string will be evaluated using the mappings setup using `setNamespace`.

  Specified by:
    `queryResource` in interface `XPathQueryService`
  Parameters:
    `id` - The id of the document to run the query against.
    `query` - The XPath query string to use.
  Returns:
    A `ResourceSet` containing the results of the query.
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

### getName

    public java.lang.String getName()

  Description copied from interface: `Service`
  Returns the name associated with the Service instance.

  Specified by:
    `getName` in interface `Service`
  Returns:
    the name of the object.

### getVersion

    public java.lang.String getVersion()

  Description copied from interface: `Service`
  Gets the Version attribute of the Service object

  Specified by:
    `getVersion` in interface `Service`
  Returns:
    The Version value

### setCollection

    public void setCollection(Collection col)

  Description copied from interface: `Service`
  Sets the Collection attribute of the Service object

  Specified by:
    `setCollection` in interface `Service`
  Parameters:
    `col` - The new Collection value

### getProperty

    public java.lang.String getProperty(java.lang.String nm)

  Description copied from interface: `Configurable`
  Returns the value of the property identified by `name`.

  Specified by:
    `getProperty` in interface `Configurable`
  Parameters:
    `nm` - the name of the property to retrieve.
  Returns:
    the property value or null if no property exists.

### setProperty

    public void setProperty(java.lang.String nm,
                            java.lang.String value)
                     throws XMLDBException

  Description copied from interface: `Configurable`
  Sets the property `name` to have the value provided in `value`.

  Specified by:
    `setProperty` in interface `Configurable`
  Parameters:
    `nm` - the name of the property to set.
    `value` - the value to set for the property.
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD