Design and Analysis of a Query Processor for Brick
Total Page:16
File Type:pdf, Size:1020Kb
Design and Analysis of a Query Processor for Brick Gabe Fierro David E. Culler UC Berkeley UC Berkeley [email protected] [email protected] ABSTRACT to increase energy efficiency and comfort, as well as provide mon- Brick is a recently proposed metadata schema and ontology for de- itoring and fault diagnosis. While many such applications exist, scribing building components and the relationships between them. the lack of a common description scheme, i.e. metadata, limits the It represents buildings as directed labeled graphs using the RDF portability of these applications across the heterogeneous building data model. Using the SPARQL query language, building-agnostic stock. applications query a Brick graph to discover the set of resources While several efforts address the heterogeneity of building meta- and relationships they require to operate. Latency-sensitive ap- data, these generally fail to capture the relationships and entities plications, such as user interfaces, demand response and model- that are required by real-world applications [8]. This set of re- predictive control, require fast queries — conventionally less than quirements drove the development of Brick [6], a recently proposed 100ms. metadata standard for describing the set of entities and relationships We benchmark a set of popular open-source and commercial within a building. Brick succeeds along three metrics: completeness SPARQL databases against three real Brick models using seven (captures 98% of building management system data points across six application queries and find that none of them meet this perfor- real buildings), expressiveness (can capture all important relation- mance target. This lack of performance can be attributed to design ships) and usability (represents this information in an easy-to-use decisions that optimize for queries over large graphs consisting manner). of billions of triples, but give poor spatial locality and join per- Brick’s goals of expressiveness and usability informed the choice formance on the small dense graphs typical of Brick. We present of the RDF data model [19] and SPARQL query language [28] for the design and evaluation of HodDB, a RDF/SPARQL database for representing and querying graphs, respectively. Initial work [6] Brick built over a node-based index structure. HodDB performs showed that RDF/SPARQL fulfill Brick’s requirements of descrip- Brick queries 3-700x faster than leading SPARQL databases and tion and representation, but did not address the question of how consistently meets the 100ms threshold, enabling the portability of well suited these technologies are to fulfilling the “systems” require- important latency-sensitive building applications. ments of Brick queries integrated into building applications. We focus on latency-sensitive applications including user interfaces, CCS CONCEPTS building modeling, demand response, alarms and model-predictive control. We target a query response time of <100ms, a conventional • Information systems → Graph-based database models; Data interactive latency threshold [25]. We address three questions re- structures; Information retrieval; garding this integration: KEYWORDS (1) What are the characteristics of the Brick workload, and what requirements does the workload place on a Brick query pro- Smart Buildings, Building Management, Metadata, Graph Database, cessor? RDF, SPARQL (2) How well do existing RDF/SPARQL databases meet these ACM Reference format: requirements? Gabe Fierro and David E. Culler. 2017. Design and Analysis of a Query Pro- (3) How can we leverage the characteristics of the Brick work- cessor for Brick. In Proceedings of BuildSys ’17, Delft, Netherlands, November load to design a query processor that does meet these re- 8–9, 2017, 10 pages. quirements? https://doi.org/10.1145/3137133.3137155 We begin with a brief overview of Brick, RDF and SPARQL, and then present a performance evaluation of several popular RDF 1 INTRODUCTION databases against the Brick workload, represented by seven Brick queries of varying complexity on three real Brick building models. Modern buildings present a rich deployment opportunity for ap- We then characterize the Brick workload by the graph properties plications that take advantage of networked sensors and actuators of Brick models and the required query language features. Finally, Permission to make digital or hard copies of all or part of this work for personal or we use these findings to develop HodDB, a RDF/SPARQL query classroom use is granted without fee provided that copies are not made or distributed processor for Brick that consistently meets the latency demands of for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the Brick applications. author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]. 2 BACKGROUND BuildSys ’17, November 8–9, 2017, Delft, Netherlands © 2017 Copyright held by the owner/author(s). Publication rights licensed to Associa- This section provides a brief primer on the structure and usage of tion for Computing Machinery. Brick and how it is realized using the RDF data model and SPARQL ACM ISBN 978-1-4503-5544-5/17/11...$15.00 https://doi.org/10.1145/3137133.3137155 query language. BuildSys ’17, November 8–9, 2017, Delft, Netherlands Gabe Fierro and David E. Culler 2.1 Brick Overview 1 ### VAV Enum (Building Dashboard) 2 SELECT DISTINCT ?vav WHERE { 3 ?vav rdf:type brick:VAV . 4 } 5 ### Temp Sensors (Building Dashboard, Room Diagnostics) 6 SELECT DISTINCT ?sensor WHERE { 7 ?sensor rdf:type/rdfs:subClassOf* brick:Zone_Temperature_Sensor . 8 } 9 ### AHU Children (Building Dashboard) 10 SELECT DISTINCT ?x WHERE { 11 ?ahu rdf:type brick:AHU . 12 ?ahu bf:feeds+ ?x. 13 } 14 ### Spatial Mapping (Building Dashboard) 15 SELECT DISTINCT ?floor ?room ?zone WHERE { 16 ?floor rdf:type brick:Floor . 17 ?room rdf:type brick:Room . 18 ?zone rdf:type brick:HVAC_Zone . 19 ?room bf:isPartOf+ ?floor. 20 ?room bf:isPartOf+ ?zone. 21 } 22 ### Sensors In Rooms (Room Diagnostics) 23 SELECT DISTINCT ?sensor ?room 24 WHERE { 25 { ?sensor rdf:type/rdfs:subClassOf* brick:Zone_Temperature_Sensor .} 26 UNION 27 { ?sensor rdf:type/rdfs:subClassOf* brick:Discharge_Air_Temperature_Sensor .} 28 UNION 29 { ?sensor rdf:type/rdfs:subClassOf* brick:Occupancy_Sensor .} 30 UNION Figure 1: Example Brick graph for a simple building, show- 31 { ?sensor rdf:type/rdfs:subClassOf* brick:CO2_Sensor .} ing class instantiations and subclass declarations. Solid blue 32 ?vav rdf:type brick:VAV . 33 ?zone rdf:type brick:HVAC_Zone . boxes make up the building, and dotted tan boxes repre- 34 ?room rdf:type brick:Room . sent the class hierarchy. Note the long chains of feeds and 35 ?vav bf:feeds+ ?zone. 36 ?zone bf:hasPart ?room. subClassOf relationships. 37 {?sensor bf:isPointOf ?vav} 38 UNION 39 {?sensor bf:isPointOf ?room} Brick represents a building as a directed, labeled graph. Nodes 40 } 41 ### VAV Relships (Building Dashboard) (entities) represent equipment, sensors, spaces, timeseries streams or 42 SELECT DISTINCT ?vav ?x ?y ?z ?a ?b WHERE { any other “thing” in a building. The names of nodes are drawn from 43 ?vav rdf:type brick:VAV . 44 ?vav bf:feeds+ ?x. Brick’s class hierarchy. Edges represent the relationships between 45 ?vav bf:isFedBy+ ?y. things and are named according to the minimal, multipurpose set 46 ?vav bf:hasPoint+ ?z. 47 ?vav bf:hasPart+ ?a. of relationships defined by Brick. 48 } Figure 1 shows the Brick graph for a simple example building; 49 ### Grey Box (Automatic Grey Box Modeler) 50 SELECT DISTINCT ?vav ?room ?temp_uuid ?valve_uuid ?setpoint_uuid WHERE { each node is labeled with its name or Brick class and each edge 51 ?vav rdf:type brick:VAV . 52 ?vav bf:hasPoint ?tempsensor. is labeled with a Brick relationship. The building consists of two 53 ?tempsensor rdf:type/rdfs:subClassOf* brick:Temperature_Sensor . adjacent rooms in an HVAC zone and conditioned by a variable air 54 ?tempsensor bf:uuid ?temp_uuid. 55 ?vav bf:hasPoint ?valvesensor. volume box (VAV) with a damper, which receives supply air from a 56 ?valvesensor rdf:type/rdfs:subClassOf* brick:Valve_Command . air handling unit (AHU); one room contains a temperature sensor. 57 ?valvesensor bf:uuid ?valve_uuid. 58 ?vav bf:hasPoint ?setpoint. The chain of feeds edges denotes that air passes from the AHU 59 ?setpoint rdf:type/rdfs:subClassOf* brick:Zone_Temperature_Setpoint . through the VAV and damper to the HVAC zone. 60 ?setpoint bf:uuid ?setpoint_uuid. 61 ?room rdf:type brick:Room . Brick helps mitigate heterogeneity, but also allows applications 62 ?tempsensor bf:isLocatedIn ?room. to understand salient structure. The particular sequence of equip- 63 } ment from an AHU to a zone differs from building to building. Because the “flow” has a consistent edge type (feeds), application Figure 2: The set of SPARQL queries used in real-world Brick developers can use the notion of “one or more feeds edges” to apps, used here for benchmarking RDF databases in §3. associate HVAC equipment with a zone without having to know the exact sequence. This is one way in which Brick allows queries usually refer to generic parent classes, so Brick queries must have to operate consistently despite differences in the structure ofa a way of specifying the semantics of the