@Override public <T> T getProperty(String name) { if ("$depth".equalsIgnoreCase(name)) { return (T) depth; } return super.getProperty(name); }
@Override public OResult next() { OResultInternal result = (OResultInternal) upstream.next(); for (String s : result.getPropertyNames()) { if (OptionalMatchEdgeTraverser.isEmptyOptional(result.getProperty(s))) { result.setProperty(s, null); } } return result; }
for (String propName : propNames.stream().filter(x -> x.startsWith("in_") || x.startsWith("out_")) .collect(Collectors.toList())) { Object val = elem.getProperty(propName); if (val instanceof OElement) { if (((OElement) val).getSchemaType().map(x -> x.isSubClassOf("E")).orElse(false)) {
String alias = proj.getProjectionAlias().getStringValue(); if (proj.isAggregate()) { AggregationContext aggrCtx = preAggr.getProperty(alias); if (aggrCtx == null) { aggrCtx = proj.getAggregationContext(ctx);
private void executeAggregation(OCommandContext ctx, int nRecords) { if (!prev.isPresent()) { throw new OCommandExecutionException("Cannot execute an aggregation or a GROUP BY without a previous result"); } OExecutionStepInternal prevStep = prev.get(); OResultSet lastRs = prevStep.syncPull(ctx, nRecords); while (lastRs.hasNext()) { aggregate(lastRs.next(), ctx); if (!lastRs.hasNext()) { lastRs = prevStep.syncPull(ctx, nRecords); } } finalResults = new ArrayList<>(); finalResults.addAll(aggregateResults.values()); aggregateResults.clear(); for (OResultInternal item : finalResults) { for (String name : item.getPropertyNames()) { Object prevVal = item.getProperty(name); if (prevVal instanceof AggregationContext) { item.setProperty(name, ((AggregationContext) prevVal).getFinalValue()); } } } }
public void applyUpdate(OResultInternal doc, OCommandContext ctx) { Object rightValue = right.execute(doc, ctx); OType type = calculateTypeForThisItem(doc, ctx); OClass linkedType = calculateLinkedTypeForThisItem(doc, ctx); rightValue = convertToType(rightValue, type, linkedType, ctx); if (leftModifier == null) { applyOperation(doc, left, rightValue, ctx); } else { Object val = doc.getProperty(left.getStringValue()); if (val == null) { val = initSchemafullCollections(doc, left.getStringValue()); } leftModifier.setValue(doc, val, rightValue, ctx); } }
continue; } else if (s.equalsIgnoreCase("@rid")) { Object newRid = getProperty(s); if (newRid instanceof OIdentifiable) { newRid = ((OIdentifiable) newRid).getIdentity(); oldId.setClusterPosition(((ORID) newRid).getClusterPosition()); } else if (s.equalsIgnoreCase("@version")) { Object v = getProperty(s); if (v instanceof Number) { ORecordInternal.setVersion(doc, ((Number) v).intValue()); doc.setClassName(getProperty(s)); } else { doc.setProperty(s, convertToElement(getProperty(s)));