graph

package
v1.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package graph contains a functionality of a buffer that consumes triples one by one and can return a byte slice containing Turtle data of all triples consumed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Graph

type Graph struct {
	// contains filtered or unexported fields
}

Graph serves as a buffer that consumes triples one by one and can return a byte slice containing Turtle data of all triples consumed.

func New

func New() *Graph

New returns a pointer to a new instance of graph.Graph. No options are set.

func NewWithOptions added in v1.3.0

func NewWithOptions(options Options) *Graph

NewWithOptions constructs a graph with options to tweak its behavior. See Options.

func (*Graph) Accept

func (g *Graph) Accept(t [3]string) error

Accept stores a new triple to the graph.

func (*Graph) AcceptWithAnnotations added in v1.2.0

func (g *Graph) AcceptWithAnnotations(t [6]string) error

AcceptWithAnnotations stores a new triple with eventual label and data type of the object literal to the graph.

func (*Graph) Bytes

func (g *Graph) Bytes() ([]byte, error)

Bytes returns the so far consumed triples as a byte slice of Turle data. The triples in the byte slice are sorted first by subject, then by predicates, then by objects alphabetically.

type Options added in v1.3.0

type Options struct {
	// If set, will output a `@base` pragma at the start. Will normalize all URLs
	// that start with the base to their relative components.
	Base string
	// If set, any encountering of the prefix URL prefixes will be normalized to
	// use the prefix. Additionally, @prefix lines are output at the top of the
	// document for each one.
	Prefixes map[string]string
}

Options changes the behavior of the graph. It is passed to NewWithOptions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL