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

Make the OffStreetParking example broker-compatible #26

Closed
fbattello opened this issue Nov 17, 2022 · 1 comment
Closed

Make the OffStreetParking example broker-compatible #26

fbattello opened this issue Nov 17, 2022 · 1 comment

Comments

@fbattello
Copy link

Hi,

I keep on developing python-ngsild-client, a Python library that allows to create and modify NGSI-LD entities effortlessly, and to interact with a NGSI-LD broker.

The Getting Started chapter uses the OffStreetParking normalized example to showcase how one can manipulate a complex Entity and persist it into the broker.
But unfortunately the udx:SmartParking context is not resolved by the broker then prevents the parking to be persisted.
I've added this minor fix.

from ngsildclient import Client, Entity, SmartDataModels

parking = Entity.load(SmartDataModels.SmartCities.Parking.OffStreetParking)
parking.ctx.remove("iudx:SmartParking")  # the fix !

client = Client()  # assumes that a local broker instance is running (localhost, default port=1026)
client.create(parking)  # ok

But it would be nice to be able to persist the example "as-is".
Would you mind removing this part of the context ?
Or if it's not possible maybe do you know a way to tell a broker to ignore a specific context ?

@albertoabellagarcia
Copy link
Contributor

albertoabellagarcia commented Nov 20, 2022

We've removed the elements of the @context that were not resolved. They came from the example which possibly has an additional @context entry.
Thanks for the warning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants