No project description provided
Project description
Mortar Data (Serverless)
Install with pip install mortardata
Set the following environment variables:
export MORTARDATA_S3_REGION=""
export MORTARDATA_S3_BUCKET=""
export MORTARDATA_QUERY_ENDPOINT=""
Then use as follows:
from mortardata import Client
c = Client()
all_points = """
PREFIX brick: <https://brickschema.org/schema/Brick#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX ref: <https://brickschema.org/schema/Brick/ref#>
SELECT ?point ?type ?uuid WHERE {
?point rdf:type/rdfs:subClassOf* brick:Point ;
rdf:type ?type ;
ref:hasExternalReference [ ref:hasTimeseriesId ?uuid ] .
}"""
df = c.sparql(all_points.strip())
df.to_csv("all_points.csv")
print(df.head())
query1 = """
PREFIX brick: <https://brickschema.org/schema/Brick#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX ref: <https://brickschema.org/schema/Brick/ref#>
SELECT ?sen_point ?sen ?equip ?equip_type WHERE {
?equip rdf:type ?equip_type .
?sen_point rdf:type brick:Supply_Air_Temperature_Sensor ;
brick:isPointOf ?equip ;
ref:hasExternalReference [ ref:hasTimeseriesId ?sen ] .
} LIMIT 10"""
df = c.sparql(query1)
df.to_csv("query1_sparql.csv")
print(df.head())
df = c.data_sparql(query1, start="2016-01-01", end="2016-02-01", limit=1e6, sites=['bldg2','bldg5'])
print(df.head())
res = c.data_sparql_to_csv(query1, "query1.csv", sites=['bldg2','bldg5'])
print(res)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mortardata-0.1.3.tar.gz
(3.0 kB
view hashes)
Built Distribution
Close
Hashes for mortardata-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61c50e76214b4325ebe81ee51d557e8a60b5e925264ff341a48573f04759cbd3 |
|
MD5 | f76d287452e37b485989af86115c1da0 |
|
BLAKE2b-256 | 90a6be457b509406ce00789d0765a79cdfaae9c13f3b511ad1b02eedf86e6297 |