Scripts2026年5月3日·1 分钟阅读

Cayley — Open-Source Graph Database Inspired by Google's Knowledge Graph

Cayley is an open-source graph database written in Go, inspired by the graph infrastructure behind Google's Knowledge Graph. It supports multiple storage backends and query languages for flexible graph traversal.

Agent 就绪

这个资产可以被 Agent 直接读取和安装

TokRepo 同时提供通用 CLI 命令、安装契约、metadata JSON、按适配器生成的安装计划和原始内容链接,方便 Agent 判断适配度、风险和下一步动作。

Native · 96/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Knowledge
安装
Single
信任
信任等级:Established
入口
Cayley Graph Database
通用 CLI 安装命令
npx tokrepo install 4c55125e-46ca-11f1-9bc6-00163e2b0d79

Introduction

Cayley is a graph database written in Go, originally created at Google and open-sourced for community use. It provides a flexible query layer supporting Gizmo (JavaScript-based) and GraphQL, backed by pluggable storage engines ranging from in-memory to PostgreSQL and MongoDB.

What Cayley Does

  • Stores and queries graph-structured data using subject-predicate-object triples (quads)
  • Supports multiple query languages: Gizmo (JS), GraphQL, and MQL
  • Pluggable backend storage: BoltDB, PostgreSQL, MongoDB, in-memory, and more
  • Provides a built-in web UI for visual graph exploration and query execution
  • Imports and exports standard RDF formats (N-Quads, JSON-LD, Turtle)

Architecture Overview

Cayley uses a quad store model where each fact is stored as a quad (subject, predicate, object, label). The query layer compiles traversal expressions into an iterator-based execution plan that operates against a pluggable backend. Storage engines implement a common interface, allowing swaps between BoltDB for embedded use, PostgreSQL for durability, or in-memory stores for testing.

Self-Hosting & Configuration

  • Install via Go toolchain or download prebuilt binaries from GitHub releases
  • Configure storage backend with --dbpath flag or YAML config file
  • Default HTTP port is 64210; override with --host and --port flags
  • Load initial data with cayley load --quads=<file> supporting N-Quads and JSON-LD
  • Deploy with Docker using the official cayleygraph/cayley image

Key Features

  • Multiple query languages let teams pick what fits their mental model
  • Pluggable backends mean you can start embedded and scale to PostgreSQL later
  • Built-in web visualizer for interactive graph exploration
  • Native Go library for embedding directly into Go applications
  • RDF-compatible data model aligns with linked data standards

Comparison with Similar Tools

  • Neo4j — More mature with Cypher, but requires JVM and commercial license for clustering
  • Dgraph — Distributed GraphQL-native DB with higher operational complexity
  • ArangoDB — Multi-model but heavier; Cayley is lighter for pure graph workloads
  • Apache Jena — Full semantic web stack in Java; Cayley is simpler and Go-native

FAQ

Q: What query language should I start with? A: Gizmo (JavaScript-based) is the most documented and flexible for traversals. GraphQL works well if you already know your schema.

Q: Can Cayley handle large datasets? A: Yes, with PostgreSQL or MongoDB backends it handles millions of quads. For billions, consider a distributed graph DB instead.

Q: Is Cayley still maintained? A: The project has slower release cadence but remains functional and accepts contributions.

Q: Can I use Cayley as an embedded library? A: Yes, import the Go packages directly and use the graph API without running a server.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产