Skip to content
Natalie Prange edited this page Feb 28, 2025 · 4 revisions

This page contains QLever links used in Natalie Prange's PhD thesis.

Human name frequencies

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?person_label (COUNT(?person) AS ?num_person) WHERE {
  ?person wdt:P31 wd:Q5 .
  ?person rdfs:label ?person_label .
  FILTER (LANG(?person_label) = "en") .
}
GROUP BY ?person_label
ORDER BY DESC(?num_person)

Run this query

Entities labeled Beethoven

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?item  ?item_label WHERE {
  ?item rdfs:label "Beethoven"@en .
  ?item rdfs:label ?item_label .
  FILTER (LANG(?item_label) = "en") .
}

Run this query

Entities labeled Symphony No. 9

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?item  ?item_label WHERE {
  ?item rdfs:label "Symphony No. 9"@en .
  ?item rdfs:label ?item_label .
  FILTER (LANG(?item_label) = "en") .
}

Run this query

QA example query

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT * WHERE {
  ?person wdt:P106 wd:Q593644 .
  ?person wdt:P509 wd:Q846316 .
}

Run this query

Multi-word names

Humans and fictional characters whose name consists of multiple words

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT DISTINCT ?s WHERE {
  {
    ?s wdt:P31/wdt:P279* wd:Q5 .
    ?s @en@rdfs:label ?sl .
	FILTER REGEX(STR(?sl), ".+ .+") .
  } UNION {
    ?s wdt:P31/wdt:P279* wd:Q95074 .
    ?s @en@rdfs:label ?sl .
	FILTER REGEX(STR(?sl), ".+ .+") .
  }
}

Run this query

Clone this wiki locally