A set of SPARQL examples that are used in different TGX resources
License: https://www.gnu.org/licenses/gpl-3.0
Uses method in: https://github.com/WDscholia/scholia/tree/master/scholia/app/templates/topic_co-occurring-map.sparql
Topic aspect: co occurring map
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
#defaultView:Map
PREFIX target: <http://www.wikidata.org/entity/Q45340488>
SELECT
?location ?locationLabel
?geo
?example_work ?example_workLabel
WITH {
SELECT
?location ?geo
(SAMPLE(?work) AS ?example_work)
WHERE {
# Find works that are marked with main subject of the topic.
?work wdt:P921 / ( wdt:P31*/wdt:P279* | wdt:P361+ | wdt:P1269+ ) target: .
# Identify co-occuring topic that is geo-locatable.
?work wdt:P921 ?location .
?location wdt:P625 ?geo .
}
GROUP BY ?location ?geo
} AS %results
WHERE {
INCLUDE %results
# Label the results
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" .
}
}
graph TD