Brick Schema Documentation

repository·master·Indexed 18 days ago

https://github.com/brickschema/brick

An open-source schema for representing building metadata using an RDF class hierarchy and principled relationships to model complex building systems as directed graphs. This repository includes the Python development environment (v0.1.0), tools for comparing schema versions, and alignment files for mapping Brick v1.1 concepts to other ontologies such as Building Topology Ontology (BOT) v0.3.2, RealEstateCore v3.1, and VBIS v3.

Tokens
2K
Snippets
4
Records
14
Agent score
63%

What's inside Brick

  1. Overview of the Brick Schema

    master

    Brick is an open-source, BSD-licensed schema designed to provide a uniform way to represent building metadata. It consists of three core components:

    1. RDF Class Hierarchy: Describes various building subsystems, entities, and equipment.
    2. Relationships: A minimal, principled set of relationships used to connect entities into a directed graph representing a building.
    3. Encapsulation: A method for composing complex building components from lower-level ones.

    For detailed documentation, visit the official website at http://brickschema.org/.

  2. Modeling residential IAQ sensor deployments with Brick and RealEstateCore

    master

    This example demonstrates how to model a complete residential Indoor Air Quality (IAQ) sensor deployment by combining the Brick ontology with RealEstateCore (REC). It covers the integration of spatial hierarchies, building metadata, network topology, and sensor measurements.

    Modeling Strategy

    To achieve a complete deployment model, use the following mapping of concerns to ontologies:

    • Spatial Hierarchy & Site Context: Use rec:Site, rec:Building, rec:Level, and specific room types like rec:CookingRoom, rec:Bedroom, rec:LivingRoom, or rec:OutdoorSpace from RealEstateCore.
    • Building & Asset Metadata: Use rec:PostalAddress and rec:ArchitectureArea for location/size, brick:buildingPrimaryFunction and brick:yearBuilt for building attributes, and rec:modelNumber/rec:serialNumber for asset identity.
    • Network Infrastructure: Model network identity using rec:IPAddress and rec:MACAddress. Model topology using Brick classes like brick:Network_Router, brick:Wireless_Access_Point, and brick:Gateway.
    • Sensor Measurements: Use specific Brick sensor classes (e.g., brick:CO2_Level_Sensor, brick:PM2.5_Sensor, brick:Temperature_Sensor, brick:Relative_Humidity_Sensor) to represent IAQ monitors.
    • Data & Ventilation Context: Use brick:hasUnit, brick:aggregate, and ref:hasExternalReference for data handling. Model the ventilation environment using rec:HVACZone, brick:HVAC_System, brick:Rooftop_Unit, brick:Filter, and brick:Thermostat.
    • Deployment Grouping: Group related assets using brick:Automation_Collection combined with the rec:includes relationship.
  3. Extend the Brick Python Framework

    master

    The Brick Python framework uses Python dictionaries to manage schema definitions, avoiding complex YAML parsing logic.

    To add to the class hierarchies or understand how to extend the schema, refer to the source files in bricksrc/, such as:

    • bricksrc/equipment.py
    • bricksrc/point.py
  4. Explore Brick concepts via code examples

    master

    The examples/ directory contains executable code samples that demonstrate Brick idioms and concepts:

    • example1: Introduces RDFlib, namespaces, and how to handle Brick ontology definitions.
    • simple_apartment: Demonstrates how to use Python to programmatically construct a Brick model of a small apartment.
    • g36: Provides Brick implementations based on ASHRAE Guideline 36 figures.
  5. Run Brick tests

    master

    Tests are implemented using pytest. To run the test suite, follow these steps:

    1. Generate the Brick.ttl file: You must create the ontology file before running tests. Use either make or python generate_brick.py.
    2. Execute tests: Run pytest or make test from the top-level directory.

    For a reference implementation, see tests/test_inference.py.

    # Step 1: Generate the ontology
    python generate_brick.py
    
    # Step 2: Run tests
    pytest
    # OR
    make test
  6. Align Brick v1.1 concepts with Building Topology Ontology (BOT) v0.3.2

    master

    To map concepts between Brick v1.1 and the Building Topology Ontology (BOT) v0.3.2, use the alignment file BOTAlignment.ttl. You can import this file into your preferred ontology editing tool to realize the mappings between the two ontologies.

    This alignment was defined by @jbkoh and @georgferdinandschneider, based on assumptions documented in the BOT project's Issue 81.

  7. Align Brick v1.1 concepts with VBIS v3

    master

    To map concepts from Brick v1.1 to VBIS v3, import the alignment file Brick-VBIS-alignment.ttl into your RDF graph. This file encodes mappings between Brick equipment classes and relevant VBIS search tags.

    Key technical details:

    • Alignment File: Brick-VBIS-alignment.ttl
    • Mapping Property: The relationship is established using the property https://brickschema.org/schema/Brick/alignments/vbis/v3#hasVBISTag.
    • Data Format: VBIS search tags are represented as string literals related to Brick classes via the property mentioned above.
  8. Compare Brick versions using the compare_versions.py tool

    master

    You can compare two different versions of the Brick ontology by running the compare_versions.py script. The tool requires the version number of the old Brick release and a URL to its .ttl file, as well as the version number of the new Brick release and a URL to its .ttl file.

    Results are output to a local directory following the pattern ./history/{old_version}-{new_version}.

    python tools/compare_versions/compare_versions.py --oldbrick 1.3.0 https://github.com/BrickSchema/Brick/releases/download/v1.3.0/Brick.ttl --newbrick 1.4.0 https://github.com/BrickSchema/Brick/releases/download/nightly/Brick.ttl
  9. Align Brick v1.1 concepts with RealEstateCore v3.1

    master

    To map concepts between Brick v1.1 and RealEstateCore v3.1, use the alignment file Brick-REC-alignment.ttl. You can realize these mappings by importing this file into your RDF graph.

    If you require an intermediate alignment output that excludes device type mappings, use Brick-REC-nodevice.rdf. This file can be processed by the generate.py script to produce the final alignment file.

    # Example workflow concept:
    # 1. Import Brick-REC-alignment.ttl into your RDF graph
    # 2. Or use generate.py with the intermediate file:
    generate.py Brick-REC-nodevice.rdf
  10. Understand the simple apartment generation pattern

    master
    The simple_apartment example demonstrates a pattern for generating Brick models that emphasizes the relationship between Zones and Spaces. This approach is useful for modeling residential layouts where high-level functional areas (Zones) contain specific physical rooms or areas (Spaces).