User:Bamyers99

From Wikidata
Jump to navigation Jump to search
Babel user information
en-N This user has a native understanding of English.
de-0 Dieser Benutzer beherrscht Deutsch nicht (oder versteht es nur mit beträchtlichen Schwierigkeiten).
es-0 Esta persona no tiene ningún conocimiento del español (o lo entiende con mucha dificultad).
fr-0 Cet utilisateur n’a aucune connaissance en français (ou le comprend avec de grandes difficultés).
mul-N This user has a native understanding of multiple languages.
Users by language

Reports

[edit]
Report Updated
Class browser 1st
Deleted properties 1st
EntitySchema directory 1st, 15th
External identifier completeness 1st
Gadget usage statistics 1st
List of properties 1st, 15th
Navel gazer 1st
[edit]
SPARQL

SPARQL examples

[edit]

Turn off query optimizer

[edit]

hint:Query hint:optimizer "None" .

[edit]

Bridges in USA w/o crosses.

SELECT DISTINCT ?s ?sLabel WHERE {
  ?s wdt:P17 wd:Q30 .
  ?s p:P31 ?stmt .
  ?stmt ps:P31/wdt:P279* wd:Q12280 .
  OPTIONAL {
    ?s p:P177 ?dummy # includes novalue statements
  }
  FILTER ( !bound(?dummy) ) .
  FILTER EXISTS {
    ?article schema:about ?s .
    ?article schema:inLanguage "en" .
    ?article schema:isPartOf <https://en.wikipedia.org/>
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,fr,es,it,pl,nl,pt,sv,no,ar,cs,ca,ml,ms,az,ru" }
 }
 ORDER BY ?sLabel
Try it!

Searches super-administrative entities

[edit]

Covered bridges in Pennsylvania.

SELECT DISTINCT ?s ?sLabel WHERE {
  ?s wdt:P31 wd:Q1825472 .
  ?s wdt:P131/wdt:P131* wd:Q1400 .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
 }
ORDER BY ?sLabel
Try it!

A qualifier's 'value counts' for a specific property

[edit]

population (P1082) qualifier determination method or standard (P459).

SELECT ?determinemethod ?determinemethodLabel ?count WHERE {
  {
    SELECT ?determinemethod (COUNT(?determinemethod) AS ?count) WHERE {
      ?s p:P1082 ?popstatement .
      ?popstatement pq:P459 ?determinemethod .
    }
    GROUP BY ?determinemethod
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
ORDER BY DESC(?count)
Try it!

A qualifier's usage counts

[edit]

Qualifier start time (P580).

SELECT ?wdP ?wdPLabel ?count WHERE {
  {
    SELECT ?prop (COUNT(?prop) AS ?count) WHERE {
      ?s ?prop ?propstatement .
      ?propstatement pq:P580 ?proptime .
    }
    GROUP BY ?prop
  }
  
  ?wdP wikibase:claim ?prop .

  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
ORDER BY DESC(?count)
Try it!

A property's qualifier property counts, includes a SPARQL query of instances

[edit]

Property formatter URL (P1630).

SELECT ?qual ?qualLabel ?count (IRI(CONCAT("https://query.wikidata.org/## qualifier - ", ?qualLabel, "
SELECT ?item ?itemLabel ?qualLabel
WHERE
{
	?item p:P1630 ?statement .
    ?statement pq:", SUBSTR(STR(?qual),32), " ?qual
	SERVICE wikibase:label { bd:serviceParam wikibase:language "en"  }    
}
ORDER BY ?itemLabel")) as ?instances)
WHERE {
  {
    SELECT ?qual (COUNT(DISTINCT ?item) AS ?count) WHERE {
         hint:Query hint:optimizer "None" .
         ?item p:P1630 ?statement .
         ?statement ?pq_qual ?pq_obj .
         ?qual wikibase:qualifier ?pq_qual .
    }  GROUP BY ?qual
  } .

  OPTIONAL {
    ?qual rdfs:label ?qualLabel filter (lang(?qualLabel) = "en") .
  }
}
ORDER BY DESC(?count) ASC(?qualLabel)
Try it!

Missing a qualifier

[edit]

award received (P166)Nobel Prize in Physiology or Medicine (Q80061) missing point in time (P585).

SELECT DISTINCT ?item ?itemLabel
WHERE {
  ?item p:P166 ?awardStat .
  ?awardStat ps:P166 wd:Q80061 .
  OPTIONAL {
    ?awardStat pq:P585 ?when .
  }
  FILTER ( !bound(?when) ) .
  
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
ORDER BY ?itemLabel
Try it!

Unreferenced statement

[edit]

award received (P166)Nobel Prize in Physiology or Medicine (Q80061) missing reference.

SELECT DISTINCT ?item ?itemLabel
WHERE {
  ?item p:P166 ?stmt .
  ?stmt ps:P166 wd:Q80061 .
  OPTIONAL {
      ?stmt prov:wasDerivedFrom ?derivedFrom .
  }
  FILTER ( !bound(?derivedFrom) ) .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
ORDER BY ?itemLabel
Try it!

Reference URL starts with

[edit]
SELECT DISTINCT ?item ?itemLabel
WHERE {
  ?item p:P1411 ?stmt .
  ?stmt prov:wasDerivedFrom ?derivedFrom .
  ?derivedFrom pr:P854 ?refurl .
  FILTER(STRSTARTS(xsd:string(?refurl), "http://www.nobelprize.org/"))
  
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
ORDER BY ?itemLabel
Try it!

Multiple optionals, or filter, must have English label

[edit]
SELECT DISTINCT ?s ?sLabel ?fatherLabel ?motherLabel WHERE {
  ?s wdt:P31/wdt:P279* wd:Q726 .
  OPTIONAL {
    ?s wdt:P22 ?father
    }
  OPTIONAL {
    ?s wdt:P25 ?mother
    }
  OPTIONAL {
    ?s wdt:P3165 ?dummy
  }
  FILTER ( !bound(?dummy) ) .
  FILTER (bound(?father) || bound(?mother) ) .
  FILTER(EXISTS {
    ?s rdfs:label ?lang_label.
    FILTER(LANG(?lang_label) = "en")
  })
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
ORDER BY ?sLabel
Try it!

Items with multiple values for a given property

[edit]
SELECT ?school ?schoolLabel (COUNT(?isni) AS ?isniC) {
  {
    SELECT DISTINCT ?school ?isni {
      ?school wdt:P31/wdt:P279* wd:Q3914 .
      ?school wdt:P213 ?isni .
      ?school wdt:P17 wd:Q30 .
    }
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
GROUP BY ?school ?schoolLabel
HAVING (COUNT(?isni) > 1)
ORDER BY ?schoolLabel
Try it!

Items with a specific value attribute

[edit]

Impact craters with coordinate globe Earth

SELECT DISTINCT ?s ?sLabel WHERE {
  ?s p:P31 ?stmt .
  ?stmt ps:P31/wdt:P279* wd:Q55818 .
  ?s p:P625 ?coordstmt .
  ?coordstmt psv:P625 ?coordvalue .
  ?coordvalue wikibase:geoGlobe <http://www.wikidata.org/entity/Q2> .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,fr,es,it,pl,nl,pt,sv,no,ar,cs,ca,ml,ms,az,ru" }
 }
 ORDER BY ?sLabel
Try it!

Label service in chunks

[edit]
SELECT ?item ?itemLabel ?itemDescription ?mbvalue ?dcvalue WHERE {
  { 
SELECT ?item ?mbvalue ?dcvalue WHERE 
{
  ?item wdt:P434 ?mbvalue . 
  ?item wdt:P1953 ?dcvalue .
}
    ORDER BY ?mbvalue ?dcvalue
    OFFSET 150000
    LIMIT 50000 
    }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en"  }
}
Try it!