Skip to content

Commit

Permalink
add flatmap
Browse files Browse the repository at this point in the history
  • Loading branch information
BalduinLandolt committed May 7, 2024
1 parent baa46fc commit c024ede
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ case class SparqlSelectResult(head: SparqlSelectResultHeader, results: SparqlSel
results.bindings.head.rowMap(v)

def getCol(v: String): Seq[String] =
results.bindings.flatMap(_.rowMap.get(v))
flatMap(_.rowMap.get(v))

def getColOrThrow(v: String): Seq[String] =
results.bindings.map(_.rowMap(v))
map(_.rowMap(v))

def map[B](f: VariableResultsRow => B): Seq[B] =
results.bindings.map(f)

def flatMap[B](f: VariableResultsRow => Iterable[B]): Seq[B] =
results.bindings.flatMap(f)

def isEmpty: Boolean =
results.bindings.isEmpty

Expand Down

0 comments on commit c024ede

Please sign in to comment.