MixDEM Examples
1 - SIMPLE FEED READER Module
<?xml version="1.0" encoding="UTF-8"?>
<!--
TEST - Modules 08 March
Simple test of FEED READER Module
@MixDem dev March 2008
-->
<Graph access="public">
<Element>
<Node id="Read Google news RSS" type="FEED_READER" url="http://news.google.com/nwshp?hl=en&tab=wn&output=rss" />
<Node id="Read feedburner feed" type="FEED_READER" url="http://feeds.feedburner.com/BurnThisRSS2" path="channel.item" />
<Node id="Read digg feed" type="FEED_READER" url="http://www.digg.com/rss/index.xml" path="channel" />
</Element>
</Graph>
2 - SIMPLE HTTP READER Module
<?xml version="1.0" encoding="UTF-8"?>
<!--
TEST - Modules 08 March
Simple test of HTTP_READER Module
@MixDem dev March 2008
-->
<Graph
access = "private"
login = "test_login"
password = "test_password"
render = "XML"
node = "Fetch Tn-blogs.com"
offset = "10"
rows = "20"
>
<Element>
<Node id="Fetch Tn-blogs.com" type="HTTP_READER" url="http://tn-blogs.com"
from="<div class="item">"
to="<div id="leftcolumns">"
split="<div class="item">"
/>
</Element>
</Graph>
3 - Create RSS Feed from an HTML page using HTTP READER and FEED WRITER Modules
<?xml version="1.0" encoding="UTF-8"?>
<!--
TEST - Modules 08 March
Simple test of FEED_WRITER Module
@MixDem dev March 2008
-->
<Graph
access = "public"
created = "01/03/2008"
modified = "08/04/2008"
author = "MixDem dev"
license = "GPL"
>
<!-- Define some Property -->
<Property name="url" value="http://tn-blogs.com" />
<Property name="description" value="test - Tn-blogs.com feed using MixDEM" />
<Property name="charset" value="UTF-8" />
<!-- Define metadata -->
<Metadata>
<DataRecord name="rss">
<DataField name="title" type="string" value="item" />
<DataField name="link" type="string" value="${url}" />
<DataField name="content" rename="description" type="string" trim="true" />
</DataRecord>
</Metadata>
<!-- Graph main definition -->
<Element>
<Node id="Fetch Tn-blogs.com" type="HTTP_READER" url="${url}"
from="<div class="item">"
to="<div id="leftcolumns">"
split="<div class="item">"
/>
<Node id="Convert to feed" type="FEED_WRITER" syndication="atom"
title="Tn-blogs.com feed"
link="${url}"
description="${description}"
charset="${charset}"
/>
<Edge from="Fetch Tn-blogs.com" to="Convert to feed" metadata="rss" />
</Element>
</Graph>
4 - SIMPLE TEST OF REGEX Module
<?xml version="1.0" encoding="UTF-8"?>
<!--
TEST - Modules 08 March
Simple test of REGEX Module
@MixDem dev Abril 2008
-->
<Graph
access="public"
created="09/09/2008"
modified="09/09/2008"
author="MixDem dev"
license="GPL"
>
<!-- Define metadata -->
<Metadata>
<DataRecord name="mdata">
<DataField name="title" type="string" />
<DataField name="pubDate" type="string" />
<DataField name="link" type="string" />
<DataField name="description" type="string" />
<DataField name="guid" type="string" />
</DataRecord>
</Metadata>
<Element>
<Node id="Read Earthquake Feed" type="FEED_READER"
url="http://earthquake.usgs.gov/eqcenter/recenteqsww/catalogs/eqs1day-M2.5.xml"
path="channel.item"
/>
<Node id="Regex Pattern Matching" type="REGEX">
<Attrib name="title 1" field="title" pattern="/^M/" replacement="" />
<Attrib name="title 2" field="title" pattern="/(\d\.\d),/" replacement="$1 :" />
<Attrib name="pubDate" field="pubDate" pattern="/ GMT/" replacement="" />
</Node>
<Edge from="Read Earthquake Feed" to="Regex Pattern Matching" metadata="mdata" />
</Element>
</Graph>
5 - HTTP READER & REGEX Module
<?xml version="1.0" encoding="UTF-8"?>
<Graph>
<Element>
<Node id="Fetch hostgator" type="HTTP_READER" url="http://www.hostgator.com/shared.shtml" from="sharedtable" to="</table>" split="<\/tr>" />
<Node id="Regex Pattern Matching" type="REGEX">
<Attrib name="feature 1" field="feature" pattern="/.* class="feature">(.*)/s" replacement="$1" />
<Attrib name="feature 2" field="feature" pattern="/<\/td>.*/s" replacement="" />
<Attrib name="hatchling 1" field="hatchling" pattern="/.*<td[^>]*?>(.*?)<\/td>(.*?)<td[^>]*?>(.*?)<\/td>(.*?)<td[^>]*?>(.*?)<\/td>.*/s" replacement="$1" />
<Attrib name="hatchling 2" field="hatchling" pattern="/<strong>UNLIMITED<\/strong>/" replacement="UNLIMITED" />
<Attrib name="hatchling 3" field="hatchling" pattern="/<img src="images\/check.gif" alt="" \/>/" replacement="TRUE" />
<Attrib name="hatchling 4" field="hatchling" pattern="/<img src="images\/x.gif" alt="" \/>/" replacement="FALSE" />
<Attrib name="baby 1" field="baby" pattern="/.*<td[^>]*?>(.*?)<\/td>(.*?)<td[^>]*?>(.*?)<\/td>(.*?)<td[^>]*?>(.*?)<\/td>.*/s" replacement="$3" />
<Attrib name="baby 2" field="baby" pattern="/<strong>UNLIMITED<\/strong>/" replacement="UNLIMITED" />
<Attrib name="baby 3" field="baby" pattern="/<img src="images\/check.gif" alt="" \/>/" replacement="TRUE" />
<Attrib name="baby 4" field="baby" pattern="/<img src="images\/x.gif" alt="" \/>/" replacement="FALSE" />
<Attrib name="swamp 1" field="swamp" pattern="/.*<td[^>]*?>(.*?)<\/td>(.*?)<td[^>]*?>(.*?)<\/td>(.*?)<td[^>]*?>(.*?)<\/td>.*/s" replacement="$5" />
<Attrib name="swamp 2" field="swamp" pattern="/<strong>UNLIMITED<\/strong>/" replacement="UNLIMITED" />
<Attrib name="swamp 3" field="swamp" pattern="/<img src="images\/check.gif" alt="" \/>/" replacement="TRUE" />
<Attrib name="swamp 4" field="swamp" pattern="/<img src="images\/x.gif" alt="" \/>/" replacement="FALSE" />
</Node>
<Edge from="Fetch hostgator" to="Regex Pattern Matching" metadata="mdata" />
</Element>
<Metadata>
<DataRecord name="mdata">
<DataField name="content" rename="feature" type="string" />
<DataField name="content" rename="hatchling" type="string" />
<DataField name="content" rename="baby" type="string" />
<DataField name="content" rename="swamp" type="string" />
</DataRecord>
</Metadata>
</Graph>
6 - SIMPLE TEST OF CSV READER Module
<?xml version="1.0" encoding="UTF-8"?>
<!--
TEST - Modules 08 April
Simple test of CSV_READER Module
@MixDem dev April 2008
-->
<Graph
access = "public"
created = "09/04/2008"
modified = "09/04/2008"
author = "MixDem dev"
license = "GPL"
>
<Element>
<Node id="Read CSV file" type="CSV_READER"
url="http://www.abc.virginia.gov/Pricelist/text/disjan08.csv"
quoted="true"
delimiter=","
charset="ISO-8859-15"
newline="\n"
skiprows="5"
maxrows="15"
/>
</Element>
</Graph>
7 - SIMPLE TEST OF CVS WRITER Module
<?xml version="1.0" encoding="UTF-8"?>
<!--
TEST - Modules 08 April
Simple test of CSV_WRITER Module
@MixDem dev April 2008
-->
<Graph
access ="public"
created = "09/04/2008"
modified = "09/04/2008"
author = "MixDem dev"
license = "GPL"
>
<!-- Define some Property -->
<Property name="url" value="http://tn-blogs.com" />
<Property name="description" value="test - Tn-blogs.com feed using MixDEM" />
<Property name="charset" value="UTF-8" />
<!-- Define metadata -->
<Metadata>
<DataRecord name="mdata">
<DataField name="title" type="string" value="item" />
<DataField name="link" type="string" value="${url}" />
<DataField name="content" rename="description" type="string" trim="true" />
</DataRecord>
</Metadata>
<!-- Graph main definition -->
<Element>
<Node id="Fetch Tn-blogs.com" type="HTTP_READER" url="http://tn-blogs.com"
from="<div class="item">"
to="<div id="leftcolumns">"
split="<div class="item">"
/>
<Node id="create and send a formatted CSV file to FTP" type="CSV_WRITER"
url=""
quoted="true"
delimiter=";"
charset="ISO-8859-15"
newline="\n"
skiprows="2"
maxrows="10"
header="true"
/>
<Edge from="Fetch Tn-blogs.com" to="create and send a formatted CSV file to FTP" metadata="mdata" />
</Element>
</Graph>
8 - SIMPLE TEST OF FILTER Module
<?xml version="1.0" encoding="UTF-8"?>
<!--
TEST - Modules 08 Abril
Simple test of FILTER Module
@MixDem dev Abril 2008
-->
<Graph
access = "public"
created = "15/04/2008"
modified = "15/04/2008"
author = "MixDem dev"
license = "GPL"
>
<Element>
<Node id="Read Google News Feed" type="FEED_READER"
url="http://news.google.com/nwshp?hl=en&tab=wn&output=rss"
path="channel.item"
/>
<Node id="FILTER Matching" type="FILTER">
<Attrib name="exp_1"> @{category} == "Top Stories" || @{category} == "World" </Attrib>
</Node>
<Edge from="Read Google News Feed" to="FILTER Matching" metadata="mdata" />
</Element>
<!-- Define metadata -->
<Metadata>
<DataRecord name="mdata">
<DataField name="title" type="string" />
<DataField name="pubDate" type="string" />
<DataField name="link" type="string" />
<DataField name="description" type="string" />
<DataField name="category" type="string" />
</DataRecord>
</Metadata>
</Graph>
9 - SIMPLE TEST OF SQL READER Module
<?xml version="1.0" encoding="UTF-8"?>
<!--
TEST - Modules 08 Abril
Simple test of SQL_READER Module
@MixDem dev Abril 2008
-->
<Graph
access = "public"
created = "10/04/2008"
modified = "10/04/2008"
author = "MixDem dev"
license = "GPL"
>
<!-- Define some Property -->
<Property name="dsn" value="mysql://root:root@127.0.0.1/information_schema" />
<Property name="query" value="SELECT * FROM TABLES" />
<!-- Define metadata -->
<Metadata>
<DataRecord name="mdata">
<DataField name="id" type="integer" />
<DataField name="titel" rename="title" type="string" />
<DataField name="interpret" type="string" />
<DataField name="jahr" type="string" />
</DataRecord>
</Metadata>
<!-- Graph main definition -->
<Element>
<Node id="Read from mysql table" type="SQL_READER" dsn="${dsn}" sqlQuery="${query}" />
<Node id="Create and send a formatted CSV file to FTP" type="CSV_WRITER"
url="ftp://user:motdepasse@example.com/pub/file.txt"
quoted="true"
delimiter=";"
charset="ISO-8859-15"
newline="\n"
skiprows="2"
maxrows="10"
header="true"
/>
<Edge from="Read from mysql table" to="Create and send a formatted CSV file to FTP" metadata="mdata" />
</Element>
</Graph>
10 - SIMPLE TEST OF SQL WRITER Module
<?xml version="1.0" encoding="UTF-8"?>
<!--
TEST - Modules 08 Abril
Simple test of SQL_WRITER Module
@MixDem dev Abril 2008
-->
<Graph
access = "public"
created = "10/04/2008"
modified = "10/04/2008"
author = "MixDem dev"
license = "GPL"
>
<!-- Define some Property -->
<Property name="dsn" value="mysql://root:root@127.0.0.1/test" />
<!-- Define metadata -->
<Metadata>
<DataRecord name="mdata">
<DataField name="Code" rename="id_product" type="integer" />
<DataField name="Brand" rename="brand_name" type="string" />
</DataRecord>
</Metadata>
<!-- Graph main definition -->
<Element>
<Node id="Read CSV file" type="CSV_READER"
url="http://www.abc.virginia.gov/Pricelist/text/disjan08.csv"
quoted="true"
delimiter=","
charset="ISO-8859-15"
newline="\n"
skiprows="5"
maxrows="15"
/>
<Node id="Insert into mysql table" type="SQL_WRITER" dsn="${dsn}"
table="t"
methode="INSERT"
truncate="FALSE"
commit="100"
errorAction="ROLLBACK"
/>
<Edge from="Read CSV file" to="Insert into mysql table" metadata="mdata" />
</Element>
</Graph>
11 - SIMPLE TEST OF XML READER Module
<?xml version="1.0" encoding="UTF-8"?>
<!--
TEST - Modules 08 April
Simple test of XML READER Module
Data Source :
- "Frequently tagged products at Amazon.com" Dapp from http://www.dapper.net/
- "Yahoo! Answers Web Service" from http://www.yahoo.com/
@MixDem dev April 2008
-->
<Graph access="public">
<Element>
<Node id="Read xml - Frequently tagged products at Amazon.com" type="XML_READER" path="RSS_Item" url="http://www.dapper.net/RunDapp?dappName=animationFrequentlytaggedproductsatAmazoncom&v=1&applyToUrl=http%3A%2F%2Fwww.amazon.com%2Frss%2Ftag%2Fanimation%2Fpopular%3Flength%3D20%26tag%3Dmovshocit-20" />
<Node id="Read xml - Yahoo! Answers" type="XML_READER" path="Question" url="http://answers.yahooapis.com/AnswersService/V1/questionSearch?appid=YahooDemo&query=mars" />
</Element>
</Graph>
12 - SIMPLE TEST OF MAP GOOGLE component
<?xml version="1.0" encoding="UTF-8"?>
<Graph>
<!-- Define metadata -->
<Metadata>
<DataRecord name="geo.rss">
<DataField name="title" type="string" />
<DataField name="link" type="string" />
<DataField name="geo:lat" rename="lat" type="string" />
<DataField name="geo:long" rename="long" type="string" />
</DataRecord>
</Metadata>
<Element>
<Node id="Read xml feed" type="XML_READER" path="rss.channel.item"
url="http://www.mapnut.com/calstatepark.xml" skiprows="1" maxrows="5"
/>
<Node id="Simple Mashup with a GMap" type="MAP_GOOGLE" skiprows="1" maxrows="2"
GMAPIKey="ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA"
GMCenter="41.1, -121.4" GMZoom="5" GMCWidth="680px" GMCHeight="270px" GMMevent="click"
GMContainer="map" GMMdataLat="@{lat}" GMMdataLong="@{long}" GMMdataHtml="@{title}"
/>
<Edge from="Read xml feed" to="Simple Mashup with a GMap" metadata="geo.rss" />
</Element>
</Graph>