# Urban Vulnerability Assessment of Sea Level Rise in Singapore through the World Avatar
## 4 Use Case
### Data Analysis via Queries  
This section demonstrates how the knowledge graph can unlock a wealth of information by providing a single, unambiguous source of truth, eliminating the need to manage heterogeneous data scattered across various locations and formats. As a demonstration, we show how the total construction cost for the vulnerable buildings can be assessed using SPARQL queries. This is the question we seek to answer:  
What is the total cost of the affected buildings based on the SSP5-8.5 low-confidence scenario at the 95 th percentage quantile in the year 2150? First, the IRI of the scenario is obtained using Query from Listing 1. This query requests the value of?scenario that adheres to the graph pattern specified in the WHERE clause. It requires?scenario to be an instance of the class ontosl:SealLevelChange and to have the following properties that comply with the ontology defined in Figure 1.  
```
1 PREFIXrdf:<[[http://www.w3.org/1999/02/22-rdf-syntax-ns#](http://www.w3.org/1999/02/22-rdf-syntax-ns#)]([http://www.w3.org/1999/02/22-rdf-syntax-ns#](http://www.w3.org/1999/02/22-rdf-syntax-ns#))>
2 PREFIXontosl:<[[https://www.theworldavatar.com/kg/ontoseallevel/](https://www.theworldavatar.com/kg/ontoseallevel/)]([https://www.theworldavatar.com/kg/ontoseallevel/](https://www.theworldavatar.com/kg/ontoseallevel/))>
3
4 SELECT?scenario
5 WHERE{
6?scenarioaontosl:SealLevelChange;
7 ontosl:hasSSP/rdf:typeontosl:SharedSocioeconomicPathway5;
8 ontosl:hasRCP/rdf:typeontosl:RepresentativeConcentrationPathway85;
9 ontosl:hasProjectionYear2150;
10 ontosl:hasConfidenceLevel/rdf:typeontosl:LowConfidence;
11 ontosl:hasPercentageQuantile95. 12}
13
14 ontosl:hasSSP whose object is of type ontosl:SharedSocioeconomicPathway5;
15 ontosl:hasRCP whose object is of type ontosl:RepresentativeConcentrationPathway85;
16 ontosl:hasProjectionYearwiththevalue2150;
17 ontosl:hasConfidenceLevel whose object is of type ontosl:LowConfidence;
18 ontosl:hasPercentageQuantilewiththevalue95. ```  
Assuming the value of?scenario from Query from Listing 1 is <SCENARIO>, Query from Listing 2 shows the query to obtain the total construction costs of buildings impacted by this scenario. The connection between the scenario and buildings, specified in Line 8, is established by the sea level impact agent (as described in Section 3.5.5). The triple pattern in Line 9 ensures that?building is an instance of the bldg:Building class. Line 10 shows the triple pattern that retrieves the cost value, adhering to the Ontology of Units of Measure [63]. The function SUM(?cost) AS?totalcost aggregates these costs to provide the total construction cost for the given scenario. ```
1 PREFIXobe:<[[https://www.theworldavatar.com/kg/ontobuiltenv/](https://www.theworldavatar.com/kg/ontobuiltenv/)]([https://www.theworldavatar.com/kg/ontobuiltenv/](https://www.theworldavatar.com/kg/ontobuiltenv/))>
2 PREFIXontosl:<[[https://www.theworldavatar.com/kg/ontoseallevel/](https://www.theworldavatar.com/kg/ontoseallevel/)]([https://www.theworldavatar.com/kg/ontoseallevel/](https://www.theworldavatar.com/kg/ontoseallevel/))>
3 PREFIXbldg:<[[http://www.opengis.net/citygml/building/2.0/](http://www.opengis.net/citygml/building/2.0/)]([http://www.opengis.net/citygml/building/2.0/](http://www.opengis.net/citygml/building/2.0/))>
4 PREFIXom:<[[http://www.ontology-of-units-of-measure.org/resource/om-2/](http://www.ontology-of-units-of-measure.org/resource/om-2/)]([http://www.ontology-of-units-of-measure.org/resource/om-2/](http://www.ontology-of-units-of-measure.org/resource/om-2/))>
5
6 SELECT(SUM(?cost)AS?totalcost)
7 WHERE{
8<SCENARIO>ontosl:hasPotentialImpact?building. 9?buildingabldg:Building;
10 obe:hasEstimatedConstructionCost/om:hasValue/om:hasNumericalValue?cost. 11}
```  
Listing 2: SPARQL query for summing construction costs. The link between the Ontology of Units of Measure and the local ontologies is indicated in Figure 1, in particular the following statement:  
bldg:Building obe:hasEstimatedConstructionCost om:Cost.