Know QID I can get items's label:
SELECT DISTINCT * WHERE {
wd:Q302 rdfs:label ?label .
FILTER (langMatches( lang(?label), "EN" ) )
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
LIMIT 1
see this query on Wikidata Query Service.
But how can I get other properties, for example description?
I tried the following:
SELECT DISTINCT * WHERE {
wd:Q302 rdfs:description ?description .
FILTER (langMatches( lang(?label), "EN" ) )
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
LIMIT 1
or this:
SELECT DISTINCT * WHERE {
wd:Q302 rdfs:label ?label .
wd:Q302 rdfs:description ?description .
FILTER (langMatches( lang(?label), "EN" ) )
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
LIMIT 1
or
SELECT DISTINCT ?label ?description WHERE {
wd:Q302 rdfs:label ?label .
FILTER (langMatches( lang(?label), "EN" ) )
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
LIMIT 1
but got nothing.
Description is only for sample, I need other properties too.
UPDATE: Probably SPARQL isn't best way to do this, I open to other ways.
UPDATE2: What exactly I need: I have Query, where I get info about item searching by it's label:
SELECT distinct ?item ?itemLabel ?itemDescription
(SAMPLE(?DR) as ?DR) (SAMPLE(?article)as ?article)
WHERE {?item wdt:P31 wd:Q5.
?item ?label "Einstein"@en
OPTIONAL{?item wdt:P569 ?DR .}
?article schema:about ?item .
?article schema:inLanguage "en" .
?article schema:isPartOf <https://en.wikipedia.org/>.
OPTIONAL{?item wdt:P570 ?RIP .}
OPTIONAL{?item wdt:P18 ?image .}
SERVICE wikibase:label
{ bd:serviceParam wikibase:language "en". }}
GROUP BY ?item ?itemLabel ?itemDescription
I need to get the same info using it's QID, in this case Q937.