Project:SPARQL/examples: Difference between revisions

From Beyond Notability
Line 414: Line 414:
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>


SELECT distinct ?personLabel ?workLabel ?positionLabel ?date_pLabel ?date  
SELECT distinct ?personLabel ?workLabel ?positionLabel ?date_propLabel ?date  
?employerLabel ?organisedLabel ?ofLabel ?person
?employerLabel ?organisedLabel ?ofLabel ?locationLabel ?person
#?s  ?position  ?of  ?work ?employer ?organised
#?s  ?position  ?of  ?work ?employer ?organised ?location ?date_prop


WHERE {
WHERE {
Line 436: Line 436:
     OPTIONAL { ?s ( bnpq:P78 | bnpq:P66 ) ?of .}
     OPTIONAL { ?s ( bnpq:P78 | bnpq:P66 ) ?of .}
   
   
  # optional { ?s bnpq:P2 ?location . } # sometimes there is location and no employer/org/of  
    optional { ?s bnpq:P2 ?location . } # sometimes there is location and no employer/org/of  
      
      
   # dates
   # dates with property labels.
     optional {
     optional {
     ?s ?pq ?date .  
     ?s ?pq ?date .
     
       ?date_prop wikibase:qualifier ?pq;       
       ?date_p wikibase:qualifier ?pq;       
               wikibase:propertyType wikibase:Time .
              #wikibase:propertyType ?date_prop_type; # can check date property types if needed
               wikibase:propertyType wikibase:Time . # nb *does not* include edtf dates but AFAICT there are none in qualifiers.
              #rdfs:label ?date_label . filter(lang(?date_label)="en-gb") . # what kind of date is it.
       } # /dates
       } # /dates
    
    
664

edits