--- a/project/build/RDB2RDF.scala Sun Mar 13 18:13:21 2011 -0400
+++ b/project/build/RDB2RDF.scala Mon Mar 14 18:33:33 2011 -0400
@@ -31,6 +31,7 @@
lazy val rdfxmlTest = project("rdfxml-test", "rdfxml-test", new RDFXMLTest(_), rdfxml)
lazy val jena = project("jena", "jena", new Jena(_), rdf)
lazy val jenaTest = project("jena-test", "jena-test", new JenaTest(_), jena, rdfmodelTest, directmappingTest, turtleTest, rdfxmlTest)
+ lazy val rdf2rdf = project("rdf2rdf", "rdf2rdf", new RDF2RDF(_), jena)
lazy val sharedtestdata = project("sharedtestdata", "sharedtestdata", new SharedTestData(_), rdb, rdf, sql, turtle)
lazy val directmapping = project("directmapping", "directmapping", new DirectMapping(_), rdb, rdf, sql, sharedtestdata)
lazy val directmappingWebapp = project("directmapping-webapp", "directmapping-webapp", new DirectMappingWebapp(_), directmapping, jena)
@@ -72,6 +73,13 @@
class JenaTest(info: ProjectInfo) extends DefaultProject(info) with Common
+ class RDF2RDF(info: ProjectInfo) extends DefaultProject(info) with Common {
+// val jena = "com.hp.hpl.jena" % "jena" % "2.6.4"
+// val jenaIri = "com.hp.hpl.jena" % "iri" % "0.8" from "http://openjena.org/repo/com/hp/hpl/jena/iri/0.8/iri-0.8.jar"
+ val arq = "com.hp.hpl.jena" % "arq" % "2.8.7"
+ }
+
+
class SharedTestData(info: ProjectInfo) extends DefaultProject(info) with Common
class DirectMapping(info: ProjectInfo) extends DefaultProject(info) with Common
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/rdf2rdf/src/main/scala/RDF2RDF.scala Mon Mar 14 18:33:33 2011 -0400
@@ -0,0 +1,28 @@
+package org.w3.rdf2rdf
+
+import org.w3.rdf.jena._
+import com.hp.hpl.jena.query._
+
+trait RDF2RDFModule extends JenaModel {
+
+ case class Construct(query:Query) {
+ assert(query.getQueryType == Query.QueryTypeConstruct, "You must provide a valid SPARQL 1.1 Construct query")
+
+ }
+
+ object Construct {
+ def apply(query:String):Construct = {
+ val construct = QueryFactory.create(query, Syntax.syntaxSPARQL_11)
+ Construct(construct)
+ }
+ }
+
+
+ trait RDF2RDF {
+
+
+
+
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/rdf2rdf/src/test/scala/Construct.scala Mon Mar 14 18:33:33 2011 -0400
@@ -0,0 +1,25 @@
+package org.w3.rdf2rdf
+
+import org.scalatest.FunSuite
+import org.scalatest.matchers.ShouldMatchers
+
+class ConstructTest extends FunSuite with ShouldMatchers with RDF2RDFModule {
+
+ test("some queries") {
+
+ Construct("CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o }")
+
+ evaluating {
+ Construct("CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p }")
+ } should produce [com.hp.hpl.jena.query.QueryParseException]
+
+ // weird but synctaticaly correct
+ Construct("CONSTRUCT { ?s ?p ?o } WHERE { ?a ?b ?c }")
+
+ evaluating {
+ Construct("SELECT ?s ?p ?o WHERE { ?a ?b ?c }")
+ } should produce [AssertionError]
+
+ }
+
+}