namespace for hand-optimized queries that are used inside the routing algorithm and need to run extremely fast (< 1 ms per query)
By convention all queries here return Entities
namespace for hand-optimized queries that are used inside the routing algorithm and need to run extremely fast (< 1 ms per query) By convention all queries here return Entities
(cache-stop-successors network)
computes the next-stops for each stop and returns a transaction that will cache those results inside the :stop entities
computes the next-stops for each stop and returns a transaction that will cache those results inside the :stop entities
(continue-trip network dst trip)
returns the :stop.times entity to reach ?dst-id via ?trip
Returns nil if no trip going to ?dst-id was found
replaces: '[:find ?departure :in $ ?dst-id ?trip ?start :where [?dst :stop.times/stop ?dst-id] [?dst :stop.times/trip ?trip] [?dst :stop.times/arrival_time ?seconds] [(plus-seconds ?start ?seconds) ?departure]]
The previous query takes around 50 milliseconds to execute. This function takes around 0.22 milliseconds to execute. Depends on :stop.times/trip index
returns the :stop.times entity to reach ?dst-id via ?trip Returns nil if no trip going to ?dst-id was found replaces: '[:find ?departure :in $ ?dst-id ?trip ?start :where [?dst :stop.times/stop ?dst-id] [?dst :stop.times/trip ?trip] [?dst :stop.times/arrival_time ?seconds] [(plus-seconds ?start ?seconds) ?departure]] The previous query takes around 50 milliseconds to execute. This function takes around 0.22 milliseconds to execute. Depends on :stop.times/trip index
(day-trips network date)
returns a set of trip (entities) ids that are available for date
returns a set of trip (entities) ids that are available for date
(find-trip network trips src dst now)
Returns a [src dst] stop.times pair for the next trip between ?src-id and ?dst-id departing after ?now.
Returns nil if no trip was found
replaces: '[:find ?trip ?departure :in $ ?src-id ?dst-id ?now ?start :where [?src :stop.times/stop ?src-id] [?dst :stop.times/stop ?dst-id] [?src :stop.times/trip ?trip] [?dst :stop.times/trip ?trip] [?src :stop.times/departure_time ?amount] [(hiposfer.kamal.libs.fastq/plus-seconds ?start ?amount) ?departure] [(hiposfer.kamal.libs.fastq/after? ?departure ?now)]]
The previous query runs in 118 milliseconds. This function takes 4 milliseconds
Returns a [src dst] stop.times pair for the next trip between ?src-id and ?dst-id departing after ?now. Returns nil if no trip was found replaces: '[:find ?trip ?departure :in $ ?src-id ?dst-id ?now ?start :where [?src :stop.times/stop ?src-id] [?dst :stop.times/stop ?dst-id] [?src :stop.times/trip ?trip] [?dst :stop.times/trip ?trip] [?src :stop.times/departure_time ?amount] [(hiposfer.kamal.libs.fastq/plus-seconds ?start ?amount) ?departure] [(hiposfer.kamal.libs.fastq/after? ?departure ?now)]] The previous query runs in 118 milliseconds. This function takes 4 milliseconds
(index-lookup network id)
returns a transducer that can be used together with index-range to get all entities whose value equals id i.e. the entities that have a reference to id
returns a transducer that can be used together with index-range to get all entities whose value equals id i.e. the entities that have a reference to id
(link-stops network)
takes a network, looks up the nearest node for each stop and returns a transaction that will link those
takes a network, looks up the nearest node for each stop and returns a transaction that will link those
(nearest-node network point)
returns the nearest node/location to point
returns the nearest node/location to point
(next-stops network src)
return the next stop entities for ?src-id based on stop.times
This function might return duplicates
replaces: '[:find [?id ...] :in $ ?src-id :where [?src :stop.times/stop ?src-id] [?src :stop.times/trip ?trip] [?dst :stop.times/trip ?trip] [?src :stop.times/sequence ?s1] [?dst :stop.times/sequence ?s2] [(> ?s2 ?s1)] [?dst :stop.times/stop ?se] [?se :stop/id ?id]] the previous query takes 145 milliseconds. This function takes 0.2 milliseconds
return the next stop entities for ?src-id based on stop.times This function might return duplicates replaces: '[:find [?id ...] :in $ ?src-id :where [?src :stop.times/stop ?src-id] [?src :stop.times/trip ?trip] [?dst :stop.times/trip ?trip] [?src :stop.times/sequence ?s1] [?dst :stop.times/sequence ?s2] [(> ?s2 ?s1)] [?dst :stop.times/stop ?se] [?se :stop/id ?id]] the previous query takes 145 milliseconds. This function takes 0.2 milliseconds
(node-successors network entity)
takes a network and an entity and returns the successors of that entity. Only valid for OSM nodes. Assumes bidirectional links i.e. nodes with back-references to entity are also returned
replaces: '[:find ?successors ?node :in $ ?id :where [?id :node/successors ?successors] [?node :node/successors ?id]]
The previous query takes around 50 milliseconds to finish. This function takes around 0.25 milliseconds
takes a network and an entity and returns the successors of that entity. Only valid for OSM nodes. Assumes bidirectional links i.e. nodes with back-references to entity are also returned replaces: '[:find ?successors ?node :in $ ?id :where [?id :node/successors ?successors] [?node :node/successors ?id]] The previous query takes around 50 milliseconds to finish. This function takes around 0.25 milliseconds
(node-ways network entity)
takes a dereferenced Datascript connection and an entity id and returns the OSM ways that reference it. Only valid for OSM node ids
replaces: '[:find ?way :in $ ?id :where [?way :way/nodes ?id]]
The previous query takes around 50 milliseconds to finish. This one takes around 0.15 milliseconds
takes a dereferenced Datascript connection and an entity id and returns the OSM ways that reference it. Only valid for OSM node ids replaces: '[:find ?way :in $ ?id :where [?way :way/nodes ?id]] The previous query takes around 50 milliseconds to finish. This one takes around 0.15 milliseconds
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close