Project:Secondary Type Query

From DiSSCo Modelling Framework
Revision as of 11:50, 21 April 2022 by Jgrieb (talk | contribs) (Created page with "SELECT ?item ?itemLabel ?itemDescription ?example ?dataType ?min ?max ?mandatory WHERE { #the type to export is ODStype1802 BIND(wd:Q45 as $type). { #get all cont...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

SELECT ?item ?itemLabel ?itemDescription ?example ?dataType ?min ?max ?mandatory WHERE {

 #the type to export is ODStype1802
 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