Skip to content

Commit

Permalink
use shorter table/column aliases.
Browse files Browse the repository at this point in the history
The maximum length of aliases for oracle is 30 chars.
  • Loading branch information
fpriyatna committed May 12, 2015
1 parent d7c1262 commit 686f748
Show file tree
Hide file tree
Showing 17 changed files with 95 additions and 128 deletions.
2 changes: 1 addition & 1 deletion morph-base-querytranslator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>es.upm.fi.dia.oeg.morph</groupId>
<artifactId>morph-rdb</artifactId>
<version>3.5.5-SNAPSHOT</version>
<version>3.5.6-SNAPSHOT</version>
</parent>
<packaging>jar</packaging>

Expand Down
2 changes: 1 addition & 1 deletion morph-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>es.upm.fi.dia.oeg.morph</groupId>
<artifactId>morph-rdb</artifactId>
<version>3.5.5-SNAPSHOT</version>
<version>3.5.6-SNAPSHOT</version>
</parent>
<packaging>jar</packaging>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,69 +1,75 @@
package es.upm.fi.dia.oeg.morph.base.sql

import Zql.ZFromItem
import es.upm.fi.dia.oeg.morph.base.Constants
import Zql.ZExp
import java.util.Random

class SQLFromItem(fullName:String , val form:Constants.LogicalTableType.Value)
extends ZFromItem(fullName) with SQLLogicalTable {
var joinType:String=null;
var onExp:ZExp =null;



override def generateAlias() :String ={
//return R2OConstants.VIEW_ALIAS + this.hashCode();
if(super.getAlias() == null) {
super.setAlias(Constants.VIEW_ALIAS + new Random().nextInt(Constants.VIEW_ALIAS_RANDOM_LIMIT));
}
super.getAlias();
}

override def toString() : String = {
this.print(true)
}

def setJoinType(joinType:String ) = { this.joinType = joinType; }

def setOnExp(onExp:ZExp ) = { this.onExp = onExp; }

def getOnExp() : ZExp = { this.onExp; }

def getJoinType() : String = { joinType; }

override def print(withAlias:Boolean ) : String = {
val alias = this.getAlias();
this.setAlias("");

val result = if(alias != null && withAlias) {
val resultAux = if(this.form == Constants.LogicalTableType.TABLE_NAME) {
val tableName = super.toString().trim();
tableName + " " + alias;
} else {
"(" + super.toString() + ") " + alias;
}
resultAux
} else {
val tableName = super.toString();
tableName;
}


if(alias != null) { this.setAlias(alias); }

return result;
}

// def setDatabaseType(dbType:String ) = { this.dbType = dbType; }

// def getDbType() : String = { dbType; }
}

object SQLFromItem {
def apply(fullName:String, form:Constants.LogicalTableType.Value, dbType:String) = {
val sqlFromItem = new SQLFromItem(fullName, form);
sqlFromItem.databaseType = dbType;
sqlFromItem;
}
package es.upm.fi.dia.oeg.morph.base.sql

import Zql.ZFromItem
import es.upm.fi.dia.oeg.morph.base.Constants
import Zql.ZExp
import java.util.Random

class SQLFromItem(fullName:String , val form:Constants.LogicalTableType.Value)
extends ZFromItem(fullName) with SQLLogicalTable {
var joinType:String=null;
var onExp:ZExp =null;



override def generateAlias() :String ={
//return R2OConstants.VIEW_ALIAS + this.hashCode();
if(super.getAlias() == null) {
val generatedAlias = Constants.VIEW_ALIAS + new Random().nextInt(Constants.VIEW_ALIAS_RANDOM_LIMIT);
val generatedAlias2 = "T" + SQLFromItem.inc;

super.setAlias(generatedAlias2);
}
super.getAlias();
}

override def toString() : String = {
this.print(true)
}

def setJoinType(joinType:String ) = { this.joinType = joinType; }

def setOnExp(onExp:ZExp ) = { this.onExp = onExp; }

def getOnExp() : ZExp = { this.onExp; }

def getJoinType() : String = { joinType; }

override def print(withAlias:Boolean ) : String = {
val alias = this.getAlias();
this.setAlias("");

val result = if(alias != null && withAlias) {
val resultAux = if(this.form == Constants.LogicalTableType.TABLE_NAME) {
val tableName = super.toString().trim();
tableName + " " + alias;
} else {
"(" + super.toString() + ") " + alias;
}
resultAux
} else {
val tableName = super.toString();
tableName;
}


if(alias != null) { this.setAlias(alias); }

return result;
}

// def setDatabaseType(dbType:String ) = { this.dbType = dbType; }

// def getDbType() : String = { dbType; }
}

object SQLFromItem {
private var current = 0
private def inc = {current += 1; current}

def apply(fullName:String, form:Constants.LogicalTableType.Value, dbType:String) = {
val sqlFromItem = new SQLFromItem(fullName, form);
sqlFromItem.databaseType = dbType;
sqlFromItem;
}
}
2 changes: 1 addition & 1 deletion morph-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<groupId>es.upm.fi.dia.oeg.morph</groupId>
<artifactId>morph-rdb-dist</artifactId>
<type>pom</type>
<version>3.5.5-SNAPSHOT</version>
<version>3.5.6-SNAPSHOT</version>
</dependency> -->

</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<http://example.com/emp/7369> <http://example.com/emp#etype> "PART_TIME" .
<http://example.com/emp/7369> <http://example.com/emp#jobtype> <http://example.com/emp/job/CLERK> .
<http://example.com/emp/7369> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/emp/etype/PART_TIME> .
<http://example.com/emp/7369> <http://example.com/emp#deptNum> "10"^^<http://www.w3.org/2001/XMLSchema#decimal> .
<http://example.com/emp/7369> <http://example.com/emp#name> "SMITH" .
<http://example.com/emp/7369> <http://example.com/emp#emptype> <http://example.com/emp/etype/PART_TIME> .
<http://example.com/emp/7369> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/emp/job/CLERK> .
<http://example.com/emp/7369> <http://example.com/emp#c_ref_deptno> _:Department10 .
<http://example.com/emp/7369> <http://example.com/emp#empno> "7369"^^<http://www.w3.org/2001/XMLSchema#decimal> .
<http://example.com/emp/7369> <http://example.com/emp#name> "SMITH" .
<http://example.com/emp/7369> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/emp/etype/PART_TIME> .
<http://example.com/emp/7369> <http://example.com/emp#jobtype> <http://example.com/emp/job/CLERK> .
<http://example.com/emp/7369> <http://example.com/emp#job> "CLERK" .
<http://example.com/emp/7369> <http://example.com/emp#etype> "PART_TIME" .
<http://example.com/emp/7369> <http://example.com/emp#empno> "7369"^^<http://www.w3.org/2001/XMLSchema#decimal> .
<http://example.com/emp/7369> <http://example.com/emp#c_ref_deptno> _:Department10 .
_:Department10 <http://example.com/dept#COMPANY> <EXAMPLE%20Corporation> .
_:Department10 <http://example.com/dept#location> "NEW YORK" .
_:Department10 <http://example.com/dept#name> "APPSERVER" .
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<http://example.com/emp/7369> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/emp/job/CLERK> .
<http://example.com/emp/7369> <http://example.com/emp#empno> "7369"^^<http://www.w3.org/2001/XMLSchema#decimal> .
<http://example.com/emp/7369> <http://example.com/emp#name> "SMITH" .
<http://example.com/emp/7369> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/emp/etype/PART_TIME> .
<http://example.com/emp/7369> <http://example.com/emp#job> "CLERK" .
<http://example.com/emp/7369> <http://example.com/emp#jobtype> <http://example.com/emp/job/CLERK> .
<http://example.com/emp/7369> <http://example.com/emp#c_ref_deptno> _:Department10 .
<http://example.com/emp/7369> <http://example.com/emp#deptNum> "10"^^<http://www.w3.org/2001/XMLSchema#decimal> .
<http://example.com/emp/7369> <http://example.com/emp#emptype> <http://example.com/emp/etype/PART_TIME> .
<http://example.com/emp/7369> <http://example.com/emp#job> "CLERK" .
<http://example.com/emp/7369> <http://example.com/emp#empno> "7369"^^<http://www.w3.org/2001/XMLSchema#decimal> .
<http://example.com/emp/7369> <http://example.com/emp#jobtype> <http://example.com/emp/job/CLERK> .
<http://example.com/emp/7369> <http://example.com/emp#etype> "PART_TIME" .
<http://example.com/emp/7369> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/emp/job/CLERK> .
<http://example.com/emp/7369> <http://example.com/emp#name> "SMITH" .
<http://example.com/emp/7369> <http://example.com/emp#deptNum> "10"^^<http://www.w3.org/2001/XMLSchema#decimal> .
<http://example.com/emp/7369> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/emp/etype/PART_TIME> .
_:Department10 <http://example.com/dept#COMPANY> <EXAMPLE%20Corporation> .
_:Department10 <http://example.com/dept#location> "NEW YORK" .
_:Department10 <http://example.com/dept#name> "APPSERVER" .
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +0,0 @@
<http://example.com/Patient/10> <http://example.com/id> "10"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Patient/10> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Patient/10> <http://example.com/firstName> "Monica" .
<http://example.com/Patient/10> <http://example.com/gender> "female" .
<http://example.com/Patient/10> <http://example.com/lastName> "Geller" .
<http://example.com/Patient/11> <http://example.com/id> "11"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Patient/11> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Patient/11> <http://example.com/firstName> "Rachel" .
<http://example.com/Patient/11> <http://example.com/gender> "female" .
<http://example.com/Patient/11> <http://example.com/lastName> "Green" .
<http://example.com/Patient/12> <http://example.com/id> "12"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/Patient/12> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Patient/12> <http://example.com/firstName> "Chandler" .
<http://example.com/Patient/12> <http://example.com/gender> "male" .
<http://example.com/Patient/12> <http://example.com/lastName> "Bing" .
Original file line number Diff line number Diff line change
@@ -1,9 +0,0 @@
<http://example.com/Patient10> <http://example.com/height> "1.65"^^<http://www.w3.org/2001/XMLSchema#double> .
<http://example.com/Patient10> <http://example.com/weight> "80.25"^^<http://www.w3.org/2001/XMLSchema#double> .
<http://example.com/Patient10> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Patient11> <http://example.com/height> "1.7"^^<http://www.w3.org/2001/XMLSchema#double> .
<http://example.com/Patient11> <http://example.com/weight> "70.22"^^<http://www.w3.org/2001/XMLSchema#double> .
<http://example.com/Patient11> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Patient12> <http://example.com/height> "1.76"^^<http://www.w3.org/2001/XMLSchema#double> .
<http://example.com/Patient12> <http://example.com/weight> "90.31"^^<http://www.w3.org/2001/XMLSchema#double> .
<http://example.com/Patient12> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
Original file line number Diff line number Diff line change
@@ -1,9 +0,0 @@
<http://example.com/Patient10> <http://example.com/entrancedate> "2009-10-10T12:12:22"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<http://example.com/Patient10> <http://example.com/birthdate> "1981-10-10"^^<http://www.w3.org/2001/XMLSchema#date> .
<http://example.com/Patient10> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Patient11> <http://example.com/entrancedate> "2008-11-12T09:45:44"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<http://example.com/Patient11> <http://example.com/birthdate> "1982-11-12"^^<http://www.w3.org/2001/XMLSchema#date> .
<http://example.com/Patient11> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Patient12> <http://example.com/entrancedate> "2007-03-12T02:13:14"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<http://example.com/Patient12> <http://example.com/birthdate> "1978-04-06"^^<http://www.w3.org/2001/XMLSchema#date> .
<http://example.com/Patient12> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
<http://example.com/Patient10> <http://example.com/paid> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<http://example.com/Patient10> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Patient11> <http://example.com/paid> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<http://example.com/Patient11> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://example.com/Patient12> <http://example.com/paid> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<http://example.com/Patient12> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
Binary file not shown.
2 changes: 1 addition & 1 deletion morph-r2rml-rdb-querytranslator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>es.upm.fi.dia.oeg.morph</groupId>
<artifactId>morph-rdb</artifactId>
<version>3.5.5-SNAPSHOT</version>
<version>3.5.6-SNAPSHOT</version>
</parent>
<packaging>jar</packaging>

Expand Down
2 changes: 1 addition & 1 deletion morph-r2rml-rdb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>es.upm.fi.dia.oeg.morph</groupId>
<artifactId>morph-rdb</artifactId>
<version>3.5.5-SNAPSHOT</version>
<version>3.5.6-SNAPSHOT</version>
</parent>
<packaging>jar</packaging>

Expand Down
2 changes: 1 addition & 1 deletion morph-r2rml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>es.upm.fi.dia.oeg.morph</groupId>
<artifactId>morph-rdb</artifactId>
<version>3.5.5-SNAPSHOT</version>
<version>3.5.6-SNAPSHOT</version>
</parent>
<packaging>jar</packaging>

Expand Down
Binary file removed morph-rdb-dist/morph-rdb-v3.5.5.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion morph-rdb-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>es.upm.fi.dia.oeg.morph</groupId>
<artifactId>morph-rdb</artifactId>
<version>3.5.5-SNAPSHOT</version>
<version>3.5.6-SNAPSHOT</version>
</parent>

<artifactId>morph-rdb-dist</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<groupId>es.upm.fi.dia.oeg.morph</groupId>
<artifactId>morph-rdb</artifactId>
<version>3.5.5-SNAPSHOT</version>
<version>3.5.6-SNAPSHOT</version>


<modules>
Expand Down

0 comments on commit 686f748

Please sign in to comment.