db

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2018 License: BSD-3-Clause Imports: 34 Imported by: 1

Documentation

Overview

this file contains the set of query operators generated by the query planner

Index

Constants

View Source
const (
	RESOLVED   = "RESOLVED"
	UNRESOLVED = ""
)
View Source
const (
	RDF_NAMESPACE = "http://www.w3.org/1999/02/22-rdf-syntax-ns"
	OWL_NAMESPACE = "http://www.w3.org/2002/07/owl"
)
View Source
const BTREE_DEGREE = 8

Variables

View Source
var (
	INVERSEOF = turtle.URI{
		Namespace: OWL_NAMESPACE,
		Value:     "inverseOf",
	}
)
View Source
var ROWPOOL = sync.Pool{
	New: func() interface{} {
		return &Row{
			content: make([]byte, 64),
		}
	},
}

Functions

This section is empty.

Types

type DB

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

func (*DB) Close added in v0.4.0

func (db *DB) Close()

type Entity

type Entity struct {
	PK Key `msg:"p"`
	// note: we have to use string keys to get msgp to work
	InEdges  map[string][]Key `msg:"i"`
	OutEdges map[string][]Key `msg:"o"`
}

func NewEntity

func NewEntity() *Entity

func (*Entity) AddInEdge

func (e *Entity) AddInEdge(predicate, endpoint Key) bool

returns true if we added an endpoint; false if it was already there

func (*Entity) AddOutEdge

func (e *Entity) AddOutEdge(predicate, endpoint Key) bool

returns true if we added an endpoint; false if it was already there

func (*Entity) DecodeMsg

func (z *Entity) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Entity) EncodeMsg

func (z *Entity) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Entity) Less added in v0.3.2

func (e *Entity) Less(than btree.Item, ctx interface{}) bool

func (*Entity) MarshalMsg

func (z *Entity) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Entity) Msgsize

func (z *Entity) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Entity) UnmarshalMsg

func (z *Entity) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EntityExtendedIndex added in v0.4.1

type EntityExtendedIndex struct {
	PK           Key              `msg:"p"`
	InPlusEdges  map[string][]Key `msg:"i+"`
	OutPlusEdges map[string][]Key `msg:"o+"`
}

func NewEntityExtendedIndex added in v0.4.1

func NewEntityExtendedIndex() *EntityExtendedIndex

func (*EntityExtendedIndex) AddInPlusEdge added in v0.4.1

func (e *EntityExtendedIndex) AddInPlusEdge(predicate, endpoint Key) bool

returns true if we added an endpoint; false if it was already there

func (*EntityExtendedIndex) AddOutPlusEdge added in v0.4.1

func (e *EntityExtendedIndex) AddOutPlusEdge(predicate, endpoint Key) bool

returns true if we added an endpoint; false if it was already there

func (*EntityExtendedIndex) DecodeMsg added in v0.4.1

func (z *EntityExtendedIndex) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*EntityExtendedIndex) EncodeMsg added in v0.4.1

func (z *EntityExtendedIndex) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*EntityExtendedIndex) MarshalMsg added in v0.4.1

func (z *EntityExtendedIndex) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EntityExtendedIndex) Msgsize added in v0.4.1

func (z *EntityExtendedIndex) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EntityExtendedIndex) UnmarshalMsg added in v0.4.1

func (z *EntityExtendedIndex) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type HodDB added in v0.6.0

type HodDB struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewHodDB added in v0.6.0

func NewHodDB(cfg *config.Config) (*HodDB, error)

Creates or loads a new instance of HodDB from the provided config file. If any of the Turtle source files in the "buildings" section have changed, HodDB will load them anew.

func (*HodDB) Close added in v0.6.0

func (hod *HodDB) Close()

Close HodDB

func (*HodDB) Databases added in v0.6.0

func (hod *HodDB) Databases() []string

List the databases loaded into HodDB by name

func (*HodDB) QueryToClassDOT added in v0.6.0

func (hod *HodDB) QueryToClassDOT(q string) (string, error)

Turn the results of the query into a GraphViz visualization of the classes and their relationships

func (*HodDB) QueryToDOT added in v0.6.0

func (hod *HodDB) QueryToDOT(q string) (string, error)

Turn the results of the query into a GraphViz visualization of the results

func (*HodDB) RunQuery added in v0.6.0

func (hod *HodDB) RunQuery(q *sparql.Query) (QueryResult, error)

Execute a parsed query against HodDB

func (*HodDB) RunQueryString added in v0.6.0

func (hod *HodDB) RunQueryString(querystring string) (result QueryResult, err error)

Execute the provided query against HodDB

func (*HodDB) Search added in v0.6.0

func (hod *HodDB) Search(q string, n int) ([]string, error)

Wildcard search using Bleve through all values in the database

type Key added in v0.3.2

type Key [8]byte

func (*Key) DecodeMsg added in v0.3.2

func (z *Key) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Key) EncodeMsg added in v0.3.2

func (z *Key) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Key) FromSlice added in v0.3.2

func (k *Key) FromSlice(src []byte)

func (Key) Less added in v0.3.2

func (k Key) Less(than btree.Item, ctx interface{}) bool

func (Key) LessThan added in v0.5.2

func (k Key) LessThan(other Key) bool

func (*Key) MarshalMsg added in v0.3.2

func (z *Key) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Key) Msgsize added in v0.3.2

func (z *Key) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (Key) String added in v0.3.3

func (k Key) String() string

func (*Key) UnmarshalMsg added in v0.3.2

func (z *Key) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type LinkResultMap

type LinkResultMap map[turtle.URI]map[string]string

func (LinkResultMap) MarshalJSON added in v0.4.0

func (m LinkResultMap) MarshalJSON() ([]byte, error)

type NamespaceIndex

type NamespaceIndex map[string]string

func (*NamespaceIndex) DecodeMsg

func (z *NamespaceIndex) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (NamespaceIndex) EncodeMsg

func (z NamespaceIndex) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (NamespaceIndex) MarshalMsg

func (z NamespaceIndex) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (NamespaceIndex) Msgsize

func (z NamespaceIndex) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*NamespaceIndex) UnmarshalMsg

func (z *NamespaceIndex) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PredIndex

type PredIndex map[string]*PredicateEntity

func (*PredIndex) DecodeMsg

func (z *PredIndex) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (PredIndex) EncodeMsg

func (z PredIndex) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (PredIndex) MarshalMsg

func (z PredIndex) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (PredIndex) Msgsize

func (z PredIndex) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PredIndex) UnmarshalMsg

func (z *PredIndex) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PredicateEntity

type PredicateEntity struct {
	PK Key `msg:"p"`
	// note: we have to use string keys to get msgp to work
	Subjects map[string]map[string]uint32 `msg:"s"`
	Objects  map[string]map[string]uint32 `msg:"o"`
}

func NewPredicateEntity

func NewPredicateEntity() *PredicateEntity

func (*PredicateEntity) AddSubjectObject

func (e *PredicateEntity) AddSubjectObject(subject, object Key) bool

adds subject/object to Predicate index entry. Returns true if this changed the entity

func (*PredicateEntity) DecodeMsg

func (z *PredicateEntity) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*PredicateEntity) EncodeMsg

func (z *PredicateEntity) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*PredicateEntity) MarshalMsg

func (z *PredicateEntity) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*PredicateEntity) Msgsize

func (z *PredicateEntity) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PredicateEntity) UnmarshalMsg

func (z *PredicateEntity) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type QueryResult

type QueryResult struct {
	Rows    []ResultMap
	Count   int
	Elapsed time.Duration
	Errors  []string
	// contains filtered or unexported fields
}

func (*QueryResult) DecodeMsg added in v0.4.1

func (z *QueryResult) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (QueryResult) Dump

func (qr QueryResult) Dump()

func (QueryResult) DumpToCSV added in v0.4.0

func (qr QueryResult) DumpToCSV(usePrefixes bool, db *HodDB, w io.Writer) error

func (*QueryResult) EncodeMsg added in v0.4.1

func (z *QueryResult) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*QueryResult) MarshalMsg added in v0.4.1

func (z *QueryResult) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*QueryResult) Msgsize added in v0.4.1

func (z *QueryResult) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*QueryResult) UnmarshalMsg added in v0.4.1

func (z *QueryResult) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Relation added in v0.5.2

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

func NewRelation added in v0.5.2

func NewRelation(vars []string) *Relation

type RelshipIndex

type RelshipIndex map[string]string

func (*RelshipIndex) DecodeMsg

func (z *RelshipIndex) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (RelshipIndex) EncodeMsg

func (z RelshipIndex) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (RelshipIndex) MarshalMsg

func (z RelshipIndex) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (RelshipIndex) Msgsize

func (z RelshipIndex) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*RelshipIndex) UnmarshalMsg

func (z *RelshipIndex) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ResultMap

type ResultMap map[string]turtle.URI

func (*ResultMap) DecodeMsg added in v0.4.1

func (z *ResultMap) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (ResultMap) EncodeMsg added in v0.4.1

func (z ResultMap) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (ResultMap) MarshalMsg added in v0.4.1

func (z ResultMap) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (ResultMap) Msgsize added in v0.4.1

func (z ResultMap) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ResultMap) UnmarshalMsg added in v0.4.1

func (z *ResultMap) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ResultRow

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

func (ResultRow) Less

func (rr ResultRow) Less(than btree.Item, ctx interface{}) bool

type Row added in v0.5.2

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

func NewRow added in v0.5.2

func NewRow() *Row

func NewRowWithNum added in v0.6.0

func NewRowWithNum(withnum int) *Row

Jump to

Keyboard shortcuts

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