SPARQuickL 3 – Bonne compagnie

Entreprises

Entreprises avec leur date de création

# List of business enterprises, with their date of creationSELECT?business(SAMPLE(?date)AS?date)WHERE{?businesswdt:P31/wdt:P279*wd:Q4830453 .# item is a business enterprise?businesswdt:P571 ?date.# … that was founded at a given point in time}GROUPBY?business

Entreprises dotées d’un siège, avec leur date de création

# List of business enterprises that have headquarters, with their date of creationSELECTDISTINCT?business?businessLabel(SAMPLE(?date)AS?date)WHERE{?businesswdt:P31/wdt:P279*wd:Q4830453 .# item is a business enterprise?businesswdt:P571 ?date.# … that was founded at a given point in time?businesswdt:P159 [].# and that has headquarters, which we don't keepSERVICEwikibase:label {bd:serviceParam wikibase:language "en,fr,de,ja,pt,zh".}}GROUPBY?business?businessLabel

# List of business enterprises that have headquarters, and a name starting with "M", with their date of creationSELECT?business?businessLabel?layer?coords?dateWHERE{{SELECTDISTINCT?business?businessLabel(SAMPLE(?century)AS?layer)?coords(SAMPLE(?date)AS?date)WHERE{?businesswdt:P31/wdt:P279*wd:Q4830453 .# item is a business enterprise?businesswdt:P571 ?date.# … that was founded at a given point in time?businesswdt:P159 [].# … and that has headquarters (which we don't keep)SERVICEwikibase:label {bd:serviceParam wikibase:language "en,fr,de,ja,pt,zh".}}GROUPBY?business?businessLabel?coords}FILTER(STRSTARTS(?businessLabel, "M")).# … and of which the label starts with "M"}ORDERBY?businessLabel?business# ordered alphabetically if possible, otherwise by the Q<id> of the business enterprise

# Map of business enterprises' headquarters color-coded with the century the business enterprises were foundedSELECT?business?businessLabel?layer?coords?dateWHERE{{SELECTDISTINCT?business?businessLabel(SAMPLE(?century)AS?layer)?coords(SAMPLE(?date)AS?date)WHERE{?businesswdt:P31/wdt:P279*wd:Q4830453 .# item is a business enterprise?businesswdt:P571 ?date.# … that was founded at a given point in time# … and of which we try to get the geographic coordinates thusly :OPTIONAL{?businessp:P159 [pq:P625 ?coords1].}# first we try to see if the statement about their headquarters has a P625 qualifierOPTIONAL{FILTER(!BOUND(?coords1))?businesswdt:P159 [wdt:P625 ?coords2].}# then, if not available, we try to see if the item representing their headquarters has a P625 statementOPTIONAL{FILTER(!BOUND(?coords1)&&!BOUND(?coords2))?businesswdt:P159 [?property[wdt:P625 ?coords3]]. VALUES ?property{wdt:P131 wdt:P276 }.}# lastly, if still not available, we try to see if the item representing their headquarters is located (administratively or not) in a given entity which has coordinatesBIND(COALESCE(?coords1, ?coords2, ?coords3)AS?coords).# finally we try to bind the first of the three that is set, if anyFILTER(BOUND(?coords)).# we remove all companies for which it was impossible to find coordinates for the headquartersBIND(FLOOR((YEAR(?date)-1)/100)+1AS?century).# get the century from the date, which will be displayed as a colored layer on the mapSERVICEwikibase:label {bd:serviceParam wikibase:language "en,fr,de,ja,pt,zh".}}GROUPBY?business?businessLabel?coords}FILTER(STRSTARTS(?businessLabel, "M")).# … and of which the label starts with "M"}ORDERBY?businessLabel?business# ordered alphabetically if possible, otherwise by the Q<id> of the business enterprise