Documentation ¶
Index ¶
- type Path
- func (p *Path) And(path *Path) *Path
- func (p *Path) BuildIterator() graph.Iterator
- func (p *Path) BuildIteratorOn(qs graph.QuadStore) graph.Iterator
- func (p *Path) Except(path *Path) *Path
- func (p *Path) Follow(path *Path) *Path
- func (p *Path) FollowReverse(path *Path) *Path
- func (p *Path) Has(via interface{}, nodes ...string) *Path
- func (p *Path) In(via ...interface{}) *Path
- func (p *Path) Is(nodes ...string) *Path
- func (p *Path) IsMorphism() bool
- func (p *Path) Morphism() graph.ApplyMorphism
- func (p *Path) Or(path *Path) *Path
- func (p *Path) Out(via ...interface{}) *Path
- func (p *Path) Reverse() *Path
- func (p *Path) Save(via interface{}, tag string) *Path
- func (p *Path) SaveReverse(via interface{}, tag string) *Path
- func (p *Path) Tag(tags ...string) *Path
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Path ¶
type Path struct {
// contains filtered or unexported fields
}
Path represents either a morphism (a pre-defined path stored for later use), or a concrete path, consisting of a morphism and an underlying QuadStore.
func StartMorphism ¶
StartMorphism creates a new Path with no underlying QuadStore.
func (*Path) And ¶
And updates the current Path to represent the nodes that match both the current Path so far, and the given Path.
func (*Path) BuildIterator ¶
BuildIterator returns an iterator from this given Path. Note that you must call this with a full path (not a morphism), since a morphism does not have the ability to fetch the underlying quads. This function will panic if called with a morphism (i.e. if p.IsMorphism() is true).
func (*Path) BuildIteratorOn ¶
BuildIteratorOn will return an iterator for this path on the given QuadStore.
func (*Path) Except ¶
Except updates the current Path to represent the all of the current nodes except those in the supplied Path.
For example:
// Will return []string{"B"} StartPath(qs, "A", "B").Except(StartPath(qs, "A"))
func (*Path) FollowReverse ¶
func (*Path) Has ¶
Has limits the paths to be ones where the current nodes have some linkage to some known node.
func (*Path) In ¶
In updates this Path to represent the nodes that are adjacent to the current nodes, via the given inbound predicate.
For example:
// Return the list of nodes that follow "B". // // Will return []string{"A", "C", "D"} if there are the appropriate // edges from those nodes to "B" labelled "follows". StartPath(qs, "B").In("follows")
func (*Path) Is ¶
Is declares that the current nodes in this path are only the nodes passed as arguments.
func (*Path) IsMorphism ¶
IsMorphism returns whether this Path is a morphism.
func (*Path) Morphism ¶
func (p *Path) Morphism() graph.ApplyMorphism
Morphism returns the morphism of this path. The returned value is a function that, when given a QuadStore and an existing Iterator, will return a new Iterator that yields the subset of values from the existing iterator matched by the current Path.
func (*Path) Or ¶
And updates the current Path to represent the nodes that match either the current Path so far, or the given Path.
func (*Path) Out ¶
Out updates this Path to represent the nodes that are adjacent to the current nodes, via the given outbound predicate.
For example:
// Returns the list of nodes that "A" follows. // // Will return []string{"B"} if there is a predicate (edge) from "A" // to "B" labelled "follows". StartPath(qs, "A").Out("follows")
func (*Path) Save ¶
Save will, from the current nodes in the path, retrieve the node one linkage away (given by either a path or a predicate), add the given tag, and propagate that to the result set.
For example: // Will return []map[string]string{{"social_status: "cool"}} StartPath(qs, "B").Save("status", "social_status"
func (*Path) SaveReverse ¶
SaveReverse is the same as Save, only in the reverse direction (the subject of the linkage should be tagged, instead of the object)