|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.fatdog.xmlEngine.XQEngine
The main driver for the query engine.
Field Summary | |
static int |
AGGRESSIVE
|
static java.lang.String |
DEFAULT_EXPLICIT_DOCNAME
|
static int |
MEEK
|
static int |
MILD
|
Constructor Summary | |
XQEngine()
|
Method Summary | |
boolean |
doSerializeIndex()
|
static double |
elapsedTime(long elapsedMillis)
|
static java.lang.String |
fileToURLString(java.io.File file)
Utility routine borrowed (thanks) from James Clark. |
java.lang.String |
getDocumentName(int docId)
Get the name of the document corresponding to its docId. |
IndexManager |
getIndexManager()
Return the IndexManager for this session. |
int[] |
getNodeTypeCounts()
Get a breakdown of node types in the index. |
int |
getNumDocuments()
Get the number of documents in the index. |
int |
getNumTotalElementNames()
|
int |
getNumUniqueElementNames()
|
SAXHandler |
getSaxHandler()
Get the SAXHandler currently in use. |
java.lang.String |
getSerializationDirectory()
|
long |
getTotalFileLength()
Return the aggregate file length of all files in the index. |
boolean |
getUseLexicalPrefixes()
|
boolean |
isDebugOutputToConsole()
Queries whether the debug-output-to-console flag has been set. |
boolean |
isDistributedQNameDictionaries()
|
boolean |
isShowFileIndexing()
Queries whether file-indexing progress is to be written to the console. |
boolean |
isWordIndexing()
|
void |
printSessionStats(long elapsedMillis,
java.io.PrintWriter dest)
Print a summary of indexing information. |
void |
printSessionStats(long elapsedMillis,
java.io.PrintWriter destination,
boolean doTextBlocks)
Print a summary of indexing information. |
void |
registerProtocolHandler(java.lang.String scheme,
IProtocolHandler yourHandler)
Register an IProtocolHandler object to receive, via its IProtocolHandler.content(java.lang.String) method,
the address argument passed in to either the setDocument(String) method or the setExplicitDocument(String) function. |
void |
setDebugOutputToConsole(boolean debugOutput)
Set a flag indicating whether debug output is desired. |
int |
setDocument(java.lang.String name)
|
int |
setDocument(java.lang.String name,
boolean inQuery)
Index this document. |
int |
setExplicitDocument(java.lang.String explicitContent)
Add explicit (literal angle-bracket) XML to the index. |
void |
setIsDistributedQNameDictionaries(boolean isDistributed)
|
void |
setIsWordIndexing(boolean wordIndexing)
NYI. |
void |
setMinIndexableWordLength(int length)
Set the minimum length of word to index. |
ResultList |
setQuery(java.lang.String query)
Pass an XQuery query to the engine, get a ResultList back. |
ResultList |
setQueryFromFile(java.lang.String file)
An alternative form of setQuery(String) . |
void |
setShowFileIndexing(boolean showFileIndexing)
Query status of file-indexing flag. |
void |
setUseLexicalPrefixes(boolean useLexicalPrefixes)
Indicate whether lexical (non-standard) namespace searching is in effect. |
IndexManager |
setXMLReader(org.xml.sax.XMLReader reader)
Indicate the SAX2 XMLReader you want to use for parsing XML documents. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String DEFAULT_EXPLICIT_DOCNAME
public static int AGGRESSIVE
public static int MILD
public static int MEEK
Constructor Detail |
public XQEngine()
Method Detail |
public void setIsDistributedQNameDictionaries(boolean isDistributed)
public boolean isDistributedQNameDictionaries()
public void setIsWordIndexing(boolean wordIndexing)
wordIndexing
- public boolean isWordIndexing()
public void setUseLexicalPrefixes(boolean useLexicalPrefixes)
Lexical prefix/namespace searching allows specification of location-path queries such as //biblio:book -- the QName prefix will be searched for exactly as is. A namespace declaration is not required (and is an error if present).
If lexical prefix searching is false, a namespace declaration for the prefix is required.
useLexicalPrefixes
- a boolean flag indicating whether non-standard
lexical prefix searching is allowed.public boolean getUseLexicalPrefixes()
public void setDebugOutputToConsole(boolean debugOutput)
This sets a flag in the engine that calling routines can interrogate
via isDebugOutputToConsole()
. This flag is only informational and
doesn't actually force debug output (which results from printing
the result of ResultList.toString()
to the console).
debugOutput
- boolean toogle for indicating desired output typepublic boolean isDebugOutputToConsole()
public boolean isShowFileIndexing()
public void setShowFileIndexing(boolean showFileIndexing)
isShowFileIndexing()
public IndexManager getIndexManager()
IndexManager
for this session.
public void setMinIndexableWordLength(int length)
Default is 1.
length
- Only index words of this length or greaterpublic IndexManager setXMLReader(org.xml.sax.XMLReader reader)
XMLReader
you want to use for parsing XML documents.
reader
- The XMLReader
IndexManager
for the query enginepublic SAXHandler getSaxHandler()
public void registerProtocolHandler(java.lang.String scheme, IProtocolHandler yourHandler)
IProtocolHandler
object to receive, via its IProtocolHandler.content(java.lang.String)
method,
the address argument passed in to either the setDocument(String)
method or the setExplicitDocument(String)
function.
The query engine will have determined that the address is prefixed by the scheme prefix
being registered by this function. The engine uses the scheme to distinguish
custom-protocol-based addresses from normal filepath-based addresses,
so you should ensure the engine can use your scheme to disambiguate between the two.
scheme
- An arbitrary string prefix of your own devisingyourHandler
- An IProtocolHandler
object
java.lang.IllegalArgumentException
- If scheme or yourHandler are null, or the scheme is already registeredpublic int setExplicitDocument(java.lang.String explicitContent) throws CantParseDocumentException, MissingOrInvalidSaxParserException
Can be called repeatedly to add different explicit documents to the index. Unlike setDocument(java.lang.String)
,
this method takes literal, angle-bracket XML content and not a filename as a argument.
explicitContent
- The literal "angle bracket" XML content you want indexed
CantParseDocumentException
- If the SAX parser can't parse the document
MissingOrInvalidSaxParserException
- If the SAX parser is missing or invalidpublic int setDocument(java.lang.String name) throws java.io.FileNotFoundException, CantParseDocumentException, MissingOrInvalidSaxParserException
java.io.FileNotFoundException
CantParseDocumentException
MissingOrInvalidSaxParserException
public int setDocument(java.lang.String name, boolean inQuery) throws java.io.FileNotFoundException, CantParseDocumentException, MissingOrInvalidSaxParserException
The document can be either :
name
- The name of the document to be indexed
java.io.FileNotFoundException
- If the file couldn't be located
CantParseDocumentException
- If the SAX parser complained
MissingOrInvalidSaxParserException
- No SAX parser had been registeredpublic static double elapsedTime(long elapsedMillis)
public int[] getNodeTypeCounts()
public long getTotalFileLength()
public void printSessionStats(long elapsedMillis, java.io.PrintWriter dest)
elapsedMillis
- Elapsed time in milliseconds since the indexing session began.dest
- PrintWriter
where output should be directed.public void printSessionStats(long elapsedMillis, java.io.PrintWriter destination, boolean doTextBlocks)
elapsedMillis
- Elapsed time in milliseconds since the indexing session began.destination
- PrintWriter
where output should be directed.doTextBlocks
- Show space allocated in NodeTrees for concatenated element and attribute textpublic static java.lang.String fileToURLString(java.io.File file)
file
- The java File object representation of the file.
public ResultList setQueryFromFile(java.lang.String file) throws InvalidQueryException
setQuery(String)
.
file
- Name of the file containing the XQuery query
ResultList
object representing the results
InvalidQueryException
- If the query was invalidpublic ResultList setQuery(java.lang.String query) throws InvalidQueryException
ResultList
back.
query
- A valid XQuery query in String format
ResultList
object
InvalidQueryException
public int getNumDocuments()
public java.lang.String getDocumentName(int docId)
docId
- The integer ID assigned to the document when it was indexed.setDocument(java.lang.String)
,
setExplicitDocument(java.lang.String)
public int getNumUniqueElementNames()
public int getNumTotalElementNames()
public boolean doSerializeIndex()
public java.lang.String getSerializationDirectory()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |