use of com.inova8.pathql.pathPattern.PathPatternParser.ObjectContext in project com.inova8.intelligentgraph by peterjohnlawrence.
the class PathPatternVisitor method visitObjectList.
/**
* Visit object list.
*
* @param ctx the ctx
* @return the object list value element
*/
@Override
public ObjectListValueElement visitObjectList(ObjectListContext ctx) {
// objectList : object ( ',' object )*;
// object : iriRef | literal | factFilterPattern | BINDVARIABLE ;
ArrayList<ObjectElement> objectList = new ArrayList<ObjectElement>();
for (ObjectContext objectContext : ctx.object()) {
if (objectContext.iriRef() != null) {
objectList.add((ObjectElement) visit(objectContext.iriRef()));
} else if (objectContext.literal() != null) {
objectList.add((ObjectElement) visit(objectContext.literal()));
} else if (objectContext.factFilterPattern() != null) {
objectList.add((ObjectElement) visit(objectContext.factFilterPattern()));
} else if (objectContext.BINDVARIABLE() != null) {
String bindVariableIndex = objectContext.BINDVARIABLE().getText().substring(1);
BindVariableElement bindVariableElement = new BindVariableElement(this.repositoryContext);
bindVariableElement.setBindVariableIndex(Integer.parseInt(bindVariableIndex));
objectList.add((ObjectElement) bindVariableElement);
}
}
ObjectListValueElement objectListElement = new ObjectListValueElement(this.repositoryContext);
objectListElement.setObjectList(objectList);
return objectListElement;
}
Aggregations