-
-
-
-
-
-
-
-
-
-Silid Pod Campanian Ignimbrite Sites¶
-
-
-
-
-
-
-
-
-
-
-This notebook fetches Campanian Ignimbrite sites using a SPARQL query from a solid pod.
-
-
-
-
-
-
-
-
-
-Define SPARQL query service¶
-
-
+
-
+
-
-
-
+ In [237]:
-
-
+
-
+
+ from SPARQLWrapper import SPARQLWrapper, TURTLE
+
+
+
+
+
+
+
+
+
+
+
+
+ Silid Pod Campanian Ignimbrite Sites¶
+
+
+
+
+
+
+
+
+
+
+
+
+ This notebook fetches Campanian Ignimbrite sites using a SPARQL
+ query from a solid pod.
+
+
+
+
+
+
+
+
+
+
+
+
+ Define SPARQL query service¶
+
+
+
+
+
+
+
+
+
+ In [237]:
+
+
+
+ from SPARQLWrapper import SPARQLWrapper, TURTLE
from rdflib import Graph, Namespace
from rdflib.namespace import RDF, RDFS
import os
@@ -7571,31 +7776,49 @@ Define SPARQL query servicesparql.setReturnFormat(TURTLE) # Request Turtle format
results = sparql.query().convert()
return results
-
-
-
-
-
-
-
-
-
-
-
-
-Define the SPARQL Query¶
-
-
-
-
-
-
-
-
-In [238]:
-
-
-# SPARQL Query
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Define the SPARQL Query¶
+
+
+
+
+
+
+
+
+
+ In [238]:
+
+
+
+ # SPARQL Query
solid_pod_query = """
SELECT ?item ?geo ?label ?ref ?spatialType {
?item a <http://fuzzy-sl.squirrel.link/ontology/Site> .
@@ -7606,31 +7829,47 @@ Define the SPARQL Query ?item_geom <http://www.opengis.net/ont/geosparql#asWKT> ?geo .
}
"""
-
-
-
-
-
-
-
-
-
-
-
-
-Fetch Data and Convert to DataFrame¶
-
-
-
-
-
-
-
-
-In [239]:
-
-
-sparql_endpoint = "https://fuzzy-sl.solidweb.org/campanian-ignimbrite-geo/ci_full.ttl"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Fetch Data and Convert to DataFrame¶
+
+
+
+
+
+
+
+
+
+ In [239]:
+
+
+
+ sparql_endpoint = "https://fuzzy-sl.solidweb.org/campanian-ignimbrite-geo/ci_full.ttl"
# Query the endpoint
turtle_data = querySolidPod(sparql_endpoint, solid_pod_query)
@@ -7669,144 +7908,158 @@ Fetch Data and Convert to DataFrame
# Convert the data to a pandas DataFrame
df = pd.DataFrame(data)
df
-
-
-
-
-
-
-
-
-
-
-
-
-c:\Users\flori\AppData\Local\Programs\Python\Python310\lib\site-packages\SPARQLWrapper\Wrapper.py:778: RuntimeWarning: Sending Accept header '*/*' because unexpected returned format 'turtle' in a 'SELECT' SPARQL query form
- warnings.warn(
-
-
-
-Out[239]:
-
-
-
-
-
-
-
-spatialType
-latitude
-longitude
-
-
-
-
-0
-Sink
-40.9489
-14.3624
-
-
-1
-UnknownCategory
-40.9285
-14.6983
-
-
-2
-InhabitedPlace
-40.7119
-14.7680
-
-
-3
-InhabitedPlace
-40.6993
-14.5259
-
-
-4
-Cave
-40.4956
-15.2092
-
-
-...
-...
-...
-...
-
-
-98
-UnknownCategory
-44.9032
-20.2802
-
-
-99
-UnknownCategory
-44.2462
-27.9347
-
-
-100
-UnknownCategory
-44.2462
-27.9347
-
-
-101
-Lake
-40.9167
-21.0000
-
-
-102
-Lake
-40.9167
-21.0000
-
-
-
-103 rows × 3 columns
-
-
-
-
-
-
-
-
-
-
-
-
-Visualise the Data in a bar chart¶
-
-
-
-
-
-
-
-
-In [240]:
-
-
-# Check if DataFrame is populated
+ .dataframe thead th {
+ text-align: right;
+ }
+
+
+
+
+
+ spatialType
+ latitude
+ longitude
+
+
+
+
+ 0
+ Sink
+ 40.9489
+ 14.3624
+
+
+ 1
+ UnknownCategory
+ 40.9285
+ 14.6983
+
+
+ 2
+ InhabitedPlace
+ 40.7119
+ 14.7680
+
+
+ 3
+ InhabitedPlace
+ 40.6993
+ 14.5259
+
+
+ 4
+ Cave
+ 40.4956
+ 15.2092
+
+
+ ...
+ ...
+ ...
+ ...
+
+
+ 98
+ UnknownCategory
+ 44.9032
+ 20.2802
+
+
+ 99
+ UnknownCategory
+ 44.2462
+ 27.9347
+
+
+ 100
+ UnknownCategory
+ 44.2462
+ 27.9347
+
+
+ 101
+ Lake
+ 40.9167
+ 21.0000
+
+
+ 102
+ Lake
+ 40.9167
+ 21.0000
+
+
+
+ 103 rows × 3 columns
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Visualise the Data in a bar chart¶
+
+
+
+
+
+
+
+
+
+ In [240]:
+
+
+
+ # Check if DataFrame is populated
if not df.empty and 'spatialType' in df:
# Plot 1: Number of Sites by Spatial Type
plt.figure(figsize=(12, 8))
@@ -7819,43 +8072,62 @@ Visualise the Data in a bar chartplt.show()
else:
print("No data retrieved or 'spatialType' column is missing.")
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Visualise the Data in a map¶
-
-
-
-
-
-
-
-
-In [241]:
-
-
-# Check if DataFrame is populated
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Visualise the Data in a map¶
+
+
+
+
+
+
+
+
+
+ In [241]:
+
+
+
+ # Check if DataFrame is populated
if df.empty:
print("No data retrieved from the query.")
else:
@@ -7883,24 +8155,28 @@ Visualise the Data in a mapplt.title("Map of CI sites in Europe")
plt.legend()
plt.show()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+