You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/_index.md
+18-3Lines changed: 18 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ flatgraph is developed and maintained as the underlying database for the code an
25
25
26
26
## Glimpse of a simple use case
27
27
We have a history in [tinkerpop](https://tinkerpop.apache.org), so allow us to use a very simple graph domain from there to show how to get started with flatgraph. Working code is typically better than prose: the full setup is part of the tests in the [flatgraph repository](https://github.com/joernio/flatgraph).
28
-
{{< figure src="/grateful-dead-schema.png" caption="grateful dead sample domain">}}
28
+
{{< figure src="/grateful-dead-schema.png" caption="grateful dead sample domain" width="600px">}}
29
29
30
30
Excerpt from the [GratefulDead domain schema](https://github.com/joernio/flatgraph/blob/44005cf16373dfaf629da8628071ebbfaf02b551/test-schemas/src/main/scala/flatgraph/testdomains/GratefulDead.scala):
31
31
```scala
@@ -42,7 +42,9 @@ song.addOutEdge(
42
42
stepNameOut ="sungBy",
43
43
stepNameIn ="sang")
44
44
```
45
-
The code generator takes the schema as input and generates [domain specific classes](https://github.com/joernio/flatgraph/tree/44005cf16373dfaf629da8628071ebbfaf02b551/test-schemas-domain-classes/src/main/scala/testdomains/gratefuldead) that can e.g. be used like this:
45
+
46
+
The code generator takes the schema as input and generates [domain specific classes](https://github.com/joernio/flatgraph/tree/44005cf16373dfaf629da8628071ebbfaf02b551/test-schemas-domain-classes/src/main/scala/testdomains/gratefuldead) that can e.g. be used as follows:
Note that the properties (e.g. `name` and `performances`) have the respective types as defined in the schema, and relationships between nodes have named steps, e.g. `sang`. If you didn't provide a name for a relationship, there are some alternative auto-generated options like `sungbyOut` and `artistViaSungbyOut`.
66
+
67
+
{{% notice note %}}
68
+
By defining your domain in a schema we enable the compiler to help us write domain-specific code, i.e. the compiler ensures that our traversals are valid and we also get domain-specific code completion. Additionally, we ensure that no schema-invalid graph can be constructed.
69
+
{{% /notice %}}
70
+
Some examples for what return types the compiler derives, based on the information given in the schema:
71
+
*`gratefulDead.artist: Iterator[Artist]`
72
+
*`gratefulDead.artist.name: Iterator[String]`
73
+
*`gratefulDead.artist.name("Garcia"): Iterator[Artist]` - note that `name(String)` is a filter step
74
+
*`gratefulDead.song.performances: Iterator[Int]`
75
+
*`gratefulDead.artist.performances` does not compile
76
+
*`gratefulDead.song.writtenBy: Iterator[Artist]`
77
+
*`gratefulDead.artist.writtenBy` does not compile
78
+
79
+
If you didn't provide a name for a relationship in the schema definition, there are some alternative auto-generated options like `sungbyOut` and `artistViaSungbyOut`.
65
80
The full working test is [here](https://github.com/joernio/flatgraph/blob/92f4cc4b84bf6b8315971128995a75872376dcff/tests/src/test/scala/flatgraph/GratefulDeadTests.scala).
Copy file name to clipboardExpand all lines: content/benchmarks/_index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title = "Benchmarks"
3
3
weight = 4
4
4
+++
5
5
6
-
In the past, many initial attempts at marrying a graph database with static analysis was done with TinkerGraph or Neo4j (see [Related Work](_index.md/#related-work)), however these databases have been proven to be slow and inefficient. This was motivation enough to create [OverfowDB](https://github.com/ShiftLeftSecurity/overflowdb), and now [flatgraph](https://github.com/joernio/flatgraph).
6
+
In the past, many initial attempts at marrying a graph database with static analysis was done with TinkerGraph or Neo4j (see [Related Work](_index.md/#related-work)), however these databases have been proven to be slow and inefficient. This was motivation enough to create [OverflowDB](https://github.com/ShiftLeftSecurity/overflowdb), and now [flatgraph](https://github.com/joernio/flatgraph).
7
7
8
8
Below are benchmarks measuring various properties of how each database performs.
0 commit comments