ChIP example

Description

This is a choreography used to illustrate the ChIP integration process.

The example is drawn from a pilot of the European EIT Digital project SMAll, integrating functionalities provided by a Regional Government, a University, and a Bus Agency. In the pilot, the Regional Government, which issues the tracking of a bus ride of a specific line. Consequently, the Bus Agency delivers to the University the schedule of the requested ride. Finally, until the tracked ride reaches the final stop, the Bus Agency sends the current bus position to the University, which computes the delay and sends it to the Regional Government.

include getSchedule, getPosition from "socket://localhost:8000" with "sodep"
include hasNextStop, calculateDelay from "socket://localhost:8001" with "http"
include insertDelay from "socket://localhost:8002"

preamble {
 starter: Admin
}

aioc {
 line @ Admin = getInput( "Insert line to track" );
 {
  setLine: Admin( line ) -> DatabaseConnector( line )
  |
  setLine: Admin( line ) -> BusAgency( line )
 }; 
 shd@BusAgency = getSchedule( line );
 passSchedule: BusAgency( shd ) -> Tracker( shd );
 hasNext@Tracker = hasNextStop( shd );
 while ( hasNext )@Tracker {
  gps@BusAgency = getPosition( line );
  passPosition: BusAgency( gps ) -> Tracker( pos );
  delay@Tracker = calculateDelay( shd, pos );
  storeDelay: Tracker( delay ) -> DatabaseConnector( delay );
  {
    _@DatabaseConnector = insertDelay( line, delay )
    |
    hasNext@Tracker = hasNextStop( shd )
  }
 }
}

Code

Download the code of the choreography, the projected connectors, and mock-ups of the external functionalities provided by the three organisations.