[Backlogmanager] [FIWARE-JIRA] (HELP-15141) [fiware-stackoverflow] Conflict Error when obtaining attributes in FIWARE Orion Context Broker

Fernando Lopez (JIRA) jira-help-desk at jira.fiware.org
Mon Jan 7 10:06:00 CET 2019


     [ https://jira.fiware.org/browse/HELP-15141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Fernando Lopez updated HELP-15141:
----------------------------------
    Description: 
Created question in FIWARE Q/A platform on 10-12-2018 at 18:12
{color: red}Please, ANSWER this question AT{color} 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?


  was:

Created question in FIWARE Q/A platform on 10-12-2018 at 18:12
{color: red}Please, ANSWER this question AT{color} 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?


     HD-Enabler: Orion

> [fiware-stackoverflow] Conflict Error when obtaining attributes in FIWARE Orion Context Broker
> ----------------------------------------------------------------------------------------------
>
>                 Key: HELP-15141
>                 URL: https://jira.fiware.org/browse/HELP-15141
>             Project: Help-Desk
>          Issue Type: Monitor
>          Components: FIWARE-TECH-HELP
>            Reporter: Backlog Manager
>              Labels: attributes, fiware, fiware-orion, id, name-conflict
>
> Created question in FIWARE Q/A platform on 10-12-2018 at 18:12
> {color: red}Please, ANSWER this question AT{color} 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?



--
This message was sent by Atlassian JIRA
(v6.4.1#64016)


More information about the Backlogmanager mailing list

You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy   Cookies policy