rdf

package module
v0.0.0-...-1c3dfad Latest Latest
Warning

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

Go to latest
Published: May 13, 2023 License: MIT Imports: 8 Imported by: 0

README

Leverage RDF with Go and Protobufs

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlankNodeObject

func BlankNodeObject(blankNode string) *rdfpb.Object

func BlankNodeSubject

func BlankNodeSubject(blankNode string) *rdfpb.Subject

func BoolLiteral

func BoolLiteral(b bool) *rdfpb.Literal

func BoolObject

func BoolObject(b bool) *rdfpb.Object

func BytesLiteral

func BytesLiteral(b []byte) *rdfpb.Literal

func BytesObject

func BytesObject(b []byte) *rdfpb.Object

func Float64Literal

func Float64Literal(f float64) *rdfpb.Literal

func Float64Object

func Float64Object(f float64) *rdfpb.Object

func IntLiteral

func IntLiteral(i int64) *rdfpb.Literal

func IntObject

func IntObject(i int64) *rdfpb.Object

func IriObject

func IriObject(iri string) *rdfpb.Object

func IriSubject

func IriSubject(iri string) *rdfpb.Subject

func LiteralObject

func LiteralObject(literal *rdfpb.Literal) *rdfpb.Object

func NewTriple

func NewTriple(subject *rdfpb.Subject, predicate Predicate, object *rdfpb.Object) *rdfpb.Triple

func StringLiteral

func StringLiteral(s string) *rdfpb.Literal

func StringObject

func StringObject(s string) *rdfpb.Object

Types

type Graph

type Graph []*rdfpb.Triple

Graph represents a set of RDF Triples.

func (*Graph) Add

func (g *Graph) Add(t *rdfpb.Triple) *Graph

Add the given RDF Triple to the graph.

func (Graph) MarshalBinary

func (g Graph) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

Binary format = repeat 8 bytes + n bytes 8 bytes = length of RDF Triple protobuf message n bytes = RDF Triple protobuf message

func (Graph) MarshalJSON

func (g Graph) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

CAUTION!! Always prefer MarshalBinary over this. This relies in protojson which does not define a stable version.

func (Graph) Triples

func (g Graph) Triples() []*rdfpb.Triple

Triples returns all the returns contained within the graph.

func (*Graph) UnmarshalBinary

func (g *Graph) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

Binary format = repeat 8 bytes + n bytes 8 bytes = length of RDF Triple protobuf message n bytes = RDF Triple protobuf message

func (*Graph) UnmarshalJSON

func (g *Graph) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler interface.

CAUTION!! Always prefer UnmarshalBinary over this. This relies in protojson which does not define a stable version.

type Predicate

type Predicate string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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