MCPcopy
hub / github.com/topoteretes/cognee / find

Method find

cognee/modules/migration/snapshot.py:154–161  ·  view source on GitHub ↗

Find nodes by type and/or exact field values: ``find(Entity, name="Alice")``.

(
        self, node_type: Union[str, Type[DataPoint], None] = None, **field_filters: Any
    )

Source from the content-addressed store, hash-verified

152 return [node for node in self.nodes if node.type == node_type]
153
154 def find(
155 self, node_type: Union[str, Type[DataPoint], None] = None, **field_filters: Any
156 ) -> List[DataPoint]:
157 """Find nodes by type and/or exact field values: ``find(Entity, name="Alice")``."""
158 nodes = self.nodes_of_type(node_type) if node_type is not None else list(self.nodes)
159 for field_name, expected in field_filters.items():
160 nodes = [node for node in nodes if getattr(node, field_name, None) == expected]
161 return nodes
162
163 def link_relations(self) -> "GraphSnapshot":
164 """Re-attach edges as object references on declared relation fields.

Callers 15

loadGraphModelsConfigFunction · 0.80
findModelForDatasetFunction · 0.80
getOrCreateApiKeyFunction · 0.80
getPromptFunction · 0.80
getModelFunction · 0.80
ensureDefaultModelFunction · 0.80
schemaReducerFunction · 0.80
GraphModelsListPageFunction · 0.80
GraphModelEditorPageFunction · 0.80
handleSaveFunction · 0.80

Calls 1

nodes_of_typeMethod · 0.95