telefonicaid / fiware-orion

Context Broker and CEF building block for context data management, providing NGSI interfaces.
https://github.com/telefonicaid/fiware-orion/blob/master/doc/manuals/orion-api.md
GNU Affero General Public License v3.0
210 stars 265 forks source link

isPattern true support in updateContext #1503

Open manubaum opened 8 years ago

manubaum commented 8 years ago

Running the following example: https://fiware-cepheus.readthedocs.org/en/latest/examples/4_CepAndBrokerAndOrion/index.html

Used components: cepheus-cep/broker: latest orion: latest deb package

Situation: Events originating in cepheus cep are forwarded to orion as expected. However, when we run our functionality, orion answers with an 501/not implemented. The ONLY difference between the updateContext resulting from the example and ours is, that we use isPattern="true".

Does it mean we cannot use patterns?

The request/response between cepheus cep/orion:

POST /ngsi10/updateContext HTTP/1.1 Accept: application/xml Content-Type: application/xml Content-Length: 374 Host: localhost:1026 Connection: Keep-Alive User-Agent: Apache-HttpAsyncClient/4.1 (Java/1.8.0_65)

<updateContextRequest><updateAction>APPEND</updateAction><contextElementList><contextElement><entityId type="OurType" isPattern="true"><id>1</id></entityId><contextAttributeList><contextAttribute><name>level</name><type>int</type><contextValue>1</contextValue><metadata/></contextAttribute></contextAttributeList></contextElement></contextElementList></updateContextRequest>

HTTP/1.1 200 OK Content-Length: 413 Content-Type: application/xml Date: Fri, 13 Nov 2015 15:43:51 GMT

<updateContextResponse>
  <contextResponseList>
    <contextElementResponse>
      <contextElement>
        <entityId type="OurType" isPattern="true">
          <id>1</id>
        </entityId>
      </contextElement>
      <statusCode>
        <code>501</code>
        <reasonPhrase>Not Implemented</reasonPhrase>
      </statusCode>
    </contextElementResponse>
  </contextResponseList>
</updateContextResponse>
manubaum commented 8 years ago

So isPattern="true" is not supported by Orion. This issue can be closed.

fgalan commented 8 years ago

So isPattern="true" is not supported by Orion.

That's is not fully correct: isPattern="true" is not implemented only for the updateContext operation, but all the others places in which isPattern is used (queryContext, subscribeContext and subscribeContextAvailability) support it.

That doesn't mean that isPattern="true" in updateContext wouldn't be implemetned in some moment. However, it needs some functional discussion and clarification (eg. if you UPDATE A attribute in Room.* entities, existing attribute A in Room1 but not existing in Room2, which kind of error should the server return?) and until now we haven't found strong use cases need for it.

I'd suggest not closing this issue, but renaming it to "isPattern true support in updateContext". In addition, could you clarify why the Cepheus use case needs it?

(Off-topic: note that XML encoding was deprecated in Orion 0.23.0, see https://github.com/telefonicaid/fiware-orion/blob/develop/doc/manuals/deprecated.md, so you are highly encouraged to use the JSON encoding. In addition, it is better to use /v1 than /ngsi10 as URL prefix in operations).

manubaum commented 8 years ago

Ok. Thank you for the suggestions! I renamed the issue.

fgalan commented 8 years ago

The following SOF question may need update after completing this issue: http://stackoverflow.com/questions/39732799/orion-context-broker-delete-several-entities-at-one-call/39776195#39776195

fgalan commented 6 years ago

The following SOF question has to be updated after completing this issue: https://stackoverflow.com/questions/47889912/fiware-orion-remove-all-entities-of-the-same-type

fgalan commented 6 years ago

With regards to deletion, the following script can be useful to delete all entities (of a given type and/or matching a given filter) while this issue gets implemented: https://github.com/telefonicaid/fiware-orion/blob/master/scripts/utils/delete_entities.py