Liking cljdoc? Tell your friends :D

hiposfer.kamal.libs.fastq

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
raw docstring

cache-stop-successorsclj

(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
sourceraw docstring

continue-tripclj

(continue-trip network dst trip)

returns the :stop_time 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_time/stop ?dst-id] [?dst :stop_time/trip ?trip] [?dst :stop_time/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_time/trip index

returns the :stop_time 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_time/stop ?dst-id]
         [?dst :stop_time/trip ?trip]
         [?dst :stop_time/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_time/trip index
sourceraw docstring

day-stop-timesclj

(day-stop-times network date)

returns a set of stop_times entity ids that are available for date

returns a set of stop_times entity ids that are available for date
sourceraw docstring

find-tripclj

(find-trip network day-stops src dst now)

Returns a [src dst] :stop_time 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_time/stop ?src-id] [?dst :stop_time/stop ?dst-id] [?src :stop_time/trip ?trip] [?dst :stop_time/trip ?trip] [?src :stop_time/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_time 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_time/stop ?src-id]
         [?dst :stop_time/stop ?dst-id]
         [?src :stop_time/trip ?trip]
         [?dst :stop_time/trip ?trip]
         [?src :stop_time/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
sourceraw docstring

index-lookupclj

(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
sourceraw docstring

(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
sourceraw docstring

nearest-nodeclj

(nearest-node network point)

returns the nearest node/location to point

returns the nearest node/location to point
sourceraw docstring

node-successorsclj

(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
sourceraw docstring

node-waysclj

(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
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close