User:Realworldobject/GraphDBExamples

From Wikidata
Jump to navigation Jump to search

Bryan's example

[edit]

The following query uses these:

Features: map (Q24515275)  View with Reasonator View with SQID

#defaultView:Map{"layer":"?instance_ofLabel"}
SELECT ?book ?bookLabel ?person ?personLabel ?birthplace ?birthplaceLabel ?image ?coordinate_location
WHERE {
  SERVICE wikibase:around {
    ?birthplace wdt:P625 ?coordinate_location.
    bd:serviceParam wikibase:center "[AUTO_COORDINATES]".
    bd:serviceParam wikibase:radius "150".
    bd:serviceParam wikibase:distance ?dist.
  }
  ?person wdt:P19 ?birthplace .
  ?book wdt:P31/wdt:P279* wd:Q571; 
        wdt:P50 ?person .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  OPTIONAL { ?book wdt:P18 ?image. }
}

Number of Women Composers

[edit]

The following query uses these:

Birthplaces of women composers born before 1800

[edit]

The following query uses these:

Features: map (Q24515275)  View with Reasonator View with SQID

#defaultView:Map
SELECT ?item ?itemLabel ?image ?placeOfBirth ?placeOfBirthLabel ?coordinates
WHERE {
  ?item wdt:P21 wd:Q6581072;
        wdt:P106/wdt:P279* wd:Q36834;
        wdt:P19 ?placeOfBirth;
        wdt:P569 ?birthdate .
  OPTIONAL {?item wdt:P18 ?image}
  ?placeOfBirth wdt:P625 ?coordinates .
  FILTER(YEAR(?birthdate) < 1800)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Images of women composers born between 1000 and 1700

[edit]

Note incorrect birthdate for زویا زاکاریان

The following query uses these:

  • Properties: sex or gender (P21)  View with Reasonator View with SQID, occupation (P106)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, date of birth (P569)  View with Reasonator View with SQID, image (P18)  View with Reasonator View with SQID
    #defaultView:Timeline
    SELECT DISTINCT ?item ?itemLabel ?image ?birthdate
    WHERE {
      ?item wdt:P21 wd:Q6581072;
            wdt:P106/wdt:P279* wd:Q36834;
            wdt:P569 ?birthdate .
      ?item wdt:P18 ?image.
      FILTER(YEAR(?birthdate) > 1000 && YEAR(?birthdate) < 1700)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }