/** * Process the traversal start event for a query {@link org.plasma.query.model.Property property} * within an {@link org.plasma.query.model.Expression expression} just traversing the property * path if exists and capturing context information for the current {@link * org.plasma.query.model.Expression expression}. * * @see org.plasma.query.visitor.DefaultQueryVisitor#start(org.plasma.query.model.Property) */ @Override public void start(Property property) { org.plasma.query.model.FunctionValues function = property.getFunction(); if (function != null) throw new GraphFilterException( "aggregate functions only supported in subqueries not primary queries"); Path path = property.getPath(); PlasmaType targetType = (PlasmaType) this.rootType; if (path != null) { for (int i = 0; i < path.getPathNodes().size(); i++) { AbstractPathElement pathElem = path.getPathNodes().get(i).getPathElement(); if (pathElem instanceof WildcardPathElement) throw new DataAccessException( "wildcard path elements applicable for 'Select' clause paths only, not 'Where' clause paths"); String elem = ((PathElement) pathElem).getValue(); PlasmaProperty prop = (PlasmaProperty) targetType.getProperty(elem); targetType = (PlasmaType) prop.getType(); // traverse } } PlasmaProperty endpointProp = (PlasmaProperty) targetType.getProperty(property.getName()); this.contextProperty = endpointProp; this.contextType = targetType; this.contextPropertyPath = property.asPathString(); super.start(property); }
public String toString() { StringBuilder buf = new StringBuilder(); buf.append(this.getClass().getSimpleName()); buf.append(" ["); buf.append(property.getName()); buf.append(" "); buf.append(this.operator.getValue().name()); buf.append(" "); buf.append(this.literal.getValue()); buf.append("]"); return buf.toString(); }