Skip to content

Instantly share code, notes, and snippets.

@rolandcrosby
Created November 23, 2024 02:00
Show Gist options
  • Save rolandcrosby/2a8852e3f7273289a97fa31e567fd5e7 to your computer and use it in GitHub Desktop.
Save rolandcrosby/2a8852e3f7273289a97fa31e567fd5e7 to your computer and use it in GitHub Desktop.
Movies with the longest duration between the original and the sequel
SELECT ?original ?sequel ?originalLabel ?sequelLabel (min(?originalDates) AS ?originalDate) (min(?sequelDates) AS ?sequelDate)
WHERE
{
?sequel wdt:P155 ?original .
?original wdt:P31/wdt:P279* wd:Q11424 .
?sequel wdt:P31/wdt:P279* wd:Q11424 .
?original wdt:P577 ?originalDates .
?sequel wdt:P577 ?sequelDates .
?original rdfs:label ?originalLabel .
?sequel rdfs:label ?sequelLabel
FILTER NOT EXISTS { ?original wdt:P155 ?prequel }
FILTER(LANG(?originalLabel) = "en")
FILTER(LANG(?sequelLabel) = "en")
FILTER(datatype(?originalDates) = xsd:dateTime)
FILTER(datatype(?sequelDates) = xsd:dateTime)
}
GROUP BY ?original ?originalLabel ?sequel ?sequelLabel
ORDER BY (YEAR(?originalDate) - YEAR(?sequelDate))
LIMIT 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment