Complex Queries

From Open Energy Information

Using Nested Queries

Complex Help:Inline queries are queries which involve multiple subjects, properties, or nested queries. The following is an example of a nested query which will return only Programs (Category:Programs) in the Energy Sector (Property:ProgramSector = Energy) within the subsector of Wind (Property:Sector = Wind) which have been developed by National Labs (Category:United States Department of Energy National Laboratories). The last piece mentioned is where the nested query comes into play. To find Programs which have been developed by National Labs, we must search the Property:Developer, which returns entities of Category:Organizations for only those Organizations who are within the Category:United States Department of Energy National Laboratories.

Here what the code would look like:

====Programs====
{{#ask:[[Category:Programs]]
    [[ProgramSector::Energy]]
    [[Sector::Wind]]
    [[Developer::<q>[[Category:United States Department of Energy National Laboratories]]</q>]]
  |format=ul
}}


And here's the results produced:

Programs


Using Inverse Property Ask Query

The code below will find all Category:Geothermal Resource Areas that are the place of an activity that used 2-M Probe Survey as it's exploration technique:

{{#ask: [[Category:Geothermal Resource Areas]] [[-Place.ExplorationTechnique::2-M Probe Survey]]
|limit=100
|format=ul
}}


Using Wildcards Plus Array Print with Count

States start with A (4)

  1. Alabama
  2. Alaska
  3. Arizona
  4. Arkansas

Happy data mining!

Jweers 09:18, 7 April 2011 (MDT)