--- a/directmapping-test/src/main/scala/DirectMappingTestSuite.scala Wed Jan 12 16:15:46 2011 -0500
+++ b/directmapping-test/src/main/scala/DirectMappingTestSuite.scala Thu Jan 13 09:23:43 2011 -0500
@@ -8,11 +8,7 @@
import org.scalatest.FunSuite
-class FundamentalTestWithRDF extends FundamentalTest with ConcreteModel with RDFImplicits
-
-abstract class FundamentalTest extends FunSuite with DirectMappingModule with RDFImplicits {
-
- val DirectMapping = new DirectMapping { }
+trait FundamentalTest extends FunSuite with DirectMappingModule with RDFImplicits {
import DirectMapping._
@@ -47,12 +43,9 @@
-class DirectMappingTestWithConcreteModel extends DirectMappingTest with ConcreteModel
trait DirectMappingTest extends FunSuite with RDFModel with RDFImplicits with DirectMappingModule with TurtleModule {
- val DirectMapping = new DirectMapping { }
-
import DirectMapping._
val SqlParser = sql.SqlParser()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/directmapping-test/src/test/scala/DirectMappingTest.scala Thu Jan 13 09:23:43 2011 -0500
@@ -0,0 +1,7 @@
+package org.w3.directmapping
+
+import org.w3.rdf.ConcreteModel
+
+class FundamentalTestWithRDF extends FundamentalTest with ConcreteModel
+
+class DirectMappingTestWithConcreteModel extends DirectMappingTest with ConcreteModel
--- a/directmapping/src/main/scala/DirectMapping.scala Wed Jan 12 16:15:46 2011 -0500
+++ b/directmapping/src/main/scala/DirectMapping.scala Thu Jan 13 09:23:43 2011 -0500
@@ -6,6 +6,8 @@
trait DirectMappingModule extends RDFModel {
+ lazy val DirectMapping = new DirectMapping { }
+
trait DirectMapping {
/** A KeyMap associates the candidate key and key values with the
--- a/project/build/RDB2RDF.scala Wed Jan 12 16:15:46 2011 -0500
+++ b/project/build/RDB2RDF.scala Thu Jan 13 09:23:43 2011 -0500
@@ -23,6 +23,7 @@
lazy val rdb = project("rdb", "rdb", new RDB(_))
lazy val sql = project("sql", "sql", new SQL(_), rdb)
lazy val rdf = project("rdf", "rdf", new RDF(_), isomorphic)
+ lazy val rdfmodelTest = project("rdfmodel-test", "rdfmodel-test", new RDFModelTest(_), rdf)
lazy val rdfdsl = project("rdfdsl", "rdfdsl", new RDFDSL(_), rdf)
lazy val turtle = project("turtle", "turtle", new Turtle(_), rdf)
lazy val turtleTest = project("turtle-test", "turtle-test", new TurtleTest(_), turtle)
@@ -50,6 +51,8 @@
class RDFDSL(info: ProjectInfo) extends DefaultProject(info) with Common
+ class RDFModelTest(info: ProjectInfo) extends DefaultProject(info) with TestSuite
+
class Turtle(info: ProjectInfo) extends DefaultProject(info) with Common
class TurtleTest(info: ProjectInfo) extends DefaultProject(info) with TestSuite
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/rdfmodel-test/src/main/scala/RDFModelTestSuite.scala Thu Jan 13 09:23:43 2011 -0500
@@ -0,0 +1,58 @@
+package org.w3.rdf
+
+// trait Model {
+
+// type IRI
+// type Graph <: Iterable[Triple]
+// type Triple
+// type BNode
+// type Node
+// type NodeIRI <: Node
+// type NodeBNode <: Node
+// type Subject
+// type SubjectNode <: Subject
+// type Predicate
+// type PredicateIRI <: Predicate
+// type Object
+// type ObjectNode <: Object
+// type ObjectLiteral <: Object
+// type Literal
+// type PlainLiteral <: Literal
+// type TypedLiteral <: Literal
+// type LangTag
+
+// val IRI : Isomorphic1[String, IRI]
+
+// trait GraphObject {
+// def empty:Graph
+// def apply(elems:Triple*):Graph
+// def apply(it:Iterable[Triple]):Graph
+// }
+// val Graph : GraphObject
+
+// val Triple : Isomorphic3[Subject, Predicate, Object, Triple]
+
+// val BNode : Isomorphic1[String, BNode]
+
+// val NodeIRI : Isomorphic1[IRI, NodeIRI]
+// val NodeBNode : Isomorphic1[BNode, NodeBNode]
+
+// val SubjectNode : Isomorphic1[Node, SubjectNode]
+
+// val PredicateIRI : Isomorphic1[IRI, PredicateIRI]
+
+// val ObjectNode : Isomorphic1[Node, ObjectNode]
+// val ObjectLiteral : Isomorphic1[Literal, ObjectLiteral]
+
+// val PlainLiteral : Isomorphic2[String, Option[LangTag], PlainLiteral]
+// val TypedLiteral : Isomorphic2[String, IRI, TypedLiteral]
+
+// val LangTag : Isomorphic1[String, LangTag]
+
+// val StringDatatype = IRI("http://www.w3.org/2001/XMLSchema#string")
+// val IntegerDatatype = IRI("http://www.w3.org/2001/XMLSchema#integer")
+// val DateDatatype = IRI("http://www.w3.org/2001/XMLSchema#date")
+// val DateTimeDatatype = IRI("http://www.w3.org/2001/XMLSchema#dateTime")
+
+// }
+
--- a/turtle-test/src/main/scala/TurtleTestSuite.scala Wed Jan 12 16:15:46 2011 -0500
+++ b/turtle-test/src/main/scala/TurtleTestSuite.scala Thu Jan 13 09:23:43 2011 -0500
@@ -3,11 +3,9 @@
import org.w3.rdf.{Model => RDFModel, Implicits => RDFImplicits, _}
import org.scalatest.FunSuite
-class TurtleTestWithRDF extends TurtleTest with ConcreteModel with RDFImplicits
+trait TurtleTest extends FunSuite with TurtleModule with RDFImplicits {
-abstract class TurtleTest extends FunSuite with TurtleModule with RDFImplicits {
-
- val turtleParser = new TurtleParser { }
+ val TurtleParser = new TurtleParser { }
test("directgraph_emp_adder") {
val directgraph_emp_adder:Graph =
@@ -34,7 +32,7 @@
<Addresses/ID.18#_> <Addresses#city> "Cambridge"^^xsd:string .
<Addresses/ID.18#_> <Addresses#state> "MA"^^xsd:string .
"""
- assert(directgraph_emp_adder === turtleParser.toGraph(turtle_emp_adder))
+ assert(directgraph_emp_adder === TurtleParser.toGraph(turtle_emp_adder))
}
test("directgraph_multi_key") {
@@ -80,7 +78,7 @@
<Addresses/ID.18#_> <Addresses#city> "Cambridge"^^xsd:string .
<Addresses/ID.18#_> <Addresses#state> "MA"^^xsd:string .
"""
- assert(directgraph_multi_key === turtleParser.toGraph(turtle_multi_key))
+ assert(directgraph_multi_key === TurtleParser.toGraph(turtle_multi_key))
}
test("directgraph_ref_no_pk") {
@@ -165,7 +163,7 @@
<Addresses/ID.18#_> <Addresses#city> "Cambridge"^^xsd:string .
<Addresses/ID.18#_> <Addresses#state> "MA"^^xsd:string .
"""
- assert(directgraph_ref_no_pk === turtleParser.toGraph(turtle_ref_no_pk))
+ assert(directgraph_ref_no_pk === TurtleParser.toGraph(turtle_ref_no_pk))
}
test("directgraph_hier_tabl_proto") {
@@ -197,7 +195,7 @@
<Addresses/ID.18#_> <Addresses#city> "Cambridge"^^xsd:string .
<Addresses/ID.18#_> <Addresses#state> "MA"^^xsd:string .
"""
- assert(directgraph_hier_tabl_proto === turtleParser.toGraph(turtle_hier_tabl_proto))
+ assert(directgraph_hier_tabl_proto === TurtleParser.toGraph(turtle_hier_tabl_proto))
}
test("directgraph_hier_tabl") {
@@ -236,7 +234,7 @@
<Addresses/ID.18#_> <Addresses#city> "Cambridge"^^xsd:string .
<Addresses/ID.18#_> <Addresses#state> "MA"^^xsd:string .
"""
- assert(directgraph_hier_tabl === turtleParser.toGraph(turtle_hier_tabl))
+ assert(directgraph_hier_tabl === TurtleParser.toGraph(turtle_hier_tabl))
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/turtle-test/src/test/scala/TurtleTest.scala Thu Jan 13 09:23:43 2011 -0500
@@ -0,0 +1,5 @@
+package org.w3.rdf.turtle
+
+import org.w3.rdf.{Model => RDFModel, Implicits => RDFImplicits, _}
+
+class TurtleTestWithRDF extends TurtleTest with ConcreteModel with RDFImplicits
--- a/turtle/src/main/scala/turtle.scala Wed Jan 12 16:15:46 2011 -0500
+++ b/turtle/src/main/scala/turtle.scala Thu Jan 13 09:23:43 2011 -0500
@@ -15,7 +15,8 @@
import MyParsers._
trait TurtleModule extends RDFModel {
-
+
+ // a turtle parser should be instanciated any time you need one
trait TurtleParser extends JavaTokenParsers {
def toGraph(t:String):Graph = parseAll(turtle, t).get
@@ -88,6 +89,7 @@
| integer ^^ { l => TypedLiteral(l, IntegerDatatype) }
)
}
+
}