본문으로 건너뛰기

8.5. Sample

8.5.1. Mobius Cnt 생성

8.5.1.1. Container 생성

POST {{mp_url}}/Mobius/poc-park-5/park-5-02/34952_1.0_0/data-report
X-M2M-RI {{ri}}
X-M2M-Origin {{aei}}

{
"m2m:cnt": {
"rn": {{Resource Name}},
"lbl": []
}
}

8.5.2. Mobius Lbl 추가

8.5.2.1. Container Label 수정

PUT {{mp_url}}/Mobius/poc-park-5/park-5-02/34952_1.0_0/data-report
X-M2M-RI {{ri}}
X-M2M-Origin {{aei}}

{
"m2m:cnt": {
"lbl": [
"Iwked-Technology:NGSI-LD",
"Iwked-Direction:[\"oneM2MtoNGSI-LD\"]",
"NGSI-LD-Context:[\"http://uri.citydatahub.kr/ngsi-ld/aiot/thermometer.jsonld\",\"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld\"]",
"Iwked-Entity-Type:Thermometer",
"Iwked-Related-Resources:[\"Mobius/poc-park-5/park-5-02/34952_1.0_0/data-report\"]",
"Iwked-mapping-rule:[{\"oneM2MAttributeName\":\"con\",\"oneM2MJsonPath\":\"$.Temperature\",\"oneM2MDataType\":\"Double\",\"ngsi-ldQueryTermAttributePath\":\"temperature\",\"ngsi-ldAttributeType\":\"Property\",\"ngsi-ldAttributeDataType\":\"Double\"},{\"oneM2MAttributeName\":\"con\",\"oneM2MJsonPath\":\"$.ReportingCycle\",\"oneM2MDataType\":\"Integer\",\"ngsi-ldQueryTermAttributePath\":\"reportingCycle\",\"ngsi-ldAttributeType\":\"Property\",\"ngsi-ldAttributeDataType\":\"Integer\"},{\"oneM2MAttributeName\":\"con\",\"oneM2MJsonPath\":\"$.DurationCycle\",\"oneM2MDataType\":\"Integer\",\"ngsi-ldQueryTermAttributePath\":\"detectionCycle\",\"ngsi-ldAttributeType\":\"Property\",\"ngsi-ldAttributeDataType\":\"Integer\"},{\"oneM2MResourceId\":\"Mobius/poc-park-5/park-5-02/34952_1.0_0/data-report\",\"oneM2MAttributeName\":\"lt\",\"oneM2MDataType\":\"Date\",\"oneM2MDateFormat\":\"yyyyMMdd'T'HHmmss\",\"ngsi-ldQueryTermAttributePath\":\"temperature.observedAt\",\"ngsi-ldAttributeType\":\"Property\",\"ngsi-ldAttributeDataType\":\"Date\",\"ngsi-ldDateFormat\":\"yyyy-MM-dd'T'HH:mm:ss,SSSXXX\"}]"
],
}
}

8.5.2.2. Resource mapping Sampling

  • Interworking mapping labels keys Sample Value
Label Key NameSample Value
Iwked-TechnologyNGSI-LD
Iwked-Entity-TypeThermometer
Iwked-mapping-ruleData type 참고
Iwked-Entity-ID
Iwked-Related-Resources["building/ae-interworking/poc-park-5/park-5-02/34952_1_0_0/data-report"]
NGSI-LD-Context["http://uri.citydatahub.kr/ngsi-ld/aiot/thermometer.jsonld", "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld"]
Iwked-Direction["oneM2MtoNGSI-LD"]
  • Data type of Mapping Rule Sample Value
NameSample Value
oneM2MResourceId
oneM2MAttributeNamecon
oneM2MJsonPath$.Temperature
oneM2MDataTypeDouble
ngsi-ldQueryTermAttributePathtemperature
ngsi-ldAttributeTypeProperty
ngsi-ldAttributeDataTypeDouble
ngsi-ldAttributeParentInformation

8.5.3. Datacore Model 생성

POST {{DATACORE_DATA_MANAGER}}/datamodels

{
"context": [
"http://uri.citydatahub.kr/ngsi-ld/aiot/thermometer.jsonld",
"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld"
],
"id": "Thermometer",
"type": "Thermometer",
"typeUri": "http://uri.citydatahub.kr/ngsi-ld/aiot/Termometer",
"name": "Termometer",
"attributes": [
{
"name": "location",
"isRequired": false,
"valueType": "GeoJson",
"attributeType": "GeoProperty",
"hasObservedAt": true,
"hasUnitCode": false,
"attributeUri": "https://uri.etsi.org/ngsi-ld/location"
},
{
"name": "temperature",
"isRequired": true,
"valueType": "Double",
"attributeType": "Property",
"hasObservedAt": true,
"hasUnitCode": false,
"attributeUri": "http://uri.citydatahub.kr/ngsi-ld/aiot/Thermometer/temperature"
},
{
"name": "reportingCycle",
"isRequired": false,
"valueType": "Integer",
"attributeType": "Property",
"hasObservedAt": false,
"hasUnitCode": false,
"attributeUri": "http://uri.citydatahub.kr/ngsi-ld/aiot/Thermometer/reportingCycle"
},
{
"name": "detectionCycle",
"isRequired": false,
"valueType": "Integer",
"attributeType": "Property",
"hasObservedAt": false,
"hasUnitCode": false,
"attributeUri": "http://uri.citydatahub.kr/ngsi-ld/aiot/Thermometer/detectionCycle"
}
]
}

8.5.4. Datacore Dataset 생성

POST {{DATACORE_DATA_MANAGER}}/datasets

{
"id": "ThermometerDemoDataset",
"name": "ThermometerDemoDataset",
"updateInterval": "-",
"category": "환경",
"providerOrganization": "-",
"providerSystem": "-",
"isProcessed": "원천데이터",
"ownership": "-",
"license": "CC BY",
"datasetItems": "-",
"targetRegions": "-",
"qualityCheckEnabled": true,
"dataModelId": "Thermometer",
"enabled": true
}

8.5.5. IPE 매핑 테이블 확인

PGPASSWORD=[Password] psql -h [Database IP] -U [Username] -d [Databasename] -c 'select * from IPE.CONTAINER_METADATA_BASE'

8.5.6. Mobius Cin 생성

POST {{mp_url}}/Mobius/poc-park-5/park-5-02/34952_1.0_0/data-report
X-M2M-RI {{ri}}
X-M2M-Origin {{aei}}

{
"m2m:cin": {
"con": {
"Temperature": 20.706926,
"ReportingCycle": 300,
"DurationCycle": 60,
"Timestamp": 1699457358
}
}
}

8.5.7. Datacore 조회

GET {{DATACORE_DATA_MANAGER}}/entities?type=Thermometer&options=sysAttrs
Accept application/ld+json
Link <http://uri.citydatahub.kr/ngsi-ld/aiot/thermometer.jsonld>,<https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld>