From 1dc27911024bf217c650f2bec5bbd24744a5a3bb Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Mon, 24 Nov 2025 09:46:39 +0100 Subject: [PATCH] Move Scope example to Core --- md/annex-c.md | 120 ++++++++++++++++++++++++++++++++++++++++++++++++ md/clause-11.md | 8 ++-- md/clause-14.md | 8 ++-- 3 files changed, 128 insertions(+), 8 deletions(-) diff --git a/md/annex-c.md b/md/annex-c.md index e6776b6..586e12c 100644 --- a/md/annex-c.md +++ b/md/annex-c.md @@ -2576,3 +2576,123 @@ Entity of type "Store" with two Properties. The "address" Property is digitally >>> + +## C.11 Scope Queries + +As specified in Clause 7.2.5, the Scope Query language is intended to select +only those Entities that are within the specified Scope(s). Scopes are specified +as a disjunction of elements, where each element can either directly be a Scope +or a conjunction of multiple Scopes. + + + +>>> [!tip] EXAMPLE: + +Give back all the Entities of type ["OffStreetParking"]{.HTML-Code} that are +within the Scope [/Madrid/Centro]{.HTML-Code} or [/Madrid/Cortes]{.HTML-Code}. + +**GET** +[/ngsi-ld/v1/entities/?type=OffStreetParking&scopeQ="/Madrid/Centro,/Madrid/Cortes"]{.HTML-Variable} + +**Request Headers** + +- [Accept: application/ld+json]{.HTML-Code} +- [Link: + <​http://example.org/ngsi-ld/latest/parking.jsonld>; + rel="http://www.w3.org/ns/json-ld#context"; + type="application/ld+json"]{.HTML-Code} + + +With a response as shown: + +**Status Code:** 200 OK + +**Response Headers** + +- [Content-Type: application/ld+json]{.HTML-Code} +- [Content-Length: 1784]{.HTML-Code} + +**Response Body** + +```json +[ + { + "id": "urn:ngsi-ld:OffStreetParking:Downtown1", + "type": "OffStreetParking", + "scope": "/Madrid/Centro", + "name": { + "type": "Property", + "value": "Downtown One" + }, + "availableSpotNumber": { + "type": "Property", + "value": 121, + "observedAt": "2017-07-29T12:05:02Z", + "reliability": { + "type": "Property", + "value": 0.7 + }, + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Camera:C1" + } + }, + "totalSpotNumber": { + "type": "Property", + "value": 200 + }, + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [-8.5, 41.2] + } + }, + "@context": [ + "http://example.org/ngsi-ld/latest/parking.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.9.jsonld" + ] + }, + { + "id": "urn:ngsi-ld:OffStreetParking:Corte4", + "type": "OffStreetParking", + "scope": ["/Madrid/Cortes", "/Company894/UnitC"], + "name": { + "type": "Property", + "value": "Corte4" + }, + "availableSpotNumber": { + "type": "Property", + "value": 121, + "observedAt": "2017-07-29T12:05:02Z", + "reliability": { + "type": "Property", + "value": 0.7 + }, + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Camera:C1" + } + }, + "totalSpotNumber": { + "type": "Property", + "value": 100 + }, + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [-8.6, 41.3] + } + }, + "@context": [ + "http://example.org/ngsi-ld/latest/parking.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.9.jsonld" + ] + } +] +``` + +>>> + + diff --git a/md/clause-11.md b/md/clause-11.md index fd17915..d1ddeb3 100644 --- a/md/clause-11.md +++ b/md/clause-11.md @@ -838,8 +838,8 @@ Clause+++clause-8+++root.6 ), no further restrictions have to be provided. - If no geoquery is provided, then S3 is equal to S2. - If the Scope query is present, from S3, select those Entities whose Entity Scope instances match the Scope query (as mandated by - Clause+++clause-7+++root.2.5, for an example see [i.16] ~annex A.16). Let - S4 be the new subset. + Clause+++clause-7+++root.2.5, for an example see Annex C.11). Let S4 be + the new subset. - If no Scope query is provided, then S4 is equal to S3. - If the ContextBroker implementation supports the use of [Entity @@ -898,8 +898,8 @@ Clause+++clause-8+++root.6 ), no further restrictions have to be provided. - If no geoquery is provided, then S6 is equal to S5. - If the Scope query is present, from S6, select those Entities whose Entity Scope instances match the Scope query (as mandated by - Clause+++clause-7+++root.2.5, for an example see [i.16] ~annex A.16). Let S7 - be the new subset. + Clause+++clause-7+++root.2.5, for an example see Annex C.11). Let S7 be the + new subset. - If no Scope query is provided, then S7 is equal to S6. - Otherwise S7 is equal to S4. - If a _`datasetId`_ parameter is provided, from S7, for all Entities, filter diff --git a/md/clause-14.md b/md/clause-14.md index 9438dac..42d1b02 100644 --- a/md/clause-14.md +++ b/md/clause-14.md @@ -316,8 +316,8 @@ Clause+++clause-8+++root.6), no further restrictions have to be provided. GeoProperty on which the geoquery is based, it is sufficient if any of these instances meets the geospatial restrictions; - if the Scope query is present, it shall match a present Entity Scope (as - mandated by Clause+++clause-7+++root.2.5, for an example see [i.16] ~annex - A.16); + mandated by Clause+++clause-7+++root.2.5, for an example see Annex + C.11); - if the Attribute list is present, in order for an Entity to match, it shall contain at least one of the Attributes in the projection Attribute list. @@ -524,8 +524,8 @@ Clause+++clause-8+++root.6), no further restrictions have to be provided. - If no geoquery is provided, then S3 is equal to S2. - If the Scope query is present, from S3, select those Entities whose Entity Scope instances match the Scope query (as mandated by - Clause+++clause-7+++root.2.5, for an example see [i.16] ~annex A.16). Let S4 - be the new subset. + Clause+++clause-7+++root.2.5, for an example see Annex C.11). Let S4 be the + new subset. - If no Scope query is provided, then S4 is equal to S3. - The local [Entity Map]{.HTML-Keyboard} is created based on S4. - Unless local scope is specified (see Clause+++clause-8+++root.6), for [Context -- GitLab