BenchmarkDB.sdl
Schema for the cpp51example_main.cpp example. Compile this schema using rdm-compile as follows:
rdm-compile --c-structs --catalog --cpp --no-cpp-constructors BenchmarkDB.sdl
and include the generated header file(s) as follows:
#include "BenchmarkDB_structs.h" #include "BenchmarkDB_cat.h"
and compile the following generated source file(s):
BenchmarkDB_cat.cpp
Here follows the actual schema:
CREATE DOMAIN "LinkID" as uint32 DEFAULT 0;
CREATE DOMAIN "LaneGroupID" as uint32 DEFAULT 0;
CREATE DOMAIN "LandmarkGroupID" as uint32 DEFAULT 0;
CREATE DOMAIN "sourceQualityClass_t" as uint32 DEFAULT 0;
CREATE DOMAIN "Distance_centimeter" as uint32 DEFAULT 0;
CREATE DOMAIN "Binary_16" as binary(16) default 0x00;
CREATE DOMAIN "Binary_32" as binary(32) default 0x00;
CREATE DOMAIN "Binary_64" as binary(64) default 0x00;
CREATE DOMAIN "Binary_128" as binary(128) default 0x00;
CREATE DOMAIN "Binary_160" as binary(160) default 0x00;
CREATE DOMAIN "Binary_256" as binary(256) default 0x00;
CREATE DOMAIN "Binary_512" as binary(512) default 0x00;
CREATE DOMAIN "Binary_1K" as binary(1024) default 0x00;
CREATE DOMAIN "rdmWgsRectangle2D" as binary(16) default 0x00; -- should be the same as sizeof(RG20::RGDB::WgsRectangle2D)
CREATE DOMAIN "rdmConstraintSet" as binary(288) default 0x00; -- should be bigger than as sizeof(RG20::Types::Street::PSD21::Constraints::ConstraintSet)
CREATE TABLE "PluginLinkAttributePerm" (
ID LinkID NOT NULL ,
"Reference_ID" LinkID NOT NULL ,
"offset" float32 NOT NULL ,
"nType" uint8 NOT NULL ,
"Value1" uint8 NOT NULL ,
"Value2" uint8 NOT NULL ,
"Source" uint16 NOT NULL ,
PRIMARY KEY(ID));
CREATE INDEX "PluginLinkAttributePerm_idx" ON PluginLinkAttributePerm (Reference_ID, offset);
create table "Landmark" (
"id" uint64 primary key,
"landmarkType" uint8 not null,
"origin" uint8 not null,
"originId" uint64 key,
"confidence" float32 not null,
"llcStdDev_trcStdDev" float64 array[6] not null, -- llcStdDev and trcStdDev of surface
"orientation" float64 array[3], -- orientation of surface (optional)
"orientationStdDev" float64 array[3], -- orientationStdDev of surface (optional)
"x_min" float64 not null key,
"location" float64 array[6] not null, -- uses llc and trc of surface
"detectionTime" uint64,
"existenceHypothesisId" uint64,
"landmarkGroupId" LandmarkGroupID references LandmarkGroup_psd21 on delete cascade,
"isComplete" boolean not null,
);
create table "TrafficSign" (
"id" uint64 primary key references Landmark on delete cascade,
"shape" uint8 not null,
"meaning" uint8 not null,
"content" binary(56) not null,
"relevance" uint8 not null,
"tsClass" uint8 not null,
"type" uint8 not null,
"color" uint8 not null,
"constraints_count" uint8 not null,
"constraints" binary(360) not null -- 3x sizeof(Types::Serialized::SerializedConstraint)
);
create table "Pole" (
"id" uint64 primary key references Landmark on delete cascade,
"poleType" uint8 not null,
"diameter" float array[2], -- top and bottom
);
-- optional: PoleWithElements can be skippt and PoleElements refer to pole
-- will be kept as separate table to be prepared for additional data
create table "PoleWithElements" (
"id" uint64 primary key references Pole on delete cascade,
);
create table "PoleElements" (
"poleWithElementsID" uint64 not null key references PoleWithElements on delete cascade,
"trafficLightID" uint64 references TrafficLight on delete cascade,
"trafficSignID" uint64 references TrafficSign on delete cascade,
);
create table "Marking" (
"id" uint64 primary key references Landmark on delete cascade,
"markingType" uint8 not null,
"markingColor" uint8 not null,
"semanticLineOrigin" uint8 not null,
"isRelevantForDriver" boolean,
);
create table "TrafficLight" (
"id" uint64 primary key references Landmark on delete cascade,
"color" uint8 not null,
"shape" uint8 not null,
"orientation" uint8 not null,
"mode" uint8 not null,
"relevancy" float32,
"constraints_count" uint8 not null,
"constraints" binary(360) not null -- 3x sizeof(Types::Serialized::SerializedConstraint)
);
create table "Barrier" (
"id" uint64 primary key references Landmark on delete cascade,
"barrierType" uint8 not null,
"surfaces" Binary_1K not null,
"binary_overflow" blob,
);
create table "MapAssociation" (
"id" uint64 primary key,
"landmarkID" uint64 not null key references Landmark on delete cascade,
"linkID" LinkID not null key, -- references Link
"offset" float32,
);
create table "LanePosition" (
"mapAssociationID" uint64 not null references MapAssociation on delete cascade,
"laneGroupID" LaneGroupID not null,
"laneID" uint8 not null,
"offset" float32,
constraint "laneIdentifiers" key (laneGroupID, laneID),
);
CREATE TABLE "Tile_psd21" (
"tileID" uint32 NOT NULL PRIMARY KEY,
"version" uint8 NOT NULL,
"incomplete" boolean NOT NULL
);
CREATE TABLE "LinkInfo" (
"linkID" LinkID NOT NULL,
"tileID" uint32 NOT NULL REFERENCES Tile_psd21, -- (in code) ON DELETE RESTRICT,
CONSTRAINT "LinkInfoID" PRIMARY KEY (linkID, tileID),
);
CREATE TABLE "Link_psd21" (
"linkId" LinkID NOT NULL PRIMARY KEY,
"linkType" uint8 NOT NULL,
"rightOfWayPos" uint8 NOT NULL,
"rightOfWayNeg" uint8 NOT NULL,
"drivingDirection" uint8 NOT NULL,
"functionalRoadClass" uint8 NOT NULL,
"trafficDirectionDeviation" boolean NOT NULL,
"trafficDirection" uint8 NOT NULL,
"roadType" uint8 NOT NULL,
"flags" uint32 NOT NULL,
"avgSpeed_mps" float32 NOT NULL,
"length_cm" Distance_centimeter NOT NULL,
"stableId" uint32 NOT NULL,
"isStableLinkRefInPositiveDigitalizationDirection" boolean NOT NULL,
"priority_road_class" uint8 NOT NULL,
/**
* Allowed direction of travel in relation to the digitization direction of the link.
* Can be: both, positive or negative (see enum values).
* Note: this flag is part of the Attributes table. Remove after it is complete.
*/
"allowed_travel_direction" uint8 NOT NULL,
"region_id" uint32 NOT NULL,
"centerline_overall_bb" rdmWgsRectangle2D NOT NULL,
"centerline" Binary_160 NOT NULL,
"curvatures" Binary_160 NOT NULL,
"slopes" Binary_160 NOT NULL,
"attributes" Binary_512 NOT NULL,
"attributes_speedlimits" Binary_128 NOT NULL, -- Populated only for HAD and empty in IVI case. When has_online_speedlimts is true, these are available in SpeedLimitsOnline table.
"has_online_speedlimits" boolean NOT NULL, -- IVI case: true if online speed limit is available and a corresponding SpeedLimitsOnline table entry has been created.
"road_middle_separations" Binary_32 NOT NULL,
"road_right_separations" Binary_32 NOT NULL,
"road_left_separations" Binary_32 NOT NULL,
"has_static_road_condition_link" boolean NOT NULL, -- only if this is true then there is data in roadObstacles, roadWaviness and roadConditions
"roadObstacles" Binary_16 NOT NULL, -- part of later updated static_road_conditions and overflows into static_road_condition_overflow
"roadWaviness" Binary_16 NOT NULL, -- part of later updated static_road_conditions and overflows into static_road_condition_overflow
"roadConditions" Binary_16 NOT NULL, -- part of later updated static_road_conditions and overflows into static_road_condition_overflow
"binary_overflow" blob,
"static_road_condition_overflow" blob,
"isComplete" boolean NOT NULL,
);
/**
* The purpose of this table is to add a dependent component on a link
* in order to allow its insertion and prevent its deletion.
* This table should be used ONLY if the dependency can not be expressed via foreign key in the dependent table!
* e.g. MPP requires links to be allowed to be inserted and be kept until all mpp links are received.
* Dependencies to these links can be added here until MPP is inserted.
*/
CREATE TABLE "LinkDependent" (
/* ID of the link the component depends on */
"linkId" LinkID NOT NULL,
/* ID of the components which depend on this link*/
/* ENUM: 0 = MPP, */
"dependentID" uint8 KEY NOT NULL,
PRIMARY KEY (linkId, dependentID)
);
CREATE TABLE "Link_Transition_psd21" (
/* Id of the link from which the transition to other link starts. */
"linkId" LinkID NOT NULL REFERENCES Link_psd21 ON DELETE CASCADE,
/* Id of the link to which the transition happens. */
"nextLinkId" LinkID REFERENCES Link_psd21 ON DELETE SET NULL,
"transientNextLinkId" LinkID KEY NOT NULL,
/* Direction of the transition regarding the nextLink digitalization direction.
Can be: both, positive or negative (see enum values). */
"direction" uint8 NOT NULL,
/* Shows where the transition starts, either at the beginning of the link or
at the end of it. */
"origin" uint8 NOT NULL,
/* Prohibition of the transition.
True means the transition is unconditionally prohibited!*/
"unconditionallyProhibited" boolean NOT NULL,
"curveRadius" int32 NOT NULL,
"conditional_prohobitions" rdmConstraintSet NOT NULL,
);
CREATE TABLE "LaneGroup_psd21" (
"LaneGroup_ID" LaneGroupID NOT NULL PRIMARY KEY,
"SourceQualityClass" sourceQualityClass_t NOT NULL,
"Mappings" Binary_128 NOT NULL,
"special_lane_types" Binary_16 NOT NULL,
"conditional_prohibitions" Binary_16 NOT NULL,
"binary_overflow" blob,
"centerline_min_x" uint32 NOT NULL KEY,
"centerline_overall_bb" rdmWgsRectangle2D NOT NULL,
"isComplete" boolean NOT NULL,
);
CREATE TABLE "Tile_LaneGroup_psd21" (
"laneGroupID" LaneGroupID NOT NULL,
"tileID" uint32 NOT NULL REFERENCES Tile_psd21, -- (in code) ON DELETE RESTRICT
CONSTRAINT "Tile_LaneGroup_ID" PRIMARY KEY (laneGroupID, tileID)
);
CREATE TABLE "LaneGroupAssociation_psd21" (
"LaneGroup_ID" LaneGroupID NOT NULL REFERENCES LaneGroup_psd21 ON DELETE CASCADE,
"type" uint8 NOT NULL,
"isComplete" boolean NOT NULL,
CONSTRAINT "LaneGroupAssociation_ID" PRIMARY KEY (LaneGroup_ID, type)
);
CREATE TABLE "LaneGroupReference_psd21" (
"LaneGroup_ID" LaneGroupID KEY NOT NULL,
"type" uint8 NOT NULL,
"otherLaneGroup_ID" LaneGroupID NULL REFERENCES LaneGroup_psd21 ON DELETE SET NULL,
"transientOtherLaneGroup_ID" LaneGroupID KEY NOT NULL,
CONSTRAINT "LaneGroupReference" FOREIGN KEY(LaneGroup_ID, type) REFERENCES LaneGroupAssociation_psd21 ON DELETE CASCADE,
);
CREATE TABLE "Lane_psd21" (
"LaneGroup_ID" LaneGroupID NOT NULL REFERENCES LaneGroup_psd21 ON DELETE CASCADE,
"LocalLane_ID" uint8 NOT NULL,
"length_cm" Distance_centimeter NOT NULL,
"width_cm" Distance_centimeter NOT NULL,
"width_type" uint8 NOT NULL,
"lane_type" uint32 NOT NULL,
"centerline" Binary_160 NOT NULL,
"connection_types" Binary_16 NOT NULL,
"curb_boundaries" Binary_160 NOT NULL,
"middle_boundaries" Binary_160 NOT NULL,
"lane_markings" Binary_16 NOT NULL,
"special_lane_types_references" Binary_16 NOT NULL,
"conditional_prohibitions_references" Binary_16 NOT NULL,
"binary_overflow" blob,
"isComplete" boolean NOT NULL,
CONSTRAINT "Lane_LaneGroup_idx" PRIMARY KEY(LaneGroup_ID, LocalLane_ID)
);
CREATE TABLE "LaneTopologyReference_psd21" (
"parentLaneGroup_ID" LaneGroupID NOT NULL,
"parentLocalLane_ID" uint8 NOT NULL,
"laneType" uint8 NOT NULL,
-- source(0), destination(1)
"transientOtherLaneGroup_ID" LaneGroupID NOT NULL,
"transientOtherLocalLane_ID" uint8 NOT NULL,
"otherLaneGroup_ID" LaneGroupID,
"otherLocalLane_ID" uint8,
FOREIGN KEY (parentLaneGroup_ID, parentLocalLane_ID) REFERENCES Lane_psd21 ON DELETE CASCADE,
FOREIGN KEY (otherLaneGroup_ID, otherLocalLane_ID) REFERENCES Lane_psd21 ON DELETE SET NULL,
KEY (transientOtherLaneGroup_ID, transientOtherLocalLane_ID)
);
CREATE TABLE "LaneGroup_Links_psd21" (
"LaneGroup_ID" LaneGroupID NOT NULL REFERENCES LaneGroup_psd21 ON DELETE CASCADE,
"Link_ID" LinkID NULL REFERENCES Link_psd21 ON DELETE SET NULL,
"transientLink_ID" LinkID KEY NOT NULL,
"offset_cm" uint32 NOT NULL,
"length_cm" uint32 NOT NULL,
"lanes_pos" uint32 NOT NULL,
"lanes_neg" uint32 NOT NULL,
"direction" uint8 NOT NULL,
);
CREATE TABLE "PluginLinkAttribute_psd21" (
"ID" rowid PRIMARY KEY,
"Link_Reference_ID" LinkID NOT NULL,
"offset" float32 NOT NULL,
"nType" uint8 NOT NULL,
"Value1" uint8 NOT NULL,
"Value2" uint8 NOT NULL,
"Source" uint16 NOT NULL,
FOREIGN KEY(Link_Reference_ID) REFERENCES Link_psd21(LinkID) ON DELETE CASCADE
);
CREATE INDEX "PluginLinkAttribute_psd21_idx" ON PluginLinkAttribute_psd21 (Link_Reference_ID, OFFSET);
CREATE TABLE "Region_psd21" (
/* The unique id of region within the map. */
"ID" rowid PRIMARY KEY,
/* The country code encoded as ISO 3166-1 numeric. */
"country_code_numeric" uint32 NOT NULL,
/* The country code encoded as ISO 3166-1 alpha-3. */
"country_code" uint8 array[3] NOT NULL,
/* The sub-country code encoded as ISO 3166-2 (second part only).
* The sub-country code is also called region code. */
"sub_country_code" uint8 array[3] NOT NULL,
/* The default speed unit. */
"speed_unit" uint8 NOT NULL,
/* The default traffic direction (right/left hand traffic). */
"traffic_direction" uint8 NOT NULL,
/* True if a u-turn is generally prohibited in the region.
* Only present if true, otherwise considered to be false or unknown.
* Link specific (contradicting) data override this default. */
"general_u_turn_prohibition" boolean NOT NULL,
/* Default lane width in centimeters for different road types.
Index in this array corresponds to the value of road type in the enum RoadType.
If there is no value specified for a road type, -1 will be used as value. */
"default_lane_width_cm" int32 array[4] NOT NULL,
/* The general speed limits that apply in this region. */
"general_speed_limits" Binary_16 NOT NULL,
"binary_overflow" blob,
/* if the PSD Data was parsed completely or not */
"isComplete" boolean NOT NULL,
);
CREATE TABLE "TrafficIncident_psd21" (
"trafficIncidentId" uint32 NOT NULL PRIMARY KEY,
"combinedEventCode" uint32 NOT NULL,
"spot_on_link" binary(20) NOT NULL,
"ranges_on_links" Binary_128 NOT NULL,
"areas" Binary_128 NOT NULL,
"binary_overflow" blob,
);
CREATE TABLE "ConnectedSpeedCourseLink_psd21" (
"link_id" LinkID NOT NULL PRIMARY KEY,
"metadata_wiper_frequency_threshold" uint32 NOT NULL,
"metadata_temperature_threshold_celsius" int32 NOT NULL,
"conditions" Binary_128 NOT NULL,
"speed_profile_events_pos" Binary_128 NOT NULL,
"speed_profile_events_neg" Binary_128 NOT NULL,
"binary_overflow" blob,
"isComplete" boolean NOT NULL,
);
CREATE TABLE "SpeedLimitsOnline" (
"link_id" LinkID NOT NULL PRIMARY KEY,
"attributes_speedlimits" Binary_128 NOT NULL,
"binary_overflow" blob,
"isComplete" boolean NOT NULL,
);
CREATE TABLE "LandmarkGroup_psd21" (
"LandmarkGroup_ID" LandmarkGroupID NOT NULL PRIMARY KEY,
"isComplete" boolean NOT NULL
);
CREATE TABLE "Tile_LandmarkGroup_psd21" (
"landmarkGroupID" LandmarkGroupID NOT NULL,
"tileID" uint32 NOT NULL REFERENCES Tile_psd21, -- (in code) ON DELETE RESTRICT,
CONSTRAINT "Tile_LandmarkGroup_ID" PRIMARY KEY (landmarkGroupID, tileID)
);