Project:Type Complete Query

From DiSSCo Modelling Framework
Revision as of 08:19, 14 March 2022 by Admin (talk | contribs) (Created page with " SELECT ?section ?sectionLabel ?item ?itemLabel ?itemDescription ?example ?dataType ?min ?max ?mandatory WHERE { #the type to export is ODStype1802 BIND(wd:Q29 as $type)....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
SELECT ?section ?sectionLabel ?item ?itemLabel ?itemDescription ?example ?dataType ?min ?max ?mandatory WHERE {
 #the type to export is ODStype1802
 BIND(wd:Q29 as $type).
 
 {
   #get all of the statements that are not sections
   ?type p:P44 ?statement.
   ?statement ps:P44 ?item.
   ?statement pqv:P45/wikibase:quantityAmount ?order.
   MINUS {?item wdt:P1 wd:Q28}.
 }UNION{
   #get all of the sections
   ?type p:P44 ?statement.
   ?statement ps:P44 ?section.
   ?statement pqv:P45/wikibase:quantityAmount ?order.
   ?section wdt:P1 wd:Q28.
 
   #get the items of the section
   ?item p:P4 ?sectionStatement.
   ?sectionStatement ps:P4 ?section.
   OPTIONAL{
     ?sectionStatement 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