db

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2017 License: GPL-3.0 Imports: 32 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 BTREE_DEGREE = 4

Variables

View Source
var EMPTYROW = [32]byte{}
View Source
var ROWPOOL = sync.Pool{
	New: func() interface{} {
		return &Row{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
	},
}

Functions

This section is empty.

Types

type DB

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

func NewDB

func NewDB(cfg *config.Config) (*DB, error)

func (*DB) Close added in v0.4.0

func (db *DB) Close()

func (*DB) DumpEntity

func (db *DB) DumpEntity(ent *Entity)

func (*DB) GetEntity

func (db *DB) GetEntity(uri turtle.URI) (*Entity, error)

func (*DB) GetEntityFromHash

func (db *DB) GetEntityFromHash(hash Key) (*Entity, error)

func (*DB) GetEntityFromHashTx

func (db *DB) GetEntityFromHashTx(graphtx *leveldb.Transaction, hash Key) (*Entity, error)

func (*DB) GetEntityIndexFromHash added in v0.4.1

func (db *DB) GetEntityIndexFromHash(hash Key) (*EntityExtendedIndex, error)

func (*DB) GetEntityIndexFromHashTx added in v0.4.1

func (db *DB) GetEntityIndexFromHashTx(extendtx *leveldb.Transaction, hash Key) (*EntityExtendedIndex, error)

func (*DB) GetEntityTx

func (db *DB) GetEntityTx(graphtx *leveldb.Transaction, uri turtle.URI) (*Entity, error)

func (*DB) GetHash

func (db *DB) GetHash(entity turtle.URI) (Key, error)

returns the uint32 hash of the given URI (this is adjusted for uniqueness)

func (*DB) GetURI

func (db *DB) GetURI(hash Key) (turtle.URI, error)

func (*DB) LoadDataset

func (db *DB) LoadDataset(dataset turtle.DataSet) error

func (*DB) MustGetEntityFromHash

func (db *DB) MustGetEntityFromHash(hash Key) *Entity

func (*DB) MustGetEntityIndexFromHash added in v0.4.1

func (db *DB) MustGetEntityIndexFromHash(hash Key) *EntityExtendedIndex

func (*DB) MustGetHash

func (db *DB) MustGetHash(entity turtle.URI) Key

func (*DB) MustGetURI

func (db *DB) MustGetURI(hash Key) turtle.URI

func (*DB) MustGetURIStringHash

func (db *DB) MustGetURIStringHash(hash string) turtle.URI

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 Key added in v0.3.2

type Key [4]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 MultiDB added in v0.5.2

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

func NewMultiDB added in v0.5.2

func NewMultiDB(cfg *config.Config) (*MultiDB, error)

func (*MultiDB) Close added in v0.5.2

func (mdb *MultiDB) Close()

func (*MultiDB) Databases added in v0.5.3

func (mdb *MultiDB) Databases() []string

func (*MultiDB) QueryToClassDOT added in v0.5.2

func (mdb *MultiDB) QueryToClassDOT(q string) (string, error)

func (*MultiDB) QueryToDOT added in v0.5.2

func (mdb *MultiDB) QueryToDOT(q string) (string, error)

func (*MultiDB) RunQuery added in v0.5.2

func (mdb *MultiDB) RunQuery(q *sparql.Query) (QueryResult, error)

func (*MultiDB) RunQueryString added in v0.5.2

func (mdb *MultiDB) RunQueryString(querystring string) (QueryResult, error)

func (*MultiDB) Search added in v0.5.2

func (mdb *MultiDB) Search(q string, n int) ([]string, 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)

func (*PredicateEntity) DecodeMsg

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

DecodeMsg implements msgp.Decodable

func (*PredicateEntity) Dump added in v0.5.2

func (e *PredicateEntity) Dump(db *DB)

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 `msg:"-"`
	// 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 *MultiDB, 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 [32]byte

func NewRow added in v0.5.2

func NewRow() *Row

Jump to

Keyboard shortcuts

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