Hi All,

I have started working on $subject with Srinath.

As we discussed, I have done a research of some data transformation
technologies and architectures of them.

1) We assume all data types we map can be represented as a tree and
accessed via a/b/c xpath like  format. For example, values in relational
table we represented via one level paths.


2) We describe the mapping using a Avro like format. Let us take an
example. Lets assume we need to convert following XML file to a JSON
document.

<employee>
<firstname>Susankha</firstname>
 <lastname>Nirmala</lastname>
<address>Street,123,State</address>
 <dob>1985.10.31</dob>
</employee>
 We define the mapping using following Avro like format.

mapping.json :

{
 fullName:concat($fname, $lname),
Address{
 address:
{
   "Street":"str.split($address, ",")[0]",
   "Zip":"str.split($address, ',')[1]",
  "State":"str.split($address, ',')[2]",
 }
"Age":"date.getAge($dob)"
 }
}

Here str.split(..) date.getAge() are functions, and we pass reference to
input document via xpath like paths starting with $.

When we apply the mapping, the output will look like following. We will use
defined path to travel the input file and extract values.

{
"fullname":"Susankha Nirmala",
 "address":{
 "Street": "Street",
  "Zip": "123",
  "State": "State"
  }
}

Note, the output can be anything.  For example, it can be a database and we
will auto map the structure define in mapping.config to output type. (e.g.
if output is a database, then it can only have one level).


After Comparing this two schemas, Srinath and myself decided to use JSON
for representing data mapping configuration. Also we decided to use Jackson
library for processing JSON configurations.
 --Susankha and Srinath

-- 
Susankha Nirmala
Software Engineer
WSO2, Inc.: http://wso2.com
lean.enterprise.middleware
Mobile : +94 77 593 2146
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to