Tax information system contains all Tax information regarding every citizen in the city.
Following FIWARE principles, seems it might make sense Consumers query Orion about entity(citizen) tax information, and the request being forwarded to Context Provider (ie:TaxInformationSystem).
Query citizen X tax information -> Orion -> TaxInformationSystem_CP
According to documentation, Context Providers can register themselves as source for specific attributes. This, for example, could make this work:
http://{{orion}}/v2/entities/urn:citizenID/attrs/name/tax
However, this seems to require every citizen to be registered as an entity, so tax information system should register multiple times (one per citizen). (And residenceInformationSystem, and healthInformationSystem, and...)
"entities": [
{
"id" : "citizenID", //one per citizen ???
"type": "taxInformation"
}
],
and that seems, at least, a lot of unnecessary/superfluous work.
After reading a bit more, seems any workaround is not yet implemented/supported
http://{{orion}}/v2/entities/tax?citizen=X
, as they aren't forwarded to CPhttp://{{orion}}/v2/entities/X/tax
if the entity hasn't be explicitly created first(IIUC, isPattern seems now deprecated in favour of idPattern/typePattern)
Am I doing something wrong? Is registering once per citizen the only way to go?
Not sure if I'm fully understanding you case...
You could do a registration for all citizen like this one:
{
"dataProvided": {
"entities": [
{
"idPattern": ".*",
"type": "taxInformation"
}
],
"attrs": [
...
},
"provider": {
"http": {
"url": "http://thetaxsystem.com"
}
}
}
So if you want to get tax information of an specific citizen you could do something like this at the CB:
GET /v2/entities/1234567H?type=taxInformation
and that registration would cause the request sent to the tax system as Context Provider.
EDIT: there is an issue at Context Broker (this one) which is precluding this case to work. In particular, second case:
regR =
.*
, query = 'E', attrs = {null}
EDIT2: the above case has been solved in Orion Context Broker. It is now available in master branch (:latest
tag in dockerhub) and will be included in the next Orion Context Broker release (3.1.0).