GtfsCalendarRule

Description

See https://developers.google.com/transit/gtfs/reference/#calendartxt

Data Model

The data model is defined as shown below:

  • id: Entity ID

    • It shall be urn:ngsi-ld:GtfsCalendarRule:<calendar_rule_identifier>.
  • type: Entity Type

    • It shall be equal to GtfsCalendarRule
  • source : A sequence of characters giving the source of the entity data.

    • Attribute type: Property. Text or URL
    • Optional
  • dataProvider : Specifies the URL to information about the provider of this information

    • Attribute type: Property. URL
    • Optional
  • dateCreated : Entity's creation timestamp.

    • Attribute type: Property. DateTime
    • Read-Only. Automatically generated.
  • dateModified : Last update timestamp of this Entity.

    • Attribute type: Property. DateTime
    • Read-Only. Automatically generated.
  • hasService : Service to which this rule applies to. Derived from service_id.

    • Attribute type: Relationship. It shall point to an entity of Type GtfsService
    • Mandatory
  • name : Name of this rule

    • Attribute type: Property. Text
    • Optional
  • description: Description of this rule

    • Attribute type: Property. Text
    • Optional
  • monday: Same as GTFS monday

  • tuesday: Same as GTFS tuesday

  • wednesday: Same as GTFS wednesday

  • thursday: Same as GTFS thursday

  • friday: Same as GTFS friday

  • saturday: Same as GTFS saturday

  • sunday: Same as GTFS sunday

  • startDate: Start date of this rule in YYYY-MM-DD format. It can be obtained from the field start_date of calendar.txt.

  • endDate: End date of this rule in YYYY-MM-DD format. It can be obtained from the field end_date of calendar.txt.

Examples

Normalized Example

Normalized NGSI response

{
    "id": "urn:ngsi-ld:CalendarRule:Madrid:Rule1267",
    "type": "GtfsCalendarRule",
    "startDate": {
        "type": "Date",
        "value": "2018-01-01"
    },
    "endDate": {
        "type": "Date",
        "value": "2019-01-01"
    },
    "name": {
        "value": "Rule Hospital Service 1"
    },
    "monday": {
        "value": true
    },
    "tuesday": {
        "value": true
    },
    "friday": {
        "value": true
    },
    "wednesday": {
        "value": true
    },
    "thursday": {
        "value": true
    },
    "sunday": {
        "value": false
    },
    "hasService": {
        "type": "Relationship",
        "value": "urn:ngsi-ld:GtfsService:Madrid:Hospital_1"
    },
    "saturday": {
        "value": false
    }
}

key-value pairs Example

Sample uses simplified representation for data consumers ?options=keyValues

{
    "id": "urn:ngsi-ld:GtfsCalendarRule:Madrid:Rule1267",
    "type": "GtfsCalendarRule",
    "name": "Rule Hospital Service 1",
    "hasService": "urn:ngsi-ld:GtfsService:Madrid:Hospital_1",
    "monday": true,
    "tuesday": true,
    "wednesday": true,
    "thursday": true,
    "friday": true,
    "saturday": false,
    "sunday": false,
    "startDate": "2018-01-01",
    "endDate": "2019-01-01"
}

LD Example

Sample uses the NGSI-LD representation

{
    "id": "urn:ngsi-ld:CalendarRule:Madrid:Rule1267",
    "type": "GtfsCalendarRule",
    "startDate": {
        "type": "Property",
        "value": {
            "@type": "Date",
            "@value": "2018-01-01"
        }
    },
    "endDate": {
        "type": "Property",
        "value": {
            "@type": "Date",
            "@value": "2019-01-01"
        }
    },
    "name": {
        "type": "Property",
        "value": "Rule Hospital Service 1"
    },
    "monday": {
        "type": "Property",
        "value": true
    },
    "tuesday": {
        "type": "Property",
        "value": true
    },
    "friday": {
        "type": "Property",
        "value": true
    },
    "wednesday": {
        "type": "Property",
        "value": true
    },
    "thursday": {
        "type": "Property",
        "value": true
    },
    "sunday": {
        "type": "Property",
        "value": false
    },
    "hasService": {
        "type": "Relationship",
        "object": "urn:ngsi-ld:GtfsService:Madrid:Hospital_1"
    },
    "saturday": {
        "type": "Property",
        "value": false
    },
    "@context": [
        "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld",
        "https://schema.lab.fiware.org/ld/context"
    ]
}

Summary of mappings to GTFS

GTFS Field NGSI Attribute LinkedGTFS Comment
name schema:name
description schema:description
monday monday gtfs:monday
tuesday tuesday gtfs:tuesday
wednesday wednesday gtfs:wednesday
thursday thursday gtfs:thursday
friday friday gtfs:friday
saturday saturday gtfs:saturday
sunday sunday gtfs:sunday
start_date startDate schema:startDate
end_date endDate schema:endDate

Relationships

GTFS Field NGSI Attribute LinkedGTFS Comment
hasService gtfs:service Shall point to another Entity of Type GtfsService

Open issues