Open Journey Planner library to simplify request/response handling | Read-only mirror of https://github.com/openTdataCH/ojp-adapter — SBB. Issues & pull requests at the source.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Peter 3da3342d1b
Merge pull request #20 from openTdataCH/TRM_V6.2_update
Transmodel v6.2 (Preview 2024) update
2025-03-20 08:38:18 +01:00
.github/workflows Update maven.yml 2025-02-13 15:50:07 +01:00
ojp-adapter Transmodel v6.2 (Preview 2024) update 2025-03-14 11:27:45 +01:00
ojp-adapter-model Transmodel v6.2 (Preview 2024) update 2025-03-14 11:27:45 +01:00
ojp-adapter-service Transmodel v6.2 (Preview 2024) update 2025-03-14 11:27:45 +01:00
ojp-adapter-test Make integrationtests of ojp-adapter-test buildable even if no config is available. 2025-03-14 11:51:44 +01:00
ojp-adapter-transmodel Transmodel v6.2 (Preview 2024) update 2025-03-14 11:27:45 +01:00
ojp-java-model ojp-java-model separated into own modul to support OJP API multi-versioned. 2025-02-13 12:42:19 +01:00
.gitignore TRM request-model refactoring 2024-12-10 09:16:59 +01:00
CONTRIBUTING.md open source distribution comments 2023-12-01 16:09:36 +01:00
LICENCE Java-Project MVN based, initial 2023-11-25 16:06:43 +01:00
NOTICE Java-Project MVN based, initial 2023-11-25 16:06:43 +01:00
open-journey-planner-api_v0.9.0-SNAPSHOT.json doc 2024-10-16 12:45:08 +02:00
pom.xml ojp-java-model separated into own modul to support OJP API multi-versioned. 2025-02-13 12:42:19 +01:00
README.md Reamde 2025-02-13 15:40:17 +01:00
ReleaseNotes.md filtering for preferredLanguage 2025-01-27 12:33:39 +01:00

Author: Peter Hirzel (Software Architect SBB Journey Planner), 2023
Licence: Apache License, Version 2.0

About OJP-Adapter

The project contains 2 targets:

  1. a simple OJPAdapter library to request Public-Transportation queries against the swiss public Open Journey-Planner (SKI) based on OJP Specification OJP.xsd.
  2. a RESTful OJPController with a Transmodel implemenation of a Journey-Planner interface

Remark about OJP SKI+

Goals

Abstracting the complex VDV OJP.xsd Schema by Java POJOs, map response properly and provide low-level error-handling.

Anyone (for e.g. public transport-organisation) who plans to use the Swiss OJP router (or other european OJP instances supporting the same protocol version) may try this library to setup a quick working starting point.

The vdv ojp XSD might be quite complex and JAXB POJO generation therefore too!
Besides, understanding the OJP semantics may mean a steep learning curve for non-insiders.

The author hopes using this OJP-Adapter library may "abstract" the above steps massively, though the resulting OJP model may still be complex to deal with (perhaps check the returned data for a more intuitive understanding as well).

Known usage

This Software was originally developed for SBB AG Switzerland, Personenverkehr, CustomerInformation by Peter Hirzel (Software Architect Journey-Planner) for experimental reasons:

Targets

OJPAdapter library

Contains:

The provided OJPAdapter is able to query Swiss SKI+ OJP instances, if configured well (by means your own access token):

  • use OJPAadapter for raw native XML handling in conversation with OJP protocol.
  • Use of Swiss SKI+ OJP 2.0 API.
  • Demonstration of easy filters and response analysis by OJPAdapterAccessTest

See:

OJPController RESTful Service

Contains:

  • OJP/Transmodel mapping
  • SpringBoot OJPWebApplication
  • Transmodel like implementation model as used by SBB Customer Information
  • Covers Place, Trip, DatedVehicleJourney (including Departures/Arrivals)

Run it

OJP-Adapter

  1. Download repository
  2. mvn clean install
  3. copy ojp-adapter-integration/src/main/resources/ojp-SAMPLE.properties to ojp.properties and add your own key for SKI+ OJP Instance from opentransportdata.swiss passive instance v2 "Manage the API key"
  4. run swiss.opentransportdata.ojp.adapter.**.OJPAdapterAccessTest (to try out native OJP XML based request/response)

OJPWebApplication

  1. clone ojp-adapter-service/main/resources/application.yml to application-local.yml and set 'ojp.authorization'
  2. run swiss.opentransportdata.ojp.adapter.service.application.OJPWebApplication with 'VM Options'=-Dspring.profiles.active=local
  3. open OpenAPI 3 Swagger-UI

Remark:

  • At least the OJP passive key should be easy to get.
  • For the OJP active instance key you probably need to contact the operation-responsibles.
  • If your just interested in Open API 3 Swagger-UI resulting out of ojp-adapter-service/../OJPController, see JSON-specification

History

OJP v1.0 implementation (DEPRECATED)

See OJP-Adapter v0.9.0-beta

  • Checkout if you need to acces SKI+ OJP active instance, which supports only OJP v1.*

  • Currently, OJPAdapter deals with one SINGLE Journey-Planner request at a time, though MULTIPLE requests could be performed at once.

  • Complete OJP set of request-filters (currently the most relevant filters are adapted).

  • Complete OJP response mapping (currently the most relevant properties are implemented).

  • Quality tests for correctly mapped output should be verified and confirmed by SKI+.