About the Solar Pattern Authoring sample

This sample creates a Solar pattern to calculate various sunrise and sunset times for a specific date and position on Earth.

The date is supplied in a WebSphere MQ XML message, and the position is specified when the Solar pattern is used by the pattern user to generate an instance. Each instance of the pattern has the position variable specified.

The output is a WebSphere MQ XML message containing the following details:

The Solar Pattern Authoring sample is used to demonstrate the following pattern authoring capabilities:

Target properties
Exposing user-defined properties as target properties in a pattern.
Enumerations
Creating an enumeration, which is presented as a drop-down list. The values of the enumeration contain both the latitude and longitude, delimited by a space.
Transformations
Using XPath string expressions to extract the latitude and longitude from the enumeration to change the Latitude and Longitude target properties into parameters.
Enablement
Using XPath string expressions to enable the Latitude and Longitude target properties when the enumeration selection is Custom Place, and to disable them when a place is selected from the enumeration.

This sample uses one message flow and covers the following actions:

  1. An MQInput node receives an XML message containing a date in Coordinated Universal Time (UTC) from the SOLAR WebSphere MQ queue.
  2. A PHPCompute node is used to extract the date from the incoming message, collect the Latitude and Longitude values from the User Defined Properties (UDPs), calculate the sunrise and sunset times, and append them to the XML message.
  3. An MQOutput node sends the augmented XML message to the SUNSETSUNRISETIMES WebSphere MQ queue.

XML Schema for the message

<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://caspian.hursley.ibm.com"
  xmlns:solar="http://caspian.hursley.ibm.com" elementFormDefault="qualified">
  <element name="sun">
    <complexType>
      <sequence>
        <element name="dateQuery" type="date"/>
        <element name="sunEventTime" minOccurs="0" maxOccurs="1">
          <complexType>
            <sequence>
              <element name="sunrise" type="date"/>
              <element name="sunset" type="date"/>
              <element name="transit" type="date"/>
              <element name="civil_twilight_begin" type="date"/>
              <element name="civil_twilight_end" type="date"/>
              <element name="nautical_twilight_begin" type="date"/>
              <element name="nautical_twilight_end" type="date"/>
              <element name="astronomical_twilight_begin" type="date"/>
              <element name="astronomical_twilight_end" type="date"/>
            </sequence>
          </complexType>
        </element>
      </sequence>
    </complexType>
  </element>
</schema>

XML example of the input message

<?xml version="1.0" encoding="UTF-8"?>
<solar:sun xmlns:solar="http://caspian.hursley.ibm.com"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://caspian.hursley.ibm.com solar.xsd">
  <solar:dateQuery>2010-04-15</solar:dateQuery>
</solar:sun>

Back to sample home