Project:SPARQL/examples: Difference between revisions

Line 1,068: Line 1,068:
   ?propertyLabel # ?propertyAltLabel
   ?propertyLabel # ?propertyAltLabel
   ?propertyDescription
   ?propertyDescription
WHERE {
WHERE {
   ?property a wikibase:Property ;
   ?property a wikibase:Property ;
Line 1,073: Line 1,074:
               wikibase:propertyType ?propertyType .
               wikibase:propertyType ?propertyType .


  # OPTIONAL { ?property skos:altLabel ?propertyAltLabel . } # not many of these and creates dups so meh
  # OPTIONAL { ?property skos:altLabel ?propertyAltLabel . } # not many of these


   OPTIONAL { ?property schema:description ?propertyDescription . } # much more useful
   OPTIONAL { ?property schema:description ?propertyDescription .  
      filter(lang(?propertyDescription)='en' ) . # works a lot better if you put the filter here!!
  } # much more useful
    
    
   FILTER(LANG(?propertyLabel) = 'en') # fix label language dups (Q: but why doesn't service wikibase:label work for this?)
   FILTER(LANG(?propertyLabel) = 'en') # fix label language dups (Q: but why doesn't service wikibase:label work for this?)
  filter ( not exists {?property schema:description ?propertyDescription .} || lang(?propertyDescription)='en' ) # filter for propertyDescription: *either* lang=en or not present


}
}
579

edits