query-38ccc7eede6f241cc904a1530c613e74

rq turtle/ttl

Propertiesinstance of (P31)subclass of (P279)equivalent property (P1628)property constraint (P2302)class (P2308)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT
  ?property
  ?propertyLabel
  ?propertyDescription 
  (GROUP_CONCAT(DISTINCT ?classLabel;SEPARATOR=' // ') AS ?classes)
  (GROUP_CONCAT(DISTINCT ?domainLabel;SEPARATOR=' // ') AS ?domain)
  (GROUP_CONCAT(DISTINCT ?codomainLabel;SEPARATOR=' // ') AS ?codomain)
  (GROUP_CONCAT(DISTINCT STR(?equivalentProp);SEPARATOR=' // ') AS ?equivalentProps)
  (SUBSTR(STR(?type),27) AS ?type)
WHERE
{
  ?property wdt:P31/wdt:P279* wd:Q27525351;
            wdt:P31/wdt:P279* ?class;
            wikibase:propertyType ?type. # https://www.wikidata.org/wiki/Help:Data_type#Technical_details
  ?class wdt:P279* wd:Q27525351.
  OPTIONAL {
    ?property p:P2302 [
      ps:P2302 wd:Q21503250;
      pq:P2308 ?domain
    ].
  }
  OPTIONAL {
    ?property p:P2302 [
      ps:P2302 wd:Q21510865;
      pq:P2308 ?codomain
    ].
  }
  OPTIONAL {
    ?property wdt:P1628 ?equivalentProp.
  }
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en,fr".
    ?property rdfs:label ?propertyLabel.
    ?property schema:description ?propertyDescription.
    ?class rdfs:label ?classLabel.
    ?domain rdfs:label ?domainLabel.
    ?codomain rdfs:label ?codomainLabel.
  } 
}
GROUP BY ?property ?propertyLabel ?propertyDescription ?type

Query found at