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

Query to create an example #11

Closed
Neeraj-Nec opened this issue Apr 8, 2023 · 3 comments
Closed

Query to create an example #11

Neeraj-Nec opened this issue Apr 8, 2023 · 3 comments

Comments

@Neeraj-Nec
Copy link

How to create following example:

{
"id": "urn:ngsi-ld:vehicle:Abc123",
"type": "vehicle",
"@context": ["https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld"],
"room": {
"type": "Property",
"value": 23,
"temp": {
"type": "Property",
"value": 40,
"temp1": {
"type": "Property",
"value": 54
}
},
"presure": {
"type": "Property",
"value": 40,
"tempPre": {
"type": "Property",
"value": 54
}
}
}
}

@fbattello
Copy link
Collaborator

One way to build that entity.

from ngsildclient import Entity

e = Entity("Vehicle", "Abc123")
e.prop("room", 23).prop("temp", 40, nested=True).prop("temp1", 54, nested=True)
e.prop("pressure", 40).prop("tempPre", 54, nested=True)

@Neeraj-Nec
Copy link
Author

In my Example presure is the subproperty of "room" but your code is putting the property "presure" outside room

@Neeraj-Nec
Copy link
Author

You should check your update function for all ngsild cases

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