--- a/src/main/scala/SPARQL.scala Thu Dec 10 14:37:35 2009 -0500
+++ b/src/main/scala/SPARQL.scala Thu Dec 10 17:23:37 2009 -0500
@@ -5,11 +5,8 @@
import MyParsers._
-// object SparqlTypeAliases {
-// type TriplePatterns = List[TriplePattern]
-// }
-
-// import SpqrqlTypeAliases._
+case class SparqlSelect(attrs:SparqlAttributeList, triples:TriplePatterns)
+case class SparqlAttributeList(attributelist:List[Var])
case class TriplePatterns(triplepatterns:List[TriplePattern])
case class TriplePattern(s:S, p:P, o:O)
@@ -37,6 +34,12 @@
case class Sparql() extends JavaTokenParsers {
+ def select:Parser[SparqlSelect] =
+ "SELECT" ~ attributelist ~ "{" ~ triplepatterns ~ "}" ^^ { case "SELECT"~a~"{"~t~"}" => SparqlSelect(a, t) }
+
+ def attributelist:Parser[SparqlAttributeList] =
+ rep(varr) ^^ { SparqlAttributeList(_) }
+
def triplepatterns:Parser[TriplePatterns] =
repsep(triplepattern, ".") ^^ { TriplePatterns(_) }