-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The maximum length of aliases for oracle is 30 chars.
- Loading branch information
Showing
17 changed files
with
95 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
142 changes: 74 additions & 68 deletions
142
morph-base/src/main/scala/es/upm/fi/dia/oeg/morph/base/sql/SQLFromItem.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
morph-examples/testcases-oracle/D014-3tables1primarykey1foreignkey/mappedb-morph.nq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 7 additions & 7 deletions
14
morph-examples/testcases-oracle/D014-3tables1primarykey1foreignkey/mappedc-morph.nq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
...amples/testcases-oracle/D016-1table1primarykey10columns3rowsSQLdatatypes/mappeda-morph.nq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" . | ||
9 changes: 0 additions & 9 deletions
9
...amples/testcases-oracle/D016-1table1primarykey10columns3rowsSQLdatatypes/mappedb-morph.nq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> . | ||
9 changes: 0 additions & 9 deletions
9
...amples/testcases-oracle/D016-1table1primarykey10columns3rowsSQLdatatypes/mappedc-morph.nq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> . | ||
6 changes: 0 additions & 6 deletions
6
...amples/testcases-oracle/D016-1table1primarykey10columns3rowsSQLdatatypes/mappedd-morph.nq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 modified
BIN
-985 Bytes
(0.0%)
...amples/testcases-oracle/D016-1table1primarykey10columns3rowsSQLdatatypes/mappede-morph.nq
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters