from-negatives-to-knowledge

Home

📊 SPARQL Queries

Explore queries contributed by and inspired by UNLV Wikimedians and Wikidata editors, focusing on community-linked topics. These examples progress from basic lookups to advanced graph patterns.


🔍 Query #1: What types of things have UNLV Wikimedians contributed to?

This query looks at all items connected to the UNLV Wikimedians Projects and returns what types of entities they are instance of(wdt:P31).

SELECT DISTINCT ?instanceOfLabel ?instanceOf
WHERE
{
 ?resource wdt:P5008 wd:Q100202113 ;
     wdt:P31 ?instanceOf .
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}ORDER BY ASC(?instanceOfLabel)

▶️ Run this query on Wikidata


🧮 Query #2: What properties are used in UNLV Wikimedians’ contributions?

This query identifies which Wikidata properties (P###) are used across the group’s contributions and returns both the property and its English label.

SELECT DISTINCT ?property ?propertyLabel
WHERE
{
 ?resource wdt:P5008 wd:Q100202113 .
 ?resource ?prop ?value .
 ?property wikibase:directClaim ?prop .
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}ORDER BY ?propertyLabel

▶️ Run this query on Wikidata


🗺️ Query #3: Map by Type (instance of)

This adds a map visualization layer for contributions to Wikidata by the UNLV Wikimedians group, grouped by what type of entity they are.

#defaultView:Map
SELECT DISTINCT ?resource ?resourceLabel ?coord ?layerLabel
WHERE
{
 ?resource wdt:P5008 wd:Q100202113 ;
     wdt:P31 ?type ;
     wdt:P625 ?coord .
 BIND(?type AS ?layer)
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}ORDER BY ASC(?layerLabel)

▶️ Run this query with Map view


🔍 Query #4: Graph of People from WikiProject African Diaspora

This CONSTRUCT query builds a graph of individuals associated with the WikiProject African diaspora (Q15304953). It includes their place of birth, date of birth/death, and occupation using schema.org and skos vocabularies.

CONSTRUCT 
{
  ?item a skos:Concept,schema:Person .
  ?item skos:prefLabel ?itemLabel .
  ?item skos:note ?description .
  ?item schema:birthDate ?dateOfBirth .
  ?item schema:deathDate ?dateOfDeath .
  ?item schema:birthPlace ?placeOfBirth .
  ?item schema:occupation ?occupation .
  ?occupation a skos:Concept,schema:Occupation .
  ?occupation skos:prefLabel ?occupationLabel .
  ?occupation skos:note ?occupation_description .
  ?placeOfBirth a skos:Concept,schema:Place .
  ?placeOfBirth skos:prefLabel ?placeOfBirthLabel .
  ?placeOfBirth skos:note ?placeOfBirth_description .
}
WHERE {
  ?item wdt:P5008 wd:Q15304953 ;
    wdt:P31 wd:Q5 ;
    wdt:P31 ?instanceOf ;
    rdfs:label ?itemLabel .
   FILTER (LANG(?itemLabel) = "en")
  ?item schema:description ?description .
  FILTER (LANG(?description) = "en")
  ?item wdt:P106 ?occupation .
  ?occupation rdfs:label ?occupationLabel .
  FILTER (LANG(?occupationLabel) = "en")
  ?occupation schema:description ?occupation_description .
  FILTER (LANG(?occupation_description) = "en")
  ?item wdt:P569 ?dateOfBirth .
  OPTIONAL {?item wdt:P570 ?dateOfDeath} .
  ?item wdt:P19 ?placeOfBirth .
  ?placeOfBirth rdfs:label ?placeOfBirthLabel .
  FILTER (LANG(?placeOfBirthLabel) = "en")
  ?placeOfBirth schema:description ?placeOfBirth_description .
  FILTER (LANG(?placeOfBirth_description) = "en")
} LIMIT 100

▶️ Run this graph query