-
Notifications
You must be signed in to change notification settings - Fork 2
/
types.txt
62 lines (46 loc) · 1.64 KB
/
types.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
-- basic types
type Int
type String
type Float
-- complex types
type GSet
-- universals
everything : GSet
nodes : GSet
ways : GSet
relations : GSet
areas : GSet
-- filters
kv : String -> String -> GSet -- things that match a key/value tag
around : Float -> GSet -> GSet -- things that are within distance of given things
in : GSet -> GSet -- things that are in areas in the set
-- set operations
or : GSet -> GSet -> GSet
and : GSet -> GSet -> GSet
not : GSet -> GSet
-- graph operations
up : GSet -> GSet -- all parents of items in set
down : GSet -> GSet -- all children of items in set
upp : GSet -> GSet -- transitive parents
downn : GSet -> GSet -- transitive children
-- graph operations with a role filter
up : String -> GSet -> GSet -- all parents of items in set
down : String -> GSet -> GSet -- all children of items in set
upp : String -> GSet -> GSet -- transitive parents
downn : String -> GSet -> GSet -- transitive children
-- convenience
name : String -> GSet
name s = kv 'name' s
amenity : String -> GSet
amenity s = kv 'amenity' s
near : GSet -> GSet
near = around 50
-- lambda fragment
lambda x: T { term :: T }
-- examples
-- cafes in sofia within 20m of water
and (and (amenity 'cafe') (in (name 'sofia'))) (around 20 (amenity 'drinking_water'))
-- cafes within 20m of water in sofia (faster)
and (amenity 'cafe') (around 20 (and (in (name 'София')) (amenity 'drinking_water')))
-- pharmacies near Circle Line stations
and (amenity 'pharmacy') (near (and (amenity 'metro_station') (down (name 'Circle Line'))))