# Graph Query Language

# Graph Query Language

Curiosity Workspace provides a graph query interface used by connectors, endpoints, and (in limited form) front-ends to traverse and filter the knowledge graph.

This page describes the concepts and common patterns you’ll see in Curiosity queries. The exact API surface can vary by environment/version, but the building blocks remain consistent.

# Core concepts

  • StartAt(...): defines the starting set of nodes (by type, key, or UID).
  • Out(...) / In(...): traverses edges to neighboring nodes.
  • Where(...): filters nodes by predicate (properties, timestamp, type).
  • Take(...) / Skip(...) / TakeAll(): pagination and bounded reads.
  • Emit(...): returns results (nodes, aggregates, summaries).

# Query anatomy

Most queries follow:

  1. Choose a starting set
  2. Traverse edges
  3. Filter
  4. Paginate
  5. Emit output

# Example: list nodes by type

// Return 10 nodes of a given type
return Q().StartAt("Device").Take(10).Emit("N");

# Example: traverse a relationship

// Starting from a manufacturer node (by key), return related devices
return Q().StartAt("Manufacturer", "Apple")
          .Out("Device")
          .Take(50)
          .Emit("N");

# Example: filter by time (event-like nodes)

// Return recent cases (sorted by timestamp if available)
return Q().StartAt("SupportCase")
          .SortByTimestamp(oldestFirst: false)
          .Take(10)
          .Emit("N");

# Example: graph summaries (high leverage during debugging)

// Summarize the graph or neighborhood
return Q().EmitSummary();
// Summarize neighbors for a type
return Q().StartAt("Part").EmitNeighborsSummary();

# Best practices

  • Bound traversal: always use Take(...)/pagination unless you truly need TakeAll().
  • Model for queries: if queries are complex, the schema likely needs another edge or entity.
  • Prefer deterministic computation in queries/endpoints: use LLMs for narration, not graph computation.

# Related pages