query-6c69f7f43e91fd04e1974c15659b7a5e

rq turtle/ttl

.on Mastodon and on TwitterOriginally posted

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?remake ?remakeLabel (MIN(?remakeDate_) AS ?remakeDate) ?original ?originalLabel (MIN(?originalDate_) AS ?originalDate) WHERE {
  ?remake wdt:P31/wdt:P279* wd:Q111241092;
          wdt:P144 ?original;
          wdt:P577 ?remakeDate_.
  ?original wdt:P31/wdt:P279* wd:Q11424;
            wdt:P577 ?originalDate_.
  FILTER NOT EXISTS {
    ?otherRemake wdt:P31/wdt:P279* wd:Q111241092;
                 wdt:P144 ?original;
                 wdt:P577 ?otherRemakeDate_.
    FILTER(?otherRemakeDate_ < ?remakeDate_)
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?remake ?remakeLabel ?original ?originalLabel
ORDER BY DESC(?remakeDate - ?originalDate)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?original"):::projected v9("?originalDate") v8("?originalDate_"):::projected v5("?otherRemake") v3("?otherRemakeDate_") v7("?remake"):::projected v9("?remakeDate") v4("?remakeDate_"):::projected a2((" ")) a3((" ")) a1((" ")) c8(["bd:serviceParam"]):::iri c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal c3(["wd:Q111241092"]):::iri c6(["wd:Q11424"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0f0[["?otherRemakeDate_ < ?remakeDate_"]] e0f0 --> e0v1 e0f0 --> e0v2 e0v3 --"wdt:P31"--> e0a1 e0a1 --"wdt:P279"--> e0c3 e0v3 --"wdt:P144"--> e0v4 e0v3 --"wdt:P577"--> e0v1 e0v4("?original"):::projected e0v3("?otherRemake"):::projected e0v1("?otherRemakeDate_"):::projected e0v2("?remakeDate_"):::projected e0a1((" ")):::projected e0c3(["wd:Q111241092"]):::iri end f0--EXISTS--> f0e0 f0 --> v3 f0 --> v4 f0 --> v5 f0 --> c1 f0 --> a1 f0 --> c2 f0 --> c3 f0 --> c4 f0 --> v6 f0 --> c5 f1[["?otherRemakeDate_ < ?remakeDate_"]] f1 --> v3 f1 --> v4 v5 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 v5 --"wdt:P144"--> v6 v5 --"wdt:P577"--> v3 v7 --"wdt:P31"--> a2 a2 --"wdt:P279"--> c3 v7 --"wdt:P144"--> v6 v7 --"wdt:P577"--> v4 v6 --"wdt:P31"--> a3 a3 --"wdt:P279"--> c6 v6 --"wdt:P577"--> v8 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end bind4[/"min(?remakeDate_)"/] v4 --o bind4 bind4 --as--o v9 bind5[/"min(?originalDate_)"/] v8 --o bind5 bind5 --as--o v9