Project:SPARQL/starters: Difference between revisions

From Timna Valley Database
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Place==
==Place==
===Where Timna sites are located===
===Where Timna sites are located===
One way into the data is through the locations of archeological sites This query does that for all the sites but could be adapted (on lines *xx* and *xx* TBD) to look for other places or regions.
One way into the data is through the locations of archeological sites. This query does that for all the sites but could be adapted (on lines 16 remove #  and choose  *Qxx*) to look for other places or regions.
<sparql tryit="1">
PREFIX wd: <https://timna-database.wikibase.cloud/entity/>
PREFIX wd: <https://timna-database.wikibase.cloud/entity/>
PREFIX wdt: <https://timna-database.wikibase.cloud/prop/direct/>
PREFIX wdt: <https://timna-database.wikibase.cloud/prop/direct/>
Line 14: Line 15:
   FILTER (STRSTARTS(?entityLabel, "Site"))
   FILTER (STRSTARTS(?entityLabel, "Site"))
   FILTER (STRSTARTS(STR(?entity), "https://timna-database.wikibase.cloud/entity/Q"))
   FILTER (STRSTARTS(STR(?entity), "https://timna-database.wikibase.cloud/entity/Q"))
   ?entity wdt:P28 ?coordinate . }  
   ?entity wdt:P28 ?coordinate .
 
  OPTIONAL {
#  VALUES ?filterEntity { wd:Q523 } # Replace wd:Q523 with the specific item you want to filter by, or leave it empty
  }
 
 
  # Apply filter if ?filterEntity is specified
  FILTER (!BOUND(?filterEntity) || ?entity = ?filterEntity)
}  
LIMIT 300  
LIMIT 300  
##defaultView:Map
##defaultView:Map
</sparql>
==Archaeological Periods==
===Sites from Archaeological periods===
One way into the data is through the archeological periods that were  found. This query shows sites from the early iron age.
To show other periods replace in line 15 and line 19 Q115 with a different period QXXX 
<sparql tryit="1">
# Query for sites from late bronze and iron age
# 1 row per site and coordinatesd.
PREFIX wd: <https://timna-database.wikibase.cloud/entity/>
PREFIX wdt: <https://timna-database.wikibase.cloud/prop/direct/>
PREFIX p: <https://timna-database.wikibase.cloud/prop/>
PREFIX ps: <https://timna-database.wikibase.cloud/prop/statement/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
SELECT DISTINCT ?entity ?entityLabel ?coordinate ?q115Label
WHERE {
  ?entity rdfs:label ?entityLabel .
  FILTER (lang(?entityLabel) = "en")
  FILTER (STRSTARTS(?entityLabel, "Site"))
  FILTER (STRSTARTS(STR(?entity), "https://timna-database.wikibase.cloud/entity/Q"))
  ?entity p:P93 ?statement1 .
  ?statement1 ps:P93 wd:Q115 .
  ?entity wdt:P28 ?coordinate .


[https://timna-database.wikibase.cloud/query/index.html#PREFIX%20wd%3A%20%3Chttps%3A%2F%2Ftimna-database.wikibase.cloud%2Fentity%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Ftimna-database.wikibase.cloud%2Fprop%2Fdirect%2F%3E%0APREFIX%20p%3A%20%3Chttps%3A%2F%2Ftimna-database.wikibase.cloud%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttps%3A%2F%2Ftimna-database.wikibase.cloud%2Fprop%2Fstatement%2F%3E%0APREFIX%20geo%3A%20%3Chttp%3A%2F%2Fwww.opengis.net%2Font%2Fgeosparql%23%3E%0A%0ASELECT%20DISTINCT%20%3Fentity%20%3FentityLabel%20%3Fcoordinate%0AWHERE%20%7B%0A%20%20%3Fentity%20rdfs%3Alabel%20%3FentityLabel%20.%0A%20%20FILTER%20(lang(%3FentityLabel)%20%3D%20%22en%22)%0A%20%20FILTER%20(STRSTARTS(%3FentityLabel%2C%20%22Site%22))%0A%20%20FILTER%20(STRSTARTS(STR(%3Fentity)%2C%20%22https%3A%2F%2Ftimna-database.wikibase.cloud%2Fentity%2FQ%22))%0A%20%20%0A%20%20%3Fentity%20wdt%3AP28%20%3Fcoordinate%20.%0A%7D%0ALIMIT%20300%0A%23#defaultView:Map Try it!]
  wd:Q115 rdfs:label ?q115Label .
  FILTER (lang(?q115Label) = "en")
}
LIMIT 300


==Time==
===When Timna excavations took place===
One way into the data is through the dates the archeological excavations took place. This query does that for CTV of 2024 but could be adapted (on lines *xx* and *xx* TBD) to look for different dates.


Try it!
</sparql>


==People==
==People==
Line 30: Line 66:
This query returns members of the CTV excavations. As such it is a relatively straightforward query.
This query returns members of the CTV excavations. As such it is a relatively straightforward query.


<sparql tryit="1">
PREFIX wd: <https://timna-database.wikibase.cloud/entity/>
PREFIX wdt: <https://timna-database.wikibase.cloud/prop/direct/>
PREFIX p: <https://timna-database.wikibase.cloud/prop/>
PREFIX ps: <https://timna-database.wikibase.cloud/prop/statement/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?entity ?entityLabel ?P110Label ?Instance
WHERE {
  ?entity rdfs:label ?entityLabel .
  FILTER (lang(?entityLabel) = "en")
  FILTER (STRSTARTS(STR(?entity), "https://timna-database.wikibase.cloud/entity/Q"))


  ?entity p:P110 ?statement1 .
  ?entity wdt:P110 ?Instance .


Try it!
  ?Instance rdfs:label ?P110Label .
  FILTER (lang(?P110Label) = "en")
}
LIMIT 300
</sparql>

Latest revision as of 07:12, 18 July 2024

Place

Where Timna sites are located

One way into the data is through the locations of archeological sites. This query does that for all the sites but could be adapted (on lines 16 remove # and choose *Qxx*) to look for other places or regions.

PREFIX wd: <https://timna-database.wikibase.cloud/entity/>
PREFIX wdt: <https://timna-database.wikibase.cloud/prop/direct/>
PREFIX p: <https://timna-database.wikibase.cloud/prop/>
PREFIX ps: <https://timna-database.wikibase.cloud/prop/statement/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>

SELECT DISTINCT ?entity ?entityLabel ?coordinate
WHERE {
  ?entity rdfs:label ?entityLabel .
  FILTER (lang(?entityLabel) = "en")
  FILTER (STRSTARTS(?entityLabel, "Site"))
  FILTER (STRSTARTS(STR(?entity), "https://timna-database.wikibase.cloud/entity/Q"))
  ?entity wdt:P28 ?coordinate .

  OPTIONAL {
 #   VALUES ?filterEntity { wd:Q523 } # Replace wd:Q523 with the specific item you want to filter by, or leave it empty
  }
  

  # Apply filter if ?filterEntity is specified
  FILTER (!BOUND(?filterEntity) || ?entity = ?filterEntity)
} 
LIMIT 300 
##defaultView:Map

Try it!


Archaeological Periods

Sites from Archaeological periods

One way into the data is through the archeological periods that were found. This query shows sites from the early iron age. To show other periods replace in line 15 and line 19 Q115 with a different period QXXX

# Query for sites from late bronze and iron age
# 1 row per site and coordinatesd.
PREFIX wd: <https://timna-database.wikibase.cloud/entity/>
PREFIX wdt: <https://timna-database.wikibase.cloud/prop/direct/>
PREFIX p: <https://timna-database.wikibase.cloud/prop/>
PREFIX ps: <https://timna-database.wikibase.cloud/prop/statement/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>

SELECT DISTINCT ?entity ?entityLabel ?coordinate ?q115Label
WHERE {
  ?entity rdfs:label ?entityLabel .
  FILTER (lang(?entityLabel) = "en")
  FILTER (STRSTARTS(?entityLabel, "Site"))
  FILTER (STRSTARTS(STR(?entity), "https://timna-database.wikibase.cloud/entity/Q"))

  ?entity p:P93 ?statement1 .
  ?statement1 ps:P93 wd:Q115 .

  ?entity wdt:P28 ?coordinate .

  wd:Q115 rdfs:label ?q115Label .
  FILTER (lang(?q115Label) = "en")
}
LIMIT 300

Try it!


People

This query returns members of the CTV excavations. As such it is a relatively straightforward query.

PREFIX wd: <https://timna-database.wikibase.cloud/entity/>
PREFIX wdt: <https://timna-database.wikibase.cloud/prop/direct/>
PREFIX p: <https://timna-database.wikibase.cloud/prop/>
PREFIX ps: <https://timna-database.wikibase.cloud/prop/statement/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT ?entity ?entityLabel ?P110Label ?Instance 
WHERE {
  ?entity rdfs:label ?entityLabel .
  FILTER (lang(?entityLabel) = "en")
  FILTER (STRSTARTS(STR(?entity), "https://timna-database.wikibase.cloud/entity/Q"))

  ?entity p:P110 ?statement1 .
  ?entity wdt:P110 ?Instance .

  ?Instance rdfs:label ?P110Label .
  FILTER (lang(?P110Label) = "en")
}
LIMIT 300

Try it!