 




<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Enterprise IT Consultant Views on Technologies and Trends &#187; OMA</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/enterprise-IT-tech-trends/tag/oma/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/enterprise-IT-tech-trends</link>
	<description>Everything from Mainframes to Cloud</description>
	<lastBuildDate>Fri, 10 May 2013 20:03:12 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Advanced Mashup Scripting in EMML &#8211; Part II</title>
		<link>http://itknowledgeexchange.techtarget.com/enterprise-IT-tech-trends/advanced-mashup-scripting-in-emml-part-ii/</link>
		<comments>http://itknowledgeexchange.techtarget.com/enterprise-IT-tech-trends/advanced-mashup-scripting-in-emml-part-ii/#comments</comments>
		<pubDate>Mon, 28 Mar 2011 08:48:17 +0000</pubDate>
		<dc:creator>Sasirekha R</dc:creator>
				<category><![CDATA[EMML]]></category>
		<category><![CDATA[Mashup]]></category>
		<category><![CDATA[OMA]]></category>
		<category><![CDATA[tag]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/enterprise-IT-tech-trends/?p=273</guid>
		<description><![CDATA[EMML Advanced Mashup Techniques &#8211; Part II In this blog, listing some more techniques that enable us to create advanced Mashups using EMML. Adding HTTP Headers to the Mashup Result HTTP headers can be sent with a Mashup result, when the mashup is invoked. Add &#60;variable&#62; declarations for HTTP header using reserved names in the [...]]]></description>
				<content:encoded><![CDATA[<p><strong><span style="text-decoration: underline">EMML Advanced Mashup Techniques &#8211; Part II</span></strong></p>
<p>In this blog, listing some more techniques that enable us to create advanced Mashups using EMML.</p>
<p><strong><span style="text-decoration: underline">Adding HTTP Headers to the Mashup Result</span></strong></p>
<p>HTTP headers can be sent with a Mashup result, when the mashup is invoked. <span id="more-273"></span>Add &lt;variable&gt; declarations for HTTP header using reserved names in the form <em>httpResponse.header-name</em>. The <em>header-name</em> portion can be any standard HTTP header or a custom header (that must begin with X-). For example:</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="638" valign="top">&lt;variables&gt;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;variable name=&#8221;httpResponse.Content-Type&#8221; type=&#8221;string&#8221; default=&#8221;text/csv&#8221;/&gt;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;variable name=&#8221;httpResponse.Last-Modified&#8221; type=&#8221;date&#8221;/&gt;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;variable name=&#8221;httpResponse.X-CUSTOM-HEADER&#8221; type=&#8221;string&#8221;&gt;</td>
</tr>
<tr>
<td width="638" valign="top">&lt;/variables&gt;</td>
</tr>
<tr>
<td width="638" valign="top">&lt;assign outputvariable=&#8221;$X-CUSTOM-HEADER&#8221; fromexpr=&#8221;&#8230;&#8230;&#8221;/&gt;</td>
</tr>
</tbody>
</table>
<p><strong><span style="text-decoration: underline">Setting the Mashup Response Character Encoding</span></strong></p>
<p>If the response is generally going to be returned in an XML format, the XML declaration &lt;?xml version=&#8221;1.0&#8243;?&gt; in the response also has an optional encoding property. Currently, the XML declaration encoding property directly in EMML cannot be set directly. Instead, a custom XPath function as shown below needs to be used.</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="638" valign="top">package com.mycompany.mashups;</td>
</tr>
<tr>
<td width="638" valign="top">import org.oma.emml.client.EMMLUserFunction;</td>
</tr>
<tr>
<td width="638" valign="top">public class CustomFunctions extends EMMLUserFunction {</td>
</tr>
<tr>
<td width="638" valign="top">  public static String ChangeDocEncoding(Document doc, String encoding) throws Exception {</td>
</tr>
<tr>
<td width="638" valign="top">    DOMSource domSrc = new DOMSource(doc.getDocumentElement());</td>
</tr>
<tr>
<td width="638" valign="top">    StringWriter writer = new StringWriter();</td>
</tr>
<tr>
<td width="638" valign="top">    StreamResult result = new StreamResult(writer);</td>
</tr>
<tr>
<td width="638" valign="top">    TransformerFactory tf = TransformerFactory.newInstance();</td>
</tr>
<tr>
<td width="638" valign="top">    Transformer t = tf.newTransformer();</td>
</tr>
<tr>
<td width="638" valign="top">    t.setOutputProperty(OutputKeys.ENCODING, encoding);</td>
</tr>
<tr>
<td width="638" valign="top">    t.transform(domSrc, result);</td>
</tr>
<tr>
<td width="638" valign="top">    return writer.toString();</td>
</tr>
<tr>
<td width="638" valign="top">  }</td>
</tr>
<tr>
<td width="638" valign="top">}</td>
</tr>
</tbody>
</table>
<p><strong><span style="text-decoration: underline">Opening and Using XML Files in Mashups</span></strong></p>
<p>Using XMLConstructorFromFile macro, we can construct variables in a mashup from XML content in files. To use XML files as source data for mashup scripts, the file must be deployed in the EMML Engine classpath.</p>
<p>The optional <strong>encoding</strong> attribute in the XML declaration (&lt;?xml ?&gt;) at the beginning of an XML file identifies the character encoding that is used to read the file. If this attribute is not specified, the XML parser may deduce the character encoding (or) read the file assuming UTF-8 as the character encoding.</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="638" valign="top">&#8230;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;variables&gt;</td>
</tr>
<tr>
<td width="638" valign="top">    &lt;variable name=&#8221;xmlConfigData&#8221; type=&#8221;document&#8221;/&gt;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;/variables&gt;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;macro:XMLConstructorFromFile</td>
</tr>
<tr>
<td width="638" valign="top">    filename=&#8221;myXMLDoc.xml&#8221;</td>
</tr>
<tr>
<td width="638" valign="top">    outputvariable=&#8221;$xmlConfigData&#8221;/&gt;</td>
</tr>
<tr>
<td width="638" valign="top">&#8230;</td>
</tr>
</tbody>
</table>
<p><strong><span style="text-decoration: underline">Formatting Results as CSV</span></strong></p>
<p>Instead of the typical XML format, we can format the mashup results as CSV (comma-separated values), using the FormatAsCSV macro (installed with the EMML Reference Runtime Engine).</p>
<p>  &lt;macro:FormatAsCSV xmldoc=&#8221;$sampleXML&#8221; outputvariable=&#8221;$csvString&#8221;/&gt;</p>
<p>For this macro to work correctly, the structure of the input document must contain at least one node that repeats. The element names of all children nodes in the first &#8216;record&#8217; (first node in the repeating set) are returned as field headers in the CSV output.</p>
<p>Ideally, repeating nodes should contain a single level of children with simple data that is converted to the CSV value. If a child of a repeating node also has descendants, then the CSV value for that child appends the values from all its descendants to the value of that child.</p>
<p><strong><span style="text-decoration: underline">Wrapping POJO Classes with Mashups</span></strong></p>
<p>In EMML, POJO classes can be used as services by wrapping them in mashup scripts. Include the POJO classes in the EMML Reference Runtime Engine classpath.</p>
<p>Create a separate wrapper mashup script for each POJO method that you want to expose as a service.</p>
<p>In the wrapper mashup script, add &lt;input&gt; declarations to accept input parameters for the Java method and an &lt;output&gt; declaration to receive the method return. Add a &lt;script&gt; statement to invoke the Java code.  An example is given below:</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="638" valign="top">&lt;script type=&#8221;text/javascript&#8221;&gt;</td>
</tr>
<tr>
<td width="638" valign="top">&lt;![CDATA[</td>
</tr>
<tr>
<td width="638" valign="top">  var list = new Packages.java.util.ArrayList();</td>
</tr>
<tr>
<td width="638" valign="top">  list.add("one");</td>
</tr>
<tr>
<td width="638" valign="top">  list.add("six");</td>
</tr>
<tr>
<td width="638" valign="top">  list.add("three");</td>
</tr>
<tr>
<td width="638" valign="top">  var listLength = list.size();</td>
</tr>
<tr>
<td width="638" valign="top">  print listLength;</td>
</tr>
<tr>
<td width="638" valign="top">]]&gt;</td>
</tr>
<tr>
<td width="638" valign="top">&lt;/script&gt;</td>
</tr>
</tbody>
</table>
<p> <strong><span style="text-decoration: underline">Pre-Processing/Post-Processing Services with Mashups</span></strong></p>
<p>Typically decoding encrypted data, encrypting data, decompressing or compressing data, filtering data or data scrubbing is done as part of pre- or post-processing. This can be handled by mashup that uses scripting to invoke pre- or post-processing code.</p>
<p>To implement pre- or post-processing, you must:</p>
<p>1. Write the logic to handle pre-processing / post-processing as a Java class or use Java libraries, as needed.</p>
<p>2. Add the custom Java classes to the classpath for the EMML Reference Runtime Engine.</p>
<p>3. Restart the EMML Engine.</p>
<p>Sample mashup script for pre-processing is given below:</p>
<p>Declare &lt;input&gt; variables to receive the data to be pre-processed and an &lt;output&gt; variable for the result.</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="638" valign="top">&#8230;</td>
</tr>
<tr>
<td width="638" valign="top">&lt;operation name=&#8221;getreviews&#8221;&gt;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;input name=&#8221;userId&#8221; type=&#8221;string&#8221; default=&#8221;someone@myOrg.com&#8221; /&gt;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;input name=&#8221;accessId&#8221; type=&#8221;string&#8221;</td>
</tr>
<tr>
<td width="638" valign="top">    default=&#8221;xOtPy9Sy7JCI3Y8aNqEkZBxmkPQw/ZH8&#8243;/&gt;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;output name=&#8221;result&#8221; type=&#8221;string&#8221;/&gt;</td>
</tr>
</tbody>
</table>
<p> </p>
<p>Add a &lt;script&gt; statement to call the pre-processing logic. In this example, an encryption class that decrypts the accessed input parameter.</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="638" valign="top">&#8230;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;output name=&#8221;result&#8221; type=&#8221;string&#8221; inputvariables=&#8221;$accessId&#8221;</td>
</tr>
<tr>
<td width="638" valign="top">    outputvariable=&#8221;$accessId&#8221;/&gt;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;script type=&#8221;text/javascript&#8221;&gt;</td>
</tr>
<tr>
<td width="638" valign="top">    &lt;![CDATA[</td>
</tr>
<tr>
<td width="638" valign="top">      var encrypter = new</td>
</tr>
<tr>
<td width="638" valign="top">        Packages.com.myOrg.services.Encrypter("My Pass Phrase!")</td>
</tr>
<tr>
<td width="638" valign="top">      accessId = encrypter.decrypt(accessId);</td>
</tr>
<tr>
<td width="638" valign="top">    ]]&gt;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;/script&gt;</td>
</tr>
</tbody>
</table>
<p> </p>
<p>Invoke the service with the pre-processed data.</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="638" valign="top">&#8230;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;/script&gt;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;directinvoke</td>
</tr>
<tr>
<td width="638" valign="top">    endpoint=&#8221;http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&#8221;</td>
</tr>
<tr>
<td width="638" valign="top">    method=&#8221;GET&#8221;</td>
</tr>
<tr>
<td width="638" valign="top">    AWSAccessKeyId=&#8221;$accessId&#8221;</td>
</tr>
<tr>
<td width="638" valign="top">    Version=&#8221;2009-01-15&#8243;</td>
</tr>
<tr>
<td width="638" valign="top">    Operation=&#8221;ListSearch&#8221;</td>
</tr>
<tr>
<td width="638" valign="top">    ListType=&#8221;WishList&#8221;</td>
</tr>
<tr>
<td width="638" valign="top">    Email=&#8221;some.body@my.company.com&#8221;</td>
</tr>
<tr>
<td width="638" valign="top">    outputvariable=&#8221;$result&#8221;/&gt;</td>
</tr>
</tbody>
</table>
<p>For detailed information refer to <a href="http://www.openmashup.org/omadocs/v1.0/emml/advMashupIntro.html">http://www.openmashup.org/omadocs/v1.0/emml/advMashupIntro.html</a>.</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/enterprise-IT-tech-trends/advanced-mashup-scripting-in-emml-part-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advanced Mashup Scripting in EMML &#8211; Part I</title>
		<link>http://itknowledgeexchange.techtarget.com/enterprise-IT-tech-trends/advanced-mashup-scripting-in-emml-part-i/</link>
		<comments>http://itknowledgeexchange.techtarget.com/enterprise-IT-tech-trends/advanced-mashup-scripting-in-emml-part-i/#comments</comments>
		<pubDate>Fri, 25 Mar 2011 07:50:13 +0000</pubDate>
		<dc:creator>Sasirekha R</dc:creator>
				<category><![CDATA[EMML]]></category>
		<category><![CDATA[Mashup]]></category>
		<category><![CDATA[OMA]]></category>
		<category><![CDATA[Open]]></category>
		<category><![CDATA[Standard]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/enterprise-IT-tech-trends/?p=252</guid>
		<description><![CDATA[EMML Advanced Mashup Techniques &#8211; Part I Mashups are expected to be used by the business users directly (and not require programming skill) and the tag language EMML makes it easy to learn and use. Using the simple statements and commands of EMML, quite a few useful mashups can be created. As usage of Mashup [...]]]></description>
				<content:encoded><![CDATA[<p><strong><span style="text-decoration: underline">EMML Advanced Mashup Techniques &#8211; Part I</span></strong></p>
<p>Mashups are expected to be used by the business users directly (and not require programming skill) and the tag language EMML makes it easy to learn and use. Using the simple statements and commands of EMML, quite a few useful mashups can be created.</p>
<p>As usage of Mashup accelerates, the tendency to create more powerful and complex mashups would follow.<span id="more-252"></span> In this blog, I have tried to give the crux of some of these advanced techniques.</p>
<p><strong><span style="text-decoration: underline">Web clipping for direct use of HTML</span></strong><strong></strong></p>
<p>Using the web clipping (or Screen scraping) technique, you can get the entire HTML from any URL as a service response. The EMML Reference Runtime Engine converts the HTML retrieved by the &lt;directinvoke&gt; statement is to XHTML in the http://www.w3.org/1999/xhtml namespace. You can filter, combine or transform with XHTML to create your own output.</p>
<p>Example of &lt;directInvoke&gt; resulting in web clipping:</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="638" valign="top">&lt;operation name=&#8221;queryGoogle&#8221;&gt;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;output name=&#8221;result&#8221; type=&#8221;document&#8221;&gt;</td>
</tr>
<tr>
<td width="638" valign="top">    &lt;res:queries/&gt;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;/output&gt;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;directinvoke outputvariable = &#8220;$searchresult&#8221;</td>
</tr>
<tr>
<td width="638" valign="top">     endpoint=&#8221;http://www.google.com/search?q=EMML&#8221;/&gt;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;foreach variable=&#8221;$query&#8221; items=&#8221;$searchresult//xhtml:a[@class='l']&#8220;&gt;</td>
</tr>
<tr>
<td width="638" valign="top">    &lt;appendresult outputvariable=&#8221;$result&#8221;&gt;</td>
</tr>
<tr>
<td width="638" valign="top">      &lt;res:itemlink&gt;{$query/@href}&lt;/res:itemlink&gt;</td>
</tr>
<tr>
<td width="638" valign="top">    &lt;/appendresult&gt;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;/foreach&gt;</td>
</tr>
<tr>
<td width="638" valign="top">&lt;/operation&gt;</td>
</tr>
</tbody>
</table>
<p>The itemlink list in the XML result is as follows:</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="638" valign="top">&lt;itemlink href=&#8221;http:// en.wikipedia.org/wiki/EMML/&#8221;/&gt;</td>
</tr>
<tr>
<td width="638" valign="top">&lt;itemlink href=&#8221;http:// www.openmashup.org/omadocs/v1.0/index.html&#8221;/&gt;</td>
</tr>
<tr>
<td width="638" valign="top">&#8230;</td>
</tr>
</tbody>
</table>
<p><strong><span style="text-decoration: underline">Normalizing Data for Effective Joins, Grouping or Filtering</span></strong></p>
<p>Mashups &#8211; as the name suggests &#8211; is expected to get results from different services (not designed to work with each other). Though similar data is obtained from these services invoked, they would not be in identical forms. For effective usage of joins, grouping or filtering these results from different services, normalization of data to a single representation becomes essential. Creating a custom XPath function is the best method to normalize data.</p>
<p>The following example shows joining mortgage rates from two web sites &#8211; one refers to the APR and the second uses custom terms:</p>
<p>Create the custom XPath function &#8211; to normalize the custom terminology &#8211; as a Java class myFinanceFunction that extends org.oma.emml.client.EMMLUserFunction.</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="638" valign="top">public class MyFinanceFunctions extends EMMLUserFunction {</td>
</tr>
<tr>
<td width="638" valign="top">static Set mortgageAliases = new HashSet();</td>
</tr>
<tr>
<td width="638" valign="top">static { mortgageAliases.add(&#8220;5/1 Orange Mortgage&#8221;); }</td>
</tr>
<tr>
<td width="638" valign="top">public static String mortgage(String data) {</td>
</tr>
<tr>
<td width="638" valign="top">  if (mortgageAliases.contains(data))</td>
</tr>
<tr>
<td width="638" valign="top">    return &#8220;5-Year ARM&#8221;;</td>
</tr>
<tr>
<td width="638" valign="top">  return data; }</td>
</tr>
<tr>
<td width="638" valign="top">}</td>
</tr>
</tbody>
</table>
<p>Compile this class, adding <em>web-apps-home</em><em>/emml/WEB-INF/lib/emml.jar</em> to the classpath. Deploy the compiled class to web-apps-home/emml/WEB-INF/classes for the EMML Engine that host the mashups using this function.</p>
<p>Add a <strong>namespace</strong> for the class as an xmlns attribute to the &lt;mashup&gt; tag that uses this function.</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="638" valign="top">xmlns:finance=&#8221;java:com.mycompany.mashups.MyFinanceFunctions&#8221;</td>
</tr>
<tr>
<td width="638" valign="top">name=&#8221;MortgageComparisons&#8221;&gt;</td>
</tr>
</tbody>
</table>
<p>Use the custom function in the XPath expressions in the &lt;join&gt; statement (or where data needs to be normalized).</p>
<table class="MsoTableGrid" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="padding-bottom: 0in;padding-left: 5.4pt;width: 6.65in;padding-right: 5.4pt;padding-top: 0in;border: #c0c0c0" width="638" valign="top">
<p class="MsoNormal" style="text-align: justify;margin: 0in 0in 0pt"><span class="keyword"><span style="font-family: &quot;Times New Roman&quot;,&quot;serif&quot;font-size">&lt;output name=&#8221;result&#8221; type=&#8221;document&#8221;/&gt; </span></span></p>
</td>
</tr>
<tr>
<td style="padding-bottom: 0in;padding-left: 5.4pt;width: 6.65in;padding-right: 5.4pt;padding-top: 0in;border: #c0c0c0" width="638" valign="top">
<p class="MsoNormal" style="text-align: justify;margin: 0in 0in 0pt"><span class="keyword"><span style="font-family: &quot;Times New Roman&quot;,&quot;serif&quot;font-size"><span>  </span>&lt;join outputvariable=&#8221;$result&#8221; </span></span></p>
</td>
</tr>
<tr>
<td style="padding-bottom: 0in;padding-left: 5.4pt;width: 6.65in;padding-right: 5.4pt;padding-top: 0in;border: #c0c0c0" width="638" valign="top">
<p class="MsoNormal" style="text-align: justify;margin: 0in 0in 0pt"><span class="keyword"><span style="font-family: &quot;Times New Roman&quot;,&quot;serif&quot;font-size"><span>    </span>joincondition=&#8221;$feed1/feed/finance:mortgage(Product) = </span></span></p>
</td>
</tr>
<tr>
<td style="padding-bottom: 0in;padding-left: 5.4pt;width: 6.65in;padding-right: 5.4pt;padding-top: 0in;border: #c0c0c0" width="638" valign="top">
<p class="MsoNormal" style="text-align: justify;margin: 0in 0in 0pt"><span class="keyword"><span style="font-family: &quot;Times New Roman&quot;,&quot;serif&quot;font-size"><span>    </span>$feed2/feed/finance:mortgage(Product)&#8221;/&gt; </span></span></p>
</td>
</tr>
<tr>
<td style="padding-bottom: 0in;padding-left: 5.4pt;width: 6.65in;padding-right: 5.4pt;padding-top: 0in;border: #c0c0c0" width="638" valign="top">
<p class="MsoNormal" style="text-align: justify;margin: 0in 0in 0pt"><span class="keyword"><span style="font-family: &quot;Times New Roman&quot;,&quot;serif&quot;font-size"><span>  </span>&lt;display message=&#8221;result = &#8221; expr=&#8221;$result&#8221;/&gt; </span></span></p>
</td>
</tr>
<tr>
<td style="padding-bottom: 0in;padding-left: 5.4pt;width: 6.65in;padding-right: 5.4pt;padding-top: 0in;border: #c0c0c0" width="638" valign="top">
<p class="MsoNormal" style="text-align: justify;margin: 0in 0in 0pt"><span class="keyword"><span style="font-family: &quot;Times New Roman&quot;,&quot;serif&quot;font-size">&#8230;.</span></span></p>
</td>
</tr>
</tbody>
</table>
<p><strong><span style="text-decoration: underline">Removing Duplicates With Filtering</span></strong></p>
<p>To remove duplicates in a mashup, simply merge, join or group results. Sort the combined results (If needed) based on the key field that determines uniqueness to ensure that duplicates are contiguous. Use &lt;filter&gt; with a filtering expression that compares the key value of either the preceding or following &#8216;item&#8217; to determine if this &#8216;item&#8217; is unique. The filter expression can use the axis feature in XPath to compare preceding or following items.</p>
<p>Following is a simple &lt;filter&gt; statement:</p>
<p>&lt;filter inputvariable=&#8221;$a&#8221; outputvariable=&#8221;$a&#8221; filterexpr=&#8221;/rss/channel/item[contains(title,'Java')" /&gt;]</p>
<p>In addition to the default XPath axis &#8211; the child axis, you can refer to previous nodes (<em>preceding / preceding-sibling</em>), following nodes (<em>following / following-sibling</em>), the parent node, ancestor nodes, descendant nodes and others. You can also use wildcards like <em>following::* </em>or <em>following::node()</em> to identify all following nodes of any name.</p>
<p>The following example checks the title of each item (after merging results from two RSS services) to remove duplicates:</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="638" valign="top">  &lt;!&#8211; merge the results &#8211;&gt;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;merge inputvariables=&#8221;$feed1, $feed2&#8243; outputvariable=&#8221;result&#8221;/&gt;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;!&#8211; filter for unique items based on title &#8211;&gt;</td>
</tr>
<tr>
<td width="638" valign="top">  &lt;filter inputvariable=&#8221;$result&#8221; outputvariable=&#8221;$result&#8221;</td>
</tr>
<tr>
<td width="638" valign="top">    filterexpr=&#8221;/rss/channel/item[not(preceding::title = ./title)]&#8221; /&gt;</td>
</tr>
</tbody>
</table>
<p>I shall cover some more techniques in the second part of this blog. The Advanced Mashup Techniques are detailed in <a href="http://www.openmashup.org/omadocs/v1.0/emml/advMashupIntro.html">http://www.openmashup.org/omadocs/v1.0/emml/advMashupIntro.html</a>.</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/enterprise-IT-tech-trends/advanced-mashup-scripting-in-emml-part-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mashup Scripting using EMML from OMA</title>
		<link>http://itknowledgeexchange.techtarget.com/enterprise-IT-tech-trends/mashup-scripting-using-emml-from-oma/</link>
		<comments>http://itknowledgeexchange.techtarget.com/enterprise-IT-tech-trends/mashup-scripting-using-emml-from-oma/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 11:46:35 +0000</pubDate>
		<dc:creator>Sasirekha R</dc:creator>
				<category><![CDATA[EMML]]></category>
		<category><![CDATA[Mashup]]></category>
		<category><![CDATA[OMA]]></category>
		<category><![CDATA[Open]]></category>
		<category><![CDATA[Standard]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/enterprise-IT-tech-trends/?p=242</guid>
		<description><![CDATA[Mashup Scripting using EMML from OMA Open Mashup Alliance (OMA) is a consortium aimed at successful use of Enterprise Mashup technologies and adoption of an open language &#8211; Enterprise Mashup Markup Language (EMML) &#8211; that promotes Enterprise Mashup interoperability and portability. EMML is an XML language to describe the processing flow for a mashup. The [...]]]></description>
				<content:encoded><![CDATA[<p><strong>Mashup Scripting using EMML from OMA</strong></p>
<p>Open Mashup Alliance (OMA) is a consortium aimed at successful use of Enterprise Mashup technologies and adoption of an open language &#8211; Enterprise Mashup Markup Language (EMML) &#8211; that promotes Enterprise Mashup interoperability and portability. EMML is an XML language to describe the processing flow for a mashup. The OMA provides the EMML schema and also a reference runtime implementation that processes mashup scripts written in EMML.<span id="more-242"></span></p>
<p>The EMML package can be downloaded from <a href="http://www.openmashup.org/download" target="_blank">http://www.openmashup.org/download</a>. Before installing the EMML package, install the JDK (1.5 or above) and Tomcat 5.5 or another compatible application server. EMML samples can be downloaded from <a href="http://www.openmashup.org/download" target="_blank">http://www.openmashup.org/download</a>.</p>
<p>You can create a mashup script using any XML editor. Adding the EMML schema, <em>emml-install</em>/EMMLSpec.xsd, to the XML editor &#8211; enables the editor to provide syntax assistance and validation. A Mashup script &#8211; an XML file that uses EMML &#8211; is created to define:</p>
<ul>
<li>the services and operations to be used by the mashup and</li>
<li>the actions to apply to service responses to construct the results of the mashup.</li>
</ul>
<p>Following is a simple mashup script that invokes a service (most viewed stories) and filters the output (business).</p>
<address>&lt;?xml version=&#8221;1.0&#8243;?&gt;</address>
<address>&lt;mashup name=&#8221;NewsStories&#8221;</address>
<address>    xmlns=&#8221;www.openemml.org/2009-04-15/EMMLSchema&#8221;</address>
<address>    xsi:schemaLocation=&#8221;www.openemml.org/2009-04-15/EMMLSchema</address>
<address>      ../schema/EMMLSpec.xsd&#8221;</address>
<address>    xmlns:xsi=&#8221;http://www.w3.org/2001/XMLSchema-instance&#8221; &gt;</address>
<address>  &lt;variables&gt;</address>
<address>    &lt;variable name=&#8221;stories&#8221; type=&#8221;document&#8221;/&gt;</address>
<address>  &lt;/variable&gt;</address>
<address>  &lt;output name=&#8221;result&#8221; type=&#8221;document&#8221;/&gt;</address>
<address>  &lt;directinvoke endpoint=&#8221;http://rss.news.yahoo.com/rss/mostviewed&#8221;</address>
<address>      method=&#8221;GET&#8221; outputvariable=&#8221;stories&#8221;/&gt;</address>
<address>  &lt;filter inputvariable=&#8221;stories&#8221;</address>
<address>      filterexpr=&#8221;matches($stories/rss/channel/item/description,&#8217;Business&#8217;)&#8221;</address>
<address>      outputvariable=&#8221;result&#8221;/&gt;</address>
<address>&lt;/mashup&gt;</address>
<p> Two categories of elements are added to mashups:</p>
<ul>
<li><strong>Declarations</strong> for variables, parameters, data sources, namespaces, macros or metadata.</li>
<li><strong>Statements</strong> that perform actions &#8211; to invoke services, control flow, act on the results or use custom statements defined in macros &#8211; for the mashup.</li>
</ul>
<p><strong>Variables and Parameters</strong></p>
<p>Variables and parameters <strong>must</strong> be declared (explicitly or implicitly) before they are used in any other EMML statement. Variables and parameters have a name, a datatype, data (a value), a scope (global or local) and optionally a default value. Variables can be created implicitly by assigning a name to the outputvariable attribute for any statement.</p>
<ul>
<li>&lt;input&gt; is an optional element to declare parameters that can be used as input to mashup, operation or macro.</li>
<li>&lt;output&gt; is the parameter that holds the result returned from a mashup, operation or macro.</li>
<li>&lt;variables&gt; is a list of variables to use for input, output or to hold any intermediate data or document content in the flow of mashup processing.</li>
</ul>
<p><strong>Accessing a database</strong></p>
<p>To invoke SQL queries or statements, &lt;datasource&gt; with connection information for the database must be declared.  Each &lt;datasource&gt; declaration must have a URL that defines the JDBC connection and database login information (or) a JNDI name for connections to the database. Connection information can also be set dynamically as follows:</p>
<address>&lt;datasource url=&#8221;$system.datasourceURL&#8221;</address>
<address>   driverclassname=&#8221;$system.datasourceDriver&#8221;</address>
<address>   username=&#8221;$system.dbUserName&#8221; password=&#8221;$system.dbPassword&#8221;/&gt;</address>
<p>Note that, to use a &lt;datasource&gt;, you must add the JAR files containing JDBC drivers for your data source to the EMML Reference Runtime Engine classpath and add configuration for these drivers.</p>
<p>Use <a href="http://www.openmashup.org/omadocs/v1.0/emml/sqlRefCmd.html#jbid093NEN003UI">&lt;sql&gt;</a>to issue individual SQL queries to a data source &#8211; for example:</p>
<address>&lt;sql query=&#8221;select CUST_ID, CUST_NAME from CUSTOMERS</address>
<address>  where CUST_ID = :customerId&#8221; outputvariable=&#8221;$customers&#8221; /&gt;</address>
<p>Use <a href="http://www.openmashup.org/omadocs/v1.0/emml/sqlUpdateRefCmd.html#jbid093NF0AA0HT">&lt;sqlUpdate&gt;</a> to execute any other SQL statement against a data source &#8211; for example:</p>
<address>&lt;sqlUpdate statement=&#8221;update credentials set</address>
<address>    user_id = &#8216;newuser&#8217; where id = &#8217;1004&#8242;&#8221;</address>
<address>    outputvariable=&#8221;$updateResult&#8221;/&gt;</address>
<p>&lt;sql&gt; and &lt;sqlUpdate&gt; can also be used to invoke stored procedures. SQL transactions can be managed using <a href="http://www.openmashup.org/omadocs/v1.0/emml/sqlBeginTransactionRefCmd.html#jbid093NF0GA0PF">&lt;sqlBeginTransaction&gt;</a>, <a href="http://www.openmashup.org/omadocs/v1.0/emml/sqlCommitRefCmd.html#jbid093NF0H0FPN">&lt;sqlCommit&gt;</a> and <a href="http://www.openmashup.org/omadocs/v1.0/emml/sqlRollbackRefCmd.html#jbid093NF0I0Z30">&lt;sqlRollback&gt;</a>. EMML currently does not support distributed transactions.</p>
<p><strong>Accessing a Web Service</strong></p>
<p>Using <a href="http://www.openmashup.org/omadocs/v1.0/emml/directinvokeRefCmd.html#jbid093KF0N0TBI">&lt;directinvoke&gt;</a>, you can invoke a publically accessible web service or website. In case of service invocation error, the EMML Reference Runtime Engine returns error information in two built-in variables: faultcode and faultmessage.</p>
<p><strong>Transforming Intermediate Results</strong></p>
<p>The mashup statements that can be used to select specific results, sort results, or otherwise transform the data in variables include:</p>
<ul>
<li><a href="http://www.openmashup.org/omadocs/v1.0/emml/assignRefCmd.html#jbid093KEK00SPF">&lt;assign&gt;</a> &#8211; to assign values or copy part of all of a variable</li>
<li><a href="http://www.openmashup.org/omadocs/v1.0/emml/filterRefCmd.html#jbid093KF40802L">&lt;filter&gt;</a> &#8211; to filter a variable</li>
<li><a href="http://www.openmashup.org/omadocs/v1.0/emml/groupRefCmd.html#jbid093KG0J03BL">&lt;group&gt;</a> &#8211; to group data in a variable and optionally filter or sort</li>
<li><a href="http://www.openmashup.org/omadocs/v1.0/emml/sortRefCmd.html#jbid093NEJ00AY4">&lt;sort&gt;</a> &#8211; to sort a variable</li>
<li><a href="http://www.openmashup.org/omadocs/v1.0/emml/annotateRefCmd.html#jbid093KE4006Y4">&lt;annotate&gt;</a> &#8211; to add nodes and data to a variable</li>
<li><a href="http://www.openmashup.org/omadocs/v1.0/emml/xsltRefCmd.html#jbid0985F0DJ0UI">&lt;xslt&gt;</a> &#8211; to transform data using XSLT stylesheets</li>
</ul>
<p>Additionally, XPath functions can be used to transform data, change datatypes, perform calculations or determine boolean conditions.</p>
<p>Using the <a href="http://www.openmashup.org/omadocs/v1.0/emml/scriptRefCmd.html#jbidemmlrefscript">&lt;script&gt;</a> statement, user-defined code can be executed within mashup processing. JavaScript and JRuby 1.0 are the scripting languages currently supported.</p>
<p><strong>Combining Service Results</strong></p>
<p>Results of two or more component services can be combined using:</p>
<p>1. <a href="http://www.openmashup.org/omadocs/v1.0/emml/mergeRefCmd.html#jbid093NE0F0Q30">&lt;merge&gt;</a> &#8211; to merge service results that have homogenous, document-type structures (similar to database union operation)</p>
<p>2. <a href="http://www.openmashup.org/omadocs/v1.0/emml/joinRefCmd.html#jbid093NC0VK0YK">&lt;join&gt;</a> &#8211; to define how the data from disparate variables should be joined. Variable data should have repetitive structures that are related based on some criteria &#8211; say, the foreign keys that define the relation. It is comparable to inner joins for databases.</p>
<p>3. <a href="http://www.openmashup.org/omadocs/v1.0/emml/outerJoinXquery.html#jbid0824CM00T5Z">XQuery</a> &#8211; to obtain outer joins in mashups.</p>
<p><strong>Constructing the Mashup Result, Input or Intermediate Variables</strong></p>
<p>The following statements can be used to define the structure of the result that is returned from a mashup, or to construct complex input parameters or any complex intermediate variable:</p>
<ul>
<li><a href="http://www.openmashup.org/omadocs/v1.0/emml/constructorRefCmd.html#jbid093KF0G504Y">&lt;constructor&gt;</a> to construct a well-formed document.</li>
<li><a href="http://www.openmashup.org/omadocs/v1.0/emml/appendresultRefCmd.html#jbid093KED0I0YK">&lt;appendresult&gt;</a> to add one or more well-formed items to a variable.</li>
<li><a href="http://www.openmashup.org/omadocs/v1.0/emml/selectRefCmd.html#jbid093NE1070QN">&lt;select&gt;</a> (within &lt;mashup&gt;, &lt;operation&gt; or &lt;macro&gt;)</li>
<li>&lt;select&gt; within a &lt;join&gt; command to select specific items within a set of repeating items. See <a href="http://www.openmashup.org/omadocs/v1.0/emml/joinRefCmd.html#jbid093NC0VK0YK">&lt;join&gt;</a>.</li>
<li><a href="http://www.openmashup.org/omadocs/v1.0/emml/groupRefCmd.html#jbid093KG0J03BL">&lt;group&gt;</a> constructs repeating structures from sorted and optionally filtered node sets.</li>
</ul>
<p>Literal XML can also be used to construct the contents of variables or input parameters.</p>
<p><strong>Controlling Mashup Processing Flow</strong></p>
<p>The mashup commands to control the processing flow for a mashup operation includes:</p>
<ul>
<li><a href="http://www.openmashup.org/omadocs/v1.0/emml/ifRefCmd.html#jbid093KG0P094B">&lt;if&gt;</a> for conditional processing</li>
<li><a href="http://www.openmashup.org/omadocs/v1.0/emml/forRefCmd.html#jbid093KG0G0FAX">&lt;for&gt;</a> for looping based on simple counts</li>
<li><a href="http://www.openmashup.org/omadocs/v1.0/emml/foreachRefCmd.html#jbid093KG0A0UTS">&lt;foreach&gt;</a> for looping through a set of nodes. This can be simple iterative loops or loops can be processed concurrently.</li>
<li><a href="http://www.openmashup.org/omadocs/v1.0/emml/whileRefCmd.html#jbid093NF0NA0E9">&lt;while&gt;</a> for looping as long as a condition is true</li>
<li><a href="http://www.openmashup.org/omadocs/v1.0/emml/breakRefCmd.html#jbid093KF0F04E9">&lt;break&gt;</a> to forceably stop looping statements</li>
<li><a href="http://www.openmashup.org/omadocs/v1.0/emml/multiFlows.html#jbid073EBC00K30">Concurrent Mashup Processing Flows</a> using <a href="http://www.openmashup.org/omadocs/v1.0/emml/parallelRefCmd.html#jbid093NE0MD0RO">&lt;parallel&gt;</a>.</li>
<li><a href="http://www.openmashup.org/omadocs/v1.0/emml/sqlTransactionCmds.html#jbid0946BA00Q5Z">SQL Transactions</a> using <a href="http://www.openmashup.org/omadocs/v1.0/emml/sqlBeginTransactionRefCmd.html#jbid093NF0GA0PF">&lt;sqlBeginTransaction&gt;</a>, <a href="http://www.openmashup.org/omadocs/v1.0/emml/sqlCommitRefCmd.html#jbid093NF0H0FPN">&lt;sqlCommit&gt;</a> and <a href="http://www.openmashup.org/omadocs/v1.0/emml/sqlRollbackRefCmd.html#jbid093NF0I0Z30">&lt;sqlRollback&gt;</a>.</li>
</ul>
<p>Using <a href="http://www.openmashup.org/omadocs/v1.0/emml/emml-metaRefCmd.html#jbid093KF0UL07U">&lt;emml-meta&gt;</a> and <a href="http://www.openmashup.org/omadocs/v1.0/emml/user-metaRefCmd.html#jbidemmlrefuser-meta">&lt;user-meta&gt;</a>, metadata can be declared to allow setting of processing flags or pass other information to applications that will use a mashup, use a macro or handle mashup results.</p>
<p>EMML, like any other tag language, is quite simple to use and can be used by business users to create mashups quickly. EMML also supports various statements and commands that can be used to create complex Mashups depending on the needs of the user.</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/enterprise-IT-tech-trends/mashup-scripting-using-emml-from-oma/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
