--- a/src/main/scala/RDB2RDFMain.scala Sun Jan 03 03:01:12 2010 -0500
+++ b/src/main/scala/RDB2RDFMain.scala Sun Jan 03 18:23:46 2010 -0500
@@ -13,7 +13,7 @@
case class Enum(relaliasattr:RelAliasAttribute) extends Binding
object RDB2RDF {
- case class R2RState(joins:Set[Join], varmap:Map[Var, SQL2RDFValueMapper], exprs:Set[Expression])
+ case class R2RState(joins:AddOrderedSet[Join], varmap:Map[Var, SQL2RDFValueMapper], exprs:Set[Expression])
sealed abstract class SQL2RDFValueMapper(relaliasattr:RelAliasAttribute, disjoints:Set[RelationalExpressionNe])
case class IntMapper(relaliasattr:RelAliasAttribute, disjoints:Set[RelationalExpressionNe]) extends SQL2RDFValueMapper(relaliasattr, disjoints)
@@ -298,7 +298,7 @@
val unionAlias = RelAlias(Name("R_union" + state.joins.size))
val initDisjoints:Set[Select] = Set()
val emptyState = R2RState(
- Set[Join](),
+ AddOrderedSet[Join](),
Map[Var, SQL2RDFValueMapper](),
Set[Expression]()
)
@@ -376,7 +376,7 @@
val leftJoinAlias = RelAlias(Name("R_opt" + state.joins.size))
val initDisjoints:Set[Select] = Set()
val emptyState = R2RState(
- Set[Join](),
+ AddOrderedSet[Join](),
Map[Var, SQL2RDFValueMapper](),
Set[Expression]()
)
@@ -448,7 +448,7 @@
/* Create an object to hold our compilation state. */
val initState = R2RState(
- Set[Join](),
+ AddOrderedSet[Join](),
Map[Var, SQL2RDFValueMapper](),
Set[Expression]()
)
--- a/src/test/scala/SQLTest.scala Sun Jan 03 03:01:12 2010 -0500
+++ b/src/test/scala/SQLTest.scala Sun Jan 03 18:23:46 2010 -0500
@@ -62,7 +62,7 @@
NamedAttribute(RelAliasAttribute(RelAlias(Name("R_manager")),
Attribute(Name("lastName"))),
AttrAlias(Name("A_managName"))))),
- TableList(Set(InnerJoin(AliasedResource(Relation(Name("Employee")),RelAlias(Name("R_emp")))),
+ TableList(AddOrderedSet(InnerJoin(AliasedResource(Relation(Name("Employee")),RelAlias(Name("R_emp")))),
InnerJoin(AliasedResource(Relation(Name("Employee")),RelAlias(Name("R_manager")))))),
Some(ExprConjunction(Set(
RelationalExpressionEq(RelAliasAttribute(RelAlias(Name("R_manager")),Attribute(Name("id"))),
@@ -82,7 +82,7 @@
val expected = Select(AttributeList(Set(NamedAttribute(RelAliasAttribute(RelAlias(Name("R_emp")),
Attribute(Name("lastName"))),
AttrAlias(Name("A_empName"))))),
- TableList(Set(InnerJoin(AliasedResource(Relation(Name("Employee")),RelAlias(Name("R_emp")))))),
+ TableList(AddOrderedSet(InnerJoin(AliasedResource(Relation(Name("Employee")),RelAlias(Name("R_emp")))))),
Some(ExprConjunction(Set(RelationalExpressionEq(RelAliasAttribute(RelAlias(Name("R_emp")),Attribute(Name("manager"))),
RValueTyped(SQLDatatype.INTEGER,Name("18"))),
RelationalExpressionNotNull(RelAliasAttribute(RelAlias(Name("R_emp")),Attribute(Name("lastName"))))))))
@@ -100,7 +100,7 @@
val expected = Select(AttributeList(Set(NamedAttribute(RelAliasAttribute(RelAlias(Name("R_emp")),
Attribute(Name("lastName"))),
AttrAlias(Name("A_empName"))))),
- TableList(Set(InnerJoin(AliasedResource(Relation(Name("Employee")),RelAlias(Name("R_emp")))),
+ TableList(AddOrderedSet(InnerJoin(AliasedResource(Relation(Name("Employee")),RelAlias(Name("R_emp")))),
InnerJoin(AliasedResource(Relation(Name("Employee")),RelAlias(Name("R_manager")))))),
Some(ExprConjunction(Set(RelationalExpressionEq(RelAliasAttribute(RelAlias(Name("R_emp")),Attribute(Name("manager"))),
RValueAttr(RelAliasAttribute(RelAlias(Name("R_manager")),Attribute(Name("id"))))),
@@ -129,7 +129,7 @@
AttrAlias(Name("A_empName"))),
NamedAttribute(RelAliasAttribute(RelAlias(Name("R_grandManager")),Attribute(Name("lastName"))),
AttrAlias(Name("A_grandManagName"))))),
- TableList(Set(InnerJoin(AliasedResource(Relation(Name("Employee")),RelAlias(Name("R_emp")))),
+ TableList(AddOrderedSet(InnerJoin(AliasedResource(Relation(Name("Employee")),RelAlias(Name("R_emp")))),
InnerJoin(AliasedResource(Relation(Name("Manage")),RelAlias(Name("R_lower")))),
InnerJoin(AliasedResource(Relation(Name("Employee")),RelAlias(Name("R_manager")))),
InnerJoin(AliasedResource(Relation(Name("Manage")),RelAlias(Name("R_upper")))),
@@ -171,13 +171,13 @@
"""
val expected = Select(AttributeList(Set(NamedAttribute(RelAliasAttribute(RelAlias(Name("R_union1")), Attribute(Name("name"))),
AttrAlias(Name("A_name"))))),
- TableList(Set(InnerJoin(AliasedResource(Relation(Name("Employee")),RelAlias(Name("R_who")))),
+ TableList(AddOrderedSet(InnerJoin(AliasedResource(Relation(Name("Employee")),RelAlias(Name("R_who")))),
InnerJoin(AliasedResource(Subselect(Union(Set(
Select(AttributeList(Set(NamedAttribute(RelAliasAttribute(RelAlias(Name("R_manager")), Attribute(Name("lastName"))),
AttrAlias(Name("A_name"))),
NamedAttribute(RelAliasAttribute(RelAlias(Name("R_above")), Attribute(Name("manages"))),
AttrAlias(Name("A_who"))))),
- TableList(Set(
+ TableList(AddOrderedSet(
InnerJoin(AliasedResource(Relation(Name("Manage")),RelAlias(Name("R_above")))),
InnerJoin(AliasedResource(Relation(Name("Employee")),RelAlias(Name("R_manager"))))
)),
@@ -188,7 +188,7 @@
AttrAlias(Name("A_name"))),
NamedAttribute(RelAliasAttribute(RelAlias(Name("R_below")), Attribute(Name("manager"))),
AttrAlias(Name("A_who"))))),
- TableList(Set(
+ TableList(AddOrderedSet(
InnerJoin(AliasedResource(Relation(Name("Manage")),RelAlias(Name("R_below")))),
InnerJoin(AliasedResource(Relation(Name("Employee")),RelAlias(Name("R_managed"))))
)),
@@ -215,7 +215,7 @@
AttrAlias(Name("A_who"))),
NamedAttribute(ConstNULL(),
AttrAlias(Name("A_bday"))))),
- TableList(Set(InnerJoin(AliasedResource(Relation(Name("Manage")),RelAlias(Name("R_above")))))),
+ TableList(AddOrderedSet(InnerJoin(AliasedResource(Relation(Name("Manage")),RelAlias(Name("R_above")))))),
Some(
RelationalExpressionNotNull(RelAliasAttribute(RelAlias(Name("R_above")),Attribute(Name("id"))))))
assert(expected === (a.parseAll(a.select, e).get))
@@ -233,7 +233,7 @@
AttrAlias(Name("A_who"))),
NamedAttribute(ConstNULL(),
AttrAlias(Name("A_bday"))))),
- TableList(Set(InnerJoin(AliasedResource(Relation(Name("Manage")),RelAlias(Name("R_above")))))),
+ TableList(AddOrderedSet(InnerJoin(AliasedResource(Relation(Name("Manage")),RelAlias(Name("R_above")))))),
Some(
ExprDisjunction(Set(
RelationalExpressionNotNull(RelAliasAttribute(RelAlias(Name("R_above")),Attribute(Name("id")))),
@@ -260,7 +260,7 @@
NamedAttribute(RelAliasAttribute(RelAlias(Name("R_mang")),
Attribute(Name("manageName"))),
AttrAlias(Name("A_manageName"))))),
- TableList(Set(InnerJoin(AliasedResource(Relation(Name("Employee")),RelAlias(Name("R_emp")))),
+ TableList(AddOrderedSet(InnerJoin(AliasedResource(Relation(Name("Employee")),RelAlias(Name("R_emp")))),
LeftOuterJoin(AliasedResource(Relation(Name("Manage")),RelAlias(Name("R_mang"))),
RelationalExpressionEq(RelAliasAttribute(RelAlias(Name("R_mang")),Attribute(Name("emp"))),
RValueAttr(RelAliasAttribute(RelAlias(Name("R_emp")),Attribute(Name("id"))))
@@ -286,11 +286,11 @@
val expected =
Select(AttributeList(Set(NamedAttribute(RelAliasAttribute(RelAlias(Name("R_emp")),Attribute(Name("lastName"))),AttrAlias(Name("A_empName"))),
NamedAttribute(RelAliasAttribute(RelAlias(Name("R_mang")),Attribute(Name("manageName"))),AttrAlias(Name("A_manageName"))))),
- TableList(Set(InnerJoin(AliasedResource(Relation(Name("Employee")),RelAlias(Name("R_emp")))),
+ TableList(AddOrderedSet(InnerJoin(AliasedResource(Relation(Name("Employee")),RelAlias(Name("R_emp")))),
LeftOuterJoin(AliasedResource(
Subselect(Select(AttributeList(Set(NamedAttribute(RelAliasAttribute(RelAlias(Name("R_emp")),Attribute(Name("lastName"))),AttrAlias(Name("A_empName"))),
NamedAttribute(RelAliasAttribute(RelAlias(Name("R_mang")),Attribute(Name("manageName"))),AttrAlias(Name("A_manageName"))))),
- TableList(Set(InnerJoin(AliasedResource(Relation(Name("Employee")),RelAlias(Name("R_emp")))))),
+ TableList(AddOrderedSet(InnerJoin(AliasedResource(Relation(Name("Employee")),RelAlias(Name("R_emp")))))),
None)),
RelAlias(Name("R_mang"))),
RelationalExpressionEq(RelAliasAttribute(RelAlias(Name("R_mang")),Attribute(Name("emp"))),