usdot-jpo-ode / wzdx

The Work Zone Data Exchange (WZDx) Specification aims to make harmonized work zone data provided by infrastructure owners and operators (IOOs) available for third party use, making travel on public roads safer and more efficient through ubiquitous access to data on work zone activity.
Creative Commons Zero v1.0 Universal
92 stars 62 forks source link

Replace the subidentifier field with a Relationship object #108

Closed DeraldDudley closed 4 years ago

DeraldDudley commented 4 years ago

Replace the subidentifier field with a Relationship object

The specification currently uses the road_events.subidentifier field as a foreign key to relate objects. However, the field does not explicitly describe how linked features are related. Replacing road_events.subidentifier with a Relation object, like the one used in JSCalendar, will relate road event features and explicitly describe how features are related.

The Relationship object as defined in the JSCalendar Specification.

A Relation object defines the relation to other objects, using a possibly empty set of relation types. The object that defines this relation is the linking object, while the other object is the linked object.

The Relation object has the following properties:

Specifies the type of this object. This MUST be "Relation".

Describes how the linked object is related to the linking object. The relation is defined as a set of relation types. If empty, the relationship between the two objects is unspecified. Keys in the set MUST be one of the following values, or specified in the property definition where the Relation object is used, or a value registered in the IANA JSCalendar Enum Registry, or a vendor-specific value:

The value for each key in the set MUST be true.

The Relationship object used in the Work Zone Data Specification.

Hierarchical Example

{
  "road_event_feed_info": {},
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "road_event_id": "1",
        "relatioship": [{"child":"2"},{"child":"3"},{"child":"4"}]
      },
      "geometry": {
        "type": "LineString",
        "coordinates": []
      }
    },
    {
      "type": "Feature",
      "properties": {
        "road_event_id": "2",
        "relatioship": {"parent":"1"}
      },
        "geometry": {
          "type": "LineString",
          "coordinates": []
      }
    },
    {
      "type": "Feature",
      "properties": {
        "road_event_id": "3",
        "relatioship": {"parent":"1"}
      },
      "geometry": {
        "type": "LineString",
        "coordinates": []
      }
    },
    {
      "type": "Feature",
      "properties": {
        "road_event_id": "4",
        "relatioship": {"parent":"1"}
      },
      "geometry": {
        "type": "LineString",
        "coordinates": []
      }
    }
  ]
}

Sequential Example

{
  "road_event_feed_info": {},
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "road_event_id": "1",
        "relatioship": {"first":"1","next":"2"}
      },
      "geometry": {
        "type": "LineString",
        "coordinates": []
      }
    },
    {
      "type": "Feature",
      "properties": {
        "road_event_id": "2",
        "relatioship":  {"first":"1","next":"3"}
      },
        "geometry": {
          "type": "LineString",
          "coordinates": []
      }
    },
    {
      "type": "Feature",
      "properties": {
        "road_event_id": "3",
        "relatioship":  {"first":"1","next":"4"}
      },
      "geometry": {
        "type": "LineString",
        "coordinates": []
      }
    },
    {
      "type": "Feature",
      "properties": {
        "road_event_id": "4",
        "relatioship":  {"first":"1"}
      },
      "geometry": {
        "type": "LineString",
        "coordinates": []
      }
    }
  ]
}
j-d-b commented 4 years ago

Added in #118