Overview
Note: an intersection contains multiple signalgroups. A signalgroup can represent multiple connections between lanes.
This specification for publishing traffic light information on the Web is split into three parts to balance different server/client costs against freshness of the data. At the bottom of the figure is historical data. The data freshness is very low and thus cost efficient to publish. There are two different strategies for publishing the real-time data. The first strategy publishes one HTTP document for each intersection. The idea is that all traffic lights of the intersection update their status almost everytime at the same time and for multiple seconds. The SPAT standard specifies that the minimum time of a connection status can't become lower, unless with emergencies. That's why there's a second strategy for real-time data: publish/subscribe communication. This means that the server pushes events to the client which enables clients to get updates faster, but requires higher server effort.
Historic data
- Contains delta-based statuses on the intersection level. The moment one of the signalgroups of an intersection changes, all the previous statuses get archived.
Example: GET /fragments?sg=http://example.org/signalgroup/1 (Accept: application/trig)
<http://example.org/signalgroup/1?time=2018-04-27T17:49:46.342Z> <http://www.w3.org/ns/prov#generatedAtTime> "2018-04-27T17:49:46.342Z". <http://example.org/signalgroup/1?time=2018-04-27T17:49:46.342Z> { <http://example.org/eventstate/protected-Movement-Allowed> a <http://example.org/eventstate/>; <http://www.w3.org/2000/01/rdf-schema#label> "protected-Movement-Allowed". <http://example.org/signalgroup/1> a <http://example.org#signalgroup>; <http://example.org#eventstate> <http://example.org/eventstate/protected-Movement-Allowed>; <http://example.org#maxendtime> "2018-04-27T17:50:05.942Z"; <http://example.org#minendtime> "2018-04-27T17:49:50.942Z" } <http://example.org/signalgroup/1?time=2018-04-27T17:49:46.541Z> <http://www.w3.org/ns/prov#generatedAtTime> "2018-04-27T17:49:46.541Z". <http://example.org/signalgroup/1?time=2018-04-27T17:49:46.541Z> { <http://example.org/eventstate/protected-Movement-Allowed> a <http://example.org/eventstate/>; <http://www.w3.org/2000/01/rdf-schema#label> "protected-Movement-Allowed". <http://example.org/signalgroup/1> a <http://example.org#signalgroup>; <http://example.org#eventstate> <http://example.org/eventstate/protected-Movement-Allowed>; <http://example.org#maxendtime> "2018-04-27T17:50:05.941Z"; <http://example.org#minendtime> "2018-04-27T17:49:50.941Z" } <#Metadata> { <http://lodi.ilabt.imec.be:3003/RawData/fragments?time=2018-04-27T17:49:23.941Z&sg=1> <http://creativecommons.org/ns#license> <https://creativecommons.org/publicdomain/zero/1.0/> }
Real-time data with polling
- Preference for HTTP/2 for multiplexing over the same connection.
- Contains latest state of the intersection with all its signalgroups listed.
- Default content-type application/ld+json, but also other formats supporting quads can be used, e.g. application/trig
Example: GET /intersections/1 (Accept: application/ld+json)
{
@context: {
generatedAt: {
@id: "http://www.w3.org/ns/prov#generatedAtTime",
@type: "http://www.w3.org/2001/XMLSchema#date"
},
ex: "http://example.org#",
EventState: "http://example.org/eventstate/",
eventState: {
@id: "ex:eventstate",
@type: "EventState"
},
minEndTime: {
@id: "ex:minendtime",
@type: "http://www.w3.org/2001/XMLSchema#date"
},
maxEndTime: {
@id: "ex:maxendtime",
@type: "http://www.w3.org/2001/XMLSchema#date"
},
fragmentGroup: "ex:fragmentGroup",
rdfs: "http://www.w3.org/2000/01/rdf-schema#"
},
@id: "http://example.org/intersection/1?time=2018-06-12T20:42:37.943Z",
generatedAt: "2018-06-12T20:42:37.943Z",
@graph: [
{
@id: "http://example.org/signalgroup/1",
@type: "ex:signalgroup",
eventState: {
@id: "http://example.org/eventstate/stop-And-Remain",
@type: "EventState",
rdfs:label: "stop-And-Remain"
},
minEndTime: "2018-06-12T20:43:04.743Z",
maxEndTime: "2018-06-12T20:43:04.743Z"
},
{
@id: "http://example.org/signalgroup/2",
@type: "ex:signalgroup",
eventState: {
@id: "http://example.org/eventstate/stop-And-Remain",
@type: "EventState",
rdfs:label: "stop-And-Remain"
},
minEndTime: "2018-06-12T20:43:04.743Z",
maxEndTime: "2018-06-12T20:43:04.743Z"
}
]
}
Real-time data with events
- Pushes changes to the client
- Preference for Server-Sent Events (SSE)
- Send a request with Accept-header set to text/event-stream in your HTTP requests
- The response can look the same as the example with polling.
