egison-5.0.0: sample/database/edge-sqlite.egi
--
-- This file has been auto-generated by egison-translator.
--
def nodeTable {a, b} : Matcher DatabaseTable :=
matcher
| cons node #$px #$py $ as (nodeTable) with
| tgt ->
match pureSqlite
(databaseName tgt)
(simpleSelect ["id"] (tableName tgt) [("id", itos px)]) as
list (integer, integer) with
| [] -> []
| _ -> [tgt]
| cons node #$px $ $ as (integer, nodeTable) with
| tgt ->
map
(\$x -> (x, tgt))
(pureSqlite
(databaseName tgt)
(simpleSelect ["name"] (tableName tgt) [("id", itos px)]))
| cons node $ #$px $ as (integer, nodeTable) with
| tgt ->
map
(\$x -> (stoi x, tgt))
(pureSqlite
(databaseName tgt)
(simpleSelect ["id"] (tableName tgt) [("name", px)]))
| $ as (something) with
| tgt -> [tgt]
def edgeTable {a, b} : Matcher DatabaseTable :=
matcher
| cons edge #$px #$py $ as (edgeTable) with
| tgt ->
match pureSqlite
(databaseName tgt)
(simpleSelect
["from_id to_id"]
(tableName tgt)
[("from_id", itos px), ("to_id", itos py)]) as
list (integer, integer) with
| [] -> []
| _ -> [tgt]
| cons edge #$px $ $ as (integer, edgeTable) with
| tgt ->
map
(\$x -> (stoi x, tgt))
(pureSqlite
(databaseName tgt)
(simpleSelect ["to_id"] (tableName tgt) [("from_id", itos px)]))
| cons edge $ #$px $ as (integer, edgeTable) with
| tgt ->
map
(\$x -> (stoi x, tgt))
(pureSqlite
(databaseName tgt)
(simpleSelect ["from_id"] (tableName tgt) [("to_id", itos px)]))
| $ as (something) with
| tgt -> [tgt]
def nodeData : DatabaseTable := DatabaseTable "sqlite/graph" "node"
def edgeData : DatabaseTable := DatabaseTable "sqlite/graph" "edge"
matchAll edgeData as edgeTable with
| edge #40 $m :: edge #m $n :: _ -> (40, m, n)
matchAll edgeData as edgeTable with
| edge #40 $m :: edge #m #40 :: _ -> (40, m)
matchAll edgeData as edgeTable with
| edge #40 $m :: !(edge #m #40 :: _) -> (40, m)