triple

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package triple implements and allows to manipulate Badwolf triples.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Object

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

Object is the box that either contains a literal, a predicate or a node.

func NewLiteralObject

func NewLiteralObject(l *literal.Literal) *Object

NewLiteralObject returns a new object that boxes a literal.

func NewNodeObject

func NewNodeObject(n *node.Node) *Object

NewNodeObject returns a new object that boxes a node.

func NewPredicateObject

func NewPredicateObject(p *predicate.Predicate) *Object

NewPredicateObject returns a new object that boxes a predicate.

func ParseObject

func ParseObject(s string, b literal.Builder) (*Object, error)

ParseObject attempts to parse an object.

func (*Object) GUID

func (o *Object) GUID() string

GUID returns a global unique identifier for the given object. It is implemented as the base64 encoded stringified version of the object.

func (*Object) Literal

func (o *Object) Literal() (*literal.Literal, error)

Literal attempts to return the boxed literal.

func (*Object) Node

func (o *Object) Node() (*node.Node, error)

Node attempts to return the boxed node.

func (*Object) Predicate

func (o *Object) Predicate() (*predicate.Predicate, error)

Predicate attempts to return the boxed predicate.

func (*Object) String

func (o *Object) String() string

String pretty prints the object.

type Triple

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

Triple describes a <subject predicate object> used by BadWolf.

func New

func New(s *node.Node, p *predicate.Predicate, o *Object) (*Triple, error)

New creates a new triple.

func Parse

func Parse(line string, b literal.Builder) (*Triple, error)

Parse process the provided text and tries to create a triple. It assumes that the provided text contains only one triple.

func (*Triple) Equal added in v0.3.0

func (t *Triple) Equal(t2 *Triple) bool

Equal checks if two triples are identical.

func (*Triple) GUID

func (t *Triple) GUID() string

GUID returns a global unique identifier for the given triple. It is implemented as the base64 encoded stringified version of the triple.

func (*Triple) Object added in v0.1.1

func (t *Triple) Object() *Object

Object returns the object of the tirple.

func (*Triple) Predicate added in v0.1.1

func (t *Triple) Predicate() *predicate.Predicate

Predicate returns the predicate of the triple.

func (*Triple) Reify

func (t *Triple) Reify() ([]*Triple, *node.Node, error)

Reify given the current triple it returns the original triple and the newly reified ones. It also returns the newly created blank node.

func (*Triple) String

func (t *Triple) String() string

String marshals the triple into pretty string.

func (*Triple) Subject added in v0.1.1

func (t *Triple) Subject() *node.Node

Subject returns the subject of the triple.

Directories

Path Synopsis
Package literal provides an abstraction to manipulate BadWolf literals.
Package literal provides an abstraction to manipulate BadWolf literals.
Package node provides the abstraction to build and use BadWolf nodes.
Package node provides the abstraction to build and use BadWolf nodes.
Package predicate allows to build and manipulate BadWolf predicates.
Package predicate allows to build and manipulate BadWolf predicates.

Jump to

Keyboard shortcuts

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