Install
openclaw skills install graph-template-query-generatorGenerate reusable Cypher or SPARQL query templates for common graph database operations such as finding nodes, relationships, paths, and aggregations.
openclaw skills install graph-template-query-generatorGenerate reusable graph query templates for common graph database operations.
This skill produces parameterized query templates that developers can quickly adapt to query graph databases without writing queries from scratch.
It supports template generation for common tasks such as:
Templates can be generated for graph query languages such as Cypher and SPARQL.
Use this skill when a user wants to:
The skill generates parameterized templates for:
Templates typically include query parameters to allow easy reuse.
Cypher template:
MATCH (n:$label {$property: $value})
RETURN n
LIMIT $limit
Example:
MATCH (p:Person {email: $email})
RETURN p
Parameters:
label: Node label (e.g., Person, Company)property: Property name (e.g., email, id)value: Property valuelimit: Result limit (default: 10)Cypher template:
MATCH (a:$sourceLabel)-[:$relationshipType]->(b:$targetLabel)
RETURN a, b
LIMIT $limit
Example:
MATCH (p:Person)-[:WORKS_AT]->(c:Company)
RETURN p, c
Parameters:
sourceLabel: Starting node labelrelationshipType: Relationship typetargetLabel: Target node labellimit: Result limitCypher template:
MATCH path = (start:$startLabel)-[*1..$depth]-(end:$endLabel)
RETURN path
LIMIT $limit
Example:
MATCH path = (p:Person)-[*1..3]-(target)
RETURN path
LIMIT 50
Parameters:
startLabel: Starting node labelendLabel: Ending node labeldepth: Maximum traversal depthlimit: Result limitCypher template:
MATCH (source:$sourceLabel)-[:$relationshipType]->(target:$targetLabel)
RETURN target.$property, COUNT(DISTINCT source) as count
GROUP BY target.$property
ORDER BY count DESC
LIMIT $limit
Example:
MATCH (p:Person)-[:WORKS_AT]->(c:Company)
RETURN c.name, COUNT(DISTINCT p) as employee_count
GROUP BY c.name
ORDER BY employee_count DESC
LIMIT 10
Cypher template:
MATCH (n:$label)
WHERE n.$property $operator $value
RETURN n
LIMIT $limit
Example:
MATCH (p:Person)
WHERE p.age > 30
RETURN p
LIMIT 100
Parameters:
label: Node labelproperty: Property to filteroperator: Comparison operator (>, <, =, !=)value: Filter valuelimit: Result limitCypher template:
MATCH (n:$label)
WHERE n.$property CONTAINS $value
RETURN n
LIMIT $limit
Example:
MATCH (p:Product)
WHERE p.description CONTAINS $search_term
RETURN p
LIMIT 20
Cypher template:
MATCH (source:$sourceLabel)-[:$relationshipType]->(target:$targetLabel)
WHERE target.$filterProperty $operator $filterValue
RETURN target.$groupProperty, COUNT(source) as count
GROUP BY target.$groupProperty
ORDER BY count DESC
LIMIT $limit
Cypher template:
MATCH (n:$label)-[r:$relationshipType]->()
RETURN n, COUNT(r) as relationship_count
ORDER BY relationship_count DESC
LIMIT $limit
Example:
MATCH (p:Person)-[r:FOLLOWS]->()
RETURN p, COUNT(r) as follower_count
ORDER BY follower_count DESC
LIMIT 10
PREFIX ex: <http://example.org/>
SELECT ?entity
WHERE {
?entity a ex:$class ;
ex:$property $value .
}
LIMIT $limit
PREFIX ex: <http://example.org/>
SELECT ?subject ?object
WHERE {
?subject ex:$predicate ?object .
}
LIMIT $limit
PREFIX ex: <http://example.org/>
SELECT ?resource
WHERE {
?resource a ex:$class .
?resource ex:$property ?value .
}
LIMIT $limit
When generating query templates:
$parameterThe skill returns:
Parameterized Cypher or SPARQL query ready for reuse.
{
"label": "string - Node label",
"property": "string - Property name",
"value": "any - Property value",
"limit": "integer - Result limit (default: 10)"
}
Plain English description of query purpose and behavior.
Concrete instantiation with sample parameter values.
Index recommendations and optimization suggestions.
When designing query templates:
Use Clear Parameter Names
$email instead of $e$depth instead of $d$company_name instead of $c_nInclude Result Limits
LIMIT $limit clauseAvoid Unbounded Traversal
[*1..3] instead of [*]Design for Reusability
Include Documentation
Index Awareness
Error Handling
Template Versioning
This skill integrates with:
Goal: Find user by email
Generated: SELECT ?user WHERE { ?user foaf:email $email }
Usage: Execute in REST API endpoint
Goal: Aggregate employee counts by company
Generated: Match relationships, group by company, count
Usage: Update dashboard monthly
Goal: Get person's network (friends and followers)
Generated: Multi-hop path template with depth limit
Usage: Paginated results in app
Goal: Export all entities of type with properties
Generated: Complete node projection template
Usage: Scheduled export job
This skill generates reusable graph query templates for common database operations.
It helps developers quickly scaffold Cypher or SPARQL queries, improving productivity and reducing query-writing effort through standardized, production-ready templates.
Status: Enterprise-Grade Template Generation
Comprehensive template library and generation system for professional knowledge graph development.