use of com.inova8.pathql.element.ObjectListValueElement in project com.inova8.intelligentgraph by peterjohnlawrence.
the class PathPatternVisitor method visitPropertyListNotEmpty.
/**
* Visit property list not empty.
*
* @param ctx the ctx
* @return the fact filter element
*/
@Override
public FactFilterElement visitPropertyListNotEmpty(PropertyListNotEmptyContext ctx) {
// propertyListNotEmpty : verbObjectList ( ';' ( verbObjectList )? )* ;
FactFilterElement propertyListNotEmptyElement = new FactFilterElement(this.repositoryContext);
ArrayList<VerbObjectList> propertyListNotEmpty = new ArrayList<VerbObjectList>();
for (VerbObjectListContext verbObjectListContext : ctx.verbObjectList()) {
PathElement verb = visit(verbObjectListContext.verb());
ObjectListValueElement objectList = (ObjectListValueElement) visit(verbObjectListContext.objectList());
VerbObjectList verbObjectList = new VerbObjectList(this.repositoryContext);
if (verb instanceof ValueElement) {
verbObjectList.setFilterOperator(((FilterOperatorValueElement) verb).getFilterOperator());
} else if (verb instanceof PredicateElement) {
verbObjectList.setPredicate(((PredicateElement) verb));
}
verbObjectList.setObjectList(objectList.getObjectList());
propertyListNotEmpty.add(verbObjectList);
}
propertyListNotEmptyElement.setPropertyListNotEmpty(propertyListNotEmpty);
return propertyListNotEmptyElement;
}
use of com.inova8.pathql.element.ObjectListValueElement 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