FIWARE / mintaka

implementation of the NGSI-LD temporal retrieval api.
5 stars 3 forks source link

Request: Implement /temporal/entityOperations/query endpoint #131

Open Blobonat opened 1 year ago

Blobonat commented 1 year ago

In order to make temporal batch requests Mintaka should support the temporal/entityOperations/query endpoint following the NGSI-LD spec.

wistefan commented 1 year ago

Hi, I'm not sure if I missunderstand something, but the tempora/enitityOperations/query is already supported: https://github.com/FIWARE/mintaka/blob/main/src/test/java/org/fiware/mintaka/QueryingTest.java#L966 Its not neccessarilly a technique for batch, but an alternative to the "normal" querying, if the query-parameters become to long.

Blobonat commented 1 year ago

Hi,

when playing around with Mintaka I forgot to remove the ngsi-ld/v1 prefix and therefore thought that the interface hasn't been implemented yet.

Thank you :)

Blobonat commented 1 year ago

As a follow up question I have noticed a small deviation from the specification in the used query type:

In the NGSI-LD API spec (I've looked up 1.3.1 to 1.6.1) entities is a list, but in the current version of Mintaka only accepts a single value.

Expected structure:

curl --location --request POST 'http://localhost:8080/temporal/entityOperations/query' \
--header 'NGSILD-Tenant: openiot' \
--header 'Content-Type: application/json' \
--data-raw '{
    "type": "Query",
    "entities": [ {"id": "urn:ngsi-ld:Vehicle:A800"}, {"id": "urn:ngsi-ld:Vehicle:A801"}],
    "temporalQ": {
        "timerel": "between",
        "timeAt": "2021-10-10T15:24:10.000Z",
        "endTimeAt": "2022-12-10T19:23:12.000Z"
    }
}'

Current structure:

curl --location --request POST 'http://localhost:8080/temporal/entityOperations/query' \
--header 'NGSILD-Tenant: openiot' \
--header 'Content-Type: application/json' \
--data-raw '{
    "type": "Query",
    "entities": {"id": "urn:ngsi-ld:Vehicle:A800,urn:ngsi-ld:Vehicle:A801"},
    "temporalQ": {
        "timerel": "between",
        "timeAt": "2021-10-10T15:24:10.000Z",
        "endTimeAt": "2022-12-10T19:23:12.000Z"
    }
}'
wistefan commented 1 year ago

Interesting find, you are right:) I think (from how I understand the spec) the request should be with a flat list of ids, but its not implemented nonetheless :

curl --location --request POST 'http://localhost:8080/temporal/entityOperations/query' \
--header 'NGSILD-Tenant: openiot' \
--header 'Content-Type: application/json' \
--data-raw '{
    "type": "Query",
    "entities": [ "urn:ngsi-ld:Vehicle:A800", "urn:ngsi-ld:Vehicle:A801"],
    "temporalQ": {
        "timerel": "between",
        "timeAt": "2021-10-10T15:24:10.000Z",
        "endTimeAt": "2022-12-10T19:23:12.000Z"
    }
}'

I will try to find time to fix it.