1 / 14

Context Data Update for Location Provider

This example demonstrates updating location data for a specific entity using Context Broker services.

terrancee
Download Presentation

Context Data Update for Location Provider

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Context Broker GE (R2.3): examples Sergio Rolando: sergio.rolando@guest.telecomitalia.it

  2. ContextML contextUpdate http://pubsub.lab.fi-ware.eu/CB/ContextBroker/contextUpdate(POST with body, content-type: “application/xml”) <?xml version="1.0" encoding="UTF-8"?> <contextML> <ctxEls> <ctxEl> <contextProvider id="MyClient" v="1.2.1"/> <entity id="123456789123" type="imei"/> <scope>position</scope> <timestamp>2012-05-20T11:12:19+01:00</timestamp> <expires>2012-05-20T11:21:22+01:00</expires> <dataPart> <par n="latitude">45.11045277777778</par> <par n="longitude">7.675251944444445</par> <par n="accuracy">50</par> <par n="locMode">GPS</par> </dataPart> </ctxEl> </ctxEls> </contextML>

  3. ContextML getContext http://pubsub.lab.fi-ware.eu/CB/ContextBroker/getContext?entity=imei|123456789123&scopeList=position Response: <?xml version="1.0" encoding="UTF-8"?> <contextML xmlns="http://ContextML/1.7" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ContextML/1.7 http://contextml.tilab.com/ContextML-1.7.xsd"> <timeRef>2012-11-12T16:37:30+01:00</timeRef> <ctxEls> <ctxEl> <contextProvider id="MyClient" v="1.2.1"/> <entity id="123456789123" type="imei"/> <scope>position</scope> <timestamp>2012-11-12T16:37:24+01:00</timestamp> <expires>2012-11-12T16:46:27+01:00</expires> <dataPart> <par n="latitude">45.11045277777778</par> <par n="longitude">7.675251944444445</par> <par n="accuracy">50</par> <par n="locMode">GPS</par> </dataPart> </ctxEl> </ctxEls> </contextML>

  4. NGSI updateContext: UPDATE action <?xml version="1.0" encoding="UTF-8"?> <updateContextRequest> <contextElementList> <contextElement> <entityId> <id>urn:username:sergio</id> </entityId> <contextAttributeList> <contextAttribute> <name>cell</name> <contextValue>222-1-61101-7066</contextValue> <metadata> <contextMetadata> <name>Timestamp</name> <value>2012-06-13T15:04:52+01:00</value> </contextMetadata> <contextMetadata> <name>Expires</name> <value>2012-06-13T15:06:52+01:00</value> </contextMetadata> <contextMetadata> <name>Source</name> <value>teamlife_1.0</value> </contextMetadata> </metadata> </contextAttribute> </contextAttributeList> </contextElement> </contextElementList> <updateAction>UPDATE</updateAction> </updateContextRequest> http://pubsub.lab.fi-ware.eu/ngsicbapi/NGSI10/updateContext  urn:[entity_type]:[entity_id]

  5. NGSI queryContext <?xml version="1.0" encoding="UTF-8"?> <queryContextRequest> <entityIdList> <entityId> <id>urn:username:cristinaF</id> </entityId> <entityId> <id>urn:username:sergio</id> </entityId> </entityIdList> <attributeList> <attribute>cell</attribute> </attributeList> <restriction> <attributeExpression>//contextAttribute[starts-with(contextValue,'222')]</attributeExpression> </restriction> </queryContextRequest> http://pubsub.lab.fi-ware.eu/ngsicbapi/NGSI10/queryContext

  6. Convenience functions  updateContext <?xml version="1.0" encoding="UTF-8"?> <updateContextElementRequest> <contextAttributeList> <contextAttribute> <name>cell</name> <contextValue>10</contextValue> <metadata> <contextMetadata> <name>Timestamp</name> <value>2012-10-24T18:22:30+02:00</value> </contextMetadata> <contextMetadata> <name>Expires</name> <value>2012-10-25T18:22:30+02:00</value> </contextMetadata> <contextMetadata> <name>Source</name> <value>testApp_1.0</value> </contextMetadata> </metadata> </contextAttribute> <contextAttribute> <name>position</name> <contextValue>20</contextValue> <metadata> <contextMetadata> <name>Timestamp</name> <value>2012-10-24T18:22:30+02:00</value> </contextMetadata> http://pubsub.lab.fi-ware.eu/ngsicbapi/NGSI10/contextEntities/urn:username:sergio (HTTP PUT) ... <contextMetadata> <name>Expires</name> <value>2012-10-25T18:22:30+02:00</value> </contextMetadata> <contextMetadata> <name>Source</name> <value>testApp_1.0</value> </contextMetadata> </metadata> </contextAttribute> </contextAttributeList> </updateContextElementRequest>

  7. Convenience functions  queryContext • http://pubsub.lab.fi-ware.eu/ngsicbapi/NGSI10/contextEntities/urn:username:sergio (HTTP GET) • http://pubsub.lab.fi-ware.eu/ngsicbapi/NGSI10/contextEntities/urn:username:sergio/attributes/cell (HTTP GET) • http://pubsub.lab.fi-ware.eu/ngsicbapi/NGSI10/contextEntityTypes/urn:username/attributes/cell (HTTP GET) Convenience functions  updateContext DELETE • http://pubsub.lab.fi-ware.eu/ngsicbapi/NGSI10/contextEntities/urn:username:sergio (HTTP DELETE) • http://pubsub.lab.fi-ware.eu/ngsicbapi/NGSI10/contextEntities/urn:username:sergio/attributes/cell (HTTP DELETE)

  8. NGSI subscribeContext (1) • http://pubsub.lab.fi-ware.eu/ngsicbapi/NGSI10/contextSubscriptions (HTTP POST) • http://pubsub.lab.fi-ware.eu/ngsicbapi/NGSI10/subscribeContext (HTTP POST) <?xml version="1.0" encoding="UTF-8"?> <subscribeContextRequest> <entityIdList> <entityId type="urn:username" isPattern="false"> <id>urn:username:sergio</id> </entityId> </entityIdList> <attributeList> <attribute>cell</attribute> </attributeList> <reference>http://127.0.0.1:8080/CB/ContextBroker/testCallback</reference> <duration>PT300S</duration> <restriction> <attributeExpression>//contextAttribute/metadata/contextMetadata[name='Timestamp']/value</attributeExpression> </restriction> </subscribeContextRequest> <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <subscribeContextResponse> <subscribeResponse> <subscriptionId>82200cca-0aa4-422b-95ea-138b98cb1fc2</subscriptionId> <duration>PT300S</duration> </subscribeResponse> </subscribeContextResponse> Response

  9. NGSI subscribeContext (2): ONCHANGE condition • http://pubsub.lab.fi-ware.eu/ngsicbapi/NGSI10/contextSubscriptions (HTTP POST) • http://pubsub.lab.fi-ware.eu/ngsicbapi/NGSI10/subscribeContext (HTTP POST) <?xml version="1.0" encoding="UTF-8"?> <subscribeContextRequest> <entityIdList> <entityId> <id>urn:username:sergio</id> </entityId> </entityIdList> <attributeList> <attribute>cell</attribute> </attributeList> <reference>http://127.0.0.1:8080/CB/ContextBroker/testCallback</reference> <duration>PT5M</duration> <notifyConditions> <notifyCondition> <type>ONCHANGE</type> <condValueList> <condValue>cell</condValue> <condValue>position</condValue> </condValueList> </notifyCondition> </notifyConditions> </subscribeContextRequest> <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <subscribeContextResponse> <subscribeResponse> <subscriptionId>82200cca-0aa4-422b-95ea-138b98cb1fc2</subscriptionId> <duration>PT300S</duration> </subscribeResponse> </subscribeContextResponse> Response

  10. CQL subscription http://pubsub.lab.fi-ware.eu/CB/ContextBroker/getContextQL (HTTP POST with parameters, content-type=“application/x-www-form-urlencoded”) cqlReq=<?xml version="1.0" encoding="UTF-8"?> <contextQL xmlns="http://ContextQL/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ContextQL/1.1 http://cark3.cselt.it/schemas/ContextQL-1.1.xsd"> <ctxQuery> <action type="SUBSCRIBE" /> <entity>username|cristinaF</entity> <scope>cell</scope> <validity>180</validity> </ctxQuery> </contextQL>&callbackUrl=http://127.0.0.1:8080/CB/ContextBroker/testCallback <?xml version="1.0" encoding="UTF-8"?> <contextML xmlns="http://ContextML/1.7" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ContextML/1.7 http://contextml.tilab.com/ContextML-1.7.xsd"> <ctxResp> <contextProvider id="CB" v="1.4.5"/> <timestamp>2012-11-13T16:35:35+01:00</timestamp> <method>getContextQL</method> <resp status="OK" code="200"/> <validity>180</validity> <subId>62</subId> </ctxResp> </contextML> Response

  11. NGSI-9 registerContext (1) http://pubsub.lab.fi-ware.eu/NGSI9/registerContext (HTTP POST) <?xml version="1.0" encoding="UTF-8"?> <registerContextRequest> <contextRegistrationList> <contextRegistration> <entityIdList> <entityId> <id>urn:username:sergio</id> </entityId> <entityId> <id>urn:username:cristina</id> </entityId> </entityIdList> <contextRegistrationAttributeList> <contextRegistrationAttribute> <name>cell</name> </contextRegistrationAttribute> </contextRegistrationAttributeList> <providingApplication>http://localhost:8080/ngsicbapi/testProvider</providingApplication> </contextRegistration> </contextRegistrationList> <duration>PT3000S</duration> <registrationId>b56a91aa-a552-487a-ac8b-1ed025969c4e</registrationId> </registerContextRequest> <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <registerContextResponse> <registrationId>b56a91aa-a552-487a-ac8b-1ed025969c4e</registrationId> </registerContextResponse> Response

  12. NGSI-9 registerContext (2) http://pubsub.lab.fi-ware.eu/NGSI9/contextEntities/urn:username:sergio/attributes/cell (HTTP POST) <?xml version="1.0" encoding="UTF-8"?> <registerProviderRequest> <duration>PT300S</duration> <providingApplication>http://localhost:8080/ngsicbapi/testProvider</providingApplication> </registerProviderRequest> <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <registerContextResponse> <registrationId>b56a91aa-a552-487a-ac8b-1ed025969c4e</registrationId> </registerContextResponse> Response

  13. Further stuff... • NGSI/ContextML cross working (e.g ContextML update NGSI queryContext) • NGSI subscription renew/delete • JSON in the beginning: • Content-Type: application/json;charset=UTF-8 • Accept: application/json;charset=UTF-8 • ....

  14. References • OMA NGSI Spec: • http://www.openmobilealliance.org/Technical/release_program/docs/NGSI/V1_0-20101207-C/OMA-TS-NGSI_Context_Management-V1_0-20100803-C.pdf • FIWARE NGSI Open RESTFul API Specification: • http://forge.fi-ware.eu/plugins/mediawiki/wiki/fiware/index.php/FI-WARE_NGSI_Open_RESTful_API_Specification_(PRELIMINARY) • Questions, etc... : • sergio.rolando@guest.telecomitalia.it

More Related