Project:Type Complete Query

From DiSSCo Modelling Framework
Revision as of 15:43, 25 April 2022 by Jgrieb (talk | contribs) (Fix use per default item for digital specimen)
(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 ?namespace WHERE {
 #the type to export is ODStype1802
 BIND(wd:Q29 as $type).
 
 {
   #get all of the statements that are not sections
   ?type wdt:P14?/p:P44 ?statement.
   ?statement ps:P44 ?item.
   OPTIONAL{
     ?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}
 OPTIONAL {?item wdt:P33 ?namespace}
 BIND(IF(BOUND(?mandatoryInternal),?mandatoryInternal,"0") AS ?mandatory)
 SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
 
}ORDER BY ?order