0

I want to retrieve the discoverers of chemical elements, i have done this:

prefix wd: <http://www.wikidata.org/entity/>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix wdt: <http://www.wikidata.org/prop/direct/>
prefix wde: <http://www.wikidata.org/entity/>

SELECT ?discoverer (Count(?element) as ?count)
WHERE
{
  ?element wdt:P31 wd:Q11344;
           wdt:P246 ?symbol;
           wdt:P61 ?discoverer.
  
     SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
   }
}GROUP BY ?discoverer

and it works, but i need the discoverer be a human(wdt:Q5) to link to external source.

i have tried adding this line:(edited)

  ?discoverer wdt:P31 wdt:Q5;

but returns empty response and i don't know why? discoverer is not supposed to be human?

I am using http://yasgui.triply.cc/ with the query point to https://query.wikidata.org/bigdata/namespace/wdq/sparql

(edit) wd works but: I want to link to nobelprize.org:

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX http: <http://www.w3.org/2011/http#>
prefix wd: <http://www.wikidata.org/entity/>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix wdt: <http://www.wikidata.org/prop/direct/>
prefix wde: <http://www.wikidata.org/entity/>

SELECT ?discoverer (Count(?element) as ?count)
WHERE
{
  ?element wdt:P31 wd:Q11344;
           wdt:P246 ?symbol;
           wdt:P61 ?discoverer.
  ?discoverer wdt:P31 wd:Q5.
     SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
   }
  ?discoverer owl:sameAs ?b.
  SERVICE <http://data.nobelprize.org/sparql>{
   ?b a <http://data.nobelprize.org/terms/laureate>.

}
}GROUP BY ?discoverer

returns zero results.

logi-kal
  • 7,107
  • 6
  • 31
  • 43
  • not sure why you call the variable `?a`, you should add `?discoverer wdt:P31 wdt:Q5`. And the type is **not** `wdt:Q5` but `wd:Q5` it's an entity. So, in the end it should be `?discoverer wdt:P31 wd:Q5` - clearly, if people aren't directly asserted as human, you will miss those. the pattern `wdt:P31/wdt:P279*` has to be used in that case - in your case it doesn't seem to be a problem though – UninformedUser Sep 08 '20 at 10:00
  • thank you, wd instead wdt works. Still not able to link 'human' to external source ('laureate' of nobelprize.org) – DamagedCyborg Sep 08 '20 at 12:03
  • there are no `owl:sameAs` links - from where did you get the idea? And why are you not using `P3188` property then? Like `?discoverer wdt:P3188 ?b.` instead of the whole `SERVICE` clause – UninformedUser Sep 08 '20 at 13:52
  • I see some sites that owl:sameAs be used. It's for a job at school.It has to be with the service, i made ´´´BIND(uri(concat("http://data.nobelprize.org/resource/", ?b)) as ?c)´´´ but the result url doesn't exist http://data.nobelprize.org/resource/chemistry/laureates/1951/seaborg. Any idea? I think the correct url is http://data.nobelprize.org/resource/laureate/ + id – DamagedCyborg Sep 08 '20 at 15:03
  • I've founded the property Nobel prize ID (P3188) in wikidata that i think it works with data.nobelprize.org/resource/laureate + id – DamagedCyborg Sep 08 '20 at 17:56
  • if you want to create the ID, you have to use `wdt:P8024` and then you can create the external URI with `?discoverer wdt:P8024 ?nobel_api_id. BIND(URI(CONCAT("https://www.nobelprize.org/laureate/", STR(?nobel_api_id))) as ?Nobel_prize_link)` – UninformedUser Sep 09 '20 at 06:37
  • at the begining i was confused with this `wdt:P8024` because said `REST api id `and i thought it was other thing.Anyway, it's already solved. thank you. – DamagedCyborg Sep 09 '20 at 10:27

0 Answers0