Project:Secondary Type Query

From DiSSCo Modelling Framework
Revision as of 09:57, 25 April 2022 by Jgrieb (talk | contribs) (Improved query from David which combines attributes from parent class)
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 wdt:P14?/p:P44 ?statement.
 ?statement ps:P44 ?item.
 OPTIONAL{
   ?statement pqv:P9/wikibase:quantityAmount ?mandatoryInternal.      
 }

 #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