Skip to content

Instantly share code, notes, and snippets.

View gtfierro's full-sized avatar

Gabe Fierro gtfierro

View GitHub Profile
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix brick: <https://brickschema.org/schema/Brick#> .
@prefix bsh: <https://brickschema.org/schema/BrickShape#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix tag: <https://brickschema.org/schema/BrickTag#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
bsh:AED_TagShape a sh:NodeShape ;
sh:rule [ a sh:TripleRule ;
sh:condition _:has_AED_condition,
# baseURI: http://data.ashrae.org/standard223/1.0/inference/owl-subset
# imports: http://data.ashrae.org/standard223/1.0/model/all
# imports: http://www.w3.org/ns/shacl#
# prefix: os223
@prefix s223: <http://data.ashrae.org/standard223#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
============================= test session starts ==============================
platform linux -- Python 3.9.5, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- /home/gabe/src/Brick/223p/223standard/tests/venv/bin/python3
cachedir: .pytest_cache
rootdir: /home/gabe/src/Brick/223p/223standard/tests
plugins: parallel-0.1.0
collecting ... collected 34 items
pytest-parallel: 8 workers (processes), 1 test per worker (thread)
test_use_cases.py::test_use_case_implementation_query[FC#2_SZVAV_AHU:fc2brick]
test_use_cases.py::test_use_case_implementation_query[Example_test:223impl]
@gtfierro
gtfierro / Dockerfile
Last active July 15, 2021 16:20
Haxall Docker
FROM openjdk:9
RUN apt-get update && apt-get install -y git build-essential wget vim expect
ADD script.exp /opt/script.exp
RUN wget --no-verbose -O /tmp/fantom.zip https://github.com/fantom-lang/fantom/releases/download/v1.0.76/fantom-1.0.76.zip
RUN unzip /tmp/fantom.zip
RUN mv /fantom-1.0.76 /fantom
RUN cd /fantom && bash adm/unixsetup
ENV PATH="/fantom/bin:${PATH}"
import brickschema
g = brickschema.Graph()
g.parse("https://raw.githubusercontent.com/BrickSchema/Brick/master/shacl/BrickEntityShapeBase.ttl", format="ttl")
q = """SELECT ?cls ?path ?allowed WHERE {
?sh a sh:NodeShape .
?sh sh:targetClass ?cls .
?sh sh:property ?prop .
?prop sh:path ?path .
import pymortar
import os
client = pymortar.Client("https://beta-api.mortardata.org/")
query = """SELECT ?meter WHERE {?meter rdf:type brick:Electric_Meter}"""
resp = client.qualify([query])
print(resp)
res = client.data_sparql(query, start='2016-01-01T00:00:00Z', end='2016-02-01T00:00:00Z')
print(res.metadata)
import brickschema
from brickschema.namespaces import BRICK, RDFS
from rdflib import URIRef
g = brickschema.Graph(load_brick_nightly=True)
def get_superclass(cls):
return [x for x in g.objects(cls, RDFS.subClassOf) if isinstance(x, URIRef)]
assert get_superclass(BRICK.Air_Temperature_Sensor) == [BRICK.Temperature_Sensor]
@gtfierro
gtfierro / BEDES (category)
Created June 21, 2021 03:18
Domains and Disciplines
- Contact
- Controls and Operations
- Emissions
- Envelope
- Generation and Storage Equipment
- Global Terms
- HVAC
- Loads
- Measures
- Metadata
@prefix bot: <https://w3id.org/bot#> .
@prefix brick: <https://brickschema.org/schema/Brick#> .
:room1 a brick:Conference_Room .
:room2 a brick:Kitchen .
:room3 a brick:Office .
:luminaire1 a brick:Luminaire ;
brick:feeds :zone1 .
@gtfierro
gtfierro / building_meter.ttl
Created April 28, 2021 19:33
Brick Meter example
@prefix bldg: <urn:example#> .
@prefix brick: <https://brickschema.org/schema/Brick#> .
@prefix unit: <http://qudt.org/vocab/unit/> .
bldg:building_energy_sensor a brick:Energy_Sensor ;
brick:hasUnit unit:KiloW-HR ;
brick:isPointOf bldg:meter ;
brick:timeseries [ brick:hasTimeseriesId "a7523b08-7bc7-4a9d-8e88-8c0cd8084be0" ] .
bldg:building_peak_demand a brick:Peak_Power_Demand_Sensor ;