SPARQL examples: Difference between revisions
From MBI
No edit summary |
(add map with headquarters) |
||
Line 53: | Line 53: | ||
OPTIONAL { ?company wdt:P9 ?DRAHTANSCHRIFT. } | OPTIONAL { ?company wdt:P9 ?DRAHTANSCHRIFT. } | ||
FILTER((LANG(?companyLabel)) = "de") | FILTER((LANG(?companyLabel)) = "de") | ||
} | |||
}} | |||
=== Map with headquarters of companies === | |||
{{SPARQL|query= | |||
#defaultView:Map | |||
SELECT DISTINCT ?item ?itemLabel ?geo WHERE { | |||
?item wdt:P3 wd:Q1; | |||
wdt:P48 ?location. | |||
?location wdt:P3 wd:Q5157; | |||
wdt:P50 ?geo. | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "de". } | |||
} | } | ||
}} | }} |
Revision as of 13:36, 27 April 2023
Companies
Companies with labels, inception, Postscheckkonto, Fernruf and Drahtanschrift
SELECT DISTINCT ?company ?companyLabel (year(?inc) as ?inception) ?POSTSCHECKKONTO ?FERNRUF ?DRAHTANSCHRIFT WHERE {
?company rdfs:label ?companyLabel;
wdt:P3 wd:Q1.
OPTIONAL { ?company wdt:P46 ?inc. }
OPTIONAL { ?company wdt:P7 ?POSTSCHECKKONTO. }
OPTIONAL { ?company wdt:P8 ?FERNRUF. }
OPTIONAL { ?company wdt:P9 ?DRAHTANSCHRIFT. }
FILTER((LANG(?companyLabel)) = "de")
}
Companies with labels, Inhaber, Geschäftsführer and Bankverbindungen
SELECT DISTINCT ?company ?companyLabel ?INHABER ?GESCHÄFTSFÜHRER ?BANKVERBINDUNGEN WHERE {
?company rdfs:label ?companyLabel;
wdt:P3 wd:Q1.
OPTIONAL { ?company wdt:P12 ?INHABER. }
OPTIONAL { ?company wdt:P18 ?GESCHÄFTSFÜHRER. }
OPTIONAL { ?company wdt:P10 ?BANKVERBINDUNGEN. }
FILTER((LANG(?companyLabel)) = "de")
}
Companies with labels, raw texts and file segments
SELECT DISTINCT ?company ?companyLabel ?RAW_TEXT ?FILE_SEGMENT WHERE {
?company rdfs:label ?companyLabel;
wdt:P3 wd:Q1;
wdt:P4 ?RAW_TEXT;
wdt:P5 ?FILE_SEGMENT.
FILTER((LANG(?companyLabel)) = "de")
}
Companies with labels, Postscheckkonto, Fernruf, Drahtanschrift and inception in time interval 1905-1910
SELECT DISTINCT ?company ?companyLabel (YEAR(?inc) AS ?inception) ?POSTSCHECKKONTO ?FERNRUF ?DRAHTANSCHRIFT WHERE {
?company rdfs:label ?companyLabel;
wdt:P3 wd:Q1.
OPTIONAL { ?company wdt:P46 ?inc. }
FILTER(?inc >= "1905-01-01T00:00:00Z"^^xsd:dateTime)
FILTER(?inc <= "1910-01-01T00:00:00Z"^^xsd:dateTime)
OPTIONAL { ?company wdt:P7 ?POSTSCHECKKONTO. }
OPTIONAL { ?company wdt:P8 ?FERNRUF. }
OPTIONAL { ?company wdt:P9 ?DRAHTANSCHRIFT. }
FILTER((LANG(?companyLabel)) = "de")
}
Map with headquarters of companies
#defaultView:Map
SELECT DISTINCT ?item ?itemLabel ?geo WHERE {
?item wdt:P3 wd:Q1;
wdt:P48 ?location.
?location wdt:P3 wd:Q5157;
wdt:P50 ?geo.
SERVICE wikibase:label { bd:serviceParam wikibase:language "de". }
}
Entities
Entities with labels
SELECT DISTINCT ?entity ?entityLabel WHERE {
?entity rdfs:label ?entityLabel.
FILTER((LANG(?entityLabel)) = "en")
}
Properties
Properties with labels, aliases, descriptions and datatypes
SELECT DISTINCT ?propertyWikibase ?propertyLabel ?propertyAlias ?propertyDescription ?propertyType WHERE {
?propertyWikibase wikibase:directClaim ?p;
wikibase:propertyType ?propertyType;
schema:description ?propertyDescription;
rdfs:label ?propertyLabel.
OPTIONAL { ?propertyWikibase skos:altLabel ?propertyAlias. }
}
Properties with non-capitalized labels and their datatypes
SELECT DISTINCT ?propertyWikibase ?propertyLabel ?propertyType WHERE {
?propertyWikibase wikibase:directClaim ?p;
wikibase:propertyType ?propertyType;
rdfs:label ?propertyLabel.
FILTER(REGEX(?propertyLabel, "[a-z].+"))
OPTIONAL { ?propertyWikibase skos:altLabel ?propertyAlias. }
}
Properties with capitalized labels and their datatypes
SELECT DISTINCT ?propertyWikibase ?propertyLabel ?propertyType WHERE {
?propertyWikibase wikibase:directClaim ?p;
wikibase:propertyType ?propertyType;
rdfs:label ?propertyLabel.
FILTER(!REGEX(?propertyLabel, "[a-z].+"))
OPTIONAL { ?propertyWikibase skos:altLabel ?propertyAlias. }
}