Brickly

Website

Introduction

Brickly is a site for building SPARQL queries with Brick. This tool is intended to allow those unfamiliar with SPARQL syntax to make queries against Brick defined buildings. Brickly uses Google's Blockly API in order to allow for simple, block-based programming in a custom SPARQL manner.

There are three custom types of blocks:

  • triple blocks are the heart of querying. They represent a RDF triple which has a subject, predicate, and object. Though the triple block reads top down, each dropdown corresponds left to right as subject -> predicate -> object.
  • let blocks allow for variable creation. Given a variableName and a type selected in a dropdown, a line of the form will be created upon querying: ?variableName rdf:type <type> .
  • limit blocks limit the resultant amount of data queried.

Installation

In order to run a Brickly instance, you can easily use our Dockerfile after cloning:

cd brickly
docker build -t brickly .
docker run -dp 5000:5000 --rm -v `pwd`:/opt brickly bldg.ttl

Note that on Windows, %cd% must be used instead of pwd.

docker run -dp 5000:5000 --rm -v %cd%:/opt brickly bldg.ttl

Note that any valid turtle (.ttl) file can be used to query against instead of the example bldg.ttl.

Instructions

An example demo video can be viewed here. Detailed instructions can be found below.

Create three "let" blocks, named "sensor" "device" and "zone" respectively. Sensor should be a https://brickschema.org/schema/Brick#Zone_Air_Temperature_Sensor, device should be a https://brickschema.org/schema/Brick#VAV and zone should be a https://brickschema.org/schema/Brick#HVAC_Zone.

Next, create a new "triple" block.

  • Select ?device in the upper dropdown.
  • Select https://brickschema.org/schema/Brick#hasPoint in the middle dropdown.
  • Select ?sensor in the lower dropdown.

Create another "triple" block.

  • Select ?device in the upper dropdown.
  • Select https://brickschema.org/schema/Brick#feeds in the middle dropdown.
  • Select ?zone in the lower dropdown.

Click the arrow icon in the top right of the "Run Query" container to run the query against an example building file.

The generated code (as a result of the block query) should look like:

SELECT * WHERE {
    ?sensor rdf:type <https://brickschema.org/schema/Brick#Zone_Air_Temperature_Sensor> .
    ?device rdf:type <https://brickschema.org/schema/Brick#VAV> .
    ?zone rdf:type <https://brickschema.org/schema/Brick#HVAC_Zone> .
    ?device <https://brickschema.org/schema/Brick#hasPoint> ?sensor .
    ?device <https://brickschema.org/schema/Brick#feeds> ?zone .
}