Labsco
AtomGraph logo

Web-Algebra

โ˜… 45

from AtomGraph

Suite of generic Linked Data/SPARQL as well as LinkedDataHub-specific MCP tools

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredAdvanced setup

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

 Agentic Content Management with Web-Algebra MCP

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
    • ExtractObjectProperties
    • ExtractOntology
  • URI & String Operations
    • ResolveURI
    • EncodeForURI
    • Concat
    • Replace
    • Str
    • STRUUID
    • URI
  • Control Flow & Variables
    • Value
    • Variable
    • ForEach
    • Filter
    • Bindings
    • Current
    • Execute
    • Merge
  • LinkedDataHub-specific
    • ldh-CreateContainer
    • ldh-CreateItem
    • ldh-List
    • ldh-AddFile
    • ldh-AddGenericService
    • ldh-AddResultSetChart
    • ldh-AddSelect
    • ldh-AddView
    • ldh-AddObjectBlock
    • ldh-AddXHTMLBlock
    • ldh-RemoveBlock
    • ldh-GeneratePortal
    • ldh-GenerateClassContainers
    • ldh-GenerateOntologyViews