{"action":"created","issue":{"url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/3122","repository_url":"https://api.github.com/repos/telefonicaid/fiware-orion","labels_url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/3122/labels{/name}","comments_url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/3122/comments","events_url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/3122/events","html_url":"https://github.com/telefonicaid/fiware-orion/issues/3122","id":303002271,"node_id":"MDU6SXNzdWUzMDMwMDIyNzE=","number":3122,"title":"NGSIv2-NGSIv1 location metadata issues","user":{"login":"fgalan","id":1534240,"node_id":"MDQ6VXNlcjE1MzQyNDA=","avatar_url":"https://avatars3.githubusercontent.com/u/1534240?v=4","gravatar_id":"","url":"https://api.github.com/users/fgalan","html_url":"https://github.com/fgalan","followers_url":"https://api.github.com/users/fgalan/followers","following_url":"https://api.github.com/users/fgalan/following{/other_user}","gists_url":"https://api.github.com/users/fgalan/gists{/gist_id}","starred_url":"https://api.github.com/users/fgalan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fgalan/subscriptions","organizations_url":"https://api.github.com/users/fgalan/orgs","repos_url":"https://api.github.com/users/fgalan/repos","events_url":"https://api.github.com/users/fgalan/events{/privacy}","received_events_url":"https://api.github.com/users/fgalan/received_events","type":"User","site_admin":false},"labels":[{"id":56268043,"node_id":"MDU6TGFiZWw1NjI2ODA0Mw==","url":"https://api.github.com/repos/telefonicaid/fiware-orion/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":{"login":"arigliano","id":11073619,"node_id":"MDQ6VXNlcjExMDczNjE5","avatar_url":"https://avatars3.githubusercontent.com/u/11073619?v=4","gravatar_id":"","url":"https://api.github.com/users/arigliano","html_url":"https://github.com/arigliano","followers_url":"https://api.github.com/users/arigliano/followers","following_url":"https://api.github.com/users/arigliano/following{/other_user}","gists_url":"https://api.github.com/users/arigliano/gists{/gist_id}","starred_url":"https://api.github.com/users/arigliano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arigliano/subscriptions","organizations_url":"https://api.github.com/users/arigliano/orgs","repos_url":"https://api.github.com/users/arigliano/repos","events_url":"https://api.github.com/users/arigliano/events{/privacy}","received_events_url":"https://api.github.com/users/arigliano/received_events","type":"User","site_admin":false},"assignees":[{"login":"arigliano","id":11073619,"node_id":"MDQ6VXNlcjExMDczNjE5","avatar_url":"https://avatars3.githubusercontent.com/u/11073619?v=4","gravatar_id":"","url":"https://api.github.com/users/arigliano","html_url":"https://github.com/arigliano","followers_url":"https://api.github.com/users/arigliano/followers","following_url":"https://api.github.com/users/arigliano/following{/other_user}","gists_url":"https://api.github.com/users/arigliano/gists{/gist_id}","starred_url":"https://api.github.com/users/arigliano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arigliano/subscriptions","organizations_url":"https://api.github.com/users/arigliano/orgs","repos_url":"https://api.github.com/users/arigliano/repos","events_url":"https://api.github.com/users/arigliano/events{/privacy}","received_events_url":"https://api.github.com/users/arigliano/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2018-03-07T08:16:10Z","updated_at":"2018-10-22T15:53:33Z","closed_at":null,"author_association":"MEMBER","body":"Create an entity E1 using NGSIv2 API with metadata location (old way of marking location in NGSIv1):\r\n\r\n```\r\nPOST /v2/entities\r\n\r\n{\r\n\t\"id\": \"E1\",\r\n\t\"type\": \"T\",\r\n\t\"A\": {\r\n\t\t\"value\": \"40, -3\",\r\n\t\t\"type\": \"whatever\",\r\n\t\t\"metadata\": {\r\n\t\t\t\"location\": {\r\n\t\t\t\t\"type\": \"string\",\r\n\t\t\t\t\"value\": \"WGS84\"\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n```\r\n\r\nCreate an entity E2 using NGSIv1 API with metadata location (old way of marking location in NGSIv1):\r\n\r\n```\r\nPOST /v1/contextEntities/type/T/id/E2\r\n\r\n{\r\n    \"attributes\": [\r\n        {\r\n            \"name\": \"A\",\r\n            \"type\": \"whatever\",\r\n            \"value\": \"39,-2\",\r\n            \"metadatas\": [\r\n               {\r\n                  \"name\": \"location\",\r\n                  \"type\": \"string\",\r\n                  \"value\": \"WGS84\"\r\n               }\r\n            ]\r\n        }\r\n    ]\r\n}\r\n```\r\n\r\nGetting entities using NGSIv2. Note that metadata location is not rendered in any entity.\r\n\r\n```\r\nGET /v2/entities\r\n\r\n[\r\n    {\r\n        \"id\": \"E1\",\r\n        \"type\": \"T\",\r\n        \"A\": {\r\n            \"type\": \"whatever\",\r\n            \"value\": \"40, -3\",\r\n            \"metadata\": {}\r\n        }\r\n    },\r\n    {\r\n        \"id\": \"E2\",\r\n        \"type\": \"T\",\r\n        \"A\": {\r\n            \"type\": \"whatever\",\r\n            \"value\": \"39,-2\",\r\n            \"metadata\": {}\r\n        }\r\n    }\r\n]\r\n```\r\n\r\nGetting entities using NGSIv1. The location metadata is rendered only for E2 (the entity created using NGSIv1):\r\n\r\n```\r\nGET /v1/contextEntities\r\n\r\n{\r\n    \"contextResponses\": [\r\n        {\r\n            \"contextElement\": {\r\n                \"type\": \"T\",\r\n                \"isPattern\": \"false\",\r\n                \"id\": \"E1\",\r\n                \"attributes\": [\r\n                    {\r\n                        \"name\": \"A\",\r\n                        \"type\": \"whatever\",\r\n                        \"value\": \"40, -3\"\r\n                    }\r\n                ]\r\n            },\r\n            \"statusCode\": {\r\n                \"code\": \"200\",\r\n                \"reasonPhrase\": \"OK\"\r\n            }\r\n        },\r\n        {\r\n            \"contextElement\": {\r\n                \"type\": \"T\",\r\n                \"isPattern\": \"false\",\r\n                \"id\": \"E2\",\r\n                \"attributes\": [\r\n                    {\r\n                        \"name\": \"A\",\r\n                        \"type\": \"whatever\",\r\n                        \"value\": \"39,-2\",\r\n                        \"metadatas\": [\r\n                            {\r\n                                \"name\": \"location\",\r\n                                \"type\": \"string\",\r\n                                \"value\": \"WGS84\"\r\n                            }\r\n                        ]\r\n                    }\r\n                ]\r\n            },\r\n            \"statusCode\": {\r\n                \"code\": \"200\",\r\n                \"reasonPhrase\": \"OK\"\r\n            }\r\n        }\r\n    ]\r\n}\r\n```\r\n\r\nConclusions:\r\n\r\n* The location metadata is ignored in NGSIv2 creation operation at two levels:\r\n   * It cannot be used to mark location. This could be considered functional (althougth it should be at remarked at https://fiware-orion.readthedocs.io/en/master/user/geolocation/index.html documentation) although it could impact in some use cases, e.g entities created/modified by a legacy client using NGSIv1+location_md, the other based on NGSIv2.\r\n   * It is ignored at creation time and not stored as conventional metadata. This could be considered a bug, as even if NGSIv2 ignored the metadata, it should be treated as a regular one.\r\n* Creating a metadata using NGSIv1 which is not shown in the NGSIv2 get operation can be considered as bug. This is probably due to NGSIv1 creating logic doesn't treat it as a regular metadata, so it is not stored in DB."},"comment":{"url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/comments/431876512","html_url":"https://github.com/telefonicaid/fiware-orion/issues/3122#issuecomment-431876512","issue_url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/3122","id":431876512,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMTg3NjUxMg==","user":{"login":"arigliano","id":11073619,"node_id":"MDQ6VXNlcjExMDczNjE5","avatar_url":"https://avatars3.githubusercontent.com/u/11073619?v=4","gravatar_id":"","url":"https://api.github.com/users/arigliano","html_url":"https://github.com/arigliano","followers_url":"https://api.github.com/users/arigliano/followers","following_url":"https://api.github.com/users/arigliano/following{/other_user}","gists_url":"https://api.github.com/users/arigliano/gists{/gist_id}","starred_url":"https://api.github.com/users/arigliano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arigliano/subscriptions","organizations_url":"https://api.github.com/users/arigliano/orgs","repos_url":"https://api.github.com/users/arigliano/repos","events_url":"https://api.github.com/users/arigliano/events{/privacy}","received_events_url":"https://api.github.com/users/arigliano/received_events","type":"User","site_admin":false},"created_at":"2018-10-22T15:53:33Z","updated_at":"2018-10-22T15:53:33Z","author_association":"COLLABORATOR","body":"As far as I understand, the idea would be to:\r\nNGSI v2 Operations:\r\n\r\n- **POST /v2/entities**: ignore the location metadata as custom metadata (as for V2 is not the right way to define a  geolocation attribute), and write to DB as normal metadata. So the GET should show it among other regular metadata.\r\n***\r\n\r\nNGSI V1:\r\n- **POST /v1/contextEntities/type/T/id/E2** :  use the location metadata to create the location attribute fields (as it is the old V2 way to do this), and in the same time store it as regular metadata, in order to let V2 correctly show in metadata with GET /v2/entities.\r\n"}}
{"actor":{"display_login":"arigliano"}}