Vector<XAQLToken> fromClauseTokens = token.children();
int iToken = 0;
String variableName = fromClauseTokens.get(iToken++).value();
XPath archiveTargetPath = null;
if (fromClauseTokens.size() > iToken) {
if (fromClauseTokens.get(iToken).type() == XAQLToken.RELATIVE_TARGET_PATH) {
archiveTargetPath = new AbsoluteTargetPathGenerator().getTargetPath(schemaRoot, versionIndex, fromClauseTokens.get(iToken++).children().iterator());
} else {
archiveTargetPath = new AbsoluteTargetPathGenerator().getTargetPath(schemaRoot, versionIndex);
}
} else {
archiveTargetPath = new AbsoluteTargetPathGenerator().getTargetPath(schemaRoot, versionIndex);
}
QueryVariable rootVariable = new QueryVariable(variableName, archiveTargetPath);
QueryVariableListing variableListing = new QueryVariableListing(rootVariable);
while (iToken < fromClauseTokens.size()) {
variableName = fromClauseTokens.get(iToken++).value();
QueryVariable parent = variableListing.get(fromClauseTokens.get(iToken).children().firstElement().value());
XPath targetPath = new VariableTargetPathGenerator().getTargetPath(parent.targetEntity(), versionIndex, fromClauseTokens.get(iToken++).children().iterator()); //should order matter??YES
QueryVariable variable = new QueryVariable(variableName, targetPath);
parent.children().add(variable);
variableListing.add(variable);
}
return new FromClause(rootVariable, variableListing);