Project:SPARQL/examples: Difference between revisions

From Beyond Notability
Line 1,050: Line 1,050:
}
}
ORDER BY DESC(?edtfmarriagespouseLabel) DESC(?PITmarriagespouseLabel)
ORDER BY DESC(?edtfmarriagespouseLabel) DESC(?PITmarriagespouseLabel)
</sparql>
=== List properties in the wikibase with property type, label, description (if present) and alternative labels (if any)
<sparql tryit="1">
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX schema: <http://schema.org/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT DISTINCT
  ?property
  ?propertyType
  ?propertyLabel
  ?propertyAltLabel
  ?propertyDescription
WHERE {
  ?property a wikibase:Property ;
              rdfs:label ?propertyLabel ;
              wikibase:propertyType ?propertyType .
  OPTIONAL { ?property skos:altLabel ?propertyAltLabel . }
  OPTIONAL { ?property schema:description ?propertyDescription . }
 
# FILTER(LANG(?propertyLabel) = 'en')
}
order by ?propertyLabel
</sparql>
</sparql>