+ screw case (with screws commented out) for need for disambiguation of applicable rules
--- a/src/test/scala/SparqlToSparqlTest.scala Thu Jun 17 07:15:32 2010 -0700
+++ b/src/test/scala/SparqlToSparqlTest.scala Thu Jun 17 07:16:51 2010 -0700
@@ -216,6 +216,65 @@
assert(transformed === expected)
}
+ val Emp_TaskToFoaf_split_knows = GlobalSparqlParser.parseAll(GlobalSparqlParser.construct, """
+ PREFIX mark : <tag://eric.prud.name/2010/mark>
+ PREFIX foaf : <http://xmlns.com/foaf/0.1/>
+ PREFIX task : <http://hr.example/DB/Task#>
+ CONSTRUCT { ?emp foaf:knows ?man . }
+ WHERE { ?pair task:drone ?emp .
+ ?pair task:manager ?man }
+ """).get // "
+/* ?emp mark:a mark:a .
+ ?man mark:a mark:a } */
+ val Emp_TaskToFoaf_split_empLastName = GlobalSparqlParser.parseAll(GlobalSparqlParser.construct, """
+ PREFIX mark : <tag://eric.prud.name/2010/mark>
+ PREFIX foaf : <http://xmlns.com/foaf/0.1/>
+ PREFIX empP : <http://hr.example/DB/Employee#>
+ CONSTRUCT { ?person foaf:last_name ?person_name }
+ WHERE { ?person empP:lastName ?person_name }
+ """).get // "
+ val Emp_TaskToFoaf_split_projLastName = GlobalSparqlParser.parseAll(GlobalSparqlParser.construct, """
+ PREFIX mark : <tag://eric.prud.name/2010/mark>
+ PREFIX foaf : <http://xmlns.com/foaf/0.1/>
+ PREFIX projP : <http://hr.example/DB/Project#>
+ CONSTRUCT { ?project foaf:last_name ?proj_name }
+ WHERE { ?project projP:lastName ?proj_name }
+ """).get // "
+
+ test("markers0") {
+ val sparqlParser = Sparql()
+ val query = sparqlParser.parseAll(sparqlParser.select, """
+PREFIX foaf : <http://xmlns.com/foaf/0.1/>
+PREFIX xsd : <http://www.w3.org/2001/XMLSchema#>
+SELECT ?lname {
+ ?who foaf:last_name ?lname .
+ ?who foaf:knows ?whom .
+ ?whom foaf:knows ?whom2 .
+ ?whom2 foaf:last_name "Smith"^^xsd:string }
+""").get
+ SparqlToSparql.Abbreviations ++= Emp_TaskToFoaf_abbr
+
+ val transformed = SparqlToSparql(query, List(SparqlMap(Emp_TaskToFoaf_split_knows, emptyPatternMap)
+// , SparqlMap(Emp_TaskToFoaf_split_projLastName, emptyPatternMap)
+ , SparqlMap(Emp_TaskToFoaf_split_empLastName, emptyPatternMap)
+ ))
+
+ val expected = sparqlParser.parseAll(sparqlParser.select, """
+PREFIX empP : <http://hr.example/DB/Employee#>
+PREFIX task : <http://hr.example/DB/Task#>
+PREFIX xsd : <http://www.w3.org/2001/XMLSchema#>
+SELECT ?lname
+ { ?who empP:lastName ?lname .
+ ?_2_pair task:drone ?who .
+ ?_2_pair task:manager ?whom .
+ ?_3_pair task:drone ?whom .
+ ?_3_pair task:manager ?whom2 .
+ ?whom2 empP:lastName "Smith"^^xsd:string
+ }
+""").get
+ assert(expected === transformed)
+ }
+
test("reaches0") {
val graph = Set[(String,String)](
("a", "b"),