*/
public ArrayList<DBAnswer> detectType() {
Iterator<String> it = this.tokens.iterator();
QueryBuilder builder = new QueryBuilder();
ArrayList<DBAnswer> types = new ArrayList<DBAnswer>();
BooleanResult askpersonresult = new BooleanResult();
BooleanResult askplaceresult = new BooleanResult();
QueryResult result = new QueryResult();
while (it.hasNext()) {
String toCheck = it.next();
/** Try if person or place with name (token substring) exists in DB */
askpersonresult = (BooleanResult) builder.query(toCheck,
"askperson");
System.out.println(askpersonresult);
askplaceresult = (BooleanResult) builder.query(toCheck, "askplace");
System.out.println(askplaceresult);
/**
* If results for askpersonresult & askplaceresult are both true,
* prefer the person result, else choose the one whose QueryResult
* contains true
*/
if (askpersonresult.isTrue() && !(askplaceresult.isTrue())) {
result = builder.query(toCheck, "person");
} else if (!(askpersonresult.isTrue()) && askplaceresult.isTrue()) {
result = builder.query(toCheck, "place");
} else if (!(askpersonresult.isTrue())
&& !(askplaceresult.isTrue()))
continue;
else {
result = builder.query(toCheck, "place");
if(result.isEmpty()){
result = builder.query(toCheck, "person");