Skip to main content

Suggested Relationship Patterns

Cloud

This capability is provided by RushDB Cloud. It is not available on a self-hosted engine, where the SDK throws CloudOnlyError before sending anything; create relationships yourself with attach or relationships.createMany.

RushDB can analyze the labels, properties, and existing edges in a project and suggest relationship patterns worth making explicit. Review suggestions before applying them: analysis proposes graph structure, but approval is the step that changes relationships.

This is useful after imports and schema evolution, when matching keys or default import edges reveal a stable domain relationship such as ORDER -[:PLACED_BY]-> CUSTOMER.

Prerequisites​

RushDB Cloud runs the analysis with its own language model; there is nothing to configure.

Lifecycle​

  1. RushDB analyzes the current project schema and stores inferred patterns as suggested.
  2. Review the source, target, type, direction, mode, confidence, and rationale.
  3. Approve a suggestion to apply it, or ignore it without changing relationships.
  4. Delete a saved pattern when it is no longer useful. Deleting with deleteExisting=true also removes relationships materialized by that pattern.
StatusMeaning
suggestedAwaiting review
approvedAccepted and applied
ignoredDismissed without applying
errorApplying or analyzing the pattern failed

Modes​

ModeWhat approval does
join_patternCreates relationships by matching keys between source and target records
retype_existing_relationshipReplaces default import edges with an explicit domain relationship type

SDK Workflow​

# Queue analysis, then poll list() until analysis.status returns to "idle"
client.relationships.patterns.analyze()
result = client.relationships.patterns.list()

for pattern in result.data["patterns"]:
print(pattern["id"], pattern["type"], pattern["confidence"])

client.relationships.patterns.approve(pattern_id)
client.relationships.patterns.ignore(pattern_id)

# Destructive: also removes relationships materialized by this pattern
client.relationships.patterns.delete(pattern_id, delete_existing=True)

REST API​

All endpoints require Authorization: Bearer <token> and x-project-id.

List patterns​

curl https://api.rushdb.com/api/v1/relationships/patterns \
-H "Authorization: Bearer $RUSHDB_API_KEY" \
-H "x-project-id: $RUSHDB_PROJECT_ID"

The response includes patterns, current schema relationships, and the latest analysis status.

Queue analysis​

curl -X POST https://api.rushdb.com/api/v1/relationships/patterns/analyze \
-H "Authorization: Bearer $RUSHDB_API_KEY" \
-H "x-project-id: $RUSHDB_PROJECT_ID" \
-H "Content-Type: application/json" \
-d '{}'

The server returns 202 Accepted with {"queued": true}. Poll the list endpoint for completion.

Approve a pattern​

curl -X POST https://api.rushdb.com/api/v1/relationships/patterns/$PATTERN_ID/approve \
-H "Authorization: Bearer $RUSHDB_API_KEY" \
-H "x-project-id: $RUSHDB_PROJECT_ID" \
-H "Content-Type: application/json" \
-d '{}'

Ignore a pattern​

curl -X POST https://api.rushdb.com/api/v1/relationships/patterns/$PATTERN_ID/ignore \
-H "Authorization: Bearer $RUSHDB_API_KEY" \
-H "x-project-id: $RUSHDB_PROJECT_ID" \
-H "Content-Type: application/json" \
-d '{}'

Delete a pattern​

# Delete the saved pattern only
curl -X DELETE https://api.rushdb.com/api/v1/relationships/patterns/$PATTERN_ID \
-H "Authorization: Bearer $RUSHDB_API_KEY" \
-H "x-project-id: $RUSHDB_PROJECT_ID"

# Also remove relationships materialized by the pattern
curl -X DELETE "https://api.rushdb.com/api/v1/relationships/patterns/$PATTERN_ID?deleteExisting=true" \
-H "Authorization: Bearer $RUSHDB_API_KEY" \
-H "x-project-id: $RUSHDB_PROJECT_ID"
warning

deleteExisting=true removes graph relationships as well as the stored pattern. Confirm this destructive action before using it.

MCP Tools​

ToolPurpose
listRelationshipPatternsList patterns, schema relationships, and analysis status
analyzeRelationshipPatternsQueue schema analysis
approveRelationshipPatternApprove and apply a suggestion by ID
ignoreRelationshipPatternIgnore a suggestion by ID
deleteRelationshipPatternDelete a pattern, optionally with deleteExisting

Agents should call listRelationshipPatterns before mutating a pattern so the inferred graph change is visible for review.