The BrickSchema.Net is a C# library implimentation of Brick Schema. This user manual will guide you through the process of setting up, importing, and working with the Brick Schema.
For more information about Brick Schema, please visit https://brickschema.org/
As of 4/20/2023 - The library implemented 80% of Brick Schema v1.3.
The package version format is a.b.x (1.3.1). a.b = Brick Schema version. https://brickschema.org/ontology x = package revision
- Installation and Setup
- Loading and Saving Schemas
- Working with Entities
- Searching Entities
- Updating Entities
- Adding Entities
- Working with Entity
To use the BrickSchema.Net, you need to have the following software installed:
- .NET7
- A compatible C# IDE, such as Visual Studio or Visual Studio Code
- Download and add the BrickSchema.Net library to your project.
- Import the required namespaces in your source code file:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BrickSchema.Net.Classes;
using BrickSchema.Net.Classes.Collection;
using BrickSchema.Net.Classes.Collection.Loop;
using BrickSchema.Net.Classes.Equipment;
using BrickSchema.Net.Classes.Location;
using BrickSchema.Net.Classes.Measureable;
using BrickSchema.Net.Classes.Point;
To load a Brick schema froma JSON-LD file:
var manager = new BrickSchemaManager();
manager.LoadSchema("path/to/your/brick-schema.jsonld");
To save a Brick schema to a JSON-LD file:
manager.SaveSchema("path/to/save/brick-schema.jsonld");
Entities in the Brick schema are represented as objects of classes that inherit from the BrickEntity class. Each entity has an Id, Type, Properties, and Relationships.
To access the entities managed by the BrickSchemaManager:
var entities = manager.Entities;
To search for entities in the Brick schema, use the SearchEntities method and provide a predicate function:
var entityToUpdate = new Sensor
{
Id = "existing-entity-id",
Type = "NewType",
Properties = newProperties,
Relationships = newRelationships,
};
bool success = manager.UpdateEntity(entityToUpdate);
To update an existing entity in the Brick schema, use the UpdateEntity method:
var entityToUpdate = new Sensor
{
Id = "existing-entity-id",
Type = "NewType",
Properties = newProperties,
Relationships = newRelationships,
};
bool success = manager.UpdateEntity(entityToUpdate);
To add a new entity to the Brick schema, use one of the AddEntity methods for the specific entity type:
// Add a new floor location entity
var floor = manager.AddLocationFloor();
// Add a HVAC AHU entity
var ahu = manager.AddEquipmentHVACAHU();
// Add a HVAC VAV entity
var vav = manager.AddEquipmentHVACTerminalUnitVAV();
// Add a new sensor point entity
var sensor = manager.AddPointSensor();
// Add a new floor location entity
var floor = manager.AddLocationFloor();
//Add property relating to this entity
foor.AddProperty("Name", "Level 1");
// Add a HVAC AHU entity
var ahu = manager.AddEquipmentHVACAHU();
//Add property relating to this entity
ahu.AddProperty("Name", "AHU1");
//Add ahu to Level 1 floor location (relationship)
ahu.AddRelationshipLocationOf(floor.Id);
// Add a HVAC VAV entity
var vav = manager AddEquipmentHVACTerminalUnitVAV();
//Add property relating to this entity
vav.AddProperty("Name", "VAV1-1");
//Add vav to Level 1 floor locatio (relationship)
vav.AddRelationshipLocationOf(floor.Id);
//Add vav feed from AHU (relationship)
vav.AddRelationshipFedBy(ahu.Id);
// Add a new sensor point entity
var sensor = manager.AddPointSensor();
// Associate the point with VAV
sensor.AddRelationshipAssociatedWith(vav.Id);
// sensor is point of VAV
sensor.AddRelationshipPointOf(vav.Id);