-
Notifications
You must be signed in to change notification settings - Fork 0
aql_pattern_matching
Stand: 5. Dezember 2025
Version: 1.0.0
Kategorie: Aql
Datum: 19. November 2025
Status: Design Complete - Nutzt existierende AQL-Syntax
Philosophie: Cypher-ähnliche Pattern-Matching-Queries können vollständig mit existierender AQL-Syntax ausgedrückt werden durch:
- Verschachtelte
FOR-Loops für Multi-Hop-Traversals -
FILTERauf Vertex/Edge-Properties -
TYPEkeyword für Edge-Type-Matching
Vorteil: Keine Spezialsyntax, konsistent mit AQL-Prinzipien, wiederverwendet Graph-Infrastruktur.
Cypher-Style:
MATCH (a:Person)-[:FOLLOWS]->(b:Person)
WHERE a.name == "Alice"
RETURN bAQL-Äquivalent:
FOR a IN persons
FILTER a.name == "Alice"
FOR e IN edges
FILTER e._from == a._id AND e._type == "FOLLOWS"
FOR b IN persons
FILTER b._id == e._to
RETURN b
Optimierte AQL (mit Graph-Traversal):
FOR b IN 1..1 OUTBOUND "persons/Alice" TYPE "FOLLOWS" GRAPH "social"
RETURN b
Cypher-Style:
MATCH (a:Person)-[:FOLLOWS]->(b:Person)-[:LIKES]->(c:Product)
WHERE a.name == "Alice" AND c.category == "Books"
RETURN b, cAQL-Äquivalent (verschachtelte Traversals):
FOR b IN 1..1 OUTBOUND "persons/Alice" TYPE "FOLLOWS" GRAPH "social"
FOR c IN 1..1 OUTBOUND b._id TYPE "LIKES" GRAPH "social"
FILTER c.category == "Books"
RETURN {person: b, product: c}
Cypher-Style:
MATCH (a:Person)-[:KNOWS*1..3]->(b:Person)
WHERE a.name == "Alice"
RETURN bAQL:
FOR b IN 1..3 OUTBOUND "persons/Alice" TYPE "KNOWS" GRAPH "social"
RETURN DISTINCT b
Cypher-Style:
MATCH (a:Person)-[r1:FOLLOWS]->(b:Person)-[r2:LIKES]->(c:Product)
WHERE a.name == "Alice"
AND r1.since > "2024-01-01"
AND b.age > 25
AND c.price < 100
RETURN b, cAQL:
FOR v1, e1, p1 IN 1..1 OUTBOUND "persons/Alice" TYPE "FOLLOWS" GRAPH "social"
FILTER e1.since > "2024-01-01"
FILTER v1.age > 25
FOR v2, e2, p2 IN 1..1 OUTBOUND v1._id TYPE "LIKES" GRAPH "social"
FILTER v2.price < 100
RETURN {person: v1, product: v2}
FOR v, e, p IN min..max DIRECTION startVertex TYPE edgeType GRAPH graphName- Richtungen:
OUTBOUND,INBOUND,ANY - Variable Tiefe:
1..3,2..5, etc.
-
TYPE "FOLLOWS"- filtert Kanten nach Typ während Traversal - Bereits im Parser:
src/query/aql_parser.cpp:502
-
v- Current Vertex -
e- Current Edge (letzte Kante zum Vertex) -
p- Full Path (vertices + edges)
-
FILTER v.age > 25- Vertex-Properties -
FILTER e.weight > 10- Edge-Properties -
FILTER p.vertices[0].name == "Alice"- Pfad-Zugriff
Ziel: Pfad-Constraints wie in Cypher:
FOR v, e, p IN 1..5 OUTBOUND 'user1' GRAPH 'social'
FILTER ALL(edge IN p.edges WHERE edge.active == true)
FILTER NONE(vertex IN p.vertices WHERE vertex.blocked == true)
RETURN v
Implementation:
- Neue Expression-Typen:
PathPredicateExpr - Evaluierung in
let_evaluator.cppvia Pfad-Iteration - Aufwand: 1 Tag
Aktuell (umständlich):
FOR v, e, p IN 1..10 OUTBOUND 'A' GRAPH 'network'
FILTER v._id == 'B'
SORT LENGTH(p.edges) ASC
LIMIT 1
RETURN p
Geplant (Syntaxzucker):
FOR p IN SHORTEST_PATH 'A' TO 'B' GRAPH 'network'
RETURN p
Implementation:
- Parser-Erweiterung für
SHORTEST_PATHkeyword - Translator nutzt
graphMgr_->dijkstra() - Aufwand: 0.5 Tage
Problem: TYPE "FOLLOWS" erfordert derzeit Edge-Loading während Traversal.
Lösung: Separate Adjacency-Listen pro Edge-Type:
graph:out:<edgeType>:<fromPk>:<edgeId> -> <toPk>
Benefit: 10x schnelleres Pattern-Matching für type-spezifische Queries.
Aufwand: 0.5 Tage
Status: Pattern-Matching ist bereits möglich mit existierender AQL-Syntax!
Kern-Features:
- ✅ Multi-Hop Traversals (verschachtelte FOR)
- ✅ Edge-Type-Filtering (TYPE keyword)
- ✅ Property-Constraints (FILTER)
- ✅ Variable Pfadlängen (min..max)
Empfohlene Erweiterungen:
- PATH-Prädikate (ALL/ANY/NONE) - 1 Tag
- SHORTEST_PATH Syntaxzucker - 0.5 Tage
- Edge-Type-Index - 0.5 Tage
Total: 2 Tage für vollständiges Cypher-Parity Pattern-Matching
Nächster Schritt: Dokumentation + Beispiele statt neue Syntax!
ThemisDB v1.3.4 | GitHub | Documentation | Discussions | License
Last synced: January 02, 2026 | Commit: 6add659
Version: 1.3.0 | Stand: Dezember 2025
- Übersicht
- Home
- Dokumentations-Index
- Quick Reference
- Sachstandsbericht 2025
- Features
- Roadmap
- Ecosystem Overview
- Strategische Übersicht
- Geo/Relational Storage
- RocksDB Storage
- MVCC Design
- Transaktionen
- Time-Series
- Memory Tuning
- Chain of Thought Storage
- Query Engine & AQL
- AQL Syntax
- Explain & Profile
- Rekursive Pfadabfragen
- Temporale Graphen
- Zeitbereichs-Abfragen
- Semantischer Cache
- Hybrid Queries (Phase 1.5)
- AQL Hybrid Queries
- Hybrid Queries README
- Hybrid Query Benchmarks
- Subquery Quick Reference
- Subquery Implementation
- Content Pipeline
- Architektur-Details
- Ingestion
- JSON Ingestion Spec
- Enterprise Ingestion Interface
- Geo-Processor Design
- Image-Processor Design
- Hybrid Search Design
- Fulltext API
- Hybrid Fusion API
- Stemming
- Performance Tuning
- Migration Guide
- Future Work
- Pagination Benchmarks
- Enterprise README
- Scalability Features
- HTTP Client Pool
- Build Guide
- Implementation Status
- Final Report
- Integration Analysis
- Enterprise Strategy
- Verschlüsselungsstrategie
- Verschlüsselungsdeployment
- Spaltenverschlüsselung
- Encryption Next Steps
- Multi-Party Encryption
- Key Rotation Strategy
- Security Encryption Gap Analysis
- Audit Logging
- Audit & Retention
- Compliance Audit
- Compliance
- Extended Compliance Features
- Governance-Strategie
- Compliance-Integration
- Governance Usage
- Security/Compliance Review
- Threat Model
- Security Hardening Guide
- Security Audit Checklist
- Security Audit Report
- Security Implementation
- Development README
- Code Quality Pipeline
- Developers Guide
- Cost Models
- Todo Liste
- Tool Todo
- Core Feature Todo
- Priorities
- Implementation Status
- Roadmap
- Future Work
- Next Steps Analysis
- AQL LET Implementation
- Development Audit
- Sprint Summary (2025-11-17)
- WAL Archiving
- Search Gap Analysis
- Source Documentation Plan
- Changefeed README
- Changefeed CMake Patch
- Changefeed OpenAPI
- Changefeed OpenAPI Auth
- Changefeed SSE Examples
- Changefeed Test Harness
- Changefeed Tests
- Dokumentations-Inventar
- Documentation Summary
- Documentation TODO
- Documentation Gap Analysis
- Documentation Consolidation
- Documentation Final Status
- Documentation Phase 3
- Documentation Cleanup Validation
- API
- Authentication
- Cache
- CDC
- Content
- Geo
- Governance
- Index
- LLM
- Query
- Security
- Server
- Storage
- Time Series
- Transaction
- Utils
Vollständige Dokumentation: https://makr-code.github.io/ThemisDB/