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

day-tripsclj

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

find-tripclj

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

next-stopsclj

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