Graph Guide

```scala mdoc:invisible import lspace._ import lspace.Implicits.Scheduler.global import lspace.Implicits.SyncGuide.guide import lspace.provider.mem.MemGraph import Label.D._ import lspace.util.SampleGraph

 
## What is a graph
A graph is a collection of nodes, unordered edges and values, these are all resources. 
Nodes can be labelled and nodes can have edges.
Edges have a source ('from') and a destination ('to') resource which can both be either a node, edge or value. 
The edge is always labeled with a key (property) and an edge can also be the source to other edges (statements on edges).
Values have a data-value and values can have edges.

* Graphs support Librarian-traversals
* Graphs can be merged (graph ++ graph)
* Graphs support transactions (graph.transaction -> new in-memory graph with 'commit' function)
* Graph support history (*never delete, only add an edge (@deletedon) to the edge .. to be tested*)

create a graph
 ```scala mdoc
 val graph: Graph = MemGraph("graph-doc")
 import scala.concurrent.duration._
 scala.concurrent.Await.ready(lspace.util.SampleGraph.loadSocial(graph).runToFuture, 5.seconds)
 val labels = SampleGraph.ontologies
 val keys = SampleGraph.properties

How to use

First steps:

import lspace._ //easy access to common object (types) //easy access to common object (types)
import lspace.Implicits.Scheduler.global //default scheduler (execution context) //default scheduler (execution context)
import lspace.Implicits.SyncGuide.guide //graph-engine

To create a graph (in-memory):

val graph = Graph("my-graph-url")
// graph: Graph = graph:my-graph-url

A graph always has a name, ideally this would be a url so it can be referenced.

Before continuing reading and learning, first load some sample-data:

lspace.util.SampleGraph.loadSocial(graph).runToFuture
// res0: monix.execution.CancelableFuture[{val places: AnyRef{val SanJosédeMaipo: AnyRef{val place: lspace.structure.Node; val id: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultString.C]; val name: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultString.C]; val geo: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultGeopoint.C]}; val CrystalSprings: AnyRef{val place: lspace.structure.Node; val id: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultString.C]; val name: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultString.C]; val geo: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultGeopoint.C]}; val Haridwar: AnyRef{val place: lspace.structure.Node; val id: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultString.C]; val name: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultString.C]; val geo: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultGeopoint.C]}; val Talca: AnyRef{val place: lspace.structure.Node; val id: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultString.C]; val name: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultString.C]; val geo: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultGeopoint.C]}};val persons: AnyRef{val Yoshio: AnyRef{val person: lspace.structure.Node; val id: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultString.C]; val name: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultString.C]; val birthdate: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultLocalDate.C]; val birthPlace: lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node]; val balance: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultDouble.C]; val rate: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultInt.C]; val address: lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node]}; val Levi: AnyRef{val person: lspace.structure.Node; val id: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultString.C]; val name: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultString.C]; val birthdate: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultLocalDate.C]; val birthPlace: lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node]; val balance: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultDouble.C]; val rate: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultInt.C]; val address: lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node]}; val Gray: AnyRef{val person: lspace.structure.Node; val id: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultString.C]; val name: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultString.C]; val birthdate: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultLocalDate.C]; val birthPlace: lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node]; val balance: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultDouble.C]; val rate: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultInt.C]; val address: lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node]}; val Kevin: AnyRef{val person: lspace.structure.Node; val id: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultString.C]; val name: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultString.C]; val birthdate: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultLocalDate.C]; val birthPlace: lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node]; val balance: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultDouble.C]; val rate: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultInt.C]; val address: lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node]}; val Stan: AnyRef{val person: lspace.structure.Node; val id: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultString.C]; val name: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultString.C]; val birthdate: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultLocalDate.C]; val birthPlace: lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node]; val balance: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultInt.C]; val rate: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultInt.C]; val address: lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node]}; val Garrison: AnyRef{val person: lspace.structure.Node; val id: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultString.C]; val name: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultString.C]; val birthdate: lspace.structure.Edge[lspace.structure.Node,lspace.structure.util.ClassTypeable.defaultLocalDate.C]; val birthPlace: lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node]; val address: lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node]}};val knows: AnyRef{val GarrissonKnownStan: (lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node], lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node]); val GarrissonKnownKevin: (lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node], lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node]); val KevinKnownStan: (lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node], lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node]); val KevinKnownGray: (lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node], lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node]); val GrayKnowsLevi: (lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node], lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node]); val LeviKnowsYoshio: (lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node], lspace.structure.Edge[lspace.structure.Node,lspace.structure.Node])}}] = Async(
//   underlying = Future(<not completed>),
//   cancelable = monix.eval.internal.TaskConnection$Impl$$anon$1@2fd6de8f,
//   isolatedCtx = null
// )

Graphs have a some basis API’s which allows for reading from and writing to the graph.

Resource API’s

Graph-resources can all be retrieved by Iri (@id) or by Id. Values and edges do mostly not have an Iri (empty-string). There are API’s on each structure-level (resource, value, edge and node).

The main methods per section:

Resources API

hasIri

graph.resources.hasIri("graph-doc/place/123")
// res1: monix.reactive.Observable[Resource[Any]] = monix.reactive.internal.operators.ConcatMapObservable@65e5b353
graph.resources.hasIri("graph-doc/place/123", "graph-doc/person/123")
// res2: monix.reactive.Observable[Resource[Any]] = monix.reactive.internal.operators.ConcatMapObservable@7b618679

hasId

graph.resources.hasId(1001L).id
// res3: monix.eval.Task[Option[Long]] = Map(
//   source = FlatMap(
//     source = Eval(
//       thunk = lspace.provider.mem.store.MemStore$$Lambda$11324/0x0000000803512040@30cb67b4
//     ),
//     f = lspace.structure.Resources$$Lambda$11325/0x0000000803512840@15cf5530,
//     trace = StackTrace(
//       stackTrace = List(
//         monix.eval.internal.TaskTracing$.buildFrame(TaskTracing.scala:52),
//         monix.eval.internal.TaskTracing$.buildCachedFrame(TaskTracing.scala:43),
//         monix.eval.internal.TaskTracing$.cached(TaskTracing.scala:38),
//         monix.eval.Task.flatMap(Task.scala:1792),
//         lspace.structure.Resources.hasId(Resources.scala:60),
//         repl.MdocSession$App.<init>(graph-guide.md:41),
//         repl.MdocSession$.app(graph-guide.md:3),
//         mdoc.internal.document.DocumentBuilder$$doc$.$anonfun$build$2(DocumentBuilder.scala:89),
//         scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18),
//         scala.util.DynamicVariable.withValue(DynamicVariable.scala:59),
//         scala.Console$.withErr(Console.scala:193),
//         mdoc.internal.document.DocumentBuilder$$doc$.$anonfun$build$1(DocumentBuilder.scala:89),
//         scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18),
//         scala.util.DynamicVariable.withValue(DynamicVariable.scala:59),
//         scala.Console$.withOut(Console.scala:164),
//         mdoc.internal.document.DocumentBuilder$$doc$.build(DocumentBuilder.scala:88),
//         mdoc.internal.markdown.MarkdownBuilder$.buildDocument(MarkdownBuilder.scala:44),
//         mdoc.internal.markdown.Processor.processScalaInputs(Processor.scala:185),
//         mdoc.internal.markdown.Processor.processScalaInputs(Processor.scala:152),
//         mdoc.internal.markdown.Processor.processDocument(Processor.scala:52),
//         mdoc.internal.markdown.Markdown$.toMarkdown(Markdown.scala:131),
//         mdoc.internal.cli.MainOps.handleMarkdown(MainOps.scala:82),
//         mdoc.internal.cli.MainOps.handleFile(MainOps.scala:110),
//         mdoc.internal.cli.MainOps.$anonfun$generateCompleteSite$1(MainOps.scala:156),
//         scala.collection.LinearSeqOps.foldLeft(LinearSeq.scala:168),
//         scala.collection.LinearSeqOps.foldLeft$(LinearSeq.scala:164),
//         scala.collection.immutable.List.foldLeft(List.scala:79),
//         mdoc.internal.cli.MainOps.generateCompleteSite(MainOps.scala:155),
//         mdoc.internal.cli.MainOps.run(MainOps.scala:177),
//         mdoc.internal.cli.MainOps$.process(MainOps.scala:269),
//         mdoc.Main$.process(Main.scala:26),
//         mdoc.Main$.process(Main.scala:21),
//         mdoc.Main$.main(Main.scala:16),
// ...

upsert

graph.values.create("some-literal")
// res4: monix.eval.Task[Value[String]] = FlatMap(
//   source = Async(
//     register = <function2>,
//     trampolineBefore = false,
//     trampolineAfter = false,
//     restoreLocals = true,
//     trace = StackTrace(
//       stackTrace = List(
//         monix.eval.internal.TaskTracing$.buildFrame(TaskTracing.scala:52),
//         monix.eval.internal.TaskTracing$.buildCachedFrame(TaskTracing.scala:43),
//         monix.eval.internal.TaskTracing$.cached(TaskTracing.scala:38),
//         monix.eval.internal.TracedAsync$.apply(TracedAsync.scala:39),
//         monix.eval.internal.TaskCreate$.cancelableCancelable(TaskCreate.scala:65),
//         monix.eval.Task$AsyncBuilder0$$anon$6.create(Task.scala:4571),
//         monix.eval.Task$AsyncBuilder$CreatePartiallyApplied$.apply$extension(Task.scala:4504),
//         monix.reactive.Observable.firstOrElseL(Observable.scala:4156),
//         monix.reactive.Observable.firstL(Observable.scala:4147),
//         monix.reactive.Observable.headL(Observable.scala:4138),
//         monix.reactive.Observable.foldLeftL(Observable.scala:4306),
//         monix.reactive.Observable.toListL(Observable.scala:4668),
//         lspace.provider.mem.store.MemNodeStore.hasIri(MemNodeStore.scala:27),
//         lspace.structure.Nodes.hasIri(Nodes.scala:31),
//         lspace.structure.RApi.hasIri(RApi.scala:10),
//         lspace.structure.RApi.hasIri$(RApi.scala:10),
//         lspace.structure.Nodes.hasIri(Nodes.scala:13),
//         lspace.structure.Ontologies.$anonfun$store$2(Ontologies.scala:109),
//         scala.Option.getOrElse(Option.scala:201),
//         lspace.structure.Ontologies.store(Ontologies.scala:95),
//         lspace.structure.Node._addLabel(Node.scala:42),
//         lspace.structure.Node._addLabel$(Node.scala:41),
//         lspace.provider.mem.MemGraph$$anon$7.lspace$provider$mem$MemNode$$super$_addLabel(MemGraph.scala:92),
//         lspace.provider.mem.MemNode.$anonfun$addLabel$1(MemNode.scala:45),
//         monix.eval.internal.TaskRunLoop$.startFuture(TaskRunLoop.scala:605),
//         monix.eval.Task.runToFutureOpt(Task.scala:587),
//         monix.eval.Task.runToFuture(Task.scala:543),
//         repl.MdocSession$App.<init>(graph-guide.md:26),
//         repl.MdocSession$.app(graph-guide.md:3),
//         mdoc.internal.document.DocumentBuilder$$doc$.$anonfun$build$2(DocumentBuilder.scala:89),
//         scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18),
//         scala.util.DynamicVariable.withValue(DynamicVariable.scala:59),
//         scala.Console$.withErr(Console.scala:193),
//         mdoc.internal.document.DocumentBuilder$$doc$.$anonfun$build$1(DocumentBuilder.scala:89),
//         scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18),
//         scala.util.DynamicVariable.withValue(DynamicVariable.scala:59),
// ...
graph.values.create("some-literal") //should be equal because values are deduplicated
// res5: monix.eval.Task[Value[String]] = FlatMap(
//   source = Async(
//     register = <function2>,
//     trampolineBefore = false,
//     trampolineAfter = false,
//     restoreLocals = true,
//     trace = StackTrace(
//       stackTrace = List(
//         monix.eval.internal.TaskTracing$.buildFrame(TaskTracing.scala:52),
//         monix.eval.internal.TaskTracing$.buildCachedFrame(TaskTracing.scala:43),
//         monix.eval.internal.TaskTracing$.cached(TaskTracing.scala:38),
//         monix.eval.internal.TracedAsync$.apply(TracedAsync.scala:39),
//         monix.eval.internal.TaskCreate$.cancelableCancelable(TaskCreate.scala:65),
//         monix.eval.Task$AsyncBuilder0$$anon$6.create(Task.scala:4571),
//         monix.eval.Task$AsyncBuilder$CreatePartiallyApplied$.apply$extension(Task.scala:4504),
//         monix.reactive.Observable.firstOrElseL(Observable.scala:4156),
//         monix.reactive.Observable.firstL(Observable.scala:4147),
//         monix.reactive.Observable.headL(Observable.scala:4138),
//         monix.reactive.Observable.foldLeftL(Observable.scala:4306),
//         monix.reactive.Observable.toListL(Observable.scala:4668),
//         lspace.provider.mem.store.MemNodeStore.hasIri(MemNodeStore.scala:27),
//         lspace.structure.Nodes.hasIri(Nodes.scala:31),
//         lspace.structure.RApi.hasIri(RApi.scala:10),
//         lspace.structure.RApi.hasIri$(RApi.scala:10),
//         lspace.structure.Nodes.hasIri(Nodes.scala:13),
//         lspace.structure.Ontologies.$anonfun$store$2(Ontologies.scala:109),
//         scala.Option.getOrElse(Option.scala:201),
//         lspace.structure.Ontologies.store(Ontologies.scala:95),
//         lspace.structure.Node._addLabel(Node.scala:42),
//         lspace.structure.Node._addLabel$(Node.scala:41),
//         lspace.provider.mem.MemGraph$$anon$7.lspace$provider$mem$MemNode$$super$_addLabel(MemGraph.scala:92),
//         lspace.provider.mem.MemNode.$anonfun$addLabel$1(MemNode.scala:45),
//         monix.eval.internal.TaskRunLoop$.startFuture(TaskRunLoop.scala:605),
//         monix.eval.Task.runToFutureOpt(Task.scala:587),
//         monix.eval.Task.runToFuture(Task.scala:543),
//         repl.MdocSession$App.<init>(graph-guide.md:26),
//         repl.MdocSession$.app(graph-guide.md:3),
//         mdoc.internal.document.DocumentBuilder$$doc$.$anonfun$build$2(DocumentBuilder.scala:89),
//         scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18),
//         scala.util.DynamicVariable.withValue(DynamicVariable.scala:59),
//         scala.Console$.withErr(Console.scala:193),
//         mdoc.internal.document.DocumentBuilder$$doc$.$anonfun$build$1(DocumentBuilder.scala:89),
//         scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18),
//         scala.util.DynamicVariable.withValue(DynamicVariable.scala:59),
// ... //should be equal because values are deduplicated
graph.values.create("some-literal2") //new value, hence new id
// res6: monix.eval.Task[Value[String]] = FlatMap(
//   source = Async(
//     register = <function2>,
//     trampolineBefore = false,
//     trampolineAfter = false,
//     restoreLocals = true,
//     trace = StackTrace(
//       stackTrace = List(
//         monix.eval.internal.TaskTracing$.buildFrame(TaskTracing.scala:52),
//         monix.eval.internal.TaskTracing$.buildCachedFrame(TaskTracing.scala:43),
//         monix.eval.internal.TaskTracing$.cached(TaskTracing.scala:38),
//         monix.eval.internal.TracedAsync$.apply(TracedAsync.scala:39),
//         monix.eval.internal.TaskCreate$.cancelableCancelable(TaskCreate.scala:65),
//         monix.eval.Task$AsyncBuilder0$$anon$6.create(Task.scala:4571),
//         monix.eval.Task$AsyncBuilder$CreatePartiallyApplied$.apply$extension(Task.scala:4504),
//         monix.reactive.Observable.firstOrElseL(Observable.scala:4156),
//         monix.reactive.Observable.firstL(Observable.scala:4147),
//         monix.reactive.Observable.headL(Observable.scala:4138),
//         monix.reactive.Observable.foldLeftL(Observable.scala:4306),
//         monix.reactive.Observable.toListL(Observable.scala:4668),
//         lspace.provider.mem.store.MemNodeStore.hasIri(MemNodeStore.scala:27),
//         lspace.structure.Nodes.hasIri(Nodes.scala:31),
//         lspace.structure.RApi.hasIri(RApi.scala:10),
//         lspace.structure.RApi.hasIri$(RApi.scala:10),
//         lspace.structure.Nodes.hasIri(Nodes.scala:13),
//         lspace.structure.Ontologies.$anonfun$store$2(Ontologies.scala:109),
//         scala.Option.getOrElse(Option.scala:201),
//         lspace.structure.Ontologies.store(Ontologies.scala:95),
//         lspace.structure.Node._addLabel(Node.scala:42),
//         lspace.structure.Node._addLabel$(Node.scala:41),
//         lspace.provider.mem.MemGraph$$anon$7.lspace$provider$mem$MemNode$$super$_addLabel(MemGraph.scala:92),
//         lspace.provider.mem.MemNode.$anonfun$addLabel$1(MemNode.scala:45),
//         monix.eval.internal.TaskRunLoop$.startFuture(TaskRunLoop.scala:605),
//         monix.eval.Task.runToFutureOpt(Task.scala:587),
//         monix.eval.Task.runToFuture(Task.scala:543),
//         repl.MdocSession$App.<init>(graph-guide.md:26),
//         repl.MdocSession$.app(graph-guide.md:3),
//         mdoc.internal.document.DocumentBuilder$$doc$.$anonfun$build$2(DocumentBuilder.scala:89),
//         scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18),
//         scala.util.DynamicVariable.withValue(DynamicVariable.scala:59),
//         scala.Console$.withErr(Console.scala:193),
//         mdoc.internal.document.DocumentBuilder$$doc$.$anonfun$build$1(DocumentBuilder.scala:89),
//         scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18),
//         scala.util.DynamicVariable.withValue(DynamicVariable.scala:59),
// ...

count:

graph.resources.count()
// res7: monix.eval.Task[Long] = Map(
//   source = Async(
//     register = <function2>,
//     trampolineBefore = true,
//     trampolineAfter = true,
//     restoreLocals = true,
//     trace = null
//   ),
//   f = lspace.structure.Resources$$Lambda$11351/0x000000080352c040@44b0abd,
//   trace = StackTrace(
//     stackTrace = List(
//       monix.eval.internal.TaskTracing$.buildFrame(TaskTracing.scala:52),
//       monix.eval.internal.TaskTracing$.buildCachedFrame(TaskTracing.scala:43),
//       monix.eval.internal.TaskTracing$.cached(TaskTracing.scala:38),
//       monix.eval.Task.map(Task.scala:2027),
//       lspace.structure.Resources.count(Resources.scala:13),
//       repl.MdocSession$App.<init>(graph-guide.md:59),
//       repl.MdocSession$.app(graph-guide.md:3),
//       mdoc.internal.document.DocumentBuilder$$doc$.$anonfun$build$2(DocumentBuilder.scala:89),
//       scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18),
//       scala.util.DynamicVariable.withValue(DynamicVariable.scala:59),
//       scala.Console$.withErr(Console.scala:193),
//       mdoc.internal.document.DocumentBuilder$$doc$.$anonfun$build$1(DocumentBuilder.scala:89),
//       scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18),
//       scala.util.DynamicVariable.withValue(DynamicVariable.scala:59),
//       scala.Console$.withOut(Console.scala:164),
//       mdoc.internal.document.DocumentBuilder$$doc$.build(DocumentBuilder.scala:88),
//       mdoc.internal.markdown.MarkdownBuilder$.buildDocument(MarkdownBuilder.scala:44),
//       mdoc.internal.markdown.Processor.processScalaInputs(Processor.scala:185),
//       mdoc.internal.markdown.Processor.processScalaInputs(Processor.scala:152),
//       mdoc.internal.markdown.Processor.processDocument(Processor.scala:52),
//       mdoc.internal.markdown.Markdown$.toMarkdown(Markdown.scala:131),
//       mdoc.internal.cli.MainOps.handleMarkdown(MainOps.scala:82),
//       mdoc.internal.cli.MainOps.handleFile(MainOps.scala:110),
//       mdoc.internal.cli.MainOps.$anonfun$generateCompleteSite$1(MainOps.scala:156),
//       scala.collection.LinearSeqOps.foldLeft(LinearSeq.scala:168),
//       scala.collection.LinearSeqOps.foldLeft$(LinearSeq.scala:164),
//       scala.collection.immutable.List.foldLeft(List.scala:79),
//       mdoc.internal.cli.MainOps.generateCompleteSite(MainOps.scala:155),
//       mdoc.internal.cli.MainOps.run(MainOps.scala:177),
//       mdoc.internal.cli.MainOps$.process(MainOps.scala:269),
//       mdoc.Main$.process(Main.scala:26),
//       mdoc.Main$.process(Main.scala:21),
//       mdoc.Main$.main(Main.scala:16),
// ...

Resource

A resource ..

Nodes API

Nodes can be:

Retrieved by Iri(s)/Uri(s):

graph.nodes.hasIri("graph-doc/place/123")
// res8: monix.reactive.Observable[Node] = monix.reactive.internal.operators.ConcatMapObservable@17a1316c
graph.nodes.hasIri("graph-doc/place/123", "graph-doc/person/123")
// res9: monix.reactive.Observable[Node] = monix.reactive.internal.operators.ConcatMapObservable@78d6df86

Retrieved by Id(s):

graph.nodes.hasId(1002L)
// res10: monix.eval.Task[Option[Node]] = Eval(
//   thunk = lspace.provider.mem.store.MemStore$$Lambda$11324/0x0000000803512040@1ceb4ae1
// )

Counted:

graph.nodes.count()
// res11: monix.eval.Task[Long] = Eval(
//   thunk = lspace.provider.mem.store.MemStore$$Lambda$11347/0x0000000803528840@76c27cf9
// )

Node

A node ..

Edges API

Edges can be:

Counted:

graph.edges.count()
// res12: monix.eval.Task[Long] = Eval(
//   thunk = lspace.provider.mem.store.MemStore$$Lambda$11347/0x0000000803528840@29a2e2f4
// )

Edge

An edge ..

Values API

Counted:

graph.values.count()
// res13: monix.eval.Task[Long] = Eval(
//   thunk = lspace.provider.mem.store.MemStore$$Lambda$11347/0x0000000803528840@6223ad40
// )

Value

A value ..

History

A graph can have a history trait which means that resources are time aware and annotated with supporting “@createdon” and “@deletedon” tags.