--- a/src/main/scala/SPARQL.scala Sun Feb 14 07:55:41 2010 -0500
+++ b/src/main/scala/SPARQL.scala Sun Feb 14 09:28:58 2010 -0500
@@ -121,14 +121,20 @@
}
case class TableConjunction(gps:List[GraphPattern]) extends GraphPattern {
assert (!(gps exists (x => { x match { case TableConjunction(_) => true case _ => false } })))
- override def toString = " " + (gps.toList.map(s => s.toString.replace("\n", "\n ")).mkString("\n "))
+ override def toString = "{\n " + (gps.toList.map(s => s.toString.replace("\n", "\n ")).mkString("\n ")) + "\n}\n"
}
case class TableDisjunction(gps:List[GraphPattern]) extends GraphPattern {
- override def toString = " " + (gps.toList.map(s => s.toString.replace("\n", "\n ")).mkString("\nUNION\n "))
+ override def toString = "{\n " + (gps.toList.map(s => s.toString.replace("\n", "\n ")).mkString("\nUNION\n ")) + "\n}\n"
}
-case class TableFilter(gp:GraphPattern, expr:Expression) extends GraphPattern
-case class OptionalGraphPattern(gp:GraphPattern) extends GraphPattern
-case class MinusGraphPattern(gp:GraphPattern) extends GraphPattern
+case class TableFilter(gp:GraphPattern, expr:Expression) extends GraphPattern {
+ override def toString = gp.toString + "\nFILTER (" + expr.toString + ")"
+}
+case class OptionalGraphPattern(gp:GraphPattern) extends GraphPattern {
+ override def toString = "OPTIONAL " + gp.toString
+}
+case class MinusGraphPattern(gp:GraphPattern) extends GraphPattern {
+ override def toString = "MINUS " + gp.toString
+}
case class GraphGraphPattern(gp:GraphPattern) extends GraphPattern
case class TriplePattern(s:Term, p:Term, o:Term) {