Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-15141

[fiware-stackoverflow] Conflict Error when obtaining attributes in FIWARE Orion Context Broker

    Details

      Description

      Created question in FIWARE Q/A platform on 10-12-2018 at 18:12
      Please, ANSWER this question AT https://stackoverflow.com/questions/53710837/conflict-error-when-obtaining-attributes-in-fiware-orion-context-broker

      Question:
      Conflict Error when obtaining attributes in FIWARE Orion Context Broker

      Description:
      I cannot get any entity attribute when I have context provider registered. I constantly get the same 409 conflict error. How can I prevent having two objects with the same id and merge them into one?

      SETUP

      I have whole Orion Context Broker all setup and running after following this commands:

      docker pull mongo:3.6
      docker pull fiware/orion:2.0.0
      docker network create fiware_default

      docker run -d --name=mongo-db --network=fiware_default \
      --expose=27017 mongo:3.6 --bind_ip_all --smallfiles
      docker run -d --name fiware-orion -h orion --network=fiware_default \
      -p 1026:1026 fiware/orion:2.0.0 -dbhost mongo-db

      ENTITIES

      I have one Car entity:

      {
      "id": "urn:ngsi-ld:Car:001",
      "type": "Car",
      "brandName": {
      "type": "Property",
      "value": "Mercedes",
      "metadata": {}
      },
      "location": {
      "type": "geo:json",
      "value":

      { "type": "Point", "coordinates": [ 0, 0 ] }

      ,
      "metadata": {}
      },
      "name": {
      "type": "Text",
      "value": "MyCar",
      "metadata": {}
      }
      }

      Moreover I also registered my Context Provider:

      {
      "description": "Temperature",
      "dataProvided": {
      "entities": [

      { "id": "urn:ngsi-ld:Car:001", "type": "Car" }

      ],
      "attrs": [
      "temperature"
      ]
      },
      "provider": {
      "http":

      { "url": "http://192.168.xxx.xxx:8080/temperature/1" }

      ,
      "legacyForwarding": true
      }
      }

      CONTEXT PROVIDER

      I exposed locally my Context Provider (exposed by my SpringBoot application written in Java 10) at http://192.168.xxx.xxx:8080/temperature/1/queryContext. The JSON data (returned in html body) is in NSGI v1 format and looks like that:

      {
      "contextResponses": [
      {
      "contextElement": {
      "attributes": [

      { "name": "temperature", "type": "float", "value": "-10" }

      ],
      "id": "urn:ngsi-ld:Car:001",
      "isPattern": "false",
      "type": "Car"
      },
      "statusCode":

      { "code": "200", "reasonPhrase": "OK" }

      }
      ]
      }

      PROBLEM

      When I try to get attribute (location) without registered context, it works fine for me, but after context registration it fails (I get 409 Conflict Error).

      { "error": "TooManyResults", "description": "More than one matching entity. Please refine your query" }

      On the other hand, I can remove entity by id and then I can get temperature for not existing object.

      When I have both entity and context provider for this entity and I make this query:

      curl GET 'http://localhost:1026/v2/entities?type=Car&options=keyValues'

      I receive list of objects with the same ids:

      [

      {"id":"urn:ngsi-ld:Car:001","type":"Car","brandName":"Mercedes","location":,"name":"MyCar"}

      ,

      {"id":"urn:nsgi-ld:Car:001","type":"Car","temperature":"-10"}

      ]

      What should I do to prevent this id conflict? How to prevent having two objects with the same id when registering context provider?

        Activity

        Hide
        backlogmanager Backlog Manager added a comment -

        2018-12-10 21:05|CREATED monitor | # answers= 0, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2018-12-10 21:05|CREATED monitor | # answers= 0, accepted answer= False

          People

          • Assignee:
            jmcantera Jose Manuel Cantera
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: