You need something like this:
---------------------------------------------------------
SELECT DISTINCT ?propLabel ?prop ?value
WHERE
{
VALUES ?geneID {"672"}
?gene wdt:P351 ?geneID ;
?prop ?value .
?p wikibase:directClaim ?prop .
?p rdfs:label ?propLabel FILTER (lang(?propLabel) = "en").
}
---------------------------------------------------------
Essentially the issue is that the labels are only connected to the
representation of the property in the wd: namespace, not the special
"truthy" wdt: namespace version of the property.
So you have to connect one to the other (wikibase:directClaim), and then
get the label from the wd: version.
Note that there can be a problem with this with the query optimiser for
larger queries, because with only about 2500 properties, it can think
that ?p wikibase:directClaim ?prop is the most economical place to
start (if your other statements would all generate solution sets of more
than 2500 triples).
You would generally need to over-rule such behaviour by specifying
hint:Query hint:optimizer "None"
and then carefully making sure that the query is specified in a sensible
order.
It's not a problem here, because you're only looking up one gene, but if
you had more than 2500 hits for part of your query, then the issue can
kick in.
Hope this helps,
James.
On 18/04/2016 11:10, Andra Waagmeester wrote:
SELECT DISTINCT ?propLabel ?prop ?value
WHERE
{
VALUES ?geneID {"672"}
?gene wdt:P351 ?geneID ;
?prop ?value .
?prop rdfs:label ?propLabel .
}
_______________________________________________
Wikidata mailing list
Wikidata@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata