--- a/src/test/scala/RDB2RDFTest.scala Thu Jan 07 19:43:09 2010 -0500
+++ b/src/test/scala/RDB2RDFTest.scala Thu Jan 07 20:48:44 2010 -0500
@@ -26,7 +26,7 @@
Map(Attribute("empid") -> Value(Datatype.INTEGER),
Attribute("lastName") -> Value(Datatype.STRING),
Attribute("birthday") -> Value(Datatype.DATE),
- Attribute("manager") -> Value(Datatype.INTEGER))),
+ Attribute("manager") -> ForeignKey(Relation("Employee"), Attribute("empid")))),
Relation("Tasks") ->
RelationDesc(Option(Attribute("taskid")),
Map(Attribute("taskid") -> Value(Datatype.INTEGER),
@@ -177,12 +177,11 @@
val parsed = sqlParser.parseAll(sqlParser.select, """
SELECT R_emp.lastName AS A_empName, R_manager.lastName AS A_manageName
FROM Employee AS R_emp
- INNER JOIN Employee AS R_manager
- WHERE R_manager.id=R_emp.manager AND R_emp.lastName IS NOT NULL AND R_manager.lastName IS NOT NULL
- AND R_emp.id IS NOT NULL
- AND R_manager.id IS NOT NULL
+ INNER JOIN Employee AS R_manager ON R_manager.empid=R_emp.manager
+ WHERE R_emp .lastName IS NOT NULL AND R_emp .empid IS NOT NULL
+ AND R_manager.lastName IS NOT NULL AND R_manager.empid IS NOT NULL
""").get
- val generated = RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), true, false)
+ val generated = RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), true, false)
assert(generated === parsed)
}
@@ -200,9 +199,9 @@
SELECT R_emp.lastName AS A_empName
FROM Employee AS R_emp
WHERE R_emp.manager=18 AND R_emp.lastName IS NOT NULL
- AND R_emp.id IS NOT NULL
+ AND R_emp.empid IS NOT NULL
""").get
- val generated = RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), false, false)
+ val generated = RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), false, false)
assert(generated === parsed)
}
@@ -212,18 +211,18 @@
PREFIX empP : <http://hr.example/DB/Employee#>
SELECT ?empName {
?emp empP:lastName ?empName .
- ?emp empP:manager <http://hr.example/DB/Employee/id.18#record>
+ ?emp empP:manager <http://hr.example/DB/Employee/empid.18#record>
}
""").get
val sqlParser = Sql()
val parsed = sqlParser.parseAll(sqlParser.select, """
SELECT R_emp.lastName AS A_empName
FROM Employee AS R_emp
- INNER JOIN Employee AS R_id18
- WHERE R_id18.id=R_emp.manager AND R_id18.id=18 AND R_emp.lastName IS NOT NULL
- AND R_emp.id IS NOT NULL
+ INNER JOIN Employee AS R_empid18
+ WHERE R_empid18.empid=R_emp.manager AND R_empid18.empid=18 AND R_emp.lastName IS NOT NULL
+ AND R_emp.empid IS NOT NULL
""").get
- val generated = RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), true, false)
+ val generated = RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), true, false)
assert(generated === parsed)
}
@@ -244,11 +243,11 @@
SELECT R_emp.lastName AS A_empName
FROM Employee AS R_emp
INNER JOIN Employee AS R_manager
-WHERE R_manager.id=R_emp.manager AND R_manager.lastName="Johnson" AND R_emp.lastName IS NOT NULL
- AND R_emp.id IS NOT NULL
- AND R_manager.id IS NOT NULL
+WHERE R_manager.empid=R_emp.manager AND R_manager.lastName="Johnson" AND R_emp.lastName IS NOT NULL
+ AND R_emp.empid IS NOT NULL
+ AND R_manager.empid IS NOT NULL
""").get
- val generated = RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), true, false)
+ val generated = RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), true, false)
assert(generated === parsed)
}
@@ -278,7 +277,7 @@
SELECT R_emp.lastName AS A_empName,
R_grandManager.lastName AS A_grandManagName
FROM Employee AS R_emp
- INNER JOIN TaskAssignments AS R_lower ON R_lower.employee=R_emp.empid
+ INNER JOIN TaskAssignments AS R_lower ON R_emp.empid=R_lower.employee
INNER JOIN Tasks AS R_ltask ON R_ltask.taskid=R_lower.task
INNER JOIN Employee AS R_taskLead ON R_taskLead.empid=R_ltask.lead
INNER JOIN TaskAssignments AS R_upper ON R_taskLead.empid=R_upper.employee