FIWARE / context.Orion-LD

Context Broker and CEF building block for context data management which supports both the NGSI-LD and the NGSI-v2 APIs
https://www.etsi.org/deliver/etsi_gs/CIM/001_099/009/01.06.01_60/gs_CIM009v010601p.pdf
GNU Affero General Public License v3.0
51 stars 43 forks source link

`attrs` on an exclusive registration with multiple `propertyNames` misses data #1706

Open jason-fox opened 6 days ago

jason-fox commented 6 days ago

Orion 1.6 - I have a context broker and a context provider. The context provider returns two properties:

{
  "id": "urn:ngsi-ld:Animal:cow001",
  "type": "Animal",
  "heartRate": {
    "type": "Property",
    "value": 10.4,
    "unitCode": "5K",
    "observedAt": "2024-02-02T15:00:00.000Z",
    "providedBy": {
      "type": "Relationship",
      "object": "urn:ngsi-ld:Device:cow001"
    }
  },
  "location": {
    "type": "GeoProperty",
    "value": {
      "type": "Point",
      "coordinates": [13.404, 52.47]
    },
    "observedAt": "2024-02-02T15:00:00.000Z",
    "providedBy": {
      "type": "Relationship",
      "object": "urn:ngsi-ld:Device:cow001"
    }
  }
}

If I create an exclusive registration with both propertyNames:

curl -L 'http://localhost:1026/ngsi-ld/v1/csourceRegistrations/' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json' \
-H 'Content-Type: application/json' \
-d '{
    "type": "ContextSourceRegistration",
    "information": [
        {
            "entities": [
                {
                    "type": "Animal",
                    "id": "urn:ngsi-ld:Animal:cow001"
                }
            ],
            "propertyNames": [
                "heartRate",
                "location"
            ]
        }
    ],
    "mode": "exclusive",
    "operations": [
        "retrieveOps"
    ],
    "endpoint": "http://context-provider"
}'

If I now query for both attributes using attrs :

curl -L 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Animal:cow001?attrs=location%2CheartRate' \
-H 'Accept: application/json' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"'

Only one of the two attributes is returned. The returned attribute appears to be random.

jason-fox commented 6 days ago

Note that if I separate the exclusive registration into two separate registrations, both attributes are returned correctly. Similarly if attrs filtering is not present both attributes are returned.