Documentation ¶
Index ¶
- Constants
- Variables
- func NextUID() uint64
- func OutputQueryShapeForIterator(it graph.Iterator, qs graph.QuadStore, outputMap map[string]interface{})
- func RunFloatOp(a quad.Float, op Operator, b quad.Float) bool
- func RunIntOp(a quad.Int, op Operator, b quad.Int) bool
- func RunStrOp(a string, op Operator, b string) bool
- func RunTimeOp(a time.Time, op Operator, b time.Time) bool
- type And
- func (it *And) AddSubIterator(sub graph.Iterator)
- func (it *And) Clone() graph.Iterator
- func (it *And) Close() error
- func (it *And) Contains(ctx context.Context, val graph.Value) bool
- func (it *And) Err() error
- func (it *And) Next(ctx context.Context) bool
- func (it *And) NextPath(ctx context.Context) bool
- func (it *And) Optimize() (graph.Iterator, bool)
- func (it *And) Reset()
- func (it *And) Result() graph.Value
- func (it *And) Size() (int64, bool)
- func (it *And) Stats() graph.IteratorStats
- func (it *And) String() string
- func (it *And) SubIterators() []graph.Iterator
- func (it *And) TagResults(dst map[string]graph.Value)
- func (it *And) Tagger() *graph.Tagger
- func (it *And) Type() graph.Type
- func (it *And) UID() uint64
- type Comparison
- func (it *Comparison) Clone() graph.Iterator
- func (it *Comparison) Close() error
- func (it *Comparison) Contains(ctx context.Context, val graph.Value) bool
- func (it *Comparison) Err() error
- func (it *Comparison) Next(ctx context.Context) bool
- func (it *Comparison) NextPath(ctx context.Context) bool
- func (it *Comparison) Operator() Operator
- func (it *Comparison) Optimize() (graph.Iterator, bool)
- func (it *Comparison) Reset()
- func (it *Comparison) Result() graph.Value
- func (it *Comparison) Size() (int64, bool)
- func (it *Comparison) Stats() graph.IteratorStats
- func (it *Comparison) String() string
- func (it *Comparison) SubIterators() []graph.Iterator
- func (it *Comparison) TagResults(dst map[string]graph.Value)
- func (it *Comparison) Tagger() *graph.Tagger
- func (it *Comparison) Type() graph.Type
- func (it *Comparison) UID() uint64
- func (it *Comparison) Value() quad.Value
- type Count
- func (it *Count) Clone() graph.Iterator
- func (it *Count) Close() error
- func (it *Count) Contains(ctx context.Context, val graph.Value) bool
- func (it *Count) Err() error
- func (it *Count) Next(ctx context.Context) bool
- func (it *Count) NextPath(ctx context.Context) bool
- func (it *Count) Optimize() (graph.Iterator, bool)
- func (it *Count) Reset()
- func (it *Count) Result() graph.Value
- func (it *Count) Size() (int64, bool)
- func (it *Count) Stats() graph.IteratorStats
- func (it *Count) String() string
- func (it *Count) SubIterators() []graph.Iterator
- func (it *Count) TagResults(dst map[string]graph.Value)
- func (it *Count) Tagger() *graph.Tagger
- func (it *Count) Type() graph.Type
- func (it *Count) UID() uint64
- type Error
- func (it *Error) Clone() graph.Iterator
- func (it *Error) Close() error
- func (it *Error) Contains(ctx context.Context, v graph.Value) bool
- func (it *Error) Err() error
- func (it *Error) Next(ctx context.Context) bool
- func (it *Error) NextPath(ctx context.Context) bool
- func (it *Error) Optimize() (graph.Iterator, bool)
- func (it *Error) Reset()
- func (it *Error) Result() graph.Value
- func (it *Error) Size() (int64, bool)
- func (it *Error) Stats() graph.IteratorStats
- func (it *Error) String() string
- func (it *Error) SubIterators() []graph.Iterator
- func (it *Error) TagResults(dst map[string]graph.Value)
- func (it *Error) Tagger() *graph.Tagger
- func (it *Error) Type() graph.Type
- func (it *Error) UID() uint64
- type Fixed
- func (it *Fixed) Add(v graph.Value)
- func (it *Fixed) Clone() graph.Iterator
- func (it *Fixed) Close() error
- func (it *Fixed) Contains(ctx context.Context, v graph.Value) bool
- func (it *Fixed) Err() error
- func (it *Fixed) Next(ctx context.Context) bool
- func (it *Fixed) NextPath(ctx context.Context) bool
- func (it *Fixed) Optimize() (graph.Iterator, bool)
- func (it *Fixed) Reset()
- func (it *Fixed) Result() graph.Value
- func (it *Fixed) Size() (int64, bool)
- func (it *Fixed) Stats() graph.IteratorStats
- func (it *Fixed) String() string
- func (it *Fixed) SubIterators() []graph.Iterator
- func (it *Fixed) TagResults(dst map[string]graph.Value)
- func (it *Fixed) Tagger() *graph.Tagger
- func (it *Fixed) Type() graph.Type
- func (it *Fixed) UID() uint64
- func (it *Fixed) Values() []graph.Value
- type HasA
- func (it *HasA) Clone() graph.Iterator
- func (it *HasA) Close() error
- func (it *HasA) Contains(ctx context.Context, val graph.Value) bool
- func (it *HasA) Direction() quad.Direction
- func (it *HasA) Err() error
- func (it *HasA) Next(ctx context.Context) bool
- func (it *HasA) NextContains(ctx context.Context) bool
- func (it *HasA) NextPath(ctx context.Context) bool
- func (it *HasA) Optimize() (graph.Iterator, bool)
- func (it *HasA) Reset()
- func (it *HasA) Result() graph.Value
- func (it *HasA) Size() (int64, bool)
- func (it *HasA) Stats() graph.IteratorStats
- func (it *HasA) String() string
- func (it *HasA) SubIterators() []graph.Iterator
- func (it *HasA) TagResults(dst map[string]graph.Value)
- func (it *HasA) Tagger() *graph.Tagger
- func (it *HasA) Type() graph.Type
- func (it *HasA) UID() uint64
- type Int64
- func (it *Int64) Clone() graph.Iterator
- func (it *Int64) Close() error
- func (it *Int64) Contains(ctx context.Context, tsv graph.Value) bool
- func (it *Int64) Err() error
- func (it *Int64) Next(ctx context.Context) bool
- func (it *Int64) NextPath(ctx context.Context) bool
- func (it *Int64) Optimize() (graph.Iterator, bool)
- func (it *Int64) Reset()
- func (it *Int64) Result() graph.Value
- func (it *Int64) Size() (int64, bool)
- func (it *Int64) Stats() graph.IteratorStats
- func (it *Int64) String() string
- func (it *Int64) SubIterators() []graph.Iterator
- func (it *Int64) TagResults(dst map[string]graph.Value)
- func (it *Int64) Tagger() *graph.Tagger
- func (it *Int64) Type() graph.Type
- func (it *Int64) UID() uint64
- type Int64Node
- type Int64Quad
- type Limit
- func (it *Limit) Clone() graph.Iterator
- func (it *Limit) Close() error
- func (it *Limit) Contains(ctx context.Context, val graph.Value) bool
- func (it *Limit) Err() error
- func (it *Limit) Next(ctx context.Context) bool
- func (it *Limit) NextPath(ctx context.Context) bool
- func (it *Limit) Optimize() (graph.Iterator, bool)
- func (it *Limit) Reset()
- func (it *Limit) Result() graph.Value
- func (it *Limit) Size() (int64, bool)
- func (it *Limit) Stats() graph.IteratorStats
- func (it *Limit) String() string
- func (it *Limit) SubIterators() []graph.Iterator
- func (it *Limit) TagResults(dst map[string]graph.Value)
- func (it *Limit) Tagger() *graph.Tagger
- func (it *Limit) Type() graph.Type
- func (it *Limit) UID() uint64
- type Link
- type LinksTo
- func (it *LinksTo) Clone() graph.Iterator
- func (it *LinksTo) Close() error
- func (it *LinksTo) Contains(ctx context.Context, val graph.Value) bool
- func (it *LinksTo) Direction() quad.Direction
- func (it *LinksTo) Err() error
- func (it *LinksTo) Next(ctx context.Context) bool
- func (it *LinksTo) NextPath(ctx context.Context) bool
- func (it *LinksTo) Optimize() (graph.Iterator, bool)
- func (it *LinksTo) Reset()
- func (it *LinksTo) Result() graph.Value
- func (it *LinksTo) Size() (int64, bool)
- func (it *LinksTo) Stats() graph.IteratorStats
- func (it *LinksTo) String() string
- func (it *LinksTo) SubIterators() []graph.Iterator
- func (it *LinksTo) TagResults(dst map[string]graph.Value)
- func (it *LinksTo) Tagger() *graph.Tagger
- func (it *LinksTo) Type() graph.Type
- func (it *LinksTo) UID() uint64
- type Materialize
- func (it *Materialize) Clone() graph.Iterator
- func (it *Materialize) Close() error
- func (it *Materialize) Contains(ctx context.Context, v graph.Value) bool
- func (it *Materialize) Err() error
- func (it *Materialize) Next(ctx context.Context) bool
- func (it *Materialize) NextPath(ctx context.Context) bool
- func (it *Materialize) Optimize() (graph.Iterator, bool)
- func (it *Materialize) Reset()
- func (it *Materialize) Result() graph.Value
- func (it *Materialize) Size() (int64, bool)
- func (it *Materialize) Stats() graph.IteratorStats
- func (it *Materialize) String() string
- func (it *Materialize) SubIterators() []graph.Iterator
- func (it *Materialize) TagResults(dst map[string]graph.Value)
- func (it *Materialize) Tagger() *graph.Tagger
- func (it *Materialize) Type() graph.Type
- func (it *Materialize) UID() uint64
- type Node
- type Not
- func (it *Not) Clone() graph.Iterator
- func (it *Not) Close() error
- func (it *Not) Contains(ctx context.Context, val graph.Value) bool
- func (it *Not) Err() error
- func (it *Not) Next(ctx context.Context) bool
- func (it *Not) NextPath(ctx context.Context) bool
- func (it *Not) Optimize() (graph.Iterator, bool)
- func (it *Not) Reset()
- func (it *Not) Result() graph.Value
- func (it *Not) Size() (int64, bool)
- func (it *Not) Stats() graph.IteratorStats
- func (it *Not) String() string
- func (it *Not) SubIterators() []graph.Iterator
- func (it *Not) TagResults(dst map[string]graph.Value)
- func (it *Not) Tagger() *graph.Tagger
- func (it *Not) Type() graph.Type
- func (it *Not) UID() uint64
- type Null
- func (it *Null) Clone() graph.Iterator
- func (it *Null) Close() error
- func (it *Null) Contains(ctx context.Context, v graph.Value) bool
- func (it *Null) Err() error
- func (it *Null) Next(ctx context.Context) bool
- func (it *Null) NextPath(ctx context.Context) bool
- func (it *Null) Optimize() (graph.Iterator, bool)
- func (it *Null) Reset()
- func (it *Null) Result() graph.Value
- func (it *Null) Size() (int64, bool)
- func (it *Null) Stats() graph.IteratorStats
- func (it *Null) String() string
- func (it *Null) SubIterators() []graph.Iterator
- func (it *Null) TagResults(dst map[string]graph.Value)
- func (it *Null) Tagger() *graph.Tagger
- func (it *Null) Type() graph.Type
- func (it *Null) UID() uint64
- type Operator
- type Optional
- func (it *Optional) Clone() graph.Iterator
- func (it *Optional) Close() error
- func (it *Optional) Contains(ctx context.Context, val graph.Value) bool
- func (it *Optional) Err() error
- func (it *Optional) Next(ctx context.Context) bool
- func (it *Optional) NextPath(ctx context.Context) bool
- func (it *Optional) NoNext()
- func (it *Optional) Optimize() (graph.Iterator, bool)
- func (it *Optional) Reset()
- func (it *Optional) Result() graph.Value
- func (it *Optional) Size() (int64, bool)
- func (it *Optional) Stats() graph.IteratorStats
- func (it *Optional) String() string
- func (it *Optional) SubIterators() []graph.Iterator
- func (it *Optional) TagResults(dst map[string]graph.Value)
- func (it *Optional) Tagger() *graph.Tagger
- func (it *Optional) Type() graph.Type
- func (it *Optional) UID() uint64
- type Or
- func (it *Or) AddSubIterator(sub graph.Iterator)
- func (it *Or) Clone() graph.Iterator
- func (it *Or) Close() error
- func (it *Or) Contains(ctx context.Context, val graph.Value) bool
- func (it *Or) Err() error
- func (it *Or) Next(ctx context.Context) bool
- func (it *Or) NextPath(ctx context.Context) bool
- func (it *Or) Optimize() (graph.Iterator, bool)
- func (it *Or) Reset()
- func (it *Or) Result() graph.Value
- func (it *Or) Size() (int64, bool)
- func (it *Or) Stats() graph.IteratorStats
- func (it *Or) String() string
- func (it *Or) SubIterators() []graph.Iterator
- func (it *Or) TagResults(dst map[string]graph.Value)
- func (it *Or) Tagger() *graph.Tagger
- func (it *Or) Type() graph.Type
- func (it *Or) UID() uint64
- type Recursive
- func (it *Recursive) AddDepthTag(s string)
- func (it *Recursive) Clone() graph.Iterator
- func (it *Recursive) Close() error
- func (it *Recursive) Contains(ctx context.Context, val graph.Value) bool
- func (it *Recursive) Err() error
- func (it *Recursive) Next(ctx context.Context) bool
- func (it *Recursive) NextPath(ctx context.Context) bool
- func (it *Recursive) Optimize() (graph.Iterator, bool)
- func (it *Recursive) Reset()
- func (it *Recursive) Result() graph.Value
- func (it *Recursive) Size() (int64, bool)
- func (it *Recursive) Stats() graph.IteratorStats
- func (it *Recursive) String() string
- func (it *Recursive) SubIterators() []graph.Iterator
- func (it *Recursive) TagResults(dst map[string]graph.Value)
- func (it *Recursive) Tagger() *graph.Tagger
- func (it *Recursive) Type() graph.Type
- func (it *Recursive) UID() uint64
- type Regex
- func (it *Regex) AllowRefs(v bool)
- func (it *Regex) Clone() graph.Iterator
- func (it *Regex) Close() error
- func (it *Regex) Contains(ctx context.Context, val graph.Value) bool
- func (it *Regex) Err() error
- func (it *Regex) Next(ctx context.Context) bool
- func (it *Regex) NextPath(ctx context.Context) bool
- func (it *Regex) Optimize() (graph.Iterator, bool)
- func (it *Regex) Reset()
- func (it *Regex) Result() graph.Value
- func (it *Regex) Size() (int64, bool)
- func (it *Regex) Stats() graph.IteratorStats
- func (it *Regex) String() string
- func (it *Regex) SubIterators() []graph.Iterator
- func (it *Regex) TagResults(dst map[string]graph.Value)
- func (it *Regex) Tagger() *graph.Tagger
- func (it *Regex) Type() graph.Type
- func (it *Regex) UID() uint64
- type Skip
- func (it *Skip) Clone() graph.Iterator
- func (it *Skip) Close() error
- func (it *Skip) Contains(ctx context.Context, val graph.Value) bool
- func (it *Skip) Err() error
- func (it *Skip) Next(ctx context.Context) bool
- func (it *Skip) NextPath(ctx context.Context) bool
- func (it *Skip) Optimize() (graph.Iterator, bool)
- func (it *Skip) Reset()
- func (it *Skip) Result() graph.Value
- func (it *Skip) Size() (int64, bool)
- func (it *Skip) Stats() graph.IteratorStats
- func (it *Skip) String() string
- func (it *Skip) SubIterators() []graph.Iterator
- func (it *Skip) TagResults(dst map[string]graph.Value)
- func (it *Skip) Tagger() *graph.Tagger
- func (it *Skip) Type() graph.Type
- func (it *Skip) UID() uint64
- type Unique
- func (it *Unique) Clone() graph.Iterator
- func (it *Unique) Close() error
- func (it *Unique) Contains(ctx context.Context, val graph.Value) bool
- func (it *Unique) Err() error
- func (it *Unique) Next(ctx context.Context) bool
- func (it *Unique) NextPath(ctx context.Context) bool
- func (it *Unique) Optimize() (graph.Iterator, bool)
- func (it *Unique) Reset()
- func (it *Unique) Result() graph.Value
- func (it *Unique) Size() (int64, bool)
- func (it *Unique) Stats() graph.IteratorStats
- func (it *Unique) String() string
- func (it *Unique) SubIterators() []graph.Iterator
- func (it *Unique) TagResults(dst map[string]graph.Value)
- func (it *Unique) Tagger() *graph.Tagger
- func (it *Unique) Type() graph.Type
- func (it *Unique) UID() uint64
Constants ¶
const MaterializeLimit = 1000
Variables ¶
var DefaultMaxRecursiveSteps = 50
Functions ¶
Types ¶
type And ¶
type And struct {
// contains filtered or unexported fields
}
The And iterator. Consists of a number of subiterators, the primary of which will be Next()ed if next is called.
func NewAnd ¶
NewAnd creates an And iterator. `qs` is only required when needing a handle for QuadStore-specific optimizations, otherwise nil is acceptable.
func (*And) AddSubIterator ¶
Add a subiterator to this And iterator.
The first iterator that is added becomes the primary iterator. This is important. Calling Optimize() is the way to change the order based on subiterator statistics. Without Optimize(), the order added is the order used.
func (*And) Close ¶
Close this iterator, and, by extension, close the subiterators. Close should be idempotent, and it follows that if it's subiterators follow this contract, the And follows the contract. It closes all subiterators it can, but returns the first error it encounters.
func (*And) Next ¶
Returns advances the And iterator. Because the And is the intersection of its subiterators, it must choose one subiterator to produce a candidate, and check this value against the subiterators. A productive choice of primary iterator is therefore very important.
func (*And) NextPath ¶ added in v0.4.0
An And has no NextPath of its own -- that is, there are no other values which satisfy our previous result that are not the result itself. Our subiterators might, however, so just pass the call recursively.
func (*And) Optimize ¶
Optimizes the And, by picking the most efficient way to Next() and Contains() its subiterators. For SQL fans, this is equivalent to JOIN.
func (*And) Size ¶
Returns the approximate size of the And iterator. Because we're dealing with an intersection, we know that the largest we can be is the size of the smallest iterator. This is the heuristic we shall follow. Better heuristics welcome.
func (*And) Stats ¶
func (it *And) Stats() graph.IteratorStats
and.Stats() lives here in and-iterator-optimize.go because it may in the future return different statistics based on how it is optimized. For now, however, it's pretty static.
func (*And) SubIterators ¶
Returns a slice of the subiterators, in order (primary iterator first).
func (*And) TagResults ¶
An extended TagResults, as it needs to add it's own results and recurse down it's subiterators.
type Comparison ¶
type Comparison struct {
// contains filtered or unexported fields
}
func NewComparison ¶
func (*Comparison) Clone ¶
func (it *Comparison) Clone() graph.Iterator
func (*Comparison) Close ¶
func (it *Comparison) Close() error
func (*Comparison) Err ¶ added in v0.4.1
func (it *Comparison) Err() error
func (*Comparison) NextPath ¶ added in v0.4.0
func (it *Comparison) NextPath(ctx context.Context) bool
func (*Comparison) Operator ¶ added in v0.6.0
func (it *Comparison) Operator() Operator
func (*Comparison) Optimize ¶
func (it *Comparison) Optimize() (graph.Iterator, bool)
There's nothing to optimize, locally, for a value-comparison iterator. Replace the underlying iterator if need be. potentially replace it.
func (*Comparison) Reset ¶
func (it *Comparison) Reset()
func (*Comparison) Result ¶
func (it *Comparison) Result() graph.Value
func (*Comparison) Size ¶
func (it *Comparison) Size() (int64, bool)
func (*Comparison) Stats ¶
func (it *Comparison) Stats() graph.IteratorStats
We're only as expensive as our subiterator. Again, optimized value comparison iterators should do better.
func (*Comparison) String ¶ added in v0.7.0
func (it *Comparison) String() string
func (*Comparison) SubIterators ¶
func (it *Comparison) SubIterators() []graph.Iterator
func (*Comparison) TagResults ¶
func (it *Comparison) TagResults(dst map[string]graph.Value)
If we failed the check, then the subiterator should not contribute to the result set. Otherwise, go ahead and tag it.
func (*Comparison) Tagger ¶
func (it *Comparison) Tagger() *graph.Tagger
func (*Comparison) Type ¶
func (it *Comparison) Type() graph.Type
Registers the value-comparison iterator.
func (*Comparison) UID ¶
func (it *Comparison) UID() uint64
func (*Comparison) Value ¶ added in v0.6.0
func (it *Comparison) Value() quad.Value
type Count ¶ added in v0.6.0
type Count struct {
// contains filtered or unexported fields
}
Count iterator returns one element with size of underlying iterator.
func NewCount ¶ added in v0.6.0
NewCount creates a new iterator to count a number of results from a provided subiterator. qs may be nil - it's used to check if count Contains (is) a given value.
func (*Count) Reset ¶ added in v0.6.0
func (it *Count) Reset()
Reset resets the internal iterators and the iterator itself.
func (*Count) Stats ¶ added in v0.6.0
func (it *Count) Stats() graph.IteratorStats
func (*Count) SubIterators ¶ added in v0.6.0
SubIterators returns a slice of the sub iterators.
type Error ¶ added in v0.7.0
type Error struct {
// contains filtered or unexported fields
}
Error iterator always returns a single error with no other results.
func (*Error) Stats ¶ added in v0.7.0
func (it *Error) Stats() graph.IteratorStats
func (*Error) SubIterators ¶ added in v0.7.0
func (*Error) TagResults ¶ added in v0.7.0
Fill the map based on the tags assigned to this iterator.
type Fixed ¶
type Fixed struct {
// contains filtered or unexported fields
}
A Fixed iterator consists of it's values, an index (where it is in the process of Next()ing) and an equality function.
func (*Fixed) Add ¶
Add a value to the iterator. The array now contains this value. TODO(barakmich): This ought to be a set someday, disallowing repeated values.
func (*Fixed) Contains ¶
Check if the passed value is equal to one of the values stored in the iterator.
func (*Fixed) Optimize ¶
Optimize() for a Fixed iterator is simple. Returns a Null iterator if it's empty (so that other iterators upstream can treat this as null) or there is no optimization.
func (*Fixed) Stats ¶
func (it *Fixed) Stats() graph.IteratorStats
As we right now have to scan the entire list, Next and Contains are linear with the size. However, a better data structure could remove these limits.
type HasA ¶
type HasA struct {
// contains filtered or unexported fields
}
A HasA consists of a reference back to the graph.QuadStore that it references, a primary subiterator, a direction in which the quads for that subiterator point, and a temporary holder for the iterator generated on Contains().
func NewHasA ¶
Construct a new HasA iterator, given the quad subiterator, and the quad direction for which it stands.
func (*HasA) Close ¶
Close the subiterator, the result iterator (if any) and the HasA. It closes all subiterators it can, but returns the first error it encounters.
func (*HasA) Contains ¶
Check a value against our internal iterator. In order to do this, we must first open a new iterator of "quads that have `val` in our direction", given to us by the quad store, and then Next() values out of that iterator and Contains() them against our subiterator.
func (*HasA) Next ¶
Next advances the iterator. This is simpler than Contains. We have a subiterator we can get a value from, and we can take that resultant quad, pull our direction out of it, and return that.
func (*HasA) NextContains ¶
NextContains() is shared code between Contains() and GetNextResult() -- calls next on the result iterator (a quad iterator based on the last checked value) and returns true if another match is made.
func (*HasA) Optimize ¶
Pass the Optimize() call along to the subiterator. If it becomes Null, then the HasA becomes Null (there are no quads that have any directions).
func (*HasA) Stats ¶
func (it *HasA) Stats() graph.IteratorStats
GetStats() returns the statistics on the HasA iterator. This is curious. Next cost is easy, it's an extra call or so on top of the subiterator Next cost. ContainsCost involves going to the graph.QuadStore, iterating out values, and hoping one sticks -- potentially expensive, depending on fanout. Size, however, is potentially smaller. we know at worst it's the size of the subiterator, but if there are many repeated values, it could be much smaller in totality.
func (*HasA) SubIterators ¶
Return our sole subiterator.
func (*HasA) TagResults ¶
Pass the TagResults down the chain.
type Int64 ¶
type Int64 struct {
// contains filtered or unexported fields
}
An All iterator across a range of int64 values, from `max` to `min`.
func (*Int64) Contains ¶
Contains() for an Int64 is merely seeing if the passed value is within the range, assuming the value is an int64.
func (*Int64) Next ¶
Next() on an Int64 all iterator is a simple incrementing counter. Return the next integer, and mark it as the result.
func (*Int64) Size ¶
The number of elements in an Int64 is the size of the range. The size is exact.
func (*Int64) Stats ¶
func (it *Int64) Stats() graph.IteratorStats
Stats for an Int64 are simple. Super cheap to do any operation, and as big as the range.
func (*Int64) TagResults ¶
Fill the map based on the tags assigned to this iterator.
type Limit ¶ added in v0.6.0
type Limit struct {
// contains filtered or unexported fields
}
Limit iterator will stop iterating if certain a number of values were encountered. Zero and negative limit values means no limit.
func (*Limit) Close ¶ added in v0.6.0
Close closes the primary and all iterators. It closes all subiterators it can, but returns the first error it encounters.
func (*Limit) Next ¶ added in v0.6.0
Next advances the Limit iterator. It will stop iteration if limit was reached.
func (*Limit) NextPath ¶ added in v0.6.0
NextPath checks whether there is another path. Will call primary iterator if limit is not reached yet.
func (*Limit) Reset ¶ added in v0.6.0
func (it *Limit) Reset()
Reset resets the internal iterators and the iterator itself.
func (*Limit) Stats ¶ added in v0.6.0
func (it *Limit) Stats() graph.IteratorStats
func (*Limit) SubIterators ¶ added in v0.6.0
SubIterators returns a slice of the sub iterators.
type LinksTo ¶
type LinksTo struct {
// contains filtered or unexported fields
}
A LinksTo has a reference back to the graph.QuadStore (to create the iterators for each node) the subiterator, and the direction the iterator comes from. `next_it` is the tempoarary iterator held per result in `primary_it`.
func NewLinksTo ¶
Construct a new LinksTo iterator around a direction and a subiterator of nodes.
func (*LinksTo) Close ¶
Close closes the iterator. It closes all subiterators it can, but returns the first error it encounters.
func (*LinksTo) Contains ¶
If it checks in the right direction for the subiterator, it is a valid link for the LinksTo.
func (*LinksTo) NextPath ¶ added in v0.4.0
We won't ever have a new result, but our subiterators might.
func (*LinksTo) Stats ¶
func (it *LinksTo) Stats() graph.IteratorStats
Return a guess as to how big or costly it is to next the iterator.
func (*LinksTo) SubIterators ¶
Return a list containing only our subiterator.
func (*LinksTo) TagResults ¶
Tag these results, and our subiterator's results.
type Materialize ¶ added in v0.4.0
type Materialize struct {
// contains filtered or unexported fields
}
func NewMaterialize ¶ added in v0.4.0
func NewMaterialize(sub graph.Iterator) *Materialize
func NewMaterializeWithSize ¶ added in v0.7.0
func NewMaterializeWithSize(sub graph.Iterator, size int64) *Materialize
func (*Materialize) Clone ¶ added in v0.4.0
func (it *Materialize) Clone() graph.Iterator
func (*Materialize) Close ¶ added in v0.4.0
func (it *Materialize) Close() error
func (*Materialize) Err ¶ added in v0.4.1
func (it *Materialize) Err() error
func (*Materialize) NextPath ¶ added in v0.4.0
func (it *Materialize) NextPath(ctx context.Context) bool
func (*Materialize) Optimize ¶ added in v0.4.0
func (it *Materialize) Optimize() (graph.Iterator, bool)
func (*Materialize) Reset ¶ added in v0.4.0
func (it *Materialize) Reset()
func (*Materialize) Result ¶ added in v0.4.0
func (it *Materialize) Result() graph.Value
func (*Materialize) Size ¶ added in v0.4.0
func (it *Materialize) Size() (int64, bool)
Size is the number of values stored, if we've got them all. Otherwise, guess based on the size of the subiterator.
func (*Materialize) Stats ¶ added in v0.4.0
func (it *Materialize) Stats() graph.IteratorStats
The entire point of Materialize is to amortize the cost by putting it all up front.
func (*Materialize) String ¶ added in v0.7.0
func (it *Materialize) String() string
func (*Materialize) SubIterators ¶ added in v0.4.0
func (it *Materialize) SubIterators() []graph.Iterator
func (*Materialize) TagResults ¶ added in v0.4.0
func (it *Materialize) TagResults(dst map[string]graph.Value)
func (*Materialize) Tagger ¶ added in v0.4.0
func (it *Materialize) Tagger() *graph.Tagger
func (*Materialize) Type ¶ added in v0.4.0
func (it *Materialize) Type() graph.Type
Register this iterator as a Materialize iterator.
func (*Materialize) UID ¶ added in v0.4.0
func (it *Materialize) UID() uint64
type Not ¶ added in v0.4.1
type Not struct {
// contains filtered or unexported fields
}
Not iterator acts like a complement for the primary iterator. It will return all the vertices which are not part of the primary iterator.
func (*Not) Close ¶ added in v0.4.1
Close closes the primary and all iterators. It closes all subiterators it can, but returns the first error it encounters.
func (*Not) Contains ¶ added in v0.4.1
Contains checks whether the passed value is part of the primary iterator's complement. For a valid value, it updates the Result returned by the iterator to the value itself.
func (*Not) Next ¶ added in v0.4.1
Next advances the Not iterator. It returns whether there is another valid new value. It fetches the next value of the all iterator which is not contained by the primary iterator.
func (*Not) NextPath ¶ added in v0.4.1
NextPath checks whether there is another path. Not applicable, hence it will return false.
func (*Not) Reset ¶ added in v0.4.1
func (it *Not) Reset()
Reset resets the internal iterators and the iterator itself.
func (*Not) Stats ¶ added in v0.4.1
func (it *Not) Stats() graph.IteratorStats
func (*Not) SubIterators ¶ added in v0.4.1
SubIterators returns a slice of the sub iterators. The first iterator is the primary iterator, for which the complement is generated.
type Null ¶
type Null struct {
// contains filtered or unexported fields
}
Here we define the simplest iterator -- the Null iterator. It contains nothing. It is the empty set. Often times, queries that contain one of these match nothing, so it's important to give it a special iterator.
func (*Null) Optimize ¶
A good iterator will close itself when it returns true. Null has nothing it needs to do.
func (*Null) Stats ¶
func (it *Null) Stats() graph.IteratorStats
A null iterator costs nothing. Use it!
func (*Null) SubIterators ¶
func (*Null) TagResults ¶
Fill the map based on the tags assigned to this iterator.
type Optional ¶
type Optional struct {
// contains filtered or unexported fields
}
An optional iterator has the sub-constraint iterator we wish to be optional and whether the last check we received was true or false.
func (*Optional) Contains ¶
Contains() is the real hack of this iterator. It always returns true, regardless of whether the subiterator matched. But we keep track of whether the subiterator matched for results purposes.
func (*Optional) NextPath ¶ added in v0.4.0
An optional iterator only has a next result if, (a) last time we checked we had any results whatsoever, and (b) there was another subresult in our optional subbranch.
func (*Optional) NoNext ¶ added in v0.6.0
func (it *Optional) NoNext()
Optional iterator cannot be Next()'ed.
func (*Optional) Optimize ¶
There's nothing to optimize for an optional. Optimize the subiterator and potentially replace it.
func (*Optional) Stats ¶
func (it *Optional) Stats() graph.IteratorStats
We're only as expensive as our subiterator. Except, we can't be nexted.
func (*Optional) SubIterators ¶
func (*Optional) TagResults ¶
If we failed the check, then the subiterator should not contribute to the result set. Otherwise, go ahead and tag it.
type Or ¶
type Or struct {
// contains filtered or unexported fields
}
func NewShortCircuitOr ¶
func NewShortCircuitOr() *Or
func (*Or) AddSubIterator ¶
Add a subiterator to this Or graph.iterator. Order matters.
func (*Or) Close ¶
Close this graph.iterator, and, by extension, close the subiterators. Close should be idempotent, and it follows that if it's subiterators follow this contract, the Or follows the contract. It closes all subiterators it can, but returns the first error it encounters.
func (*Or) Next ¶
Next advances the Or graph.iterator. Because the Or is the union of its subiterators, it must produce from all subiterators -- unless it it shortcircuiting, in which case, it is the first one that returns anything.
func (*Or) NextPath ¶ added in v0.4.0
An Or has no NextPath of its own -- that is, there are no other values which satisfy our previous result that are not the result itself. Our subiterators might, however, so just pass the call recursively. In the case of shortcircuiting, only allow new results from the currently checked graph.iterator
func (*Or) Size ¶
Returns the approximate size of the Or graph.iterator. Because we're dealing with a union, we know that the largest we can be is the sum of all the iterators, or in the case of short-circuiting, the longest.
func (*Or) Stats ¶
func (it *Or) Stats() graph.IteratorStats
func (*Or) SubIterators ¶
Returns a list.List of the subiterators, in order. The returned slice must not be modified.
func (*Or) TagResults ¶
Overrides BaseIterator TagResults, as it needs to add it's own results and recurse down it's subiterators.
type Recursive ¶ added in v0.6.1
type Recursive struct {
// contains filtered or unexported fields
}
Recursive iterator takes a base iterator and a morphism to be applied recursively, for each result.
func NewRecursive ¶ added in v0.6.1
func (*Recursive) AddDepthTag ¶ added in v0.6.1
func (*Recursive) Stats ¶ added in v0.6.1
func (it *Recursive) Stats() graph.IteratorStats
func (*Recursive) SubIterators ¶ added in v0.6.1
func (*Recursive) TagResults ¶ added in v0.6.1
type Regex ¶ added in v0.6.0
type Regex struct {
// contains filtered or unexported fields
}
Regex is a unary operator -- a filter across the values in the relevant subiterator. It works similarly to gremlin's filter{it.matches('exp')}, reducing the iterator set to values whose string representation passes a regular expression test.
func (*Regex) AllowRefs ¶ added in v0.6.0
AllowRefs allows regexp iterator to match IRIs and BNodes.
Consider using it carefully. In most cases it's better to reconsider your graph structure instead of relying on slow unoptimizable regexp.
An example of incorrect usage is to match IRIs:
<http://example.org/page> <http://example.org/page/foo>
Via regexp like:
http://example.org/page.*
The right way is to explicitly link graph nodes and query them by this relation:
<http://example.org/page/foo> <type> <http://example.org/page>
func (*Regex) Optimize ¶ added in v0.6.0
There's nothing to optimize, locally, for a Regex iterator. Replace the underlying iterator if need be.
func (*Regex) Stats ¶ added in v0.6.0
func (it *Regex) Stats() graph.IteratorStats
We're only as expensive as our subiterator.
func (*Regex) SubIterators ¶ added in v0.6.0
func (*Regex) TagResults ¶ added in v0.6.0
If we failed the check, then the subiterator should not contribute to the result set. Otherwise, go ahead and tag it.
type Skip ¶ added in v0.6.0
type Skip struct {
// contains filtered or unexported fields
}
Skip iterator will skip certain number of values from primary iterator.
func (*Skip) Close ¶ added in v0.6.0
Close closes the primary and all iterators. It closes all subiterators it can, but returns the first error it encounters.
func (*Skip) Next ¶ added in v0.6.0
Next advances the Skip iterator. It will skip all initial values before returning actual result.
func (*Skip) NextPath ¶ added in v0.6.0
NextPath checks whether there is another path. It will skip first paths according to iterator parameter.
func (*Skip) Reset ¶ added in v0.6.0
func (it *Skip) Reset()
Reset resets the internal iterators and the iterator itself.
func (*Skip) Stats ¶ added in v0.6.0
func (it *Skip) Stats() graph.IteratorStats
func (*Skip) SubIterators ¶ added in v0.6.0
SubIterators returns a slice of the sub iterators.
type Unique ¶ added in v0.5.0
type Unique struct {
// contains filtered or unexported fields
}
Unique iterator removes duplicate values from it's subiterator.
func (*Unique) Contains ¶ added in v0.5.0
Contains checks whether the passed value is part of the primary iterator, which is irrelevant for uniqueness.
func (*Unique) Next ¶ added in v0.5.0
Next advances the subiterator, continuing until it returns a value which it has not previously seen.
func (*Unique) NextPath ¶ added in v0.5.0
NextPath for unique always returns false. If we were to return multiple paths, we'd no longer be a unique result, so we have to choose only the first path that got us here. Unique is serious on this point.
func (*Unique) Reset ¶ added in v0.5.0
func (it *Unique) Reset()
Reset resets the internal iterators and the iterator itself.
func (*Unique) Stats ¶ added in v0.5.0
func (it *Unique) Stats() graph.IteratorStats
func (*Unique) SubIterators ¶ added in v0.5.0
SubIterators returns a slice of the sub iterators. The first iterator is the primary iterator, for which the complement is generated.