Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jason-fox opened this issue Nov 20, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@jason-fox
Copy link
Member

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
Copy link
Member Author

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.

@kzangeli kzangeli self-assigned this Jan 24, 2025
@kzangeli kzangeli added the bug Something isn't working label Jan 24, 2025
kzangeli added a commit that referenced this issue Jan 24, 2025
…L parameter (attrs) with attributes from registrations
kzangeli added a commit that referenced this issue Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants