uk.ac.bbk.dcs.automed.xml.wrappers
Class DOMWrapper
java.lang.Object
uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
uk.ac.bbk.dcs.automed.xml.wrappers.XMLWrapper
uk.ac.bbk.dcs.automed.xml.wrappers.DOMWrapper
public class DOMWrapper
- extends XMLWrapper
A lower level wrapper that conforms to the XMLWrapper class. The DOMWrapper class uses XPath and DOM.
The DOMWrapper holds both the schema and the instance documents in memory.
- Author:
- Lucas Zamboulis
| 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 |
protected ASG |
elementAttributeQuery(java.lang.String searchNode1,
java.lang.String searchNode2)
|
protected ASG |
elementElementQuery(java.lang.String searchNode1,
java.lang.String searchNode2)
|
protected ASG |
elementElementQuery(java.lang.String searchNode1,
java.lang.String searchNode2,
int order)
Nodes are compared based on elementName:count, not their whole UID |
protected ASG |
elementPCDataQuery(java.lang.String searchNode)
|
protected ASG |
elementPCDataQuery(java.lang.String searchNode,
int order)
|
protected ASG |
elementQuery(java.lang.String searchNode)
|
protected AutoMedWrapperFactory |
getDefaultWrapperFactory()
Returns a new instance of the default wrapper factory for this wrapper |
org.w3c.dom.Document |
getInputDoc()
|
org.w3c.dom.Document |
getInstanceUIDDoc()
|
uk.ac.bbk.dcs.automed.qproc.annotate.grammars.QueryParser |
getParserType(ASG query)
|
java.lang.String |
getProtocolName()
The name of the Protocol that this wrapper uses |
boolean |
insertIQL(ASG q)
Execute an IQL insert on the datasource. |
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)
|
protected ASG |
textQuery()
|
| Methods inherited from class uk.ac.bbk.dcs.automed.xml.wrappers.XMLWrapper |
connect, executeIQL, executeLocalQuery, executeXMLQuery, getSchemaDoc, getSchemaName, getSchemaUIDDoc, getURI, getXMLDSS, UIDGetAttNameFromAttUID, UIDGetElementName, UIDGetElementName, UIDGetElementNameFromAttUID, UIDGetSchemaUIDFromInstanceUID, UIDGetSchemaUIDFromInstanceUID |
| Methods inherited from class uk.ac.ic.doc.automed.wrappers.AutoMedWrapper |
atDebugLevel, cacheWrapper, deleteIQL, getAccessMethod, getAutoMedWrapper, getAutoMedWrapper, getAutoMedWrapperFactory, getDrivers, getOption, getOptionKeyProtection, getOptionKeys, getProtocol, getQueryParser, getSchema, getSchema, newAutoMedSchema, newAutoMedWrapper, newAutoMedWrapper, registerWrapper, selectNewAutoMedWrapper, selectNewAutoMedWrapper, setDebugLevel, setOption |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DOMWrapper
public DOMWrapper(AccessMethod am,
java.lang.String password)
throws DataSourceException,
NotFoundException,
XMLNotFoundException
- Throws:
DataSourceException
NotFoundException
XMLNotFoundException
getParserType
public uk.ac.bbk.dcs.automed.qproc.annotate.grammars.QueryParser getParserType(ASG query)
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
textQuery
protected final ASG textQuery()
- Specified by:
textQuery in class XMLWrapper
- Returns:
- all PCData and CData nodes
elementQuery
protected final ASG elementQuery(java.lang.String searchNode)
- Specified by:
elementQuery in class XMLWrapper
- Parameters:
searchNode - the tag of the element (not its UID)
- Returns:
- ASG with the result elements
- Throws:
javax.xml.transform.TransformerException
elementElementQuery
protected final ASG elementElementQuery(java.lang.String searchNode1,
java.lang.String searchNode2)
- Specified by:
elementElementQuery in class XMLWrapper
elementPCDataQuery
protected final ASG elementPCDataQuery(java.lang.String searchNode)
- Specified by:
elementPCDataQuery in class XMLWrapper
elementElementQuery
protected final ASG elementElementQuery(java.lang.String searchNode1,
java.lang.String searchNode2,
int order)
- Nodes are compared based on elementName:count, not their whole UID
- Specified by:
elementElementQuery in class XMLWrapper
- Parameters:
searchNode1 - parent elementsearchNode2 - child elementorder - the order of the child element in its parent's nodelist, including PCData nodes. If -1 then order is unimportant
- Returns:
elementPCDataQuery
protected final ASG elementPCDataQuery(java.lang.String searchNode,
int order)
- Specified by:
elementPCDataQuery in class XMLWrapper
elementAttributeQuery
protected final ASG elementAttributeQuery(java.lang.String searchNode1,
java.lang.String searchNode2)
- Specified by:
elementAttributeQuery in class XMLWrapper
insertIQL
public boolean insertIQL(ASG q)
- Description copied from class:
AutoMedWrapper
- Execute an IQL insert on the datasource. Note that in later releases this
method will become abstract, but at present no Wrapper implements this
method.
- Overrides:
insertIQL in class AutoMedWrapper
- Parameters:
q - is the ASG representation of an IQL
query of the form
sub [t1, ..., tn] s
where:
- 'sub' is the sub-bag builtin function (this has the same
semantics as sub-set if operating on sets, which is what the
extents of schemes are)
- [t1, ..., tn] are the tuples to be inserted/deleted
- s is the scheme that they will be inserted into/deleted from
The semantics and execution of the insert request will
depend on the data source e.g. for a relational database it could
be translated into a series of INSERT requests within a
single transaction, which may fail or succeeed as a whole (and
thus return False or True respectively from the insertIQL
method).
For a non-transactional repository like the HDM or XML flat
files, we may choose to allow partial updates e.g. some of a set
of tuples are inserted, while some already exist or violate some
constraint or another.
getInputDoc
public org.w3c.dom.Document getInputDoc()
throws XMLNotFoundException
- Returns:
- the instance XML data source, without UIDs
- Throws:
XMLNotFoundException
getInstanceUIDDoc
public org.w3c.dom.Document getInstanceUIDDoc()
throws XMLNotFoundException
- Returns:
- the instance XML data source, with UIDs
- Throws:
XMLNotFoundException
getProtocolName
public java.lang.String getProtocolName()
- Description copied from class:
AutoMedWrapper
- The name of the
Protocol that this wrapper uses
- Specified by:
getProtocolName in class AutoMedWrapper
- Returns:
- the name of the
Protocolin the repository used to represent XML DOM connections.
getDefaultWrapperFactory
protected final AutoMedWrapperFactory getDefaultWrapperFactory()
- Returns a new instance of the default wrapper factory for this wrapper
- Specified by:
getDefaultWrapperFactory in class AutoMedWrapper