- You must query all fields for them to being returned (
SPARQL
can't guess where to get them), with the exception of labels and descriptions when using Wikibase Label Service.
- All fields in your
SELECT
must be in the GROUP BY
clause, with the exception of the use of the GROUP_CONCAT
function that will concatenate all values into one field.
- Bad news: searching humans by other than their exact label in Wikidata Query Service is hard, as you will often hit the timeout of 60 seconds. A solution, as shown by AKSW, is to use Wikibase Mediawiki API and do an entity search.
Here is an example of your query rewritten:
SELECT ?person ?personLabel ?personDescription (GROUP_CONCAT(DISTINCT ?dob ; SEPARATOR = ' / ') AS ?dob) (GROUP_CONCAT(DISTINCT ?gender ; SEPARATOR = ' / ') AS ?gender)
WHERE {
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "EntitySearch" .
bd:serviceParam wikibase:endpoint "www.wikidata.org" .
bd:serviceParam mwapi:search "Michael Bloom" .
bd:serviceParam mwapi:language "en" .
?person wikibase:apiOutputItem mwapi:item .
}
?person wdt:P31 wd:Q5 .
OPTIONAL { ?person wdt:P569 ?dob }
OPTIONAL { ?person wdt:P21 ?gender }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
GROUP BY ?person ?personLabel ?personDescription