query-ccda2cb3a6d5b18d53bb3241e33e5c15

rq turtle/ttl

将数据排列

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT * 


WHERE {
   {
SELECT ?year ?country ?human ?yearOther ?countryOther ?humanOther WHERE {
    ?human (p:P166) ?awardStatement.
    ?awardStatement ps:P166/wdt:P279* wd:Q7191.
    ?awardStatement pq:P585 ?date.
    bind(str(YEAR(?date)) AS ?year)

    ?humanOther (p:P166) ?awardStatementOther.
    ?awardStatementOther ps:P166/wdt:P279* wd:Q7191.
    ?awardStatementOther pq:P585 ?dateOther.
    bind(str(YEAR(?dateOther)) AS ?yearOther)

    FILTER (?year >= ?yearOther).
    FILTER (?year >= "1901" && ?year <= "1903").
}
}

  ?human  wdt:P27 ?country.
  ?humanOther  wdt:P27 ?countryOther.
  FILTER(?country = ?countryOther)
}

#GROUP BY ?year
ORDER BY ASC(?year)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?awardStatement") v9("?awardStatementOther") v2("?country"):::projected v3("?countryOther"):::projected v7("?date") v10("?dateOther") v5("?human"):::projected v8("?humanOther"):::projected v8("?year"):::projected v11("?yearOther"):::projected a1((" ")) a2((" ")) c6(["wd:Q7191"]):::iri f0[["?country = ?countryOther"]] f0 --> v2 f0 --> v3 f1[["?year >= '1901'?year <= '1903'"]] f1 --> v8 f2[["?year >= ?yearOther"]] f2 --> v8 f2 --> v11 v5 --"p:P166"--> v6 v6 --"p:statement/P166"--> a1 a1 --"p:direct/P279"--> c6 v6 --"p:qualifier/P585"--> v7 bind3[/"str(year-from-dateTime(?date))"/] v7 --o bind3 bind3 --as--o v8 v8 --"p:P166"--> v9 v9 --"p:statement/P166"--> a2 a2 --"p:direct/P279"--> c6 v9 --"p:qualifier/P585"--> v10 bind4[/"str(year-from-dateTime(?dateOther))"/] v10 --o bind4 bind4 --as--o v11 v5 --"p:direct/P27"--> v2 v8 --"p:direct/P27"--> v3