Skip to content
Snippets Groups Projects
Commit 85adc7a9 authored by npedot's avatar npedot
Browse files

fixes for vjoin PersonTransfomerScenarioTI

parent cf73d165
No related branches found
No related tags found
No related merge requests found
......@@ -87,7 +87,7 @@ class XPathTransformUseCase {
println(" $derivedList")
}
// if derivationRule starts with - then compute intersection
return derivedList
return derivedList.toSet().toList()
}
private fun asValueList(xpathResultNodes: NodeList): MutableList<String> {
......@@ -125,14 +125,15 @@ class XPathTransformUseCase {
templModel[name] = asValueList(xpath.compile(value).evaluate(doc, XPathConstants.NODESET) as NodeList)
println(" ${name} = ${value}")
println(" ${name} = ${templModel[name]}")
}
if (pathTokens.size == 3) {
val pathCondition = pathTokens[1]
val pathSize = pathTokens[2].toInt()
if (pathCondition == ">")
if ((templModel[name])!!.size <= pathSize) goon = false
if (pathCondition == "=")
if ((templModel[name])!!.size != pathSize) goon = false
if (pathTokens.size == 3) {
println(pathTokens)
val pathCondition = pathTokens[1]
val pathSize = pathTokens[2].toInt()
if (pathCondition == ">")
if ((templModel[name])!!.size <= pathSize) goon = false
if (pathCondition == "=")
if ((templModel[name])!!.size != pathSize) goon = false
}
}
}
if (!goon) {
......
......@@ -49,6 +49,8 @@ class PersonTransfomerScenarioTI {
}
@Test
// FIXME rimuovere attributi doppi dalla tabella
// FIXME drop della primary key person1
fun test_xpath_horizontal_decomposition_on_person_db() {
// given
val dbFilePath = "db/person_splitted.xml"
......@@ -68,4 +70,8 @@ class PersonTransfomerScenarioTI {
}
@Test
fun test_roundtrip_vertical_transformation() {
}
}
\ No newline at end of file
<database name="" id="">
<schema name="" id="">
<tables>
<tables name="person2" id="" view="" condition="">
<columns>
<columns name="SSN2" id="id.SSN" dbname="dbname.SSN" nullable="false" dbtype=""/>
<columns name="T2" id="id.T" dbname="dbname.T" nullable="false" dbtype=""/>
<columns name="S2" id="id.S" dbname="dbname.S" nullable="true" dbtype=""/>
<columns name="X2" id="id.X" dbname="dbname.X" nullable="true" dbtype=""/>
</columns>
</tables>
<tables name="person1" id="" view="person" condition="">
<columns>
<columns name="SSN" id="id.SSN" dbname="" nullable="false" dbtype=""/>
......@@ -24,30 +16,6 @@
</tables>
</tables>
<constraints>
<constraints name="primaryKey.person" id="" type="PRIMARY_KEY">
<source name="" id="" table="person">
<columns>
<columns name="SSN" id="id.SSN" dbname="dbname.SSN" nullable="false" dbtype=""/>
</columns>
</source>
<target name="" id="" table="">
<columns>
<columns name="" id="" dbname="" nullable="false" dbtype=""/>
</columns>
</target>
</constraints>
<constraints name="functional.person" id="" type="FUNCTIONAL">
<source name="" id="" table="person">
<columns>
<columns name="T" id="id.T" dbname="dbname.T" nullable="false" dbtype=""/>
</columns>
</source>
<target name="" id="" table="person">
<columns>
<columns name="S" id="id.S" dbname="dbname.S" nullable="true" dbtype=""/>
</columns>
</target>
</constraints>
<constraints name="person.doubleInclusion" id="" type="DOUBLE_INCLUSION">
<source name="" id="" table="person1">
<columns>
......
<changeSet id="234">
<createTable name="${targetTable[0]}" id="" view="" condition="">
<columns>
<#list keys as key>
<columns name="${key}" id="id.${key}" dbname="" nullable="false" dbtype=""/>
</#list>
<#list lhss as lhs>
<columns name="${lhs}" id="id.${lhs}" dbname="" nullable="false" dbtype=""/>
</#list>
<#list rhss as rhs>
<columns name="${rhs}" id="id.${rhs}" dbname="" nullable="false" dbtype=""/>
<#list all as col>
<columns name="${col}" id="id.${col}" dbname="" nullable="false" dbtype=""/>
</#list>
</columns>
</createTable>
......@@ -26,6 +20,22 @@
</columns>
</target>
</createConstraint>
<createConstraint name="${targetTable[0]}.functional" id="" type="FUNCTIONAL">
<source name="" id="" table="${targetTable[0]}">
<columns>
<#list fds as fd>
<columns name="${fd}" id="id.${fd}" dbname="" nullable="false" dbtype=""/>
</#list>
</columns>
</source>
<target name="" id="" table="">
<columns>
<#list fds_target as fdt>
<columns name="${fdt}" id="id.${fdt}" dbname="" nullable="false" dbtype=""/>
</#list>
</columns>
</target>
</createConstraint>
<dropTable path="" schemaName="" tableName="${originTable1[0]}"/>
<dropTable path="" schemaName="" tableName="${originTable2[0]}"/>
<dropConstraint path="" schemaName="" constraintName="${originTable1[0]}.primaryKey"/>
......
keys=/database/schema/constraints/constraints[@type='PRIMARY_KEY']/source[@table='%%originTable1%%']/columns/columns/@name
lhss=/database/schema/tables/tables[@name='%%originTable1%%']/columns/columns/@name > 0
rhss=/database/schema/tables/tables[@name='%%originTable2%%']/columns/columns/@name > 0
\ No newline at end of file
......@@ -68,4 +68,5 @@
</createConstraint>
<dropTable path="" schemaName="" tableName="${table[0]}"/>
<dropConstraint path="" schemaName="" constraintName="${table[0]}.primaryKey"/>
<dropConstraint path="" schemaName="" constraintName="${table[0]}.functional"/>
</changeSet>
\ No newline at end of file
......@@ -5,6 +5,9 @@
<xrules name="keys">/database/schema/constraints/constraints[@type='PRIMARY_KEY']/source[@table='%%originTable1%%']/columns/columns/@name</xrules>
<xrules name="lhss">/database/schema/tables/tables[@name='%%originTable1%%']/columns/columns/@name</xrules>
<xrules name="rhss">/database/schema/tables/tables[@name='%%originTable2%%']/columns/columns/@name</xrules>
<xrules name="fds">/database/schema/constraints/constraints[@type='DOUBLE_INCLUSION']/source[@table='%%originTable1%%']/columns/columns/@name</xrules>
<xrules name="fds_target">- rhss fds</xrules>
<xrules name="all">+ keys lhss rhss</xrules>
</xrules>
</xman>
<template filename="transformer/vertical/compose/vertical_changeset_1.template"/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment