FIND
Syntax of a FIND query
<Query>
<Documentation>
This query finds all pairs of illuminated street lights next to vacant (or about to become vacant) parking
meters operated by the same business outside of 1000 feet radius of a Chevron gas station if any.
</Documentation>
<Find using="Sencity,City,Business" format="version,current">
<Light operatedBy="some.Business" not.state="OutOfOrder" as="MyLight">
<Brightness gt="80%"/>
<Location>
<Lattitude between="1.234,0.9876"/>
</Location>
</Light>
<Parking.Meter operatedBy="some.Business" as="MyParkingMeter">
<or>
<eq target="state">vacant</eq>
<and>
<eq target="state" value="occupied"/>
<le target="remainingTime" value="PT10M"/>
</and>
</or>
</Parking.Meter>
<Entity Qtype="Business" as="some.Business"/>
<not>
<Business name="Chevron" as="Chevron"/>
<GasStation operatedBy="Chevron">
<le target="MyLight.distance.Chevron" value="1000ft"/>
</GasStation>
</not>
</Find>
</Query>
Example
Simple Find Query
<Query>
<Find format="version, current">
<SensorModel>
<sensorID ne=""/>
</SensorModel>
</Find>
</Query>
Returns the result set with all SensorModel instances, where sensorID is not empty.
<Find Status="success", Format="version, current">
<Result>
<SensorModel>
....
</SensorModel>
</Result>
<Result>
...
</Result>
</Find>
to remove the Result node -
<Query>
<Find as="$none" format="version,current">
<SensorModel>
<ZoneID ne=""/>
</SensorModel>
</Find>
</Query>
which will return the collection of all SensorModel instances under <Find> node
Simple Join Query
<Query>
<Find format="version,current">
<Zone as="var.Zone">
<ZoneID ne=""/>
</Zone>
<ZoneInfo >
<ZoneName eq="var.Zone.Name" />
</ZoneInfo>
</Find>
</Query>
Returns the collection of Result nodes with the pairs of Zone and ZoneInfo
To concatenate the two models, one can send the following query
<Query>
<Find as="$none:Zone:$none" format="version,current">
<Zone as="var.Zone">
<ZoneID ne=""/>
</Zone>
<ZoneInfo >
<ZoneName eq="var.Zone.Name" />
</ZoneInfo>
</Find>
</Query>
Constraints
and this will return all the Zones (with ZoneInfo).
Constraints that can be used with FIND
other structure can be used
Queries
- Use of Standard Prefixes : "var", "lit", "fun"
- Function Queries
- Only & Distinct
Query Description | Query |
---|---|
From any gateway, I should be able to query all the latest temperature sensor (soil sensor) readings | |
From any gateway, query any temperature sensor reading that has a temperature above ___ °C and give the sensor ID and ZoneID | |
From any gateway, query any soil sensor reading that had soil tension above ____ and give the sensor ID and GridID and ZoneID | |
From any gateway, query any ZoneImpl that has temperature below ____ °C and also Humidity below ____ % | |
From the cloud, query any Zone that has ZoneTemperature below ____ °C and also ZoneHumidity below ____ % | |
From any gateway, update the IrrigationMotor status to on | |
From any gateway, identify one or more specific grid(s), and update the light status to be on. Then change intensity % | |
From any gateway, find all grids whose AmbientLight is below 800 lux and turn lights on (over ride app facet/model logic) | |
From the cloud, find all zones whose temperature is below ____ °C and also Humidity is above ____ %, and turn the heater on |