public class QueryParser
extends java.lang.Object
implements org.ai_heuristic.def.ParserDef
QueryModel
model type. This can parse both text-based or XML-based queries.Constructor and Description |
---|
QueryParser()
Create a new instance of QueryParser
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
parse(org.licas_xml.abs.Element toParse)
Parse the XML element back into the appropriate Object.
|
java.util.ArrayList |
parseList(org.licas_xml.abs.Element toParse)
Parse the XML element back into the appropriate Object.
|
org.licas_xml.abs.Element |
serialize(int index,
QueryModel queryModel,
boolean forDisplay)
Serialize the object into an XML element.
|
org.licas_xml.abs.Element |
serialize(java.lang.Object queryModel)
Serialize the object into an XML element.
|
org.licas_xml.abs.Element |
serializeList(java.util.ArrayList queryList)
Serialize the query list into an XML element.
|
void |
serializePatternConstraints(int index,
PatternElement pattern,
org.licas_xml.abs.Element rootElem)
Serialize the pattern element valueConstraints into an XML element.
|
void |
serializePatternElement(int index,
PatternElement pattern,
org.licas_xml.abs.Element rootElem,
org.licas_xml.abs.Element constraintElem)
Serialize the pattern element into an XML element.
|
java.lang.String |
toStringDescription(int index,
QueryModel queryModel)
Serialize the object into a string-based description only.
|
static org.licas_xml.abs.Element |
uriListToXml(java.lang.String fileType,
java.util.ArrayList uriList)
Convert the query file path list into an xml description for adding to the root model element.
|
public org.licas_xml.abs.Element serializeList(java.util.ArrayList queryList) throws java.lang.Exception
queryList
- a list of QueryModel
objects.java.lang.Exception
- any error.public org.licas_xml.abs.Element serialize(java.lang.Object queryModel) throws java.lang.Exception
serialize
in interface org.ai_heuristic.def.ParserDef
queryModel
- the query model to serialize.java.lang.Exception
- any error.public org.licas_xml.abs.Element serialize(int index, QueryModel queryModel, boolean forDisplay) throws java.lang.Exception
index
- the pattern index. Used for an ID marker only.queryModel
- the query model to serialize.forDisplay
- if true for display only, if false then for data transfer.java.lang.Exception
- any error.public void serializePatternElement(int index, PatternElement pattern, org.licas_xml.abs.Element rootElem, org.licas_xml.abs.Element constraintElem) throws java.lang.Exception
index
- the pattern index. Used for an ID marker only.pattern
- the pattern element to serialize.rootElem
- the root element to add to.constraintElem
- the element to add the valueConstraints description to.java.lang.Exception
- any error.public void serializePatternConstraints(int index, PatternElement pattern, org.licas_xml.abs.Element rootElem) throws java.lang.Exception
index
- the pattern index. Used for an ID marker only.pattern
- the pattern element to serialize.rootElem
- the root element to add to.java.lang.Exception
- any error.public java.util.ArrayList parseList(org.licas_xml.abs.Element toParse) throws java.lang.Exception
toParse
- the element to parse. This should contain mediate child elements that
are of type QueryConst
.QUERYMODEL
, where they are all parsed
and added to a vector list.QueryModel
objects.java.lang.Exception
- any error.public java.lang.Object parse(org.licas_xml.abs.Element toParse) throws java.lang.Exception
parse
in interface org.ai_heuristic.def.ParserDef
toParse
- the element to parse. This should be of type QueryConst
.QUERYMODEL
.QueryModel
.java.lang.Exception
- any error.public java.lang.String toStringDescription(int index, QueryModel queryModel) throws java.lang.Exception
index
- the pattern index. Used for an ID marker only.queryModel
- the query model to serialize.java.lang.Exception
- any error.public static org.licas_xml.abs.Element uriListToXml(java.lang.String fileType, java.util.ArrayList uriList)
fileType
- the file type, if known.uriList
- list of URIs or file paths.