-----------------------------------------------------------------------------------------------
## Project: GeoKnow, http://geoknow.eu
## Institute for the Management of Information Systems, Athena R.C.
## Testing (Geo)SPARQL queries against Metadata with TripleGeo-CSW middleware
## Using INSPIRE-compliant metadata in CSW from several European agencies and portals.
## Queries prepared by Nikos Georgomanolis, mailto:ngeorgomanolis@imis.athena-innovation.gr
## Date: 09/05/2014
## Revised: 28/05/2014
-----------------------------------------------------------------------------------------------
## C1: Identify datasets modified in 2010 and afterwards:
--------------------------------------------------------
PREFIX dct:
PREFIX xsd:
SELECT *
WHERE {
?s dct:modified ?date .
FILTER ( ?date > "2010-01-01"^^xsd:date )
}
## C2: Find datasets having "oceans" or "boundaries" as subjects:
---------------------------------------------------------------
PREFIX dc:
SELECT *
WHERE {
{?s dc:subject "oceans"}
UNION
{?s dc:subject "boundaries"}
}
## C3: Find datasets that include the term "population" in their title:
---------------------------------------------------------------------
PREFIX dc:
SELECT *
WHERE {
?s dc:title ?title .
FILTER ( REGEX( ?title , "*population*" ))
}
## C4: Identify datasets on "biota" that include the term "ecology" in their title:
---------------------------------------------------------------------------------
PREFIX dc:
SELECT *
WHERE {
?b dc:subject "biota" .
?s dc:title ?title .
FILTER ( REGEX(?title , "*ecology*"))
}
## C5: Find datasets that include the term "water" in their title and were modified before 2014:
----------------------------------------------------------------------------------------------
PREFIX dct:
PREFIX xsd:
SELECT *
WHERE {
?s dct:modified ?date .
?b dc:title ?title .
FILTER ( (?date < "2014-01-01"^^xsd:date) && REGEX(str(?title) , "%water%"))
}
## C6: Find any datasets with an area of coverage that geographically contains the given rectangle:
-------------------------------------------------------------------------------------------------
PREFIX geo:
PREFIX geof:
SELECT *
WHERE {
?s geo:hasGeometry ?fWKT .
FILTER (geof:sfContains(?fWKT, "BOX2D(-5.01 50.23, 1.69 56.12)"^^geo:wktLiteral))
}
## C7: Find datasets mentioning term "ecology" in their title and having an area of coverage that is within the given rectangle:
------------------------------------------------------------------------------------------------------------------------
PREFIX dc:
PREFIX geo:
PREFIX geof:
SELECT *
WHERE {
?b dc:subject "biota" .
?s dc:title ?title .
?s geo:hasGeometry ?fWKT .
FILTER ( REGEX(?title , "*ecology*") && geof:sfWithin(?fWKT, "BOX2D(-5.01 50.23, 1.69 56.12)"^^geo:wktLiteral))
}