跳到正文
Simon Willison·· 8 天前精选AI 评分44

sparqlite:用 Rust 编写、在 SQLite 内运行 SPARQL 1.1

sparqlite: SPARQL 1.1 inside SQLite, written in Rust

AI 导读

Simon Willison 使用 Claude Code for web 的 Ultracode 模式生成 sparqlite,这是一个用 Rust 编写的 SQLite 扩展,可在 SQLite 进程内执行 SPARQL 1.1 查询和更新。

正文 · AI 翻译

研究 sparqlite:用 Rust 编写的 SQLite 内置 SPARQL 1.1 — sparqlite 是一个基于 Rust 的 SQLite 可加载扩展,可将 RDF 四元组存储在普通的 SQLite 表中,并在 SQLite 进程内部原生执行 SPARQL 1.1 查询和更新。其整数编码的术语、覆盖索引、基于成本的规划器、批量连接,以及可选的直接 SQLite B-tree 读取器,在计数模式下相比 SQL 转换实现了 3.5 倍的加速,在返回完整结果时实现了 2.8 倍的加速;同时通过了 639 项适用 W3C 评估测试中的 636 项,以及数百万次差分模糊测试……

这项研究任务其实是一次运行 Claude Code for web 的实验,采用“Ultracode”模式,具体说明见 Claude Code 文档中的以动态工作流大规模编排子代理。

启用 Ultracode 后,Claude Code 会积极使用动态工作流——它会生成用于定义和协调子代理网络的 JavaScript,以处理复杂问题。

我最初的提示词是这样的——我的意思是“直接命中这些行”,其中的“delete”是我在手机上误打的错字:

Write a SQLite extension in Rust that implants SPARQL and runs really fast because it can hit the delete rows directly

这导致 Claude Code for web 连续运行了 12 个多小时。第二天我查看进度时,注意到它构建了多少个 Rust crate,于是只发送了一条后续提示:

Every folder in the crates/ directory needs a README

Include a tutorial.md teaching users how to install the extension and how to run it in the SQLite CLI and then teaching them SPARQL in addition to how to use the SQLite extension

Include a script with the tutorial for populating a SQLite database with useful and realistic example data for that tutorial

这个项目感觉像是下一阶段的氛围编程——这里生成的代码完全不可能逐一审查,即使只是按照文档操作,也需要投入大量工作。我不完全确定该如何处理这一切——现在看来,我似乎已经在 SQLite 内部用 Rust 实现了完整的 SPARQL,但如果这是我一时兴起创建的,而且我无法(或不愿意)投入必要的时间去了解它能做什么,那么它的价值究竟有多大?

来源:Simon Willison · simonwillison.net