Orion Context Broker&协会

时间:2015-02-16 13:12:32

标签: fiware-orion

我一直在尝试运行设置,以启用Orion Context Broker的关联。

我一直在关注FIWARE wiki上的用户和程序员指南,其中的功能解释如下:

首先注册“Room1”和“Room2”实体,如下所述: https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/Publish/Subscribe_Broker_-_Orion_Context_Broker_-_User_and_Programmers_Guide#Register_Context_operation

这可以按预期工作。然后我按照这里的关联步骤: https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/Publish/Subscribe_Broker_-_Orion_Context_Broker_-_User_and_Programmers_Guide#Associations

所有注册都按预期进行,但是,当我尝试“discoverContextAvailability”时,我得到了一个“NGSI 404”,看起来像这样:

REQUEST:

<?xml version="1.0"?>
<discoverContextAvailabilityRequest>
  <entityIdList>
    <entityId type="Room" isPattern="false">
      <id>Room2</id>
    </entityId>
  </entityIdList>
  <attributeList>
    <attribute>temperature</attribute>
  </attributeList>
  <restriction>
    <scope>
      <operationScope>
        <scopeType>IncludeAssociations</scopeType>
        <scopeValue>SOURCES</scopeValue>
      </operationScope>
    </scope>
  </restriction>
</discoverContextAvailabilityRequest>

响应:

<discoverContextAvailabilityResponse>
  <errorCode>
    <code>404</code>
    <reasonPhrase>No context element found</reasonPhrase>
    <details>Could not query association with combination of entity/attribute</details>
  </errorCode>
</discoverContextAvailabilityResponse>

作为旁注,我想提一下,我正在尝试将Orion Configuration Manager与NEC IoT Broker集成,当IoT Broker向Orion发送discoverContextAvailability时,它还包含告诉Orion的限制“包含关联”,导致下面描述的相同错误(即使在这种情况下没有注册关联)。

我真的可以使用一些帮助。

更新1 echo'db.registrations.find()'|的结果蒙古猎户座:

{ "_id" : ObjectId("54d4acdfa85d6301365b7240"), "expiration" : NumberLong(1423310431), "contextRegistration" : [        {       "entities" : [  {       "id" : "Filtered000D6F000277BCC0",      "type" : "FilteredSmartPlug" } ],       "attrs" : [  {       "name" : "currentPower",        "type" : "float",       "isDomain" : "false" } ],       "providingApplication" : "http://localhost/EspR4FastData/" } ] }
{ "_id" : ObjectId("54e1c2e7a85d6301365b7314"), "expiration" : NumberLong(1424513639), "contextRegistration" : [        {       "entities" : [  {       "id" : "30DE8600002001C4",      "type" : "SmartPlug" } ],       "attrs" : [     {   "name" : "name",         "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "manufacturer",        "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "model",       "type" : "xs:string",   "isDomain" : "false" },      {       "name" : "protocol",    "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "currentPower",        "type" : "xs:float",    "isDomain" : "false" },         {       "name" : "currentState",     "type" : "xs:integer",  "isDomain" : "false" } ],       "providingApplication" : "http://10.42.82.127:8080/zpa/ngsi" } ] }
{ "_id" : ObjectId("54e1c2f9a85d6301365b7315"), "expiration" : NumberLong(1424513657), "contextRegistration" : [        {       "entities" : [  {       "id" : "30DE8600002001C4",      "type" : "SmartPlug" } ],       "attrs" : [     {   "name" : "name",         "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "manufacturer",        "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "model",       "type" : "xs:string",   "isDomain" : "false" },      {       "name" : "protocol",    "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "currentPower",        "type" : "xs:float",    "isDomain" : "false" },         {       "name" : "currentState",     "type" : "xs:integer",  "isDomain" : "false" } ],       "providingApplication" : "http://10.42.82.127:8080/zpa/ngsi" } ] }
{ "_id" : ObjectId("54e1c3aaa85d6301365b7316"), "expiration" : NumberLong(1424513834), "contextRegistration" : [        {       "entities" : [  {       "id" : "30DE8600002001C4",      "type" : "SmartPlug" } ],       "attrs" : [     {   "name" : "name",         "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "manufacturer",        "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "model",       "type" : "xs:string",   "isDomain" : "false" },      {       "name" : "protocol",    "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "currentPower",        "type" : "xs:float",    "isDomain" : "false" },         {       "name" : "currentState",     "type" : "xs:integer",  "isDomain" : "false" } ],       "providingApplication" : "http://10.42.82.127:8080/zpa/ngsi" } ] }
{ "_id" : ObjectId("54e1c416a85d6301365b7317"), "expiration" : NumberLong(1424513942), "contextRegistration" : [        {       "entities" : [  {       "id" : "30DE8600002001C5",      "type" : "SmartPlug" } ],       "attrs" : [     {   "name" : "name",         "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "manufacturer",        "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "model",       "type" : "xs:string",   "isDomain" : "false" },      {       "name" : "protocol",    "type" : "xs:string",   "isDomain" : "false" },         {       "name" : "currentPower",        "type" : "xs:float",    "isDomain" : "false" },         {       "name" : "currentState",     "type" : "xs:integer",  "isDomain" : "false" } ],       "providingApplication" : "http://10.42.82.127:8080/zpa/ngsi" } ] }
{ "_id" : ObjectId("54e1ce41a85d6301365b7318"), "expiration" : NumberLong(1424084605), "contextRegistration" : [        {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1d2eda85d6301365b7319"), "expiration" : NumberLong(1424085801), "contextRegistration" : [        {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1d333a85d6301365b731a"), "expiration" : NumberLong(1424085871), "contextRegistration" : [        {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1d334a85d6301365b731b"), "expiration" : NumberLong(1424085872), "contextRegistration" : [        {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1d56ea85d6301365b731c"), "expiration" : NumberLong(1424086442), "contextRegistration" : [        {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1d922a85d6301365b731d"), "expiration" : NumberLong(1426679330), "contextRegistration" : [        {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1d92da85d6301365b731e"), "expiration" : NumberLong(1426679341), "contextRegistration" : [        {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1d97ba85d6301365b731f"), "expiration" : NumberLong(1426679419), "contextRegistration" : [        {       "entities" : [  {       "id" : "Room1",         "type" : "Room" },      {       "id" : "Room2",         "type" : "Room" } ],         "attrs" : [     {       "name" : "temperature",         "type" : "float",       "isDomain" : "false" },         {       "name" : "pressure",    "type" : "integer",     "isDomain" : "false" } ],       "providingApplication" : "http://mysensors.com/Rooms" } ] }
{ "_id" : ObjectId("54e1d9afa85d6301365b7320"), "expiration" : NumberLong(1426679471), "contextRegistration" : [        {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1dd0fa85d6369180b7c49"), "expiration" : NumberLong(1426680335), "servicePath" : "/", "contextRegistration" : [   {       "entities" : [  {       "id" : "Room1",         "type" : "Room" },      {       "id" : "Room2",      "type" : "Room" } ],    "attrs" : [     {       "name" : "temperature",         "type" : "float",       "isDomain" : "false" },         {       "name" : "pressure",    "type" : "integer",     "isDomain" : "false" } ],       "providingApplication" : "http://mysensors.com/Rooms" } ] }
{ "_id" : ObjectId("54e1dd47a85d6369180b7c4a"), "expiration" : NumberLong(1426680391), "servicePath" : "/", "contextRegistration" : [   {       "entities" : [  {       "id" : "Room1",         "type" : "Room" },      {       "id" : "Room2",      "type" : "Room" } ],    "attrs" : [     {       "name" : "temperature",         "type" : "float",       "isDomain" : "false" },         {       "name" : "pressure",    "type" : "integer",     "isDomain" : "false" } ],       "providingApplication" : "http://mysensors.com/Rooms" } ] }
{ "_id" : ObjectId("54e1ddc1a85d6369180b7c4d"), "expiration" : NumberLong(1426680513), "servicePath" : "/", "contextRegistration" : [   {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1ddc2a85d6369180b7c4e"), "expiration" : NumberLong(1426680514), "servicePath" : "/", "contextRegistration" : [   {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1ddc2a85d6369180b7c4f"), "expiration" : NumberLong(1426680514), "servicePath" : "/", "contextRegistration" : [   {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }
{ "_id" : ObjectId("54e1ddc3a85d6369180b7c50"), "expiration" : NumberLong(1426680515), "servicePath" : "/", "contextRegistration" : [   {       "entities" : [ ],       "attrs" : [ ],  "providingApplication" : "http://www.fi-ware.eu/NGSI/association" } ] }

更新2

删除数据库后,指南中描述的过程现在可以使用。当实体具有关联时,我得到回复。如果另一方面实体没有关联,则查询仍会返回错误“无法查询与实体/属性组合的关联”。

然而。我的初始问题始于NEC IoT Broker向Configuration Manager发出此请求(始终包含关联限制)这一事实,这意味着每当我在IoT Broker上查询没有关联的数据时,它就会失败。这真的是正确的行为吗?

1 个答案:

答案 0 :(得分:0)

问题似乎与Orion数据库中的重叠注册有关。清洁数据库并重复测试后,它可以工作(根据用户的报告)。