Project:SPARQL/admin: Difference between revisions

mNo edit summary
Line 194: Line 194:


</sparql>
</sparql>
=== Date of latest edit for every item, according to WQS ===
<sparql tryit="1">
#title:latest edits dates for wikibase items
## because of WQS disappearing data bugs this may not always match the latest edit in the page history
SELECT ?item ?date ?dateLabel
WHERE {
  ?item wikibase:timestamp ?date .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
order by ?date
</sparql>
=== Questions ===
<sparql tryit="1">
#title:asking questions
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 bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>
SELECT ?personLabel ?propLabel ?link ?question
WHERE { 
  ?person bnwdt:P3 bnwd:Q3 .
 
  ?person ?p ?s .
      ?prop wikibase:claim ?p;     
        wikibase:statementProperty ?ps.     
         
  # direct link to relevant part of page
        BIND (REPLACE(STR(?prop), "^.*/([^/]*)$", "$1") as ?pid).
        bind(iri(concat(str(?person), "#", ?pid)) as ?link ) .
 
  # the question
    ?s bnpq:P157 ?question . 
       
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
order by ?personLabel
</sparql>
== Place ==




Line 254: Line 321:




 
=== Reviewing instance of locality ===
=== Date of latest edit for every item, according to WQS ===


<sparql tryit="1">
<sparql tryit="1">
#title:latest edits dates for wikibase items
# how many i/o locality don't have a wikidata id?
 
## because of WQS disappearing data bugs this may not always match the latest edit in the page history
 
SELECT ?item ?date ?dateLabel
WHERE {
  ?item wikibase:timestamp ?date .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
order by ?date
 
</sparql>
 
 
 
 
 
=== Questions ===
 
<sparql tryit="1">
 
#title:asking questions
 
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 288: Line 332:
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>
SELECT ?personLabel ?propLabel ?link ?question


#title:i/o locality
SELECT distinct ?itemLabel ?item ?wd_id ?adminLabel ?bn_geo
WHERE {   
WHERE {   
  ?person bnwdt:P3 bnwd:Q3 .
 
  ?person ?p ?s .
      ?prop wikibase:claim ?p;     
        wikibase:statementProperty ?ps.     
         
  # direct link to relevant part of page
        BIND (REPLACE(STR(?prop), "^.*/([^/]*)$", "$1") as ?pid).
        bind(iri(concat(str(?person), "#", ?pid)) as ?link ) .
    
    
   # the question
  ?item bnwdt:P12 bnwd:Q2147 . # has i/o locality (could have other i/o as well?)
    ?s bnpq:P157 ?question .   
 
 
  #optional { ?item bnwdt:P12 ?io .
       
  #        #filter not exists { ?item bnwdt:P12 bnwd:Q2147 . } # this doesn't work... ??? should be only a handful.
  #        } # check io other than locality
 
   # what props do they have: 945 P117 wikidata id; 919 P33 admin territory; 9 P153 coord location
  #?item ?p ?s .
  #    ?prop wikibase:claim ?p.
 
  optional { ?item bnwdt:P117 ?wd_id . }
  optional { ?item bnwdt:P14 ?described . } # to check for described at url instead of wd.  
   optional { ?item bnwdt:P33 ?admin . } # admin territory; some multi
  optional { ?item bnwdt:P153 ?bn_geo . }
 
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }  
}
}


order by ?personLabel
ORDER BY ?itemLabel ?item
</sparql>
</sparql>


== Dates ==
== Dates ==
582

edits