Documentation for the rdf-go RDF parsing/encoding library
A small, fast RDF parsing/encoding library with streaming APIs and RDF-star support.
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.
Reader and Writer interfaces for all formatsFormatAutoTripleTerm valuesParse function for streaming with handler functionsimport (
"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
}
go get github.com/geoknoesis/rdf-go
See the repository for license information.