User:Daanvr

From Wikidata
Jump to navigation Jump to search
Babel user information
nl-N Deze gebruiker heeft het Nederlands als moedertaal.
en-4 This user has near native speaker knowledge of English.
fr-4 Cet utilisateur dispose de connaissances proches de la langue maternelle en français.
de-1 Dieser Benutzer beherrscht Deutsch auf grundlegendem Niveau.
QuickStatements logoThis user uses QuickStatements.
This user has a page on English Wikipedia.
Users by language

This is my Wikidata user page. I also have a Wikimedia Commons user page. Here is an incompleet map of images I uploaded

This user loves Wikidata.



User subpages

[edit]

Tools I use for editing

[edit]

Further reading for me

[edit]
[edit]

Query exemples

[edit]

API query examples

[edit]

Useful queries for external services and bots

All properties and their values of a given item

[edit]
# added 2022-08
# title: All Properties and Values of an Item
# Based on the "winwaed"'s answer on Stack Overflow: https://stackoverflow.com/questions/56486888/how-to-get-property-labels-from-wikidata-using-sparql

SELECT ?propLabel ?valueLabel
WHERE
{
  wd:Q243 ?a ?value.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } 
  ?prop wikibase:directClaim ?a .
}
Try it!

similar but with qualifiers based on this Stackoverflow answer

Other queries

[edit]

UNESCO World Heritage Sites (including Tentative)

[edit]
#defaultView:Map
SELECT ?item ?itemLabel ?itemDescription ?image (SAMPLE(?geo) AS ?geo) (SAMPLE(?pic) AS ?pic) (SAMPLE(?picAlbum) AS ?picAlbum) (SAMPLE(?article) AS ?article) WHERE {
         { ?item wdt:P4171 ?WorldHeritageTentative. }
  UNION  { ?item wdt:P757 ?WorldHeritage. }
  UNION  { ?item wdt:P31/wdt:P279* wd:Q9259.}
  
  OPTIONAL { ?item wdt:P625 ?geo. }
  OPTIONAL { ?item wdt:P18 ?pic. }
  OPTIONAL { ?item wdt:P373 ?picAlbum. }
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en".
    ?item rdfs:label ?itemLabel;
      schema:description ?itemDescription.
  }
  OPTIONAL {
    ?article schema:about ?item;
      schema:isPartOf <https://en.wikipedia.org/>.
  }
}
GROUP BY ?item ?itemLabel ?itemDescription ?image
Try it!

Ancient history query

[edit]
#defaultView:Map
            SELECT DISTINCT ?item ?itemLabel ?itemDescription ?geo ?img ?commons ?instanceOf ?instanceOfLabel ?sitelink WHERE {
              # \"instance of\" \"Roman amphitheatre\" or(UNION) \"Greek theatre\" or one of it's subclasses(/wdt:P279*)
              {?item wdt:P31/wdt:P279* wd:Q7362268.} #Roman amphitheatre
              UNION {?item wdt:P31/wdt:P279* wd:Q2860319} #Greek Theater
              UNION {?item wdt:P31/wdt:P279* wd:Q69391739} #Greek colony
              UNION {?item wdt:P31/wdt:P279* wd:Q24933318} #Galo-roman amphiteaters
              UNION {?item wdt:P31/wdt:P279* wd:Q6581615} #Thermae
              UNION {?item wdt:P31/wdt:P279* wd:Q19757} #Roman theatre
              UNION {?item wdt:P31/wdt:P279* wd:Q867143} #Roman temple
              UNION {?item wdt:P31/wdt:P279* wd:Q918230} #Roman villa
              UNION {?item wdt:P31/wdt:P279* wd:Q2202509} #Roman city
              UNION {?item wdt:P31/wdt:P279* wd:Q782970} #domus 
              UNION {?item wdt:P31/wdt:P279* wd:Q252021} #villa rustica
              UNION {?item wdt:P31/wdt:P279* wd:Q180927} #mastaba 
              UNION {?item wdt:P31/wdt:P279* wd:Q2270185} #Mesoamerican pyramids 
              UNION {?item wdt:P31/wdt:P279* wd:Q1456099} #step pyramid
              UNION {?item wdt:P31/wdt:P279* wd:Q731966} #nymphaeum 
              UNION {?item wdt:P361/wdt:P279* wd:Q38888} #Olympia 
              UNION {?item wdt:P361/wdt:P279* wd:Q43332} #Pompeii 
              UNION {?item wdt:P31/wdt:P279* wd:Q6581615} #thermae  
              UNION {?item wdt:P31/wdt:P279* wd:Q1473950} #stepwell 
              UNION {?item wdt:P31/wdt:P279* wd:Q3411290} #smooth-sided pyramid
              UNION {?item wdt:P31/wdt:P279* wd:Q200141} #necropolis v
              UNION {?item wdt:P31/wdt:P279* wd:Q877152} #White elephant
              UNION {?item wdt:P31/wdt:P279* wd:Q12223988} #sphinx 
              UNION {?item wdt:P31/wdt:P279* wd:Q66108498} #Wonder of the Ancient World
              UNION {?item wdt:P31/wdt:P279* wd:Q13466456} #house of millions of years
              UNION {?item wdt:P31/wdt:P279* wd:Q665247} #hypogeum 
              UNION {?item wdt:P179/wdt:P279* wd:Q458082} #list of burials in the Valley of the Kings
              UNION {?item wdt:P179/wdt:P279* wd:Q690551} #list of Theban Tombs
              UNION {?item wdt:P136/wdt:P279* wd:Q6611811} #list of colossal sculpture in situ
              UNION {?item wdt:P31/wdt:P279* wd:Q855747} #Egyptian temple 
              UNION {?item wdt:P31/wdt:P279* wd:Q15661340} #ancient city 
              UNION {?item wdt:P361/wdt:P279* wd:Q5788} #Petra  
              UNION {?item wdt:P5008/wdt:P279* wd:Q68074438} #WikiProject Livius 
              UNION {?item wdt:P2596/wdt:P279* wd:Q220594} #Nabataeans  
              UNION {?item wdt:P361/wdt:P279* wd:Q163607} #Angkor 
              UNION {?item wdt:P361/wdt:P279* wd:Q1493784} #Chemtou, archaeological site in Tunisia 
              UNION {?item wdt:P361/wdt:P279* wd:Q3378708} #Pheradi Majius
              UNION {
                ?romanArchio wdt:P2596 wd:Q1747689. #everything Ancient Rome
                ?romanArchio wdt:P625 ?notRelavant. #Only keep thing with a location
                ?item wd:* ?romanArchio. #add them to item
              } # Anicent Roman Locations
                UNION {
                ?romanCity wdt:P31/wdt:P279* wd:Q2202509. #everything Ancient Rome
                ?romanCity wdt:P625 ?notRelavant. #Only keep archiological site
                ?item wd:* ?romanCity. #add them to item
              }  
              ?item wdt:P625 ?geo . #Filter on \"has a location\"
              OPTIONAL {?item wdt:P18 ?img}. # if result has a location, get it
              OPTIONAL {?item wdt:P373 ?commons}. # wiki commons img categorie
              OPTIONAL {?item wdt:P31 ?instanceOf}. #Hat is it part of?
              OPTIONAL { ?sitelink schema:about ?item.
                ?sitelink schema:isPartOf <https://en.wikipedia.org/>. }
            
              SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
            
            }
            LIMIT 10000
Try it!

Windmils in commons pictues query

[edit]

A http://wcqs-beta.wmflabs.org query. Quering images dipicting windmils, and bringing along coordinates when they exist. For more Wikimedia Commons Query Service Exemples

#defaultView:ImageGrid
SELECT ?file ?image ?geo WHERE {
  ?file wdt:P180 wd:Q38720;
    schema:contentUrl ?url.
   OPTIONAL{ ?file wdt:P1259 ?geo.} #location on the point ov vieuw
   OPTIONAL{ ?file wdt:P625 ?geo2.} #location
  BIND(IRI(CONCAT("http://commons.wikimedia.org/wiki/Special:FilePath/", wikibase:decodeUri(SUBSTR(STR(?url), 53 )))) AS ?image)
}
Try it!

get almoost all items in map vieuw (coordinat box)

[edit]
#defaultView:ImageGride
SELECT
  ?itemNew ?itemNewLabel ?itemNewDescription
  ?geo ?img ?categorie
  (GROUP_CONCAT(?instanceLabel; SEPARATOR = ", ") AS ?instancesof) # a nices String with the labels of the different instances of related to the item
WITH
{
  SELECT 
    ?itemNew 
    (SAMPLE(?geo_) AS ?geo) # The SAMPLE code is needed to inform the GROUP BY code what to do when there are more than one.
    (SAMPLE(?img_) AS ?img)
  WHERE
  {
    #### Selection based on location ####   
    SERVICE wikibase:box
    {
      ?itemNew wdt:P625 ?geo_.
      bd:serviceParam wikibase:cornerWest "Point(2.30 48.87)"^^geo:wktLiteral. 
      bd:serviceParam wikibase:cornerEast "Point(2.32 48.86)"^^geo:wktLiteral.
    }

    MINUS { ?itemNew (wdt:P31/(wdt:P279*)) wd:Q376799. } # Remove everything related to roads
    ?itemNew wdt:P18 ?img_. # Only keep items with pictures
  }
  GROUP BY ?itemNew
} AS %get_items
WHERE
{
  INCLUDE %get_items

  #### Categorise items ####
  BIND(
    IF(EXISTS {?itemNew (wdt:P31/(wdt:P279*)) wd:Q811979},
       "Architectural",
       IF(EXISTS {?itemNew (wdt:P31/(wdt:P279*)) wd:Q1656682},
          "Event",
          "Other"
         )
      )
  AS ?categorie)
  
  OPTIONAL { ?itemNew wdt:P31 ?instance. } # Get instances
   
  #### Wikipedia link ####
  OPTIONAL {
    ?article schema:about ?itemNew . # Get wikipedia link
    ?article schema:isPartOf <https://en.wikipedia.org/>. # Only keep EN language
  }
  
  #### Labels & discription #### 
  SERVICE wikibase:label { # Get labels
    bd:serviceParam wikibase:language "en". 
    ?instance rdfs:label ?instanceLabel.      # The specification of the variables to be labeld is needed for grouping the instances of correctly
    ?itemNew rdfs:label ?itemNewLabel.
    ?itemNew schema:description ?itemNewDescription.
  }
}
GROUP BY ?itemNew ?itemNewLabel ?itemNewDescription ?geo ?img ?categorie ?article
Try it!

Nazi death camps query

[edit]

A map of Nazi death camp locations in a SPARQL query It is impressive to see the quantity of camps.

Digital Atlas of the Roman Empire query

[edit]

Here follows an evolution of a query I have written to find the historical location of the Roman era that can be visited today.

  • Wikidata SPARQL query - added a filter that filters down to include only locations that are archaeological sites and have a Commons album link and/or property.
  • Wikidata SPARQL query - original query: all items that have a "Digital Atlas of the Roman Empire ID" property.

Next up: making a tool to loop through all locations and determine by hand how interesting each location is to visit.

I am using the data from this query to add to the hand-picked data set behind my pet project showing interesting places from Roman history to visit.


Adding Google Maps CID to a Wikidata item

[edit]

It is not straight forward. The Google Maps CID used as a Reference code from the Wikidata item is hidden.

  • Step 1: Find and select the correct Google Maps item.
  • Step 2: Find the Hexadecimal CID by look for the second string of characters just after the "0x" ending before the "!" in the URL.
    • exemple: google.com/maps/place/Le+Collectif+du+Château+de+Verchaüs/@44.5102554,4.6807098,3a,75y,90t/data=!3m8!1e2!3m6!1sAF1QipOlaaaRfNV0HAa9B1ZdCJpi6vueTCZtxSYngN6W!2e10!3e12!6shttps:%2F%2Flh5.googleusercontent.com%2Fp%2FAF1QipOlaaaRfNV0HAa9B1ZdCJpi6vueTCZtxSYngN6W%3Dw203-h360-k-no!7i1836!8i3264!4m5!3m4!1s0x0:0x24627753b48d58a4!8m2!3d44.510282!4d4.680589
    • When lost, try this guid: and look for the section called: "From Google Maps for an SAB Listing (with hidden address)"
  • Step 3: convert the Hexadecimal to a number. This tool does the job among others.
  • Step 4: Add the CID as a Google Maps Customer ID (P3749) to the correct Wikidata item.