run-llama/llama_index · error · NotImplementedError

Structured query not implemented for SimplePropertyGraphStor

Error message

Structured query not implemented for SimplePropertyGraphStore.

What it means

SimplePropertyGraphStore.structured_query() unconditionally raises NotImplementedError. The store keeps plain in-memory node/edge dicts and deliberately omits any query-language engine; the sibling methods get_schema() and vector_query() are stubbed the same way, so only the direct node/edge accessor APIs are usable.

Source

Thrown at llama-index-core/llama_index/core/graph_stores/simple_labelled.py:243

        return cls(graph)

    def to_dict(self) -> dict:
        """Convert to dict."""
        return self.graph.model_dump()

    # NOTE: Unimplemented methods for SimplePropertyGraphStore

    def get_schema(self, refresh: bool = False) -> str:
        """Get the schema of the graph store."""
        raise NotImplementedError(
            "Schema not implemented for SimplePropertyGraphStore."
        )

    def structured_query(
        self, query: str, param_map: Optional[Dict[str, Any]] = None
    ) -> Any:
        """Query the graph store with statement and parameters."""
        raise NotImplementedError(
            "Structured query not implemented for SimplePropertyGraphStore."
        )

    def vector_query(
        self, query: VectorStoreQuery, **kwargs: Any
    ) -> Tuple[List[LabelledNode], List[float]]:
        """Query the graph store with a vector store query."""
        raise NotImplementedError(
            "Vector query not implemented for SimplePropertyGraphStore."
        )

    @property
    def client(self) -> Any:
        """Get client."""
        raise NotImplementedError(
            "Client not implemented for SimplePropertyGraphStore."
        )

View on GitHub (pinned to afd0fef371)

Solutions

  1. Move to a query-capable property graph store (Neo4j, Kuzu, Neptune, etc.) when structured queries are required.
  2. With SimplePropertyGraphStore, fetch data via its supported accessors (get, get_triplets, node/edge lookups) and filter in Python.
  3. Feature-detect with a NotImplementedError guard in any generic query layer so the store can be swapped safely.

Example fix

# before
rows = store.structured_query("MATCH (n) RETURN n", param_map={})

# after
try:
    rows = store.structured_query(query)
except NotImplementedError:
    nodes = [store.graph.nodes[k] for k in store.graph.nodes]  # direct access
Defensive patterns

Strategy: fallback

Validate before calling

from llama_index.core.graph_stores.simple_labelled import SimplePropertyGraphStore

if isinstance(store, SimplePropertyGraphStore):
    nodes = list(store.graph.nodes.values())  # direct in-memory access
else:
    rows = store.structured_query(cypher, param_map=params)

Type guard

def supports_structured_query(store) -> bool:
    return not isinstance(store, SimplePropertyGraphStore)

Try / catch

try:
    rows = store.structured_query(query, param_map=params)
except NotImplementedError:
    rows = list(store.graph.nodes.values())  # degrade to direct access

Prevention

When it happens

Trigger: Calling structured_query('MATCH (n:Entity) RETURN n') or any Cypher-like statement on a SimplePropertyGraphStore — e.g. a PropertyGraphIndex retriever configured for structured retrieval, or LLM-generated query strings routed to the default store.

Common situations: Building a graph RAG prototype with the default store and later enabling Cypher-based custom retrievers; migrating from Neo4j-backed development to the in-memory store for tests; agent tooling that assumes every store can execute queries.

Related errors


AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15). Data as JSON: /api/errors/7f4481264a161db9. Report an issue: GitHub.