This document describes the NGSI-LD data model and entity types used in UrbanReflex for managing smart city data in Ho Chi Minh City.
- Overview
- NGSI-LD Basics
- Core Entity Types
- Entity Relationships
- Spatial Properties
- Temporal Properties
- Data Standards
- Examples
UrbanReflex uses NGSI-LD as the foundation for its data model. NGSI-LD is a standardized API and information model for context information management, developed by ETSI and adopted by FIWARE.
Key Benefits:
- Standardized data representation
- Interoperability with FIWARE ecosystem
- Support for linked data (JSON-LD)
- Built-in spatial and temporal capabilities
- Relationship management between entities
Data Model Philosophy:
- Reuse existing FIWARE data models where possible
- Extend with custom properties when needed
- Maintain compatibility with NGSI-LD specification
- Use RoadSegment as the central linking entity
Every NGSI-LD entity has the following core elements:
{
"@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld",
"id": "urn:ngsi-ld:EntityType:uniqueId",
"type": "EntityType",
"propertyName": {
"type": "Property",
"value": "property value"
},
"relationshipName": {
"type": "Relationship",
"object": "urn:ngsi-ld:RelatedEntity:id"
},
"locationName": {
"type": "GeoProperty",
"value": {
"type": "Point",
"coordinates": [longitude, latitude]
}
}
}Core Components:
@context: JSON-LD context defining namespacesid: Unique identifier (URN format)type: Entity type name- Properties: Attributes with values
- Relationships: Links to other entities
- GeoProperties: Spatial data
Property:
- Represents an attribute with a value
- Can include metadata (unit, observedAt, etc.)
"temperature": {
"type": "Property",
"value": 28.5,
"unitCode": "CEL",
"observedAt": "2025-12-08T10:00:00Z"
}Relationship:
- Links to another entity
- Points to entity by ID
"refRoadSegment": {
"type": "Relationship",
"object": "urn:ngsi-ld:RoadSegment:HoChiMinh-001"
}GeoProperty:
- Geographic data in GeoJSON format
- Supports Point, LineString, Polygon
"location": {
"type": "GeoProperty",
"value": {
"type": "Point",
"coordinates": [106.7009, 10.7756]
}
}UrbanReflex uses the following main entity types, organized around RoadSegment as the central entity.
Represents logical segments of the road network in Ho Chi Minh City.
Based On: FIWARE dataModel.Transportation/RoadSegment
Purpose: Backbone for linking infrastructure, environmental data, and citizen reports
Key Properties:
name: Street namelocation: LineString geometry of the roadroadClass: Type of road (primary, secondary, residential)length: Road segment length in meterswidth: Road width in meterslaneCount: Number of lanessurfaceType: Road surface materialmaxSpeed: Speed limit
Example:
{
"@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld",
"id": "urn:ngsi-ld:RoadSegment:HoChiMinh-NguyenHue-001",
"type": "RoadSegment",
"name": {
"type": "Property",
"value": "Nguyen Hue Boulevard"
},
"location": {
"type": "GeoProperty",
"value": {
"type": "LineString",
"coordinates": [
[106.7009, 10.7756],
[106.7015, 10.7762],
[106.7021, 10.7768]
]
}
},
"roadClass": {
"type": "Property",
"value": "primary"
},
"length": {
"type": "Property",
"value": 450,
"unitCode": "MTR"
},
"width": {
"type": "Property",
"value": 24,
"unitCode": "MTR"
},
"laneCount": {
"type": "Property",
"value": 4
},
"surfaceType": {
"type": "Property",
"value": "asphalt"
},
"maxSpeed": {
"type": "Property",
"value": 40,
"unitCode": "KMH"
}
}Street lighting infrastructure located along road segments.
Based On: FIWARE dataModel.Streetlighting/Streetlight
Purpose: Monitor and manage public lighting infrastructure
Key Properties:
location: Point geometry of lamp positionrefRoadSegment: Link to associated roadstatus: on, off, defectivepowerState: Current power consumptionlampType: LED, sodium vapor, etc.luminousFlux: Light output in lumensinstallationDate: When installed
Example:
{
"@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld",
"id": "urn:ngsi-ld:Streetlight:HoChiMinh-001",
"type": "Streetlight",
"location": {
"type": "GeoProperty",
"value": {
"type": "Point",
"coordinates": [106.7009, 10.7756]
}
},
"refRoadSegment": {
"type": "Relationship",
"object": "urn:ngsi-ld:RoadSegment:HoChiMinh-NguyenHue-001"
},
"status": {
"type": "Property",
"value": "on",
"observedAt": "2025-12-08T20:00:00Z"
},
"powerState": {
"type": "Property",
"value": 45,
"unitCode": "WTT"
},
"lampType": {
"type": "Property",
"value": "LED"
},
"luminousFlux": {
"type": "Property",
"value": 3000,
"unitCode": "LUM"
},
"installationDate": {
"type": "Property",
"value": "2023-05-15T00:00:00Z"
}
}Weather observations for locations in the city.
Based On: FIWARE dataModel.Weather/WeatherObserved
Purpose: Track weather conditions affecting urban environment
Key Properties:
location: Point geometry of observationtemperature: Temperature in Celsiushumidity: Relative humidity percentagepressure: Atmospheric pressurewindSpeed: Wind speed in km/hprecipitation: Rainfall in mmdateObserved: Observation timestamp
Example:
{
"@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld",
"id": "urn:ngsi-ld:WeatherObserved:HoChiMinh-District1-20251208",
"type": "WeatherObserved",
"location": {
"type": "GeoProperty",
"value": {
"type": "Point",
"coordinates": [106.7009, 10.7756]
}
},
"temperature": {
"type": "Property",
"value": 32.5,
"unitCode": "CEL",
"observedAt": "2025-12-08T14:00:00Z"
},
"humidity": {
"type": "Property",
"value": 75,
"unitCode": "P1",
"observedAt": "2025-12-08T14:00:00Z"
},
"pressure": {
"type": "Property",
"value": 1013,
"unitCode": "HPA",
"observedAt": "2025-12-08T14:00:00Z"
},
"windSpeed": {
"type": "Property",
"value": 12,
"unitCode": "KMH",
"observedAt": "2025-12-08T14:00:00Z"
},
"precipitation": {
"type": "Property",
"value": 0,
"unitCode": "MMT",
"observedAt": "2025-12-08T14:00:00Z"
},
"dateObserved": {
"type": "Property",
"value": "2025-12-08T14:00:00Z"
}
}Air quality measurements for locations in the city.
Based On: FIWARE dataModel.Environment/AirQualityObserved
Purpose: Monitor air pollution and environmental health
Key Properties:
location: Point geometry of monitoring stationpm25: PM2.5 concentration in µg/m³pm10: PM10 concentration in µg/m³no2: Nitrogen dioxide concentrationo3: Ozone concentrationco: Carbon monoxide concentrationso2: Sulfur dioxide concentrationaqi: Air Quality IndexdateObserved: Observation timestamp
Example:
{
"@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld",
"id": "urn:ngsi-ld:AirQualityObserved:HoChiMinh-District1-20251208",
"type": "AirQualityObserved",
"location": {
"type": "GeoProperty",
"value": {
"type": "Point",
"coordinates": [106.7009, 10.7756]
}
},
"pm25": {
"type": "Property",
"value": 35.2,
"unitCode": "GQ",
"observedAt": "2025-12-08T14:00:00Z"
},
"pm10": {
"type": "Property",
"value": 58.7,
"unitCode": "GQ",
"observedAt": "2025-12-08T14:00:00Z"
},
"no2": {
"type": "Property",
"value": 42.1,
"unitCode": "GQ",
"observedAt": "2025-12-08T14:00:00Z"
},
"o3": {
"type": "Property",
"value": 28.5,
"unitCode": "GQ",
"observedAt": "2025-12-08T14:00:00Z"
},
"aqi": {
"type": "Property",
"value": 87,
"observedAt": "2025-12-08T14:00:00Z"
},
"dateObserved": {
"type": "Property",
"value": "2025-12-08T14:00:00Z"
}
}Points of interest such as schools, hospitals, parks, and public facilities.
Based On: FIWARE dataModel.PointOfInterest/PointOfInterest
Purpose: Map important locations affecting urban planning and citizen reports
Key Properties:
name: Name of the POIlocation: Point geometrycategory: Type (hospital, school, park, etc.)address: Physical addresscontactPoint: Contact informationopeningHours: Operating hours
Example:
{
"@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld",
"id": "urn:ngsi-ld:PointOfInterest:HoChiMinh-Hospital-District1",
"type": "PointOfInterest",
"name": {
"type": "Property",
"value": "District 1 General Hospital"
},
"location": {
"type": "GeoProperty",
"value": {
"type": "Point",
"coordinates": [106.7009, 10.7756]
}
},
"category": {
"type": "Property",
"value": ["hospital", "healthcare"]
},
"address": {
"type": "Property",
"value": {
"streetAddress": "123 Nguyen Hue Boulevard",
"addressLocality": "District 1",
"addressRegion": "Ho Chi Minh City",
"postalCode": "700000",
"addressCountry": "VN"
}
},
"contactPoint": {
"type": "Property",
"value": {
"telephone": "+84-28-1234567",
"email": "info@district1hospital.vn"
}
},
"openingHours": {
"type": "Property",
"value": "Mo-Su 00:00-24:00"
}
}Reports created by citizens about infrastructure or environmental issues.
Based On: NGSI-LD core + project-specific fields
Purpose: Enable citizen participation in urban monitoring
Key Properties:
description: Report descriptionlocation: Point geometry of issuecategory: Issue category (infrastructure, environment, safety, etc.)priority: low, medium, high, criticalstatus: pending, in_progress, resolved, rejectedrefRoadSegment: Related road segmentreportedBy: User who created reportimages: Attached imagesassignedTo: Responsible agency
Example:
{
"@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld",
"id": "urn:ngsi-ld:CitizenReport:HoChiMinh-001",
"type": "CitizenReport",
"description": {
"type": "Property",
"value": "Large pothole on Nguyen Hue Boulevard causing traffic issues and vehicle damage"
},
"location": {
"type": "GeoProperty",
"value": {
"type": "Point",
"coordinates": [106.7009, 10.7756]
}
},
"category": {
"type": "Property",
"value": "infrastructure"
},
"priority": {
"type": "Property",
"value": "high"
},
"status": {
"type": "Property",
"value": "pending"
},
"refRoadSegment": {
"type": "Relationship",
"object": "urn:ngsi-ld:RoadSegment:HoChiMinh-NguyenHue-001"
},
"reportedBy": {
"type": "Property",
"value": "user@example.com"
},
"images": {
"type": "Property",
"value": [
"https://storage.urbanreflex.dev/reports/report-001-image1.jpg",
"https://storage.urbanreflex.dev/reports/report-001-image2.jpg"
]
},
"assignedTo": {
"type": "Property",
"value": "maintenance@hcmc.gov.vn"
},
"createdAt": "2025-12-08T10:00:00Z",
"modifiedAt": "2025-12-08T10:30:00Z"
}The data model is organized around RoadSegment as the central linking entity.
┌─────────────────┐
│ RoadSegment │
│ (Central Hub) │
└────────┬────────┘
│
┌────────────────┼────────────────┐
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Streetlight │ │CitizenReport │ │PointOfInterest│
│refRoadSegment│ │refRoadSegment│ │ near road │
└──────────────┘ └──────────────┘ └──────────────┘
│ │ │
▼ ▼ ▼
(Infrastructure) (Issues) (Context)
┌────────────────┼────────────────┐
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│WeatherObserved│ │AirQualityObserved│ (Other data)
│ observes │ │ observes │
│ road area │ │ road area │
└──────────────┘ └──────────────┘
1. Direct References (Relationship type)
Streetlight.refRoadSegment→RoadSegmentCitizenReport.refRoadSegment→RoadSegment
2. Proximity-Based (Spatial queries)
PointOfInterestnearRoadSegment(via geo-query)WeatherObservedaffectingRoadSegmentareaAirQualityObservedmeasuringRoadSegmentarea
3. Temporal Associations
- Multiple observations over time for same location
- Historical data linked by entity ID and timestamp
Get all Streetlights for a Road:
GET /ngsi-ld/v1/entities?type=Streetlight&q=refRoadSegment=="urn:ngsi-ld:RoadSegment:HoChiMinh-NguyenHue-001"Get nearby POIs (within 500m of a point):
GET /ngsi-ld/v1/entities?type=PointOfInterest&georel=near;maxDistance==500&geometry=Point&coordinates=[106.7009,10.7756]Get all reports for a road segment:
GET /ngsi-ld/v1/entities?type=CitizenReport&q=refRoadSegment=="urn:ngsi-ld:RoadSegment:HoChiMinh-NguyenHue-001"All spatial entities use NGSI-LD compatible GeoJSON geometries.
Point - Single location (POIs, sensors):
"location": {
"type": "GeoProperty",
"value": {
"type": "Point",
"coordinates": [106.7009, 10.7756]
}
}LineString - Road segments, routes:
"location": {
"type": "GeoProperty",
"value": {
"type": "LineString",
"coordinates": [
[106.7009, 10.7756],
[106.7015, 10.7762],
[106.7021, 10.7768]
]
}
}Polygon - Areas, districts:
"location": {
"type": "GeoProperty",
"value": {
"type": "Polygon",
"coordinates": [[
[106.7000, 10.7750],
[106.7020, 10.7750],
[106.7020, 10.7770],
[106.7000, 10.7770],
[106.7000, 10.7750]
]]
}
}- Format: [longitude, latitude]
- Coordinate Reference System: WGS84 (EPSG:4326)
- Precision: 6 decimal places (approximately 0.1 meter accuracy)
Near (within distance):
GET /ngsi-ld/v1/entities?georel=near;maxDistance==1000&geometry=Point&coordinates=[106.7009,10.7756]Within area:
GET /ngsi-ld/v1/entities?georel=within&geometry=Polygon&coordinates=[[[106.7,10.77],[106.71,10.77],[106.71,10.78],[106.7,10.78],[106.7,10.77]]]Intersects (for roads):
GET /ngsi-ld/v1/entities?georel=intersects&geometry=LineString&coordinates=[[106.7,10.77],[106.71,10.78]]Observation entities include temporal attributes:
dateObserved - When observation was made:
"dateObserved": {
"type": "Property",
"value": "2025-12-08T14:00:00Z"
}observedAt - Per-property observation time:
"temperature": {
"type": "Property",
"value": 32.5,
"observedAt": "2025-12-08T14:00:00Z"
}createdAt - Entity creation time (auto-generated):
"createdAt": "2025-12-08T10:00:00Z"modifiedAt - Last update time (auto-updated):
"modifiedAt": "2025-12-08T10:30:00Z"After timestamp:
GET /ngsi-ld/v1/temporal/entities?type=AirQualityObserved&timerel=after&timeAt=2025-12-01T00:00:00ZBefore timestamp:
GET /ngsi-ld/v1/temporal/entities?type=WeatherObserved&timerel=before&timeAt=2025-12-08T23:59:59ZBetween timestamps:
GET /ngsi-ld/v1/temporal/entities?type=AirQualityObserved&timerel=between&timeAt=2025-12-01T00:00:00Z&endTimeAt=2025-12-08T23:59:59ZEntity IDs:
- Format:
urn:ngsi-ld:EntityType:UniqueIdentifier - Example:
urn:ngsi-ld:RoadSegment:HoChiMinh-NguyenHue-001
Property Names:
- camelCase:
refRoadSegment,dateObserved - Descriptive:
temperature,humidity - Consistent with FIWARE models
Unit Codes:
- Use UN/CEFACT codes
- Examples:
CEL(Celsius),MTR(meters),KMH(km/h)
JSON Schema Validation:
- All entities validated against JSON schemas
- Located in
schemas/directory - Enforced before insertion to Orion-LD
Example Schema Usage:
# Validate entity before insertion
python scripts/validate_entities.py examples/example_citizen_report.jsonJSON-LD Contexts:
- Define semantic meaning of properties
- Located in
docs/jsonld/ - Referenced in
@contextfield
Example Context:
{
"@context": {
"location": "https://uri.etsi.org/ngsi-ld/location",
"refRoadSegment": "https://smartdatamodels.org/refRoadSegment",
"dateObserved": "https://smartdatamodels.org/dateObserved"
}
}Full entity examples are available in the examples/ directory:
example_road_segment.json- Road segment with full propertiesexample_streetlight.json- Streetlight with monitoring dataexample_weather_observed.json- Weather observationexample_air_quality_observed.json- Air quality measurementexample_point_of_interest.json- POI with contact infoexample_citizen_report.json- Citizen report with classification
Pre-generated datasets in open_data/:
RoadSegment.geojson- All road segmentsStreetlight.geojson- All streetlightsWeatherObserved.geojson- Weather observationsAirQualityObserved.geojson- Air quality dataPointOfInterest.geojson- Points of interestCitizenReport.geojson- Citizen reports
Also available in NDJSON format for bulk import.
1. View Examples:
cat examples/example_citizen_report.json2. Validate Entity:
python scripts/validate_entities.py examples/example_citizen_report.json3. Insert to Orion-LD:
curl -X POST http://localhost:1026/ngsi-ld/v1/entities \
-H "Content-Type: application/ld+json" \
-d @examples/example_citizen_report.json4. Query Entity:
curl http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:CitizenReport:001For implementation details, see:
- API_REFERENCE.md - API documentation
- ARCHITECTURE.md - System architecture
- DEVELOPMENT_SETUP.md - Setup guide