Data Models Contribution API

The schemas to be accepted in the Smart Data Model initiative need to include a description for every property. In order to review your data models before submission, it should pass this test.

Call: https://smartdatamodels.org/extra/check_schema.php

Parameters: (Mandatories)

  • schemaUrl: The link to the RAW version of the schema (see example)
  • mail: your mail
  • test: 1

Example: https://smartdatamodels.org/extra/check_schema.php?schemaUrl=https://raw.githubusercontent.com/smart-data-models/dataModel.Building/master/Building/schema.json&mail=alberto.abella@fiware.org&test=1

Output: A json payload with the list with of properties of the data model including those referenced through $ref and its status of documentation in the schema.

  • x-ngsi: Boolean. Describes if the description contains property, relationship or geoproperty in the description.
  • x-ngsi_text: Text. Further explanations about x-ngsi value.
  • documented: Boolean. If the description is complete enough for its use.
  • text: Text. complementary information about the documentation (It could be either incomplete or non-existing)

In order to be accepted all the properties have to include a relevant description, and therefore need to have both parameters x-ngsi and documented to True for all the properties.

We are on the transition to having all the data models compliant.

French translation of data models available

Most of the data models have a new file into its /doc directory name spec_FR.md. It contains a specification generated automatically based on the schema.json with all its texts translated into French. (With the deepL tool, so you can expect some ‘incorrect’ translated elements).

The official spec remains to be the spec.md file. However in coming days, the format, but not the name of this spec will change when the version named spec_EN-US.md will become official and it will replace the contents of spec.md.

Independently of what is happening the official version will always be spec.md.

Other languages, possibly German, Japanese and eventually Chinese are on the queue.

Spanish specification draft available

Most of the data models have a new file into its /doc directory name spec_ES.md. It contains a specification generated automatically based on the schema.json with all its texts translated into Spanish. (With the deepL tool, so you can expect some ‘incorrect’ translated elements.

The official spec remains to be the spec.md file. However in coming days the format, but not the name of this spec will change when the version named spec_EN-US.md will become official and it will replace the contents of spec.md.

Independently of what is happening the official version will be always spec.md.

Draft new specification

There is a new specification (in draft mode) in each directory (most of them) of the data models. It has the name spec_EN-US.md and it is drafting the new specification format for all the data models.

Currently, this format is under design and feedback is welcomed in this form, option feedback on the new specification.

 

New file new_model.yaml

You’ll notice that there is a new file in the directory of the data models named new_model.yaml

This file is a temporary version of model.yaml till we replace model.yaml (formerly created manually) for this new_model.yaml which is automatically generated from the json schema.

some other changes will be announced soon.

 

 

Migration to schema-generated specifications

In order to:

  1. Maintain updated the specifications
  2. Be able to provide them in multiple languages
  3. Being able to track what properties are already defined
  4. Populate properly the database of properties
  5. Have a shared image for all contributions
  6. Reduce the burden of work for the contributors (it will be reduced to just the documented json schema and the examples)

It has been decided that the description of the properties of the data models will be included in the schemas defining the data models (or those linked through $ref). so during next days, you will see minor changes in the schema.json of every data model in the initiative.

And although it will be announced previously all the spec.md will be replaced by an automatically generated (based on the info). See an example here. Design could be modified so any suggestion will be assessed and eventually implemented.

Customization will be possible through a new file named notes.yaml

This is taking most of our resources and impact on our bandwidth t provide answers to the PR, but we expect that this will reduce our workload significantly so we will be more agile after this change.

updated context.jsonld

The @context, located on the root of the github repository, of the initiative is now updated automatically.

The long URLs are now completely significative because either they point to the original URL of the property or they point to the terms.jsonld file where the definitions based on the existing data models are present.

 

Cheatsheet for installing a NGSI v2

We’ve submitted into the utils directory a short script for installing and running an instance of NGSI v2 and to create your first entity and to list it. It is not a complete guide which is available at FIWARE mains page in this link.

# 1.- if your are coming from a clean installation
sudo docker pull mongo:3.6
sudo docker pull fiware/orion
sudo docker network create fiware_default
sudo docker run -d –name=mongo-db –network=fiware_default –expose=27017 mongo:3.6 –bind_ip_all –smallfiles
sudo docker run -d –name fiware-orion -h orion –network=fiware_default -p 1026:1026 fiware/orion -dbhost mongo-db

# 2.- In case you already had a installation it is better to run these instructions
docker stop fiware-orion
docker rm fiware-orion
docker stop mongo-db
docker rm mongo-db
docker network rm fiware_default

# 3.- Check that your installation is up and running
curl -X GET ‘http://localhost:1026/version’

# 4.- Create your first entity
curl -iX POST ‘http://localhost:1026/v2/entities’ -H ‘Content-Type: application/json’ -d ‘
{
“id”: “urn:ngsi-ld:PhotovoltaicDevice:PhotovoltaicDevice:MNCA-PV-T2-R-012”,
“type”: “PhotovoltaicDevice”,
“name”: {
“type”: “Property”,
“value”: “DEVICE-PV-T2-R-012”
},
“alternateName”: {
“type”: “Property”,
“value”: “AirPort – global Observation”
},
“description”: {
“type”: “Property”,
“value”: “Photo-voltaic Device description”
},
“location”: {
“type”: “GeoProperty”,
“value”: {
“type”: “Point”,
“coordinates “: [43.664810, 7.196545]
}
},
“address”: {
“type”: “Property”,
“value”: {
“addressCountry”: “FR”,
“addressLocality”: “Nice”,
“streetAddress”: “Airport – Terminal 2 – Roof 2 – Local 12”
}
},
“areaServed”: {
“type”: “Property”,
“value”: “Nice Aeroport”
},
“refDevice”: {
“type”: “Relationship”,
“value”: “urn:ngsi-ld:Device:PV-T2-R-012”
},
“brandname”: {
“type”: “Property”,
“value”: “Canadian Solar”
},
“modelName”: {
“type”: “Property”,
“value”: “CS6P-270P”
},
“manufacturerName”: {
“type”: “Property”,
“value”: “Canadian Solar EMEA GmbH,”
},
“serialNumber”: {
“type”: “Property”,
“value”: [“CSPV270P-SN1804L6J34Z8742H”,
“CSPV270P-SN1804L6J34Z8743H”,
“CSPV270P-SN1804L6J34Z8744H”,
“CSPV270P-SN1804L6J34Z8745H”,
“CSPV270P-SN1804L6J34Z8746H”
]
},
“application”: {
“type”: “Property”,
“value”: “electric”
},
“cellType”: {
“type”: “Property”,
“value”: “polycrystalline”
},
“instalationMode”: {
“type”: “Property”,
“value”: “roofing”
},
“instalationCondition”: {
“type”: “Property”,
“value”: [“extremeHeat”, “extremeCold”, “extremeClimate”, “desert”]
},
“possibilityOfUsed”: {
“type”: “Property”,
“value”: “stationary”
},
“integrationMode”: {
“type”: “Property”,
“value”: “IAB”
},
“documentation”: {
“type”: “Property”,
“value”: “https://www.myDevicePV.Cn”
},
“owner”: {
“type”: “Property”,
“value”: [“Airport-Division Maintenance”]
},
“cellDimension”: {
“type”: “Property”,
“value”: {
“length”: 16.0,
“width”: 9.0,
“thickness”: 2.3
}
},
“moduleNbCells”: {
“type”: “Property”,
“value”: 60
},
“moduleDimension”: {
“type”: “Property”,
“value”: {
“length”: 1600,
“width”: 975,
“thickness”: 3.75
}
},
“panelNbModules”: {
“type”: “Property”,
“value”: 1
},
“panelDimension”: {
“type”: “Property”,
“value”: {
“length”: 1638,
“width”: 982,
“thickness”: 40
}
},
“panelWeight”: {
“type”: “Property”,
“value”: 18
},
“arealWeight”: {
“type”: “Property”,
“value”: 32
},
“maxPressureLoad”: {
“type”: “Property”,
“value”: {
“hail”: 2500,
“snow”: 5400,
“wind”: 2400
}
},
“NominalPower”: {
“type”: “Property”,
“value”: 270
},
“MaximumSystemVoltage”: {
“type”: “Property”,
“value”: 1000
},
“applicationClass”: {
“type”: “Property”,
“value”: “A”
},
“fireClass”: {
“type”: “Property”,
“value”: “C”
},
“pTCClass”: {
“type”: “Property”,
“value”: 92.1
},
“nTCClass”: {
“type”: “Property”,
“value”: 88.3
},
“protectionIP”: {
“type”: “Property”,
“value”: “IP67”
},
“moduleSTC”: {
“type”: “Property”,
“value”: {
“Pmax”: 270,
“Umpp”: 30.8,
“Impp”: 8.75,
“Uoc”: 37.9,
“Isc”: 9.32
}
},
“moduleNOCT”: {
“type”: “Property”,
“value”: {
“Pmax”: 196,
“Umpp”: 28.1,
“Impp”: 6.97,
“Uoc”: 34.8,
“Isc”: 7.55
}
},
“moduleYieldRate”: {
“type”: “Property”,
“value”: 16.79
},
“panelOperatingTemperature”: {
“type”: “Property”,
“value”: {
“min”: -40,
“max”: 85
}
},
“cellOperatingTemperature”: {
“type”: “Property”,
“value”: {
“min”: 45,
“max”: 2
}
},
“temperatureCoefficient”: {
“type”: “Property”,
“value”: {
“Pmax”: -0.41,
“Uoc”: -0.31,
“Isc”: 0.053
}
},
“performanceLowIrradiance”: {
“type”: “Property”,
“value”: 96.5
},
“panelLifetime”: {
“type”: “Property”,
“value”: 30
},
“panelYieldCurve”: {
“type”: “Property”,
“value”: [“95.0”, “92.5”, “90.0”, “87.5”, “85.0”, “80.0”]
},
“panelYieldRate”: {
“type”: “Property”,
“value”: 0.5
},
“panelTiltReference”: {
“type”: “Property”,
“value”: {
“min”: 28,
“max”: 37
}
}
}

# 5.- List the entity you have created
curl -G -X GET ‘http://localhost:1026/v2/entities’ -d ‘options=keyValues’

Drafting service for creation of automatic payloads of a Smart Data Model

We are in the way of creating a service for testing purposes for getting payloads according to a data model.

The service is under debugging, so it cannot be trusted for production purposes. Let us know issues here

In order to access it has to access this URL (https://smartdatamodels.org/extra/payload_generator.php) with these two parameters token and dataModel

I.e. with a weather observation in the link below:

https://smartdatamodels.org/extra/payload_generator.php?token=sSdme8954c9&dataModel=%22WeatherObserved (reload page several times for generation)

In the production stage, there will be necessary a token in order to, if necessary, to limit the access for a single user. Additionally, it should be available the options of normalized and keyvalues and for the NGSI v2 and LD.

Comments are welcomed

Drafting service for checking properties of a new data model

We are in the way of creating a service for those contributors willing to contribute with a complete data model.

The service is under debugging, so it cannot be trusted for production purposes. Let us know issues here

In order to access it has to access this URL (https://smartdatamodels.org/extra/check_properties.php) with this parameter ?urlSchema=[url of the raw access o the JSON schema]

I.e. a complete link could be

https://smartdatamodels.org/extra/check_properties.php?urlSchema=https://raw.githubusercontent.com/smart-data-models/dataModel.Agrifood/60755d5e970f18938a59dcb190a91ac5622c6c11/AgriParcel/schema.json

It returns a JSON payload indicating if this property is available for use (not used in any other data model) or in the case it is already being used what data models are currently using.