Get (from Invivo), deploy and test sample project from TQLStudio

This guide lets you Get HelloTQL sample project from Invivo Store, deploy it on the A-Stack running in the sandbox and test it with queries and subscriptions. To test HelloTQL project on your own local A-Stack, see here.

You need to first set up a TQLStudio account to be able to do the following.

1. Log into TQLStudio. Click on the Invivo Store

2. Select "HelloTQL" project from the Invivo Store and click "Get It"

The project can now be see in dashboard under "From Invivo" section.

3. HelloTQL Project Models Consists of Data Model, Thing Model, ThingFacet, and Macros.

3. Click on ThingSpace tab from the top and click on "Deploy Models" to deploy the project onto the A-Stack in the sandbox. The host name is automatically filled in and you don't have to change anything.

4. After successful deployment, go to the Queries tab from the top and now you can see the query end points has been generated. You have 2 end points, one is on HTTP and starts with http://, the other is on WebSocket and starts with ws://.  You can now run sample queries.

List of Queries provided are:

Query NameQuery
CreateVendorInfo

Execute this over an HTTP Endpoint.

CreateVendorInfo
#
Query:
	Create:
		VendorInfo:
			vendorId: 	vendorA
			vendorName: Phidget
			vendorCity: Calgary
DeleteAllVendors
DeleteAllVendors
#
Query:
	DeleteAll:
		VendorInfo(ne: "")
FindAllSensors
FindAllSensors
#
Query:
	Find(format="version,known"):
		TempSensor:
			sensorId(ne: "")
FindAllVendors
FindAllVendors
#
Query:
	Find(format="all"):
		VendorInfo:
			vendorId (ne: "")
InitSensor

Initialize the Sensor in simulated mode.

InitSensor
#
Query:
	DeleteAll(format="version,current"):
		TempSensor:
			sensorId(ne: "")
	Save(format="version,current"): #This will read	
		TempSensor:
			Simulation: true
      		PerifMsg: $Null()
      		Peripheral:	serial
      		Baudrate: 9600
      		InterfacePort: "/dev/cu.usbmodem1411"
      		Interface: serial
      		Format: ascii
      		Operation: receive
      		UniqueId: 76522
      		Payload: $Null()
      		TempValue: $Null()
StopSimulation
StopSimulation
#
Query:
	Find(format="version,known"):
		TempSensor:
			sensorId(ne: "")
	SetResponseData:
		Key: Message.Value.Find.Result.TempSensor.Simulation.Value
		Value: false
	Update:
		From: Result
		Include: $Response.Message.Value.Find
SubscribeQuery

Execute this over a ws:// endpoint.

Subscribe to Temp values
#
Query(Storage='TqlSubscription')
	Save:
		TqlSubscription(Label: 'TempSensor', sid:'20'):
			Topic: *Atomiton.Sensors.TempSensor.TempValue*
UpdateVendorInfo
Update Vendor Info
#
Query:
	Find(Format="Version"):
		VendorInfo:
			vendorId(ne: "")
	SetResponseData:
		Key: Message.Value.Find.Result.vendorInfo.vendorName.Value
    	Value: "Phidget Inc"
	Update:
		From: Result
		Include: $Response.Message.Value.Find