$ show google/badwolf
BadWolf is a Go-based temporal graph store library and CLI tool designed for managing RDF-like triples with time-anchored predicates. It implements a custom query language (BQL) modeled after SPARQL, featuring a compiler pipeline architecture that includes lexical analysis, parsing, semantic analysis, and execution planning. The system supports immutable and temporal predicates, allowing queries to filter by time validity and perform temporal reasoning over graph data. It provides a pluggable storage abstraction layer, with a default in-memory implementation, and exposes functionality via a CLI tool (`bw`) and a simple HTTP server. The codebase demonstrates high craftsmanship in its query engine, utilizing a recursive descent parser with hook injection for semantic validation and a specificity-based planner for query optimization. The storage layer is decoupled via interfaces, enabling driver implementations to be swapped without modifying query logic. Extensive compliance testing ensures driver consistency across different backends. However, the project is explicitly pre-1.0, indicating API instability, and relies on a future Go version (1.24) in its module definition, suggesting experimental or forward-looking development practices. While primarily an application framework, it contains significant data engineering components, particularly in its temporal data modeling and query planning logic. The repository is suitable for engineers needing a temporal graph store or those looking to study compiler patterns applied to graph data. The CLI and server components provide immediate utility for testing and integration, while the library core offers reusable patterns for storage abstraction and query execution.
The LLM identified 3 files worth highlighting for reuse:
Implements a specificity-based query planner that converts semantic statements into executable plans. It prioritizes clauses by binding specificity to optimize data retrieval, demonstrating non-obvious skill in query optimization logic. The code is self-contained within the planner package and could be extracted for use in other graph query engines.
Provides a high-performance in-memory storage backend with multi-indexing (S, P, O, SP, PO, SO) for efficient triple lookups. It implements the core `storage.Store` and `storage.Graph` interfaces cleanly, demonstrating strong engineering in data structure design. This component is reusable for any project requiring a fast, volatile graph store.
Implements a compliance testing framework that validates driver implementations against canonical BQL semantics using JSON-based story files. This pattern ensures consistency across different storage backends and is a reusable approach for validating data store correctness. It solves the common problem of driver drift in pluggable architecture systems.