node

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: 7 Imported by: 0

Documentation

Overview

Package node provides the abstraction to build and use BadWolf nodes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID string

ID represents a node ID.

func NewID

func NewID(id string) (*ID, error)

NewID create a new ID from a plain string.

func (*ID) String

func (i *ID) String() string

String converts a ID to its string form.

type Node

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

Node describes a node in a BadWolf graph.

func NewBlankNode

func NewBlankNode() *Node

NewBlankNode creates a new blank node. The blank node ID is guaranteed to be uique in BadWolf.

func NewNode

func NewNode(t *Type, id *ID) *Node

NewNode returns a new node constructed from a type and an ID.

func NewNodeFromStrings

func NewNodeFromStrings(sT, sID string) (*Node, error)

NewNodeFromStrings returns a new node constructed from a type and ID represented as plain strings.

func Parse

func Parse(s string) (*Node, error)

Parse returns a node given a pretty printed representation of Node.

func (*Node) Covariant

func (n *Node) Covariant(on *Node) bool

Covariant checks if the types of two nodes is covariant.

func (*Node) GUID

func (n *Node) GUID() string

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

func (*Node) ID

func (n *Node) ID() *ID

ID returns the ID of the node.

func (*Node) String

func (n *Node) String() string

String returns a pretty printing representation of Node.

func (*Node) Type

func (n *Node) Type() *Type

Type returns the type of the node.

type Type

type Type string

Type describes the type of the node.

func NewType

func NewType(t string) (*Type, error)

NewType creates a new type from plain string.

func (*Type) Covariant

func (t *Type) Covariant(ot *Type) bool

Covariant checks for given two types A and B, A covariant B if B _is a_ A. In other word, A _covariant_ B if B is a prefix of A.

func (*Type) String

func (t *Type) String() string

String converts a type to its string form.

Jump to

Keyboard shortcuts

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