Project:SPARQL/admin: Difference between revisions

Line 872: Line 872:
   }
   }
order by ?personLabel
order by ?personLabel
</sparql>
=== Reference query for RHS ===
<sparql tryit="1">
#title:statements with references to RHS archive
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/>
# for QAing work done on  enhancement
# stated in (P56) /
# RHS Q2519 (see eg Katherine Routledge academic degree)
# looking for all Q315 references for person EXCEPT the ones in the election statement itself [P155]
# nb there can be more than one item in the reference (as well as information that doesn't have a reference)
# so stuff returned might not have anything to do with the Q315, but the referencing isn't specific enough to know which does.
# added evidence text from election statement. group_concat as there's often more than one. however this is not as useful as the blue papers
SELECT distinct ?personLabel ?propLabel ?valueLabel
(group_concat(?evidence; separator=" | ") as ?evidence_text)
?link 
#?s
WHERE { 
  ?person bnwdt:P3 bnwd:Q3 .
  ?person ?p ?s .
      ?prop wikibase:claim ?p;     
        wikibase:statementProperty ?ps.     
 
  # *not* in p155 rhs election 
  filter not exists { ?s bnps:P155 ?anything . }
 
    ?s ?ps ?value .
 
        # direct link to relevant 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: stated in = p56. blue papers q315  RHS Q2519
    ?s prov:wasDerivedFrom ?refnode.
        ?refnode bnpr:P56 bnwd:Q2519 .
 
 
  optional { ?person bnp:P155 ?ss.
              ?ss bnps:P155 ?proposed .
              ?ss bnpq:P21 ?evidence .
          }
   
     
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
group by ?person ?personLabel ?propLabel ?valueLabel ?link 
order by ?personLabel ?propLabel
</sparql>
</sparql>


579

edits