Project:SPARQL/examples: Difference between revisions

Line 2,709: Line 2,709:
#title:fishing for dates for FSAs
#title:fishing for dates for FSAs
# union query to get [hopefully] every date associated with women FSAs including main dates and qualifier dates, with date precision
# union query to get [hopefully] every date associated with women FSAs including main dates and qualifier dates, with date precision
# updated query for qualifiers


PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
Line 2,741: Line 2,742:
    
    
   # get dates detail via ?s and psv
   # get dates detail via ?s and psv
   # gets edtf dates in simplified std wiki date format. could handle them separately to keep the extra info.  
   # gets edtf dates in simplified std wiki date format.  
   # https://github.com/ProfessionalWiki/WikibaseEdtf
   # https://github.com/ProfessionalWiki/WikibaseEdtf
    
    
Line 2,759: Line 2,760:
     ?person ?p ?s .   
     ?person ?p ?s .   
    
    
      # get stuff about ?p .  
    # get stuff for ?p .
       ?prop wikibase:claim ?p;       
       ?prop wikibase:claim ?p;       
         #wikibase:propertyType ?prop_type ;
         wikibase:statementProperty ?ps;    
         wikibase:statementProperty ?ps.    
         wikibase:statementValue ?psv.
       ?prop rdfs:label ?prop_label. filter(lang(?prop_label)="en-gb") .  
       ?prop rdfs:label ?prop_label. filter(lang(?prop_label)="en") . # spoke at etc
    
      # get stuff about ?p via ps. .
   # direct value (usually item) for the property
      # pdv is the direct value (usually item), things like annual meeting, girton college.
        ?s ?ps ?prop_value.
      ?s ?ps ?pdv.
   
 
  # get date qualifiers. [assumes no edtf in quals. ]
      # get qualifier dates . ?pq is the date property like P1  .
        ?s ?pq ?date_qual . #  
      ?s ?pq ?pqs .  
          ?qual_prop wikibase:qualifier ?pq .
        # get pq and restrict to dates here, instead of using a filter.
          ?qual_prop wikibase:propertyType wikibase:Time.  
        ?qual_prop wikibase:qualifier ?pq.
          ?qual_prop rdfs:label ?date_qual_label . filter(lang(?date_qual_label)="en") .  
        ?qual_prop wikibase:propertyType wikibase:Time.  
 
        ?qual_prop rdfs:label ?date_prop_label . filter(lang(?date_prop_label)="en") .
   # qualifier time precision. requires bnpqv: prefix
    
  # pit/start/end/earliest/latest
      # now get detail.
       ?s (bnpqv:P1 | bnpqv:P27 | bnpqv:P28 | bnpqv:P51 | bnpqv:P53 ) ?pqv.
       ?s ?date_prop ?pqv .
          #?pqv wikibase:timeValue ?time_qual . #don't need this as well as date_qual.
        ?pqv wikibase:timeValue ?date_value.
          ?pqv wikibase:timePrecision ?date_qual_precision .
        ?pqv wikibase:timePrecision ?date_precision.
     
       
   }  # /qual dates
   }  # /qual dates
    
    
586

edits