Skip to content

Commit cdf1414

Browse files
committed
readme
1 parent 0896200 commit cdf1414

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ insert!(db, Node(1, "Person", "Actor"; name="Tom Hanks"))
6161

6262
insert!(db, Node(2, "Movie"; title="Forest Gump"))
6363

64-
insert!(db, Edge(1, 2, "Acts In"))
64+
insert!(db, Edge(1, 2, "Acts In"; awards=["Best Actor in a Leading Role"]))
6565
```
6666

6767
<br><br>
@@ -76,6 +76,32 @@ replace!(db, Node(2, "Movie"; title="Forest Gump", genre="Drama"))
7676

7777
<br><br>
7878

79+
## Simple Queries
80+
81+
- Use `getindex` to access elements.
82+
- If `:` is used as an index, an iterator is returned.
83+
84+
```julia
85+
db[1] # Node(2, "Movie"; title="Forest Gump", genre="Drama")
86+
87+
for node in db[:]
88+
println(node)
89+
end
90+
91+
92+
# (Pretend the graph is populated with many more items. The following return iterators.)
93+
94+
db[1, :, "Acts In"] # All movies that Tom Hanks acts in
95+
96+
db[:, 2, "Acts In"] # All actors in "Forest Gump"
97+
98+
db[1, 2, :] # All relationships between "Tom Hanks" and "Forest Gump"
99+
100+
db[:, :, :] # All edges
101+
```
102+
103+
<br><br>
104+
79105
## ✨ Attribution ✨
80106

81107
SQLiteGraph is **STRONGLY** influenced (much has been copied verbatim) from [https://github.com/dpapathanasiou/simple-graph](https://github.com/dpapathanasiou/simple-graph).

0 commit comments

Comments
 (0)