Meta-data Property

Meta-data property based filtering is done on the basis of properties mentioned in meta-data property. Property can be of text or count type. Input data will be passed only if meta-data property is present in input data with the value satisfying the condition in MR rule.

  • Below is the create rule JSON for meta-data property based filtering:

{
  "RuleName": "Demo rule meta-data property",
  "RuleDescription": "Demo rule for user guide",
  "parallelismFactor": "1",
  "input": {
     "DirectExchange": "Direct.Exchange",
     "RoutingKey": "e325f4fe-a0e3-4252-82af-4c24deb8c0cf"
  },
  "params": [
     {
         "name": "feature",
         "value": "room1"
     },
     {
         "name": "sensorID",
         "value": "NEXUS1"
     },
     {
         "name": "time",
         "value": {
             "starttime": "",
             "endtime": ""
         }
     },
     {
         "name": "expression",
         "value": {
             "if": "",
             "then": "",
             "else": ""
         }
     },
     {
         "name": "",
         "type": "rectangle/circles/polygon",
         "geoFencing": "NO",
         "value": {
             "points": [
                 {
                     "x": "",
                     "y": ""
                 },
                 {
                     "x": "",
                     "y": ""
                 }
             ]
         }
     },
     {
         "name": "ObservedProperties",
         "value": []
     },
     {
         "name": "meta-data",
         "value": [
             {
                 "name": "speedometer-version",
                 "value": "30",
                 "type": "count",
                 "operator": ">"
             }
         ]
     }
  ],
  "output": {
     "TopicExchange": "DemoExchange",
     "Topic": "demo20"
  }
 }

As we can see in the above JSON sensor ID, feature and meta-data is provided as speedometer-version which acts as filtering condition for input data and routes input data with sensor NEXUS1, feature as room1 and speedometer-version property in meta-data with the given value. In case input data misses the meta-data property or value of given meta-data property is not matching the condition, it will be discarded. Topic exchange name is DemoExchange which we have already created in the topic exchange section.

  • In above create rule JSON filtering type of meta-data property can be used in the following ways:

1)Range Check (Band Pass)

In order to specify the value as a range check format, the value can be provided with lower range value and upper range value. Here we have used speedometer-version property with range of 80-120 which means any value from 80 to 120 will be passed from this MR rule. This acts as band pass. Following portion of create rule JSON can be used for band pass:

{
      "name": "meta-data",
      "value": [
           {
             "name": "speedometer-version",
             "type": "quantity",
             "value": "(80,120)",
             "operator": ""
         }
     ]
  }

Steps to create rule will be same as discussed in observed property section.

Send Request operation for meta-data property will remain same as in observed property section:

  • Below is the input SOS observation JSON

{
 "version": "1.0.1",
 "observations": [
     {
         "sensor": "testquality",
         "feature": "room1",
         "record": [
             {
                 "starttime": "1-JAN-2014 15:30:00 IST",
                 "output": [
                     {
                         "name": "temp",
                         "value": "xyz",
                         "type": "text"
                     }
                 ]
             }
         ],
         "meta-data": [
             {
                 "name": "speedometer-version",
                 "value": "85",
                 "type": "count"
             }
         ]
      }
   ]
 }

2)Range Check (Band Block)

In order to specify the value as a range check format, the value can be provided with lower range value and upper range value. Here we have used speedometer-version property with range of 80-120 which means any value from 80 to 120 will not be passed from this MR rule. This acts as band block. Following portion of create rule JSON can be used for band block:

{
      "name": "meta-data",
      "value": [
           {
             "name": "speedometer-version",
             "type": "quantity",
             "value": "!(80,120)",
             "operator": ""
         }
     ]
  }

3)”<” Operator

In this filtering only the upper value should be defined and the operator “<” is used. Here we have used speedometer-version property with < operator and value 200. This means any value greater than or equal to 200 for input JSON will not be passed from this MR rule. Following portion of create rule JSON can be used for < operator:

{
      "name": "meta-data",
      "value": [
           {
             "name": "speedometer-version",
             "type": "quantity",
             "value": "200",
             "operator": "<"
         }
     ]
  }

4)”>” Operator

In this filtering only the lower value should be defined and the operator “>” is used. Here we have used speedometer-version property with > operator and value 50. This means any value less than or equal to 50 for input JSON will be not be passed from this MR rule. Following portion of create rule JSON can be used for > operator:

{
      "name": "meta-data",
      "value": [
           {
             "name": "speedometer-version",
             "type": "quantity",
             "value": "50",
             "operator": ">"
         }
     ]
  }

5)”<=” Operator

In this filtering only the higher value should be defined and the operator “<=” is used. Here we have used speedometer-version property with <= operator and value 200 which means any value greater than 200 for input JSON will not be passed from this MR rule. Following portion of create rule JSON can be used for <= operator:

{
      "name": "meta-data",
      "value": [
           {
             "name": "speedometer-version",
             "type": "quantity",
             "value": "200",
             "operator": "<="
         }
     ]
  }

6)”>=” Operator

In this filtering only the lower value should be defined and the operator “>=” is used. Here we have used speedometer-version property with >= operator and value 50 which means any value less than 50 for input JSON will be not be passed from this MR rule. Following portion of create rule JSON can be used for >= operator:

{
      "name": "meta-data",
      "value": [
           {
             "name": "speedometer-version",
             "type": "quantity",
             "value": "50",
             "operator": ">="
         }
     ]
  }

7)”!=” Operator

In this filtering only one value to be blocked is defined and the operator “!=” is used. Here we have used speedometer-version property with != operator and value 80 which means any value equal to 80 for input JSON will be not be passed from this MR rule. Following portion of create rule JSON can be used for != operator:

{
      "name": "meta-data",
      "value": [
           {
             "name": "speedometer-version",
             "type": "quantity",
             "value": "80",
             "operator": "!="
         }
     ]
  }

8)REGEX Checking

In this filtering regular expression is defined in rule like sys*. Here we have used speedometer-version property of type text defined with value as regular expression as sys* which means any value other than sys* regular exp for input JSON will not pass from this MR rule. Following portion of create rule JSON can be used for regex operator:

{
      "name": "meta-data",
      "value": [
           {
             "name": "speedometer-version",
             "type": "text",
             "value": "sys*",
             "operator": ""
         }
     ]
  }