Data transformation

This article is about metadata transformation in computer science. For the statistical concept see data transformation (statistics).

In metadata and data warehouse, a data transformation converts a set of data values from the data format of a source data system into the data format of a destination data system.

Data transformation can be divided into two steps:

  1. data mapping maps data elements from the source data system to the destination data system and captures any transformation that must occur
  2. code generation that creates the actual transformation program

Data element to data element mapping is frequently complicated by complex transformations that require one-to-many and many-to-one transformation rules.

The code generation step takes the data element mapping specification and creates an executable program that can be run on a computer system. Code generation can also create transformation in easy-to-maintain computer languages such as Java or XSLT.

A master data recast is another form of data transformation where the entire database of data values is transformed or recast without extracting the data from the database. All data in a well designed database is directly or indirectly related to a limited set of master database tables by a network of foreign key constraints. Each foreign key constraint is dependent upon a unique database index from the parent database table. Therefore, when the proper master database table is recast with a different unique index, the directly and indirectly related data are also recast or restated. The directly and indirectly related data may also still be viewed in the original form since the original unique index still exists with the master data. Also, the database recast must be done in such a way as to not impact the applications architecture software.

When the data mapping is indirect via a mediating data model, the process is also called data mediation.

Transformational languages

There are numerous languages available for performing data transformation. Many transformation languages require a grammar to be provided. In many cases the grammar is structured using something closely resembling Backus–Naur Form (BNF). There are numerous languages available for such purposes varying in their accessibility (cost) and general usefulness. Examples of such languages include:

Although transformational languages are typically best suited for transformation, something as simple as regular expressions can be used to achieve useful transformation. A text editor like emacs or Textpad supports the use of regular expressions with arguments. This would allow all instances of a particular pattern to be replaced with another pattern using parts of the original pattern. For example:

foo ("some string", 42, gCommon);
bar (someObj, anotherObj);

foo ("another string", 24, gCommon);
bar (myObj, myOtherObj);

could both be transformed into a more compact form like:

foobar("some string", 42, someObj, anotherObj);
foobar("another string", 24, myObj, myOtherObj);

In other words, all instances of a function invocation of foo with three arguments, followed by a function invocation with two invocations would be replaced with a single function invocation using some or all of the original set of arguments.

Another advantage to using regular expressions is that they will not fail the null transform test. That is, using your transformational language of choice, run a sample program through a transformation that doesn't perform any transformations. Many transformational languages will fail this test.

Transforming source code

Program synthesis, Automatic programming and other fields use the data transformation strategies to translate, adapt or even generate software source code. Inversely these source transformation tools can be used for data transform, typically for transform "document source code" as HTML or another XML dialect (see also Template processors).

For further information on (software) source transformation see[1](Chapter 2.4) or.[2]

Generally the different types of transformations fall into one of two categories,[3]

Example

A difficult problem to address in C/C++ is "unstructured preprocessor directives". These are preprocessor directives which do not contain blocks of code with simple grammatical descriptions, like in this function definition:

	void MyFunc ()
	{
	 if (x>17)
	 { printf("test");
	# ifdef FOO
	 } else {
	# endif
	 if (gWatch)
	 mTest = 42;
	 }
	}

A really general solution to handling this is very hard because such preprocessor directives can essentially edit the underlying language in arbitrary ways. However, because such directives are not, in practice, used in completely arbitrary ways, one can build practical tools for handling preprocessed languages. The DMS Software Reengineering Toolkit is capable of handling structured macros and preprocessor conditionals. Brabrand and Schwartzbach (2000)[4] offer another approach, substituting the C preprocessor by a metamorphic one.

See also

Concepts:     Languages and typical transforms:     Other:

References

  1. T. Cassidy (2004) "Concurrency Analysis of Java RMI Using Source Transformation and Verisoft", http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.90.5755&rep=rep1&type=pdf
  2. J. R. Cordy (2006) "The TXL source transformation language". DOI 10.1016/j.scico.2006.04.002
  3. Eelco Visser (2001), "A Survey of Strategies in Program Transformation Systems". Electronic Notes in Theoretical Computer Science, 57:363-377.
  4. Claus Brabrand and Michael I. Schwartzbach (2000) "Growing Languages with Metamorphic Syntax Macros". BRICS Report Series RS-00-24. BRICS, Denmark. ISSN 0909-0878.

External links

This article is issued from Wikipedia - version of the Friday, November 06, 2015. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.