Project:SPARQL/examples: Difference between revisions

Line 4,757: Line 4,757:
group by ?person ?personLabel ?propLabel ?valueLabel ?link   
group by ?person ?personLabel ?propLabel ?valueLabel ?link   
order by ?personLabel ?propLabel
order by ?personLabel ?propLabel
</sparql>
=== References using P11 ===
<sparql tryit="1">
#title:references using P11
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwdv: <https://beyond-notability.wikibase.cloud/value/>
PREFIX bnwdt: <https://beyond-notability.wikibase.cloud/prop/direct/>
PREFIX bnp: <https://beyond-notability.wikibase.cloud/prop/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpr: <https://beyond-notability.wikibase.cloud/prop/reference/>
select distinct ?person ?personLabel ?propLabel ?reference ?link
where
{
  ?person ?p ?s .
      ?prop wikibase:claim ?p;     
        wikibase:statementProperty ?ps.     
 
  # direct link to statement
  BIND (REPLACE(STR(?s), "^.*/([^/]*)$", "$1") as ?sid).
    # for some grrr reason the first dash is replaced with a $ in the html id.
  bind(replace(?sid, "^([Q]\\d+)-", "$1\\$") as ?pid) .
  bind(iri(concat(str(?person), "#", ?pid)) as ?link ) . 
 
  # references
    ?s prov:wasDerivedFrom ?refnode.       
          ?refnode bnpr:P11 ?reference .
          #?refnode bnpr:P91 ?specific .
  # you'll get extras if multi in the same reference...
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
  }
order by ?personLabel
</sparql>
</sparql>


579

edits