PathAwareTraversal

overflowdb.traversal.PathAwareTraversal
See thePathAwareTraversal companion object
class PathAwareTraversal[+A](val elementsWithPath: IterableOnce[(A, Vector[Any])]) extends Traversal[A]

Attributes

Companion:
object
Graph
Supertypes
class Traversal[A]
trait IterableFactoryDefaults[A, Traversal]
trait IterableOps[A, Traversal, Traversal[A]]
trait IterableOnceOps[A, Traversal, Traversal[A]]
trait IterableOnce[A]
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Concrete methods

override def collect[B](pf: PartialFunction[A, B]): Traversal[B]

Attributes

Definition Classes
IterableOps -> IterableOnceOps
override def dedup: Traversal[A]

Deduplicate elements of this traversal - a.k.a. distinct, unique, ...

Deduplicate elements of this traversal - a.k.a. distinct, unique, ...

Attributes

Definition Classes
override def dedupBy(fun: A => Any): Traversal[A]

deduplicate elements of this traversal by a given function

deduplicate elements of this traversal by a given function

Attributes

Definition Classes
override def filter(pred: A => Boolean): Traversal[A]

Attributes

Definition Classes
IterableOps -> IterableOnceOps
override def filterNot(pred: A => Boolean): Traversal[A]

Attributes

Definition Classes
IterableOps -> IterableOnceOps
override def flatMap[B](f: A => IterableOnce[B]): Traversal[B]

Attributes

Definition Classes
IterableOps -> IterableOnceOps
override def map[B](f: A => B): Traversal[B]

Attributes

Definition Classes
IterableOps -> IterableOnceOps
override def path: Traversal[Vector[Any]]

retrieve entire path that has been traversed thus far prerequisite: enablePathTracking has been called previously

retrieve entire path that has been traversed thus far prerequisite: enablePathTracking has been called previously

Attributes

Example:
myTraversal.enablePathTracking.out.out.path.toList

TODO would be nice to preserve the types of the elements, at least if they have a common supertype

Definition Classes
override def repeat[B >: A](repeatTraversal: Traversal[A] => Traversal[B])(implicit behaviourBuilder: Builder[B] => Builder[B]): Traversal[B]

Repeat the given traversal

Repeat the given traversal

By default it will continue repeating until there's no more results, not emit anything along the way, and use depth first search.

The @param behaviourBuilder allows you to configure end conditions (until|whilst|maxDepth), whether it should emit elements it passes by, and which search algorithm to use (depth-first or breadth-first).

Search algorithm: Depth First Search (DFS) vs Breadth First Search (BFS): DFS means the repeat step will go deep before wide. BFS does the opposite: wide before deep. For example, given the graph

 L3 <- L2 <- L1 <- Center -> R1 -> R2 -> R3 -> R4 

DFS will iterate the nodes in the order:

 Center, L1, L2, L3, R1, R2, R3, R4 

BFS will iterate the nodes in the order:

 Center, L1, R1, R1, R2, L3, R3, R4 

Attributes

See also:

RepeatTraversalTests for more detail and examples for all of the above.

Note:

this works for domain-specific steps as well as generic graph steps - for details please take a look at the examples in RepeatTraversalTests: both '''.followedBy''' and '''.out''' work.

Example:
.repeat(_.out)                            // repeat until there's no more elements, emit nothing, use DFS
.repeat(_.out)(_.maxDepth(3))                            // perform exactly three repeat iterations
.repeat(_.out)(_.until(_.property(Name).endsWith("2")))  // repeat until the 'Name' property ends with '2'
.repeat(_.out)(_.emit)                                   // emit everything along the way
.repeat(_.out)(_.emit.breadthFirstSearch)                // emit everything, use BFS
.repeat(_.out)(_.emit(_.property(Name).startsWith("L"))) // emit if the 'Name' property starts with 'L'
Definition Classes
override def simplePath: Traversal[A]

Removes all results whose traversal path has repeated objects.

Removes all results whose traversal path has repeated objects.

Attributes

Definition Classes

Inherited methods

final def ++[B >: A](suffix: IterableOnce[B]): CC[B]

Attributes

Inherited from:
IterableOps
final def addString(b: StringBuilder): StringBuilder

Attributes

Inherited from:
IterableOnceOps
final def addString(b: StringBuilder, sep: String): StringBuilder

Attributes

Inherited from:
IterableOnceOps
def addString(b: StringBuilder, start: String, sep: String, end: String): StringBuilder

Attributes

Inherited from:
IterableOnceOps
def aggregate(into: Growable[A]): Traversal[A]

aggregate all objects at this point into the given collection (side effect)

aggregate all objects at this point into the given collection (side effect)

Attributes

Example:
val xs = mutable.ArrayBuffer.empty[A]
myTraversal.aggregate(xs).foo.bar
// xs will be filled once `myTraversal` is executed
Inherited from:
Traversal
def and(traversals: Traversal[A] => Traversal[_]*): Traversal[A]

only preserves elements for which all of the given traversals have at least one result Works for arbitrary amount of 'AND' traversals.

only preserves elements for which all of the given traversals have at least one result Works for arbitrary amount of 'AND' traversals.

Attributes

Example:
 .and(_.label("someLabel"),
      _.has("someProperty"))
Inherited from:
Traversal
def cast[B]: Traversal[B]

casts all elements to given type note: this can lead to casting errors

casts all elements to given type note: this can lead to casting errors

Attributes

See also:
collectAll
Inherited from:
Traversal
def choose[BranchOn >: Null, NewEnd](on: Traversal[A] => Traversal[BranchOn])(options: PartialFunction[BranchOn, Traversal[A] => Traversal[NewEnd]]): Traversal[NewEnd]

Branch step: based on the current element, match on something given a traversal, and provide resulting traversals based on the matched element. Allows to implement conditional semantics: if, if/else, if/elseif, if/elseif/else, ...

Branch step: based on the current element, match on something given a traversal, and provide resulting traversals based on the matched element. Allows to implement conditional semantics: if, if/else, if/elseif, if/elseif/else, ...

Attributes

BranchOn

required to be >: Null because the implementation is using null as the default value. I didn't find a better way to implement all semantics with the niceties of PartialFunction, and also yolo...

NewEnd

The element type of the resulting traversal

on

Traversal to get to what you want to match on

options

PartialFunction from the matched element to the resulting traversal

See also:

LogicalStepsTests

Example:
.choose(_.property(Name)) {
 case "L1" => _.out
 case "R1" => _.repeat(_.out)(_.maxDepth(3))
 case _ => _.in
}
Inherited from:
Traversal
def coalesce[NewEnd](options: Traversal[A] => Traversal[NewEnd]*): Traversal[NewEnd]

Branch step: evaluates the provided traversals in order and returns the first traversal that emits at least one element.

Branch step: evaluates the provided traversals in order and returns the first traversal that emits at least one element.

Attributes

See also:

LogicalStepsTests

Example:
.coalesce(
  _.out("label1"),
  _.in("label2"),
  _.in("label3")
)
Inherited from:
Traversal
def collectAll[B : ClassTag]: Traversal[B]

collects and all elements of the given type

collects and all elements of the given type

Attributes

Inherited from:
Traversal
def collectFirst[B](pf: PartialFunction[A, B]): Option[B]

Attributes

Inherited from:
IterableOnceOps
def concat[B >: A](suffix: IterableOnce[B]): CC[B]

Attributes

Inherited from:
IterableOps
def copyToArray[B >: A](xs: Array[B], start: Int, len: Int): Int

Attributes

Inherited from:
IterableOnceOps
def copyToArray[B >: A](xs: Array[B], start: Int): Int

Attributes

Inherited from:
IterableOnceOps
def copyToArray[B >: A](xs: Array[B]): Int

Attributes

Inherited from:
IterableOnceOps
def corresponds[B](that: IterableOnce[B])(p: (A, B) => Boolean): Boolean

Attributes

Inherited from:
IterableOnceOps
def count: Traversal[Int]

Attributes

Inherited from:
Traversal
def count(p: A => Boolean): Int

Attributes

Inherited from:
IterableOnceOps
def drop(n: Int): C

Attributes

Inherited from:
IterableOps
def dropRight(n: Int): C

Attributes

Inherited from:
IterableOps
def dropWhile(p: A => Boolean): C

Attributes

Inherited from:
IterableOps
override def empty: CC[A]

Attributes

Definition Classes
IterableFactoryDefaults -> IterableOps
Inherited from:
IterableFactoryDefaults

Attributes

Inherited from:
Traversal
def exists(p: A => Boolean): Boolean

Attributes

Inherited from:
IterableOnceOps
def find(p: A => Boolean): Option[A]

Attributes

Inherited from:
IterableOnceOps
def flatten[B](implicit asIterable: A => IterableOnce[B]): CC[B]

Attributes

Inherited from:
IterableOps
def fold[A1 >: A](z: A1)(op: (A1, A1) => A1): A1

Attributes

Inherited from:
IterableOnceOps
def foldLeft[B](z: B)(op: (B, A) => B): B

Attributes

Inherited from:
IterableOnceOps
def foldRight[B](z: B)(op: (A, B) => B): B

Attributes

Inherited from:
IterableOnceOps
def forall(p: A => Boolean): Boolean

Attributes

Inherited from:
IterableOnceOps
def foreach[U](f: A => U): Unit

Attributes

Inherited from:
IterableOnceOps
protected def fromSpecific(coll: IterableOnce[A]): CC[A]

Attributes

Inherited from:
IterableFactoryDefaults
def groupBy[K](f: A => K): Map[K, C]

Attributes

Inherited from:
IterableOps
def groupCount[B](by: A => B): Map[B, Int]

group elements by a given transformation function and count how often the results appear

group elements by a given transformation function and count how often the results appear

Attributes

Inherited from:
Traversal
def groupCount[B >: A]: Map[B, Int]

group elements and count how often they appear

group elements and count how often they appear

Attributes

Inherited from:
Traversal
def groupMap[K, B](key: A => K)(f: A => B): Map[K, CC[B]]

Attributes

Inherited from:
IterableOps
def groupMapReduce[K, B](key: A => K)(f: A => B)(reduce: (B, B) => B): Map[K, B]

Attributes

Inherited from:
IterableOps
def grouped(size: Int): Iterator[C]

Attributes

Inherited from:
IterableOps
def hasNext: Boolean

Attributes

Inherited from:
Traversal
def head: A

Attributes

Inherited from:
IterableOps
def headOption: Option[A]

Attributes

Inherited from:
IterableOps
def help[B >: A](implicit elementType: ClassTag[B], searchPackages: DocSearchPackages): String

Print help/documentation based on the current elementType A. Relies on all step extensions being annotated with @Traversal / @Doc Note that this works independently of tab completion and implicit conversions in scope - it will simply list all documented steps in the classpath

Print help/documentation based on the current elementType A. Relies on all step extensions being annotated with @Traversal / @Doc Note that this works independently of tab completion and implicit conversions in scope - it will simply list all documented steps in the classpath

Attributes

Inherited from:
Traversal
def helpVerbose[B >: A](implicit elementType: ClassTag[B], searchPackages: DocSearchPackages): String

Attributes

Inherited from:
Traversal
def init: C

Attributes

Inherited from:
IterableOps
def inits: Iterator[C]

Attributes

Inherited from:
IterableOps
def is[B >: A](value: B): Traversal[A]

filters out everything that is not the given value

filters out everything that is not the given value

Attributes

Inherited from:
Traversal
def isEmpty: Boolean

Attributes

Inherited from:
IterableOnceOps
override def isTraversableAgain: Boolean

Attributes

Definition Classes
IterableOps -> IterableOnceOps
Inherited from:
IterableOps
override def iterableFactory: IterableFactory[Traversal]

Attributes

Definition Classes
Traversal -> IterableOps
Inherited from:
Traversal
def iterate(): Unit

Execute the traversal without returning anything

Execute the traversal without returning anything

Attributes

Inherited from:
Traversal
def knownSize: Int

Attributes

Inherited from:
IterableOnce
def l: List[A]

Execute the traversal and convert the result to a list - shorthand for toList

Execute the traversal and convert the result to a list - shorthand for toList

Attributes

Inherited from:
Traversal
def last: A

Attributes

Inherited from:
IterableOps
def lastOption: Option[A]

Attributes

Inherited from:
IterableOps
def max[B >: A](implicit ord: Ordering[B]): A

Attributes

Inherited from:
IterableOnceOps
def maxBy[B](f: A => B)(implicit cmp: Ordering[B]): A

Attributes

Inherited from:
IterableOnceOps
def maxByOption[B](f: A => B)(implicit cmp: Ordering[B]): Option[A]

Attributes

Inherited from:
IterableOnceOps
def maxOption[B >: A](implicit ord: Ordering[B]): Option[A]

Attributes

Inherited from:
IterableOnceOps
def min[B >: A](implicit ord: Ordering[B]): A

Attributes

Inherited from:
IterableOnceOps
def minBy[B](f: A => B)(implicit cmp: Ordering[B]): A

Attributes

Inherited from:
IterableOnceOps
def minByOption[B](f: A => B)(implicit cmp: Ordering[B]): Option[A]

Attributes

Inherited from:
IterableOnceOps
def minOption[B >: A](implicit ord: Ordering[B]): Option[A]

Attributes

Inherited from:
IterableOnceOps
final def mkString: String

Attributes

Inherited from:
IterableOnceOps
final def mkString(sep: String): String

Attributes

Inherited from:
IterableOnceOps
final def mkString(start: String, sep: String, end: String): String

Attributes

Inherited from:
IterableOnceOps
protected def newSpecificBuilder: Builder[A, CC[A]]

Attributes

Inherited from:
IterableFactoryDefaults
def next(): A

Attributes

Inherited from:
Traversal
def nextOption(): Option[A]

Attributes

Inherited from:
Traversal
def nonEmpty: Boolean

Attributes

Inherited from:
IterableOnceOps
def not(trav: Traversal[A] => Traversal[_]): Traversal[A]

only preserves elements if the provided traversal does not have any results - alias for whereNot

only preserves elements if the provided traversal does not have any results - alias for whereNot

Attributes

Inherited from:
Traversal
def or(traversals: Traversal[A] => Traversal[_]*): Traversal[A]

only preserves elements for which at least one of the given traversals has at least one result Works for arbitrary amount of 'OR' traversals.

only preserves elements for which at least one of the given traversals has at least one result Works for arbitrary amount of 'OR' traversals.

Attributes

Example:
 .or(_.label("someLabel"),
     _.has("someProperty"))
Inherited from:
Traversal
def partition(p: A => Boolean): (C, C)

Attributes

Inherited from:
IterableOps
def partitionMap[A1, A2](f: A => Either[A1, A2]): (CC[A1], CC[A2])

Attributes

Inherited from:
IterableOps
def product[B >: A](implicit num: Numeric[B]): B

Attributes

Inherited from:
IterableOnceOps
def reduce[B >: A](op: (B, B) => B): B

Attributes

Inherited from:
IterableOnceOps
def reduceLeft[B >: A](op: (B, A) => B): B

Attributes

Inherited from:
IterableOnceOps
def reduceLeftOption[B >: A](op: (B, A) => B): Option[B]

Attributes

Inherited from:
IterableOnceOps
def reduceOption[B >: A](op: (B, B) => B): Option[B]

Attributes

Inherited from:
IterableOnceOps
def reduceRight[B >: A](op: (A, B) => B): B

Attributes

Inherited from:
IterableOnceOps
def reduceRightOption[B >: A](op: (A, B) => B): Option[B]

Attributes

Inherited from:
IterableOnceOps
protected def reversed: Iterable[A]

Attributes

Inherited from:
IterableOnceOps
def scan[B >: A](z: B)(op: (B, B) => B): CC[B]

Attributes

Inherited from:
IterableOps
def scanLeft[B](z: B)(op: (B, A) => B): CC[B]

Attributes

Inherited from:
IterableOps
def scanRight[B](z: B)(op: (A, B) => B): CC[B]

Attributes

Inherited from:
IterableOps
def sideEffect(fun: A => Unit): Traversal[A]

perform side effect without changing the contents of the traversal

perform side effect without changing the contents of the traversal

Attributes

Inherited from:
Traversal
def sideEffectPF(pf: PartialFunction[A, Unit]): Traversal[A]

perform side effect without changing the contents of the traversal will only apply the partialFunction if it is defined for the given input - analogous to collect

perform side effect without changing the contents of the traversal will only apply the partialFunction if it is defined for the given input - analogous to collect

Attributes

Inherited from:
Traversal
def size: Int

Attributes

Inherited from:
IterableOnceOps
def sizeCompare(that: Iterable[_]): Int

Attributes

Inherited from:
IterableOps
def sizeCompare(otherSize: Int): Int

Attributes

Inherited from:
IterableOps
final def sizeIs: SizeCompareOps

Attributes

Inherited from:
IterableOps
def slice(from: Int, until: Int): C

Attributes

Inherited from:
IterableOps
def sliding(size: Int, step: Int): Iterator[C]

Attributes

Inherited from:
IterableOps
def sliding(size: Int): Iterator[C]

Attributes

Inherited from:
IterableOps
def sortBy[B](f: A => B)(implicit ord: Ordering[B]): Seq[A]

sort elements by the value of the given transformation function

sort elements by the value of the given transformation function

Attributes

Inherited from:
Traversal
def sorted[B >: A](implicit ord: Ordering[B]): Seq[B]

sort elements by their natural order

sort elements by their natural order

Attributes

Inherited from:
Traversal
def span(p: A => Boolean): (C, C)

Attributes

Inherited from:
IterableOps
override def splitAt(n: Int): (C, C)

Attributes

Definition Classes
IterableOps -> IterableOnceOps
Inherited from:
IterableOps
def stepper[S <: Stepper[_]](implicit shape: StepperShape[A, S]): S

Attributes

Inherited from:
IterableOnce
def sum[B >: A](implicit num: Numeric[B]): B

Attributes

Inherited from:
IterableOnceOps
def tail: C

Attributes

Inherited from:
IterableOps
def tails: Iterator[C]

Attributes

Inherited from:
IterableOps
def take(n: Int): C

Attributes

Inherited from:
IterableOps
def takeRight(n: Int): C

Attributes

Inherited from:
IterableOps
def takeWhile(p: A => Boolean): C

Attributes

Inherited from:
IterableOps
override def tapEach[U](f: A => U): C

Attributes

Definition Classes
IterableOps -> IterableOnceOps
Inherited from:
IterableOps
def to[C1](factory: Factory[A, C1]): C1

Attributes

Inherited from:
IterableOnceOps
def toArray[B >: A : ClassTag]: Array[B]

Attributes

Inherited from:
IterableOnceOps
final def toBuffer[B >: A]: Buffer[B]

Attributes

Inherited from:
IterableOnceOps
def toIndexedSeq: IndexedSeq[A]

Attributes

Inherited from:
IterableOnceOps
override def toIterable: Iterable[A]

Attributes

Definition Classes
Traversal -> IterableOps
Inherited from:
Traversal
def toList: List[A]

Attributes

Inherited from:
IterableOnceOps
def toMap[K, V](implicit ev: A <:< (K, V)): Map[K, V]

Attributes

Inherited from:
IterableOnceOps
def toSeq: Seq[A]

Attributes

Inherited from:
IterableOnceOps
def toSet[B >: A]: Set[B]

Attributes

Inherited from:
IterableOnceOps
def toSetImmutable[B >: A]: Set[B]

Execute the traversal and convert the result to an immutable Set

Execute the traversal and convert the result to an immutable Set

Attributes

Inherited from:
Traversal
def toSetMutable[B >: A]: Set[B]

Execute the traversal and return a mutable.Set (better performance than immutableSet)

Execute the traversal and return a mutable.Set (better performance than immutableSet)

Attributes

Inherited from:
Traversal
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns:

a string representation of the object.

Definition Classes
Traversal -> Any
Inherited from:
Traversal
def toVector: Vector[A]

Attributes

Inherited from:
IterableOnceOps
def transpose[B](implicit asIterable: A => Iterable[B]): CC[CC[B]]

Attributes

Inherited from:
IterableOps
def union[B](traversals: Traversal[A] => Traversal[B]*): Traversal[B]

union step from the current point

union step from the current point

Attributes

traversals

to be executed from here, results are being aggregated/summed/unioned

Example:
 .union(_.out, _.in)
Inherited from:
Traversal
def unzip[A1, A2](implicit asPair: A => (A1, A2)): (CC[A1], CC[A2])

Attributes

Inherited from:
IterableOps
def unzip3[A1, A2, A3](implicit asTriple: A => (A1, A2, A3)): (CC[A1], CC[A2], CC[A3])

Attributes

Inherited from:
IterableOps
def view: View[A]

Attributes

Inherited from:
IterableOps
def where(trav: Traversal[A] => Traversal[_]): Traversal[A]

only preserves elements if the provided traversal has at least one result

only preserves elements if the provided traversal has at least one result

Attributes

Inherited from:
Traversal
def whereNot(trav: Traversal[A] => Traversal[_]): Traversal[A]

only preserves elements if the provided traversal does not have any results

only preserves elements if the provided traversal does not have any results

Attributes

Inherited from:
Traversal
def withFilter(p: A => Boolean): WithFilter[A, CC]

Attributes

Inherited from:
IterableOps
def within[B >: A](values: Set[B]): Traversal[A]

filters out all elements that are not in the provided set

filters out all elements that are not in the provided set

Attributes

Inherited from:
Traversal
def without[B >: A](values: Set[B]): Traversal[A]

filters out all elements that are in the provided set

filters out all elements that are in the provided set

Attributes

Inherited from:
Traversal
def zip[B](that: IterableOnce[B]): CC[(A, B)]

Attributes

Inherited from:
IterableOps
def zipAll[A1 >: A, B](that: Iterable[B], thisElem: A1, thatElem: B): CC[(A1, B)]

Attributes

Inherited from:
IterableOps
def zipWithIndex: CC[(A, Int)]

Attributes

Inherited from:
IterableOps

Deprecated and Inherited methods

def ++:[B >: A](that: IterableOnce[B]): CC[B]

Attributes

Deprecated
[Since version 2.13.0] Use ++ instead of ++: for collections of type Iterable
Inherited from:
IterableOps
final def /:[B](z: B)(op: (B, A) => B): B

Attributes

Deprecated
[Since version 2.13.0] Use foldLeft instead of /:
Inherited from:
IterableOnceOps
final def :\[B](z: B)(op: (A, B) => B): B

Attributes

Deprecated
[Since version 2.13.0] Use foldRight instead of :\\
Inherited from:
IterableOnceOps
def aggregate[B](z: => B)(seqop: (B, A) => B, combop: (B, B) => B): B

Attributes

Deprecated
[Since version 2.13.0] `aggregate` is not relevant for sequential collections. Use `foldLeft(z)(seqop)` instead.
Inherited from:
IterableOnceOps
def companion: IterableFactory[CC]

Attributes

Deprecated
[Since version 2.13.0] Use iterableFactory instead
Inherited from:
IterableOps
final def copyToBuffer[B >: A](dest: Buffer[B]): Unit

Attributes

Deprecated
[Since version 2.13.0] Use `dest ++= coll` instead
Inherited from:
IterableOnceOps
def hasDefiniteSize: Boolean

Attributes

Deprecated
[Since version 2.13.0] Check .knownSize instead of .hasDefiniteSize for more actionable information (see scaladoc for details)
Inherited from:
IterableOnceOps
final def repr: C

Attributes

Deprecated
[Since version 2.13.0] Use coll instead of repr in a collection implementation, use the collection value itself from the outside
Inherited from:
IterableOps
final def toIterator: Iterator[A]

Attributes

Deprecated
[Since version 2.13.0] Use .iterator instead of .toIterator
Inherited from:
IterableOnceOps
final def toStream: Stream[A]

Attributes

Deprecated
[Since version 2.13.0] Use .to(LazyList) instead of .toStream
Inherited from:
IterableOnceOps
final def toTraversable: Iterable[A]

Attributes

Deprecated
[Since version 2.13.0] toTraversable is internal and will be made protected; its name is similar to `toList` or `toSeq`, but it doesn\'t copy non-immutable collections
Inherited from:
IterableOps
def view(from: Int, until: Int): View[A]

Attributes

Deprecated
[Since version 2.13.0] Use .view.slice(from, until) instead of .view(from, until)
Inherited from:
IterableOps

Concrete fields

val elementsWithPath: IterableOnce[(A, Vector[Any])]

Inherited fields

override val iterator: Iterator[A]

Attributes

Inherited from:
Traversal