Query patterns, response structures, and domain schemas demonstrating DGP usage
v0.8.0Common query patterns including simple lookups, relationship traversal, filtering, aggregations, and computed fields.
{
"name": "Customer with Orders and Line Items",
"query": {
"entity": "Customer",
"where": {
"email": { "eq": "jane.doe@example.com" }
},
"include": {
"orders": {
"where": { "status": { "in": ["confirmed", "shipped"] } },
"limit": 10,
"include": { "line_items": {} }
}
}
}
}
Response structures with execution metadata, cost breakdown, freshness indicators, and provenance information.
{
"data": [{ "id": "cust_12345", "email": "jane@example.com" }],
"metadata": {
"execution": {
"query_id": "q_abc123",
"duration_ms": 45,
"rows_scanned": 1
},
"cost": {
"tokens": 12,
"breakdown": { "query_parse": 2, "execution": 8 }
},
"freshness": { "age_seconds": 0, "cached": false }
}
}
Complete domain schema in Compressed Schema Notation featuring Customer, Order, Product, Payment entities with relationships and state machines.
# Domain Graph Protocol - Compressed Schema Notation
# Domain: commerce | Entities: 6 | Operations: 4
## ENTITIES
Customer "A person or organization that purchases products"
id : uuid! @key
email : email! @unique @indexed
name : string!
lifecycle_stage : enum(prospect|lead|customer|champion|churned)
@fsm{prospect -> lead : engaged, lead -> customer : first_purchase}
lifetime_value : decimal @computed(sum:orders.total) @freshness(1h)
->* orders : Order @inverse(customer)
Common patterns used in DGP queries:
"where": {"id": {"eq": "..."}}
"include": {"orders": {"limit": 10}}
"where": {"status": {"in": ["a", "b"]}}
"computed": ["lifetime_value"]
"limit": 20, "offset": 40
"order_by": {"created_at": "desc"}