Create, update and publish models with API
Creating a Site via API
This request creates the Site resource and sets its metadata.
curl --location --request PUT 'https://dataclearinghouse.org/api/mv/v1/org/demo_org/site/demo_site' \
--header 'Content-Type: application/json' \
--header 'x-api-key: myApiKeyGoesHere' \
--data '{
"orgId": "demo_org",
"siteId": "demo_site",
"label": "demo_site",
"description": "Represents demo_site site in org demo_org.",
"addressMeta": {
"subAddress": null,
"streetNumber": "3",
"streetName": "Castray Esplanade",
"subLocality": null,
"locality": "Battery Point",
"subAdministrativeArea": null,
"administrativeArea": "Tasmania",
"countryCode": "AUS",
"postcode": "7004",
"propertyId": null,
"cadastralId": null,
"titleId": null
},
"geolocation2d": {
"latitude":-42.8867605,
"longitude":147.338252
}
}
Creating a Building via API
This request creates the Building resource and sets its metadata.
curl --location --request PUT 'https://dataclearinghouse.org/api/mv/v1/org/demo_org/site/demo_site/building/demo_building1' \
--header 'Content-Type: application/json' \
--header 'x-api-key: myApiKeyGoesHere' \
--data '{"orgId":"demo_org","siteId":"demo_site","buildingId":"demo_building1","label":"demo_building1","description":"demo_site demo_building1"}'
Updating Site RDF via API
This request overwrites the Site's draft RDF model. (It has no effect on the published model.)
curl --location --request PUT 'https://dataclearinghouse.org/api/mv/v1/org/demo_org/site/demo_site/draft' \
--header 'x-api-key: myApiKeyGoesHere' \
--data 'PREFIX brick: <https://brickschema.org/schema/Brick#>
PREFIX unit: <http://qudt.org/vocab/unit/>
PREFIX senaps: <http://senaps.io/schema/1.0/senaps#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX qudt: <http://qudt.org/schema/qudt/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX site: <dch:org/demo_org/site/demo_site#>
PREFIX b1: <dch:org/demo_org/site/demo_site/building/demo_building1#>
PREFIX dp1: <dch:org/demo_org/demo_datapool1#>
site: a brick:Site ;
brick:isMeteredBy site:siteMeter .
site:siteMeter a brick:Electrical_Meter ;
brick:hasSubMeter b1:submeter1 ;
brick:hasPoint dp1:site_energy . '
Updating Building RDF via API
This request overwrites the Building's draft RDF model. (It has no effect on the published model.)
curl --location --request PUT 'https://dataclearinghouse.org/api/mv/v1/org/demo_org/site/demo_site/building/demo_building1/draft' \
--header 'Content-Type: text/plain' \
--header 'x-api-key: myApiKeyGoesHere' \
--data 'PREFIX brick: <https://brickschema.org/schema/Brick#>
PREFIX unit: <http://qudt.org/vocab/unit/>
PREFIX senaps: <http://senaps.io/schema/1.0/senaps#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX qudt: <http://qudt.org/schema/qudt/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX site: <dch:org/demo_org/site/demo_site#>
PREFIX b1: <dch:org/demo_org/site/demo_site/building/demo_building1#>
PREFIX dp1: <dch:org/demo_org/demo_datapool1#>
b1: a brick:Building ;
brick:isMeteredBy b1:meter1 .
b1:meter1 a brick:Electrical_Meter ;
brick:isSubMeterOf b1:siteMeter
brick:hasPoint dp1:b1_energy .
Publish a Site via API
This request causes a sequence of events to occur across semantic models in the site. These are:
dependency discovery
intersection of site/building models with datapool models
root node composition
inferencing
validation
merging
updating represented resources to point to the newly merged models
The result of this is that the site and its buildings are then available to be queried through the query API, and returned solutions will reflect the newer version of the semantic model.
curl --location --request POST 'https://dataclearinghouse.org/api/mv/v1/org/demo_org/site/demo_site/publish' --header 'x-api-key: myApiKeyGoesHere'
Last updated