Trigo Documentation

Trigo

A high-performance RDF triplestore and SPARQL 1.1 query engine written in Go

What is Trigo?

Trigo is a modern RDF triplestore inspired by Oxigraph's architecture, implementing:

Documentation

Quick Start

Get up and running with Trigo in minutes. Build the project, load data, and run your first SPARQL query.

Read Guide →

Architecture

Deep dive into Trigo's design: 11-index storage, query optimization, Volcano iterator model, and encoding strategies.

Learn More →

HTTP Endpoint

Complete HTTP API reference. Query via REST, bulk data loading, result formats, and client examples.

API Reference →

Testing & Compliance

W3C test suite integration, current compliance rates, RDF parser tests, and SPARQL execution validation.

View Tests →

Key Features

🚀 High Performance

Optimal index selection, query optimization, lazy evaluation, and efficient encoding with xxHash3.

📊 SPARQL 1.1

Full query support with OPTIONAL, UNION, MINUS, GRAPH, BIND, and 20+ functions and operators.

🔄 RDF Formats

Parse and serialize Turtle, N-Triples, N-Quads, TriG, RDF/XML, and JSON-LD with high compliance.

🌐 HTTP API

W3C SPARQL 1.1 Protocol compliant endpoint with JSON, XML, CSV, and TSV result formats.

✅ Standards Compliant

Validated against W3C test suites for RDF 1.1 and SPARQL 1.1 specifications.

📦 Easy Integration

Use as a library in your Go applications or run as a standalone SPARQL endpoint server.

Quick Example

// Start the SPARQL endpoint
./trigo serve

// Query via HTTP
curl -X POST http://localhost:8080/sparql \
  -H 'Content-Type: application/sparql-query' \
  -H 'Accept: application/sparql-results+json' \
  -d 'SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 10'

// Or use as a library
import (
    "github.com/aleksaelezovic/trigo/pkg/store"
    "github.com/aleksaelezovic/trigo/pkg/rdf"
)

storage, _ := storage.NewBadgerStorage("./data")
ts := store.NewTripleStore(storage)

triple := rdf.NewTriple(
    rdf.NewNamedNode("http://example.org/alice"),
    rdf.NewNamedNode("http://xmlns.com/foaf/0.1/name"),
    rdf.NewLiteral("Alice"),
)
ts.InsertTriple(triple)

Test Results

Trigo is validated against the official W3C test suites:

RDF 1.1 Parsers — 🎉 Perfect Compliance!

RDF 1.1 Total: 100% (992/992 tests) — Full W3C Compliance Achieved! ✅

RDF 1.2 Parsers — 🎉 Perfect Compliance!

RDF 1.2 Total: 100% (1,312/1,312 tests) — Full W3C Compliance Achieved! ✅

Combined RDF: 100% (2,304/2,304 tests) — Perfect W3C Compliance! 🎉

SPARQL Query

View detailed test results →