# Structured Data REST Protocol for End to End Data Mashup
## Structured Data Rest Protocol
### SDX Mapping  
The data exchange is the process where the data structured under one schema (the source schema) must be restructured and translated into an instance of a different schema (the target schema) [50]. According to them [50], a data exchange setting consists of a source schema S, a target schema T, a set of source-to-target dependencies, and a set t of target dependencies. They also explained that the input to a data exchange problem is a source instance only; the data exchange setting itself (source schema, target schema, and dependencies) is considered fixed. In our proposed work, we have developed SDXMapping in such a way that source to target and target to source mapping is fixed and unique. This process is performed at DSC's end upon receiving MCAttributes which creates Structured Data eXchange (SDX). The SDX is the logical entity which contains the mapping between attributes of DMD and that of MCA. It is used to validate and transform the structured data records received from MSP/DSP and populate them into appropriate SDMB.  
Thus, SDX can be defined as follows:  
\[\text{SDX}=(\text{Sdx}\#\text{Id},\text{Dmd}\#\text{Id},\text{SDXMapping})\]  
where Sdx#Id is the unique id of SDX, Dmd#Id is the id of DMDAdtributes and SDXMapping is the collection of a pair of DMDAttribute and MCAttribute semantically equal to each other. For example,  
\[\text{SDXMapping}=(\text{x}_{1}=\text{p}_{3},\text{x}_{2}=\text{p}_{n}, \text{x}_{3}=\text{p}_{2},\ldots,\text{x}_{n}=\text{p}_{1})\]  
where \(\text{x}_{1},\text{x}_{2},\ldots\text{x}_{n}\) are the name of DMD attributes defined by data service consumer and \(\text{p}_{1},\text{p}_{2},\ldots\text{p}_{n}\) are the name of attributes of MCAttributes received from MSP/DSP for one time configuration. Here, pair \(\text{x}_{1}=\text{p}_{3}\) shows that DMDAttribute \(\text{x}_{1}\) is semantically equal to MCAttribute \(\text{p}_{3}\). There should be one to one mapping between these attributes. The Algorithm 1 explains how MCAttribute is processed to create SDX.  
Let us understand the output of Algorithm 1 (i.e. SDXMapping) using sample data in tabular format. Table 5 shows the mapping between DMD attributes and MCAttributes which looks like 'Column Matching Problem'. It is clear that the attribute \"x\({}_{1}\)\" defined in DMD is mapped with the attribute \"p\({}_{3}\)\" in MCA.  
SDX table shown on Table 6 contains unique Sdx#Id, Dmd#Id and SDXMapping.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Sdx\#Id** & **Dmd\#Id** & **SDXMapping** \\ \hline Sdx\#01 & Dmd\#02 & (\(\text{x}_{1}=\text{p}_{3}\), \(\text{x}_{2}=\text{p}_{n},\ldots,\text{x}_{n}=\text{p}_{1}\)) \\ Sdx\#02 & Dmd\#04 & (\(\text{y}_{1}=\text{q}_{4}\), \(\text{y}_{2}=\text{q}_{m},\ldots,\text{y}_{m}=\text{q}_{1}\)) \\ \(\ldots\) & \(\ldots\) & \(\ldots\) \\ Sdx\#n & Dmd\#01 & (\(\text{z}_{2}=\text{r}_{6}\), \(\text{z}_{3}=\text{r}_{k}\), \(\ldots,\text{z}_{k}=\text{r}_{1}\)) \\ \hline \hline \end{tabular}
\end{table}
Table 6: SDX Mapping between DMD and MCAttributes.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**DMDAttributes** & **MCAttributes** \\ \hline \(\text{x}_{1}\) & \(\text{P}^{1}\) \\ \(\text{x}_{2}\) & \(\text{P}^{2}\) \\ \(\text{x}_{3}\) & \(\text{P}^{3}\) \\ \(\ldots\) & \(\ldots\) \\ \(\text{x}_{n}\) & \(\text{P}^{n}\) \\ \hline \hline \end{tabular}
\end{table}
Table 5: Structured Data eXchange (SDX) Mapping between DMD and MCAttributes.  
After the creation of SDX by data service consumer, the association between structured data mashup box and mashup data service should be updated. Let us understand Mashup Data Service (MDS) first and then its association with SDMB in the next section.