XMLWrapper
Keywords: uk.ac.bbk.dcs.automed.xml.wrappers.XMLWrapper class

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

## uk.ac.bbk.dcs.automed.xml.wrappers
Class XMLWrapper

    java.lang.Object
      uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
          uk.ac.bbk.dcs.automed.xml.wrappers.XMLWrapper

Direct Known Subclasses:
  DOMWrapper, NXDBWrapper, SAXWrapper

    public abstract class XMLWrapper

extends AutoMedWrapper

XMLWrapper class is a wrapper class for the AutoMed Repository. It acts as a mediator between IQL and XML files in the AutoMed Repository. It queries the XML files by transforming the IQL queries it is given into XPath searches, then transforms the results back into IQL. Allowed queries:

NODE QUERIES:

Elements: <<elementUID>>, returns a list of element instance UIDs that correspond to the input element schema UID.
Attributes: <<elementUID:attributeName>>, returns a list of attribute instance UIDs that correspond to the input attribute schema UID
Get all text: <<AutoMedXMLPCData>>

EDGE QUERIES:

Element-element: <<order,element1UID,element2UID>> or <<element1UID,element2UID>>, returns 2-tuples of element instance UIDs that correspond to the pair of input element schema UIDs. If order is specified, only the 2-tuples having the same order are returned.
Element-text: <<elementUID,AutoMedXMLPCData>> (not <<elementUID,PCDATAUID>>), returns 2-tuples containing the instance UID corresponding to the input element schema UID and the element's text. If order is specified, only the 2-tuples having the same order are returned.
Element-attribute: <<elementUID,attributeName>> (not <<elementUID,attributeUID>>), returns 2-tuples containing the instance UIDs corresponding to the input element and attribute schema UIDs.
Attribute-text: <<attributeUID,AutoMedXMLPCData>>, returns 2-tuples containing the instance UID corresponding to the input attribute schema UID and the atribute's text.

Author:
  Lucas Zamboulis

Field Summary
`protected static java.util.logging.Logger` | `logger`
`protected java.util.ArrayList` | `resultList`
`protected org.w3c.dom.Document` | `schemaDoc`
`protected org.w3c.dom.Document` | `schemaUIDDoc`

Fields inherited from class uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
`am, awf, debug, driver, emptyKeyProtection, emptyKeys, optionKeyProtection, optionKeys, password, s, url, username`

Method Summary
`static org.w3c.dom.Document` | `assignCIDs(org.w3c.dom.Document schemaUIDDoc)` Assigns UIDs to the schema document supplied.
`protected abstract ASG` | `compositeQuery(ASG query)`
`protected void` | `connect()` Use the connection details held with this wrapper to connect to the data source.
`protected abstract ASG` | `elementAttributeQuery(java.lang.String searchNode1, java.lang.String searchNode2)`
`protected ASG` | `elementElementQuery(java.lang.String searchNode1, java.lang.String searchNode2)`
`protected abstract ASG` | `elementElementQuery(java.lang.String searchNode1, java.lang.String searchNode2, int order)`
`protected ASG` | `elementPCDataQuery(java.lang.String searchNode)`
`protected abstract ASG` | `elementPCDataQuery(java.lang.String searchNode1, int order)`
`protected abstract ASG` | `elementQuery(java.lang.String searchNode)`
`ASG` | `executeIQL(ASG q)` Execute an IQL query on the datasource.
`AutoMedResult` | `executeLocalQuery(AutoMedQuery amq)` Execute a query in the datasource's native query language, and obtain a result in an AutoMedResult class
`ASG` | `executeXMLQuery(ASG ASGquery)` Given an IQL query, this method queries the XML file, then returns the answer in ASG format.
`org.w3c.dom.Document` | `getSchemaDoc()`
`java.lang.String` | `getSchemaName()`
`org.w3c.dom.Document` | `getSchemaUIDDoc()`
`void` | `getSODefinition(QuerySubGoal qsg)` An abstract method used by `#getSOQuality(String schemeDef)`.
`java.lang.String` | `getURI()`
`Schema` | `getXMLDSS()`
`protected void` | `initialiseWrapper(AccessMethod am, java.lang.String password)`
`static AutoMedWrapper` | `newAutoMedWrapper(java.lang.String username, java.lang.String password, java.lang.String driver, java.lang.String url, java.lang.String schemaName, AutoMedWrapperFactory awf)`
`static AutoMedWrapper` | `selectNewAutoMedWrapper(java.lang.String username, java.lang.String password, Protocol protocol, java.lang.String driver, java.lang.String url, java.lang.String schemaName, AutoMedWrapperFactory awf)`
`protected abstract ASG` | `textQuery()`
`java.lang.String` | `xpathForAttributeQuery(org.w3c.dom.Document d, java.lang.String elemCID, java.lang.String attribute)`
`java.lang.String` | `xpathForElementQuery(org.w3c.dom.Document schemaUIDDoc, java.lang.String elemCID)`
`java.lang.String` | `xpathForTextQuery(org.w3c.dom.Document schemaUIDDoc, java.lang.String elemCID)`

Methods inherited from class uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
`atDebugLevel, cacheWrapper, deleteIQL, executeIQL, getAccessMethod, getAutoMedWrapper, getAutoMedWrapper, getAutoMedWrapperFactory, getDefaultWrapperFactory, getDrivers, getOption, getOptionKeyProtection, getOptionKeys, getProtocol, getProtocolName, getQueryCache, getQueryCache, getQueryParser, getSchema, getSchema, getSODefinition, insertIQL, newAutoMedSchema, newAutoMedWrapper, newAutoMedWrapper, registerWrapper, selectNewAutoMedWrapper, setDebugLevel, setOption, updateCache`

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

Field Detail

### logger

    protected static java.util.logging.Logger logger

### schemaDoc

    protected org.w3c.dom.Document schemaDoc

### schemaUIDDoc

    protected org.w3c.dom.Document schemaUIDDoc

### resultList

    protected java.util.ArrayList resultList

Method Detail

### initialiseWrapper

    protected void initialiseWrapper(AccessMethod am,
                                     java.lang.String password)
                              throws DataSourceException,
                                     IntegrityException

  Throws:
    `DataSourceException`
    `IntegrityException`

### selectNewAutoMedWrapper

    public static AutoMedWrapper selectNewAutoMedWrapper(java.lang.String username,
                                                         java.lang.String password,
                                                         Protocol protocol,
                                                         java.lang.String driver,
                                                         java.lang.String url,
                                                         java.lang.String schemaName,
                                                         AutoMedWrapperFactory awf)
                                                  throws IntegrityException,
                                                         DataSourceException

  Throws:
    `IntegrityException`
    `DataSourceException`

### newAutoMedWrapper

    public static AutoMedWrapper newAutoMedWrapper(java.lang.String username,
                                                   java.lang.String password,
                                                   java.lang.String driver,
                                                   java.lang.String url,
                                                   java.lang.String schemaName,
                                                   AutoMedWrapperFactory awf)
                                            throws IntegrityException,
                                                   DataSourceException

  Throws:
    `IntegrityException`
    `DataSourceException`

### connect

    protected void connect()
                    throws DataSourceException

  Description copied from class: `AutoMedWrapper`
  Use the connection details held with this wrapper to connect to the data source.

  Specified by:
    `connect` in class `AutoMedWrapper`
  Throws:
    `DataSourceException` - if unable to connect to the data source

### getXMLDSS

    public final Schema getXMLDSS()

  Returns:
    the AutoMed XML DataSource Schema

### getSchemaDoc

    public final org.w3c.dom.Document getSchemaDoc()
                                            throws XMLNotFoundException

  Returns:
    the DOM schema of the XML data source, without UIDs
  Throws:
    `XMLNotFoundException`

### getSchemaUIDDoc

    public final org.w3c.dom.Document getSchemaUIDDoc()
                                               throws XMLNotFoundException

  Returns:
    the DOM schema of the XML data source, with UIDs
  Throws:
    `XMLNotFoundException`

### getSchemaName

    public final java.lang.String getSchemaName()
                                         throws XMLNotFoundException

  Returns:
    the AutoMed schema name of the XML data source
  Throws:
    `XMLNotFoundException`

### getURI

    public final java.lang.String getURI()
                                  throws XMLNotFoundException

  Returns:
    the URI of the XML data source
  Throws:
    `XMLNotFoundException`

### executeIQL

    public final ASG executeIQL(ASG q)
                         throws DataSourceException,
                                NotFoundException

  Description copied from class: `AutoMedWrapper`
  Execute an IQL query on the datasource.

  Specified by:
    `executeIQL` in class `AutoMedWrapper`
  Parameters:
    `q` - An IQL query held in an `ASG` which complies with the limitations of what this wrapper is able to process
  Returns:
    An `ASG` containing the results of the query
  Throws:
    `DataSourceException`
    `NotFoundException`

### executeLocalQuery

    public final AutoMedResult executeLocalQuery(AutoMedQuery amq)

  Description copied from class: `AutoMedWrapper`
  Execute a query in the datasource's native query language, and obtain a result in an AutoMedResult class

  Overrides:
    `executeLocalQuery` in class `AutoMedWrapper`

### executeXMLQuery

    public final ASG executeXMLQuery(ASG ASGquery)
                              throws TranslationException,
                                     NotFoundException

  Given an IQL query, this method queries the XML file, then returns the answer in ASG format. The query schemes have element IDs of the form element$count, so this method appends the sid part to make them proper UIDs

  Parameters:
    `ASGquery` - the IQL query in ASG format
  Returns:
    the answer to the IQL query in ASG format
  Throws:
    `TranslationException`
    `NotFoundException`
    `QProcException`

### xpathForElementQuery

    public java.lang.String xpathForElementQuery(org.w3c.dom.Document schemaUIDDoc,
                                                 java.lang.String elemCID)
                                          throws NotFoundException

  Throws:
    `NotFoundException`

### xpathForAttributeQuery

    public java.lang.String xpathForAttributeQuery(org.w3c.dom.Document d,
                                                   java.lang.String elemCID,
                                                   java.lang.String attribute)
                                            throws TranslationException

  Throws:
    `TranslationException`

### xpathForTextQuery

    public java.lang.String xpathForTextQuery(org.w3c.dom.Document schemaUIDDoc,
                                              java.lang.String elemCID)
                                       throws TranslationException

  Throws:
    `TranslationException`

### textQuery

    protected abstract ASG textQuery()
                              throws TranslationException,
                                     NotFoundException

  Returns:
    all PCData and CData nodes
  Throws:
    `XMLException`
    `TranslationException`
    `NotFoundException`

### elementQuery

    protected abstract ASG elementQuery(java.lang.String searchNode)
                                 throws TranslationException,
                                        NotFoundException

  Throws:
    `TranslationException`
    `NotFoundException`

### elementPCDataQuery

    protected final ASG elementPCDataQuery(java.lang.String searchNode)
                                    throws TranslationException,
                                           NotFoundException

  Throws:
    `TranslationException`
    `NotFoundException`

### elementPCDataQuery

    protected abstract ASG elementPCDataQuery(java.lang.String searchNode1,
                                              int order)
                                       throws TranslationException,
                                              NotFoundException

  Throws:
    `TranslationException`
    `NotFoundException`

### elementAttributeQuery

    protected abstract ASG elementAttributeQuery(java.lang.String searchNode1,
                                                 java.lang.String searchNode2)
                                          throws TranslationException,
                                                 NotFoundException

  Throws:
    `TranslationException`
    `NotFoundException`

### elementElementQuery

    protected final ASG elementElementQuery(java.lang.String searchNode1,
                                            java.lang.String searchNode2)
                                     throws TranslationException,
                                            NotFoundException

  Throws:
    `TranslationException`
    `NotFoundException`

### elementElementQuery

    protected abstract ASG elementElementQuery(java.lang.String searchNode1,
                                               java.lang.String searchNode2,
                                               int order)
                                        throws TranslationException,
                                               NotFoundException

  Throws:
    `TranslationException`
    `NotFoundException`

### compositeQuery

    protected abstract ASG compositeQuery(ASG query)
                                   throws TranslationException,
                                          NotFoundException

  Throws:
    `TranslationException`
    `NotFoundException`

### assignCIDs

    public static org.w3c.dom.Document assignCIDs(org.w3c.dom.Document schemaUIDDoc)

  Assigns UIDs to the schema document supplied.

  Parameters:
    `schemaDoc` - the DOM XMLDSS schema without CIDs
  Returns:
    the DOM XMLDSS schema with CIDs (different object than the input document)

### getSODefinition

    public void getSODefinition(QuerySubGoal qsg)
                         throws DataSourceException

  Description copied from class: `AutoMedWrapper`
  An abstract method used by `#getSOQuality(String schemeDef)`. This method must be implemented by all sub-classes

  Specified by:
    `getSODefinition` in class `AutoMedWrapper`
  Throws:
    `DataSourceException`

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