query-0f9704d728f204c8bf032ba77e4e9cd0
.on Mastodon and on TwitterOriginally posted
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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 DISTINCT ?company ?companyLabel ?founded ?dissolved (xsd:integer((?dissolved - ?founded)/365.2425) AS ?years) WHERE {
?company wdt:P1454/wdt:P279* wd:Q6881511; # the instance/subclass tree for companies seems to be a bit messy, so go via “legal form” instead
wdt:P571 ?founded;
wdt:P576 ?dissolved.
FILTER(?founded < (NOW() - "P200Y"^^xsd:duration))
FILTER(?dissolved > (?founded + "P200Y"^^xsd:duration))
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,de". } # final fallback to German because as of 2019-09-26, many results were German(-language) companies
}
ORDER BY DESC(?dissolved)
LIMIT 25
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?company"):::projected
v1("?dissolved"):::projected
v2("?founded"):::projected
v4("?years")
a1((" "))
c8(["bd:serviceParam"]):::iri
c10(["#91;AUTO_LANGUAGE#93;,en,de"]):::literal
c4(["wd:Q6881511"]):::iri
f0[["?dissolved > ?founded + 'P200Y^^xsd:duration'"]]
f0 --> v1
f0 --> v2
f1[["?founded < NOW() - 'P200Y^^xsd:duration'"]]
f1 --> v2
v3 --"wdt:P1454"--> a1
a1 --"wdt:P279"--> c4
v3 --"wdt:P571"--> v2
v3 --"wdt:P576"--> v1
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end
bind2[/"http://www.w3.org/2001/XMLSchema#integer(?dissolved - ?founded / '365.2425^^xsd:decimal')"/]
v1 --o bind2
v2 --o bind2
bind2 --as--o v4