Update sbmsont authored by Adam Kučera's avatar Adam Kučera
# Semantic BMS SPARQL Query example
The RDF definitions of the ontology reside here: http://is.muni.cz/www/255658/sbms/v2_0/
## SPARQL query example
When populated by proper individuals, ontology can be used as data source for SPARQL queries.
SPARQL Query that collects all the available data about a data point has following structure (in this particular case, the data point has BMS ID ``11304.AI3'':
```
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ssn: <http://purl.oclc.org/NET/ssnx/ssn#>
PREFIX dul: <http://www.loa.istc.cnr.it/ontologies/DUL.owl#>
PREFIX sbim: <http://is.muni.cz/www/255658/sbms/v2_0/SemanticBIM#>
PREFIX sbms: <http://is.muni.cz/www/255658/sbms/v2_0/SemanticBMS#>
PREFIX sbmsd: <http://is.muni.cz/www/255658/sbms/v2_0/SemanticBMSData#>
SELECT *
WHERE
{
?datapoint sbms:expressesObservation ?obs;
sbms:hasBMSId "11304.AI3".
?datapoint sbms:hasBMSId ?bmsId;
a ?type.
?type rdfs:subClassOf sbms:DataPoint
FILTER ((?type != sbms:DataPoint)
&& NOT EXISTS {?subtype rdfs:subClassOf ?type
FILTER (((?subtype != ?type)
&& (?subtype != sbms:DataPoint))
&& (?subtype != owl:Nothing))
})
?obs sbms:observedBy ?source.
?source sbim:hasBIMId ?sourcebimId;
a ?sourcetype.
?sourcetype rdfs:subClassOf sbim:Device
FILTER ((?sourcetype != sbms:Source)
&& NOT EXISTS {?subtype rdfs:subClassOf ?sourcetype
FILTER (((?subtype != ?sourcetype)
&& (?subtype != sbms:Source))
&& (?subtype != owl:Nothing))
})
?source sbim:hasInstallationInRoom ?sourcelocationF.
?sourcelocationF sbim:hasBIMId ?sourcelocation.
?obs sbms:featureOfInterest ?scope.
?scope sbim:hasBIMId ?scopebimId;
a ?scopetype.
?scopetype rdfs:subClassOf dul:PhysicalObject
FILTER ((?scopetype != sbms:Scope)
&& NOT EXISTS { ?subtype rdfs:subClassOf ?scopetype
FILTER (((?subtype != ?scopetype)
&& (?subtype != sbms:Scope))
&& (?subtype != owl:Nothing ))
})
OPTIONAL {?scope sbim:hasInstallationLocation ?scopeLocF.
?scopeLocF sbim:hasBIMId ?scopelocation}
?obs sbms:sensingMethodUsed ?sensing.
?sensing a ?sensingtype.
?sensingtype rdfs:subClassOf sbms:Sensing
FILTER ((?sensingtype != sbms:Sensing)
&& NOT EXISTS {?subtype rdfs:subClassOf ?sensingtype
FILTER (((?subtype != ?sensingtype)
&& (?subtype != sbms:Sensing))
&& (?subtype != owl:Nothing ))
})
OPTIONAL {?sensing sbms:hasAggregationTimeWindow ?sensingwindow}
?obs sbms:observedProperty ?property.
?property sbms:hasPhysicalQuality ?propertyquality;
sbms:hasPropertyDomain ?propertydomain.
?datapoint sbms:publishedByDevice ?publisher.
?publisher sbim:hasBIMId ?publisherbimId
}
```
\ No newline at end of file