Project:Secondary Type Query
Jump to navigation
Jump to search
SELECT ?item ?itemLabel ?itemDescription ?example ?dataType ?min ?max ?mandatory WHERE { #the type to export is ImageObject but can also be applied to other types (change "wd:Q45") BIND(wd:Q45 as $type). { #get all contains statements ?type p:P44 ?statement. ?statement ps:P44 ?item. OPTIONAL{ ?statement pqv:P9/wikibase:quantityAmount ?mandatoryInternal. }}UNION{ #get parent class reference if exists ?type p:P14 ?statement. ?statement ps:P14 ?item. BIND("subclass of" AS ?itemLabel) } #additional optional properties OPTIONAL {?item wdt:P18 ?example} OPTIONAL {?item wdt:P10 ?dataType} OPTIONAL {?item wdt:P37 ?min} OPTIONAL {?item wdt:P38 ?max} BIND(IF(BOUND(?mandatoryInternal),?mandatoryInternal,"0") AS ?mandatory) SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }ORDER BY ?order