rdf-go Documentation

Documentation for the rdf-go RDF parsing/encoding library

View the Project on GitHub geoknoesis/rdf-go

rdf-go

A small, fast RDF parsing/encoding library with streaming APIs and RDF-star support.

Overview

rdf-go is designed for low allocations and for use in pipelines where RDF data should be processed incrementally. It provides a compact RDF model with streaming parsers and encoders, focusing on fast, low-allocation I/O with a small surface area.

Key Features

Quick Example

import (
    "io"
    "strings"
    "github.com/geoknoesis/rdf-go"
)

input := `<http://example.org/s> <http://example.org/p> "v" .`
reader, err := rdf.NewReader(strings.NewReader(input), rdf.FormatNTriples)
if err != nil {
    // handle error
}
defer dec.Close()

for {
    stmt, err := dec.Next()
    if err == io.EOF {
        break
    }
    if err != nil {
        // handle error
    }
    // process statement (stmt.S, stmt.P, stmt.O)
    // Use stmt.IsTriple() or stmt.IsQuad() to check type
}

Documentation

Installation

go get github.com/geoknoesis/rdf-go

License

See the repository for license information.