Target collection for the $graphLookup operation to search, recursively
matching the connectFromField to the connectToField.

The from collection cannot be sharded and must be in the same database as
any other collections used in the operation.
166794
public function from(string $from) : self
    {
        // $from can either be
        // a) a field name indicating a reference to a different document. Currently, only REFERENCE_STORE_AS_ID is supported
        // b) a Class name
        // c) a collection name
        // In cases b) and c) the local and foreign fields need to be filled
        if ($this->class->hasReference($from)) {
            return $this->fromReference($from);
        }

        // Check if mapped class with given name exists
        try {
            $this->targetClass = $this->dm->getClassMetadata($from);
        } catch (BaseMappingException $e) {
            $this->from = $from;
            return $this;
        }

        if ($this->targetClass->isSharded()) {
            throw MappingException::cannotUseShardedCollectionInLookupStages($this->targetClass->name);
        }

        $this->from = $this->targetClass->getCollection();
        return $this;
    }
137171
def relations_to(self, target, include_object=False):
        '''  '''
        relations = self._get_item_node(target).incoming
        if include_object:
            for k in relations:
                for v in relations[k]:
                    if hasattr(v, 'obj'): # filter dead links
                        yield v.obj, k
        else:
            yield from relations
489168
def build_node_graph_data_search(key: str, data_predicate: Callable[[Any], bool]):  # noqa: D202
    

    def node_data_filter(graph: BELGraph, node: BaseEntity) -> bool:
        """Pass if the given node has a given data annotated and passes the contained filter."""
        value = graph.nodes[node].get(key)
        return value is not None and data_predicate(value)

    return node_data_filter
1249644
@Override
	protected QueryLookupStrategy getQueryLookupStrategy(QueryLookupStrategy.Key key) {
		return SimpleDbQueryLookupStrategy.create(simpleDbOperations, key);
	}
1131363
public static <K, VV, EV> Graph<K, VV, EV> fromCollection(Collection<Vertex<K, VV>> vertices,
			Collection<Edge<K, EV>> edges, ExecutionEnvironment context) {

		return fromDataSet(context.fromCollection(vertices),
				context.fromCollection(edges), context);
	}
198264
private void collectGroupValues(Entity obj, PathEntry entry, GroupSetEntry groupSetEntry, Set<String>[] groupKeys) {
		if(entry.query != null) {
			timers.start("Where", entry.queryText);
			boolean result = entry.checkCondition(obj);
			timers.stop("Where", entry.queryText, result ? 1 : 0);
			if (!result) return;
		}

		for(PathEntry field : entry.leafBranches) {
			String fieldName = field.name;
			int groupIndex = field.groupIndex;
			if(fieldName == PathEntry.ANY) {
			    groupSetEntry.m_groupPaths[groupIndex].addValueKeys(groupKeys[groupIndex], obj.id().toString());
			}
			else {
				String value = obj.get(fieldName);
				if(value == null || value.indexOf(CommonDefs.MV_SCALAR_SEP_CHAR) == -1) {
				    groupSetEntry.m_groupPaths[groupIndex].addValueKeys(groupKeys[groupIndex], value);
				}
				else {
					String[] values = value.split(CommonDefs.MV_SCALAR_SEP_CHAR);
					for(String collectionValue : values) {
					    groupSetEntry.m_groupPaths[groupIndex].addValueKeys(groupKeys[groupIndex], collectionValue);
					}
				}
			}
		}
        for(PathEntry child : entry.linkBranches) {
			boolean hasLinkedEntities = false;
            if(child.nestedLinks == null || child.nestedLinks.size() == 0) {
                for(Entity linkedObj : obj.getLinkedEntities(child.name, child.fieldNames)) {
    				hasLinkedEntities = true;
                    collectGroupValues(linkedObj, child, groupSetEntry, groupKeys);
                }
            }
            else {
                for(LinkInfo linkInfo : child.nestedLinks) {
                    for(Entity linkedObj : obj.getLinkedEntities(linkInfo.name, child.fieldNames)) {
        				hasLinkedEntities = true;
                        collectGroupValues(linkedObj, child, groupSetEntry, groupKeys);
                    }
                }
            }
			if(!hasLinkedEntities && !child.hasUnderlyingQuery())
				nullifyGroupKeys(child, groupSetEntry, groupKeys);
        }
    }
454595
private void connectNodesIfNecessary(AbstractPlanNode node) {
        NodeSchema outputSchema = node.getOutputSchema();
        if (outputSchema != null) {
            for (SchemaColumn col : outputSchema) {
                connectPredicateStmt(col.getExpression());
            }
        }
        if (node instanceof AbstractScanPlanNode) {
            AbstractScanPlanNode scanNode = (AbstractScanPlanNode)node;
            connectPredicateStmt(scanNode.getPredicate());
            // If this is common table scan, we connect the scan node to the
            // plan nodes for the base and recursive query.
            if (scanNode instanceof SeqScanPlanNode) {
                SeqScanPlanNode seqScanNode = (SeqScanPlanNode)scanNode;
                connectCTENodesIfAny(seqScanNode);
            }
        } else if (node instanceof AbstractJoinPlanNode) {
            AbstractJoinPlanNode joinNode = (AbstractJoinPlanNode)node;
            connectPredicateStmt(joinNode.getPreJoinPredicate());
            connectPredicateStmt(joinNode.getJoinPredicate());
            connectPredicateStmt(joinNode.getWherePredicate());
        } else if (node instanceof AggregatePlanNode) {
            AggregatePlanNode aggNode = (AggregatePlanNode)node;
            connectPredicateStmt(aggNode.getPostPredicate());
        }

        for (AbstractPlanNode inlineNode: node.getInlinePlanNodes().values()) {
            connectNodesIfNecessary(inlineNode);
        }
    }
876632
function _find(collection, query, opts) {
  if (Tyr.logging.trace) {
    Tyr.trace({ e: 'db', c: collection.id, m: 'find', q: query });
    const cursor = collection.db.find(query, opts);
    //Tyr.Log.updateDuration(logPromise);
    return cursor;
  } else {
    return collection.db.find(query, opts);
  }
}
541357
function mapRelation(rel, modelName, relName) {
    let acceptingParams = Object.assign({}, {
        filter: {
            generated: false,
            type: 'JSON'
        }
    }, connectionArgs);
    types[modelName].meta.fields[relName] = {
        generated: true,
        meta: {
            relation: true,
            connection: true,
            relationType: rel.type,
            isMany: isManyRelation(rel.type),
            embed: rel.embed,
            type: rel.modelTo.modelName,
            args: acceptingParams,
        },
        resolve: (obj, args, context, info) => {

            const ctxOptions = { accessToken: context.req.accessToken }
            const modelId = args && args.id;

            const method = rel.modelTo.sharedClass.findMethodByName('find');
            // TODO: ...
            return new Promise((resolve, reject) => { resolve(true) }).then(() => {
                let params = {};

                _.forEach(acceptingParams, (param, name) => {
                    if (typeof args[name] !== 'undefined' && Object.keys(args[name]).length > 0) {
                        _.merge(params, _.cloneDeep(args[name]));
                    }
                });

                if (isManyRelation(rel.type) === true) {
                    return connectionFromPromisedArray(findRelatedMany(rel, obj, params, context), args, rel.modelTo);
                } else {
                    return findRelatedOne(rel, obj, params, context);
                }

                // let wrap = promisify(model[method.name](...params, ctxOptions));

                // if (typeObj.list) {
                //     return connectionFromPromisedArray(wrap, args, model);
                // } else {
                //     return wrap;
                // }


            }).catch((err) => {
                throw err;
            });
        }
    };
}
559929
private int extractMatchingFields(Tuple<Type.Field> lhsFields, Tuple<Type.Field> rhsFields, Type.Field[] result,
			LifetimeRelation lifetimes, LinkageStack stack) {
		int index = 0;
		// Extract all matching fields first.
		for (int i = 0; i != lhsFields.size(); ++i) {
			for (int j = 0; j != rhsFields.size(); ++j) {
				Type.Field lhsField = lhsFields.get(i);
				Type.Field rhsField = rhsFields.get(j);
				Identifier lhsFieldName = lhsField.getName();
				Identifier rhsFieldName = rhsField.getName();
				if (lhsFieldName.equals(rhsFieldName)) {
					Type type = apply(lhsField.getType(), rhsField.getType(), lifetimes, stack);
					Type.Field combined = new Type.Field(lhsFieldName, type);
					result[index++] = combined;
				}
			}
		}
		return index;
	}
1000139
function() {

        var connectionAncestor;

        if (this.graph) {

            var cells = [
                this,
                this.getSourceElement(), // null if source is a point
                this.getTargetElement() // null if target is a point
            ].filter(function(item) {
                return !!item;
            });

            connectionAncestor = this.graph.getCommonAncestor.apply(this.graph, cells);
        }

        return connectionAncestor || null;
    }
383501
public static List getDisconnected(
        Collection leftCollection, Graph relation, Collection rightCollection)
    {
        List disconnected;
        Iterator iter;
        Object left;
        EdgeIterator relationIter;

        disconnected = new ArrayList();
        iter = leftCollection.iterator();
        while (iter.hasNext()) {
            left = iter.next();
            relationIter = relation.edges();
            while (relationIter.step()) {
                if (relationIter.left() == left) {
                    if (!rightCollection.contains(relationIter.right())) {
                        relationIter = null;
                        break;
                    }
                }
            }
            if (relationIter != null) {
                disconnected.add(left);
            }
        }
        return disconnected;
    }
1352979
private void mapMapCollectionToVertex(ITypedInstance typedInstance, AtlasVertex instanceVertex,
                                          AttributeInfo attributeInfo, Operation operation) throws AtlasException {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Mapping instance {} to vertex {} for attribute {}", typedInstance.toShortString(), string(instanceVertex),
                    attributeInfo.name);
        }

        @SuppressWarnings("unchecked") Map<Object, Object> newAttribute =
                (Map<Object, Object>) typedInstance.get(attributeInfo.name);

        boolean newAttributeEmpty = (newAttribute == null || newAttribute.isEmpty());

        IDataType elementType = ((DataTypes.MapType) attributeInfo.dataType()).getValueType();
        String propertyName = GraphHelper.getQualifiedFieldName(typedInstance, attributeInfo);

        Map<String, Object> currentMap = new HashMap<>();
        Map<String, Object> newMap = new HashMap<>();

        List<String> currentKeys = GraphHelper.getListProperty(instanceVertex, propertyName);
        if (currentKeys != null && !currentKeys.isEmpty()) {
            for (String key : currentKeys) {
                String propertyNameForKey = GraphHelper.getQualifiedNameForMapKey(propertyName, key);
                Object propertyValueForKey = GraphHelper.getMapValueProperty(elementType, instanceVertex, propertyNameForKey);
                currentMap.put(key, propertyValueForKey);
            }
        }

        if (!newAttributeEmpty) {
            for (Map.Entry<Object,Object> entry : newAttribute.entrySet()) {
                String keyStr = entry.getKey().toString();
                String propertyNameForKey = GraphHelper.getQualifiedNameForMapKey(propertyName, keyStr);

                Object newEntry = addOrUpdateCollectionEntry(instanceVertex, attributeInfo, elementType,
                        entry.getValue(), currentMap.get(keyStr), propertyNameForKey, operation);

                //Add/Update/Remove property value
                GraphHelper.setMapValueProperty(elementType, instanceVertex, propertyNameForKey, newEntry);
                newMap.put(keyStr, newEntry);
            }
        }

        Map<String, Object> additionalMap =
                removeUnusedMapEntries(instanceVertex, propertyName, currentMap, newMap, elementType, attributeInfo);

        Set<String> newKeys = new HashSet<>(newMap.keySet());
        newKeys.addAll(additionalMap.keySet());


        // for dereference on way out
        GraphHelper.setListProperty(instanceVertex, propertyName, new ArrayList<>(newKeys));
    }
1280863
function recursivelyMatch(className, where) {
  debugPrint('MATCH', { className, where });
  const collection = getCollection(className);
  // eslint-disable-next-line no-use-before-define
  const matches = _.filter(_.values(collection), queryFilter(where));
  debugPrint('MATCHES', { matches });
  return _.cloneDeep(matches); // return copies instead of originals
}
35857
function(connectionName, collectionName, options, stream) {

      options = options || {};

      var connectionObject = connections[connectionName];
      if (!connectionObject) return stream.end(Errors.InvalidConnection);

      var collection = connectionObject.collections[collectionName];
      if (!collection) return stream.end(Errors.CollectionNotRegistered);

      collection.stream(options, stream);
    }
286899
public void getScanNodeList_recurse(ArrayList<AbstractScanPlanNode> collected,
            HashSet<AbstractPlanNode> visited) {
        if (visited.contains(this)) {
            assert(false): "do not expect loops in plangraph.";
            return;
        }
        visited.add(this);
        for (AbstractPlanNode n : m_children) {
            n.getScanNodeList_recurse(collected, visited);
        }

        for (AbstractPlanNode node : m_inlineNodes.values()) {
            node.getScanNodeList_recurse(collected, visited);
        }
    }
1297558
def relations_of(self, target, include_object=False):
        '''  '''
        relations = (target if isinstance(target, RamGraphDBNode) else self._get_item_node(target)).outgoing
        if include_object:
            for k in relations:
                for v in relations[k]:
                    if hasattr(v, 'obj'): # filter dead links
                        yield k, v.obj
        else:
            yield from relations