Home chevron_right Documentation

API

NGSI-LD API Access Guide

Access Open Data Models attribute descriptions through standardized NGSI-LD queries

📘 What is this API?

This page provides information on how to access the Open Data Models attribute descriptions through the NGSI-LD API.

📊 Data Model Structure

Property Type Description
id string (URI) Unique identifier for the attribute
type string NGSI-LD Entity type (always “Attribute”)
attributeName string Name of the attribute
dataModel string The data model this attribute belongs to
description string Description of the attribute
dataType string Data type of the attribute (string, number, etc.)
modelTags string Tags associated with the data model
repoLink string (URL) Link to the GitHub repository

📚 Full Specification: You can view the complete data model specification at:
GitHub Specification |
JSON Schema

💡 Example Queries

Example 1: Querying a Specific Attribute

To retrieve information about a specific attribute, you can query by its unique identifier. Here’s an example querying the name attribute from the MachineLearning data model:

🔹 Using cURL

cURL
curl -X GET \
  'http://opendatamodels.org:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Attribute:smartdatamodels.org:dataModel.MachineLearning:MLProcessing:name%230.0.2' \
  -H 'Accept: application/ld+json'

🔹 Using Python

Python
import requests
import json

url = "http://opendatamodels.org:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Attribute:smartdatamodels.org:dataModel.MachineLearning:MLProcessing:name%230.0.2"
headers = {
    "Accept": "application/ld+json"
}

response = requests.get(url, headers=headers)
data = response.json()
print(json.dumps(data, indent=2))

🔹 Using JavaScript (Node.js/Browser)

JavaScript
const url = "http://opendatamodels.org:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Attribute:smartdatamodels.org:dataModel.MachineLearning:MLProcessing:name%230.0.2";

fetch(url, {
  method: 'GET',
  headers: {
    'Accept': 'application/ld+json'
  }
})
  .then(response => response.json())
  .then(data => console.log(JSON.stringify(data, null, 2)))
  .catch(error => console.error('Error:', error));

✅ Example Response

{
  "id": "urn:ngsi-ld:Attribute:smartdatamodels.org:dataModel.MachineLearning:MLProcessing:name#0.0.2",
  "type": "Attribute",
  "attributeName": {
    "type": "Property",
    "value": "name"
  },
  "dataModel": {
    "type": "Property",
    "value": "MLProcessing"
  },
  "description": {
    "type": "Property",
    "value": "The name of this item"
  },
  "dataType": {
    "type": "Property",
    "value": "string"
  },
  "modelTags": {
    "type": "Property",
    "value": "ML, MachineLearning, AI"
  },
  "repoLink": {
    "type": "Property",
    "value": "https://github.com/smart-data-models/dataModel.MachineLearning"
  },
  "@context": [
    "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld"
  ]
}

Example 2: Querying Another Attribute (Urban Mobility)

Here’s another example querying the description attribute from the UrbanMobility data model:

🔹 Using cURL

cURL
curl -X GET \
  'http://opendatamodels.org:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Attribute:smartdatamodels.org:dataModel.UrbanMobility:GtfsStopTime:description%230.0.2' \
  -H 'Accept: application/ld+json'

🔹 Using Python

Python
import requests
import json

url = "http://opendatamodels.org:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Attribute:smartdatamodels.org:dataModel.UrbanMobility:GtfsStopTime:description%230.0.2"
headers = {
    "Accept": "application/ld+json"
}

response = requests.get(url, headers=headers)
data = response.json()
print(json.dumps(data, indent=2))

🔹 Using JavaScript (Node.js/Browser)

JavaScript
const url = "http://opendatamodels.org:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Attribute:smartdatamodels.org:dataModel.UrbanMobility:GtfsStopTime:description%230.0.2";

fetch(url, {
  method: 'GET',
  headers: {
    'Accept': 'application/ld+json'
  }
})
  .then(response => response.json())
  .then(data => console.log(JSON.stringify(data, null, 2)))
  .catch(error => console.error('Error:', error));

✅ Example Response

{
  "id": "urn:ngsi-ld:Attribute:smartdatamodels.org:dataModel.UrbanMobility:GtfsStopTime:description#0.0.2",
  "type": "Attribute",
  "attributeName": {
    "type": "Property",
    "value": "description"
  },
  "dataModel": {
    "type": "Property",
    "value": "GtfsStopTime"
  },
  "description": {
    "type": "Property",
    "value": "A description of this item"
  },
  "dataType": {
    "type": "Property",
    "value": "string"
  },
  "modelTags": {
    "type": "Property",
    "value": "GTFS, UrbanMobility, Transportation"
  },
  "repoLink": {
    "type": "Property",
    "value": "https://github.com/smart-data-models/dataModel.UrbanMobility"
  },
  "@context": [
    "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld"
  ]
}

Example 3: Query Structure for Searching Attributes

While this page doesn’t execute live queries, you can search for attributes using NGSI-LD query parameters. Here’s an example structure for filtering attributes by data model:

cURL
curl -X GET \
  'http://opendatamodels.org:1026/ngsi-ld/v1/entities/?type=Attribute&q=dataModel==%22MLProcessing%22' \
  -H 'Accept: application/ld+json'

Query Parameters Explanation:

  • type=Attribute – Filters entities to only Attribute types
  • q=dataModel=="MLProcessing" – Filters by the dataModel property value
  • You can combine multiple conditions using & or | operators

âš ī¸ Note: Remember to URL-encode special characters in your queries. The # character in attribute IDs should be encoded as %23.

📚 NGSI-LD Standard Resources

To learn more about the NGSI-LD standard and how to work with NGSI-LD APIs, please refer to these resources:

â„šī¸ Additional Information

Attribute ID Format

Attribute identifiers follow this structure:

urn:ngsi-ld:Attribute:smartdatamodels.org:[domain]:[dataModel]:[attributeName]#[version]

Example breakdown:

  • urn:ngsi-ld:Attribute – NGSI-LD URN prefix and entity type
  • smartdatamodels.org – Authority/namespace
  • dataModel.MachineLearning – Domain identifier
  • MLProcessing – Data model name
  • name – Attribute name
  • version – Version of the schema of the data model
Last updated: