Commit 9117e45d authored by npedot's avatar npedot
Browse files

adds sakila query for film1 mappings

parent 030264f1
......@@ -68,33 +68,15 @@ technology depenent packages
* A domain component has to depends on nothing.
## v0.1.0
## v1.0.0
from object database meta representation as input
apply kotlin transformer vertical or horizontal
obtain a second database meta representation as output
## v0.2.0
from xml object database meta representation as input
apply kotlin transformer vertical or horizontal
obtain a changeset representation as output
## v0.3.0
from xml object database meta representation as input
a generic xpath engine extraction plus freemarker template to generate
obtain a database meta representation as output
## v0.4.0
from xml object database meta representation as input
a xml transfomer descriptor
SQL-based migrations
add liquibase adapter
add flyway adapter
### to fix
* jdbc read views metainfo
* film_id doppio nella tabella film_core.
* redirect FOREIGN_KEY from splitted table.
* remove select PRIMARY KEY not by name, but by source table.
......@@ -44,13 +44,13 @@ class TransformerVUseCase(serializer: IXMLSerializerService, fileIOAdapter: File
if (changeSet.size()!=0) {
val csFileName = workingDir + "cs_${timestamp.format(DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss_nnnnnnnnnn"))}.xml"
val csFileName = workingDir + "${timestamp.format(DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss_nnnnnnnnnn"))}_cs.xml"
println("Written cs file $tableToSplit : $csFileName ")
fileIOAdapter.writeOnWorkingFilePath(serializer.prettyChangeSet(changeSet), csFileName)
val newdb = ApplyChangeSetUseCase(serializer).apply(db, changeSet)
val newDbFileName = workingDir + "db_${timestamp.format(DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss_nnnnnnnnnn"))}.xml"
val newDbFileName = workingDir + "${timestamp.format(DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss_nnnnnnnnnn"))}_db.xml"
fileIOAdapter.writeOnWorkingFilePath(serializer.prettyDatabase(newdb), newDbFileName)
println("Written db files $tableToSplit : $newDbFileName")
package unibz.cs.semint.kprime.scenario.sakila
import junit.framework.Assert.assertEquals
import org.junit.Test
import unibz.cs.semint.kprime.adapter.repository.QueryJdbcAdapter
import unibz.cs.semint.kprime.adapter.service.XMLSerializerJacksonAdapter
import unibz.cs.semint.kprime.domain.DataSource
import unibz.cs.semint.kprime.domain.dql.Query
import unibz.cs.semint.kprime.domain.dql.Select
import unibz.cs.semint.kprime.usecase.common.SQLizeUseCase
class SakilaQueryTI {
......@@ -52,4 +56,43 @@ class SakilaQueryTI {
fun test_sakila_film1_query_to_xml() {
// given
val query = SQLizeUseCase().fromsql("""
SELECT film_id,title,description,release_year,release_year,original_language_id,length,rating
FROM film
// when
var queryXml = XMLSerializerJacksonAdapter().prettyQuery(query) as String
// then
<attributes name="film_id"/>
<attributes name="title"/>
<attributes name="description"/>
<attributes name="release_year"/>
<attributes name="release_year"/>
<attributes name="original_language_id"/>
<attributes name="length"/>
<attributes name="rating"/>
<from tableName="film" alias="" joinOn=""/>
<where condition=""/>
\ No newline at end of file
......@@ -48,7 +48,7 @@ class OptimusUseCaseTI {
.addFunctionals("address", "address_id --> address2")
val rootWorkingDir = "/home/nipe/Temp/"
val rootWorkingDir = System.getenv()["tmp_dir"] ?: "" // "/home/nipe/Temp/"
val timestampSuffix ="yyyyMMdd_HHmmss_nnnnnnnnnn"))
val workingDir = rootWorkingDir + timestampSuffix + "/"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment