AW

atomgraph/web-algebra

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

49 stars 5 forks 质量 83 趋势 14Apache-2.0

一套通用的 Linked Data/SPARQL 以及 LinkedDataHub 专用的 MCP 工具套件

概览

一个可组合的RDF操作系统,将自然语言指令转换为JSON格式的领域特定语言操作,用于加载、查询和编写RDF链接数据。 该系统实现了RDF链接数据和SPARQL管理的通用操作,以及一些LinkedDataHub特有操作。操作可以通过两种方式被使用: 1. : 操作被组合成 JSON 结构,由提供的执行引擎执行 2.: 操作作为工具公开,供 AI 代理交互使用 Web-Algebra 使代理能够将整个工作流编译成优化的 JSON “字节码”,并以原子方式执行,从而实现复杂的多操作组合,而不是让代理通过单个 MCP 工具逐步执行语义工作流。 参见WebAlgebra的实际操作——将自然语言转化为RDF操作。

概述(AI 翻译)

一个可组合的RDF操作系统,将自然语言指令转换为JSON格式的领域特定语言操作,用于加载、查询和编写RDF链接数据。

概述

该系统实现了RDF链接数据和SPARQL管理的通用操作,以及一些LinkedDataHub特有操作。操作可以通过两种方式被使用:

  1. 可执行的JSON格式:操作被组合成JSON结构,由提供的执行引擎执行
  2. 模型上下文协议(MCP):操作作为AI代理可交互使用的工具被公开

Web-Algebra 使代理能够将整个工作流编译成优化的 JSON “字节码”,并以原子方式执行,从而实现复杂的多操作组合,而不是让代理通过单个 MCP 工具逐步执行语义工作流。

演示

参见WebAlgebra的实际操作——将自然语言转化为RDF运算。

建筑

该系统围绕 Operation 抽象基类构建,该基类提供:

  • 注册表系统:自动发现来自src/web_algebra/operations/的操作

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Web-Algebra

A composable RDF operations system that translates natural language instructions into JSON-formatted domain-specific language operations for loading, querying, and writing RDF Linked Data.

Overview

This system implements generic operations for RDF Linked Data and SPARQL management, as well as some LinkedDataHub-specific operations. Operations can be consumed in two ways:

  1. Executable JSON format: Operations are composed into JSON structures and executed by the provided execution engine
  2. Model Context Protocol (MCP): Operations are exposed as tools for AI agents to use interactively

Instead of agents executing semantic workflows step-by-step through individual MCP tool calls, Web-Algebra enables agents to compile entire workflows into optimized JSON “bytecode” that executes atomically - enabling complex multi-operation compositions.

Demo

See WebAlgebra in action - translating natural language into RDF operations.

Architecture

The system is built around the Operation abstract base class that provides:

  • Registry System: Auto-discovery of operations from src/web_algebra/operations/
  • JSON DSL: Operations use @op key with args for parameters, supporting nested operation calls
  • RDFLib Type System: Uses URIRef, Literal, Graph, and Result types internally for proper RDF handling
  • Execution Engine: Both standalone execution and MCP server integration
  • Context System: ForEach operations set row context for inner operations to access via Value
  • URI Resolution: Proper semantic URI construction with ResolveURI operation

Key Components

Operations

The operations cover read-write Linked Data, SPARQL queries, URI manipulation, and LinkedDataHub-specific resource creation. Non-exhaustive list:

  • Linked Data
    • GET
    • PATCH
    • POST
    • PUT
  • SPARQL
    • CONSTRUCT
    • DESCRIBE
    • SELECT
    • Substitute
    • Values
    • SPARQLString
  • Schema
    • ExtractClasses
    • ExtractDatatypeProperties
在 GitHub 查看完整 README

安装

uvx --from web-algebra web-algebra-mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "web-algebra": { "command": "uvx", "args": ["--from", "web-algebra", "web-algebra-mcp"], "env": { "CERT_PEM_PATH": "/path/to/LinkedDataHub/ssl/owner/cert.pem", "CERT_PASSWORD": "********" } } } }