[Mulgara-svn] r1837 - in projects: . SparqlTester SparqlTester/trunk SparqlTester/trunk/.manager SparqlTester/trunk/dist SparqlTester/trunk/lib SparqlTester/trunk/src SparqlTester/trunk/src/org SparqlTester/trunk/src/org/duraspace SparqlTester/trunk/src/org/duraspace/rdf SparqlTester/trunk/src/org/duraspace/rdf/impl SparqlTester/trunk/src/org/duraspace/rdf/parser SparqlTester/trunk/src/org/duraspace/rdf/vocab SparqlTester/trunk/src/org/duraspace/rdf/xml SparqlTester/trunk/src/org/duraspace/sparql SparqlTester/trunk/src/org/duraspace/sparql/test
pag at mulgara.org
pag at mulgara.org
Fri Nov 13 08:55:08 UTC 2009
Author: pag
Date: 2009-11-13 00:55:07 -0800 (Fri, 13 Nov 2009)
New Revision: 1837
Added:
projects/SparqlTester/
projects/SparqlTester/trunk/
projects/SparqlTester/trunk/.classpath
projects/SparqlTester/trunk/.manager/
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_BlankNode.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_Graph.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_Literal.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_Node.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_ObjectNode.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_PredicateNode.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_SubjectNode.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_Triple.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_URIRef.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_impl_$_BlankNodeImpl.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_impl_$_GraphImpl.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_impl_$_LiteralImpl.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_impl_$_Uri.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_parser_$_GraphReader.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_parser_$_ParseException.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_vocab_$_OWL.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_vocab_$_RDF.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_vocab_$_XSD.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_xml_$_BlankNodeXML.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_xml_$_Literal.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_xml_$_LiteralXML.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_xml_$_SparqlResult.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_xml_$_UriXML.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_DirProcessor.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_Manifest.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_ManifestExecutor.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_ManifestFinder.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_ManifestRunner.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_NegativeSyntaxTest.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_PositiveSyntaxTest.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_QueryEvalTest.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_TestHarness.scala
projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_TestInstance.scala
projects/SparqlTester/trunk/.project
projects/SparqlTester/trunk/build.properties
projects/SparqlTester/trunk/build.xml
projects/SparqlTester/trunk/dist/
projects/SparqlTester/trunk/dist/sparqltest.jar
projects/SparqlTester/trunk/lib/
projects/SparqlTester/trunk/lib/antlr.jar
projects/SparqlTester/trunk/lib/apache-mime4j-0.5.jar
projects/SparqlTester/trunk/lib/commons-codec-1.3.jar
projects/SparqlTester/trunk/lib/commons-logging-1.1.1.jar
projects/SparqlTester/trunk/lib/httpclient-4.0-beta2.jar
projects/SparqlTester/trunk/lib/httpcore-4.0-beta3.jar
projects/SparqlTester/trunk/lib/httpmime-4.0-beta2.jar
projects/SparqlTester/trunk/lib/jena-2.5.6.jar
projects/SparqlTester/trunk/src/
projects/SparqlTester/trunk/src/org/
projects/SparqlTester/trunk/src/org/duraspace/
projects/SparqlTester/trunk/src/org/duraspace/rdf/
projects/SparqlTester/trunk/src/org/duraspace/rdf/BlankNode.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/BlankNode.scala
projects/SparqlTester/trunk/src/org/duraspace/rdf/Graph$$anonfun$write$1.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/Graph.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/Graph.scala
projects/SparqlTester/trunk/src/org/duraspace/rdf/Literal.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/Literal.scala
projects/SparqlTester/trunk/src/org/duraspace/rdf/Node.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/Node.scala
projects/SparqlTester/trunk/src/org/duraspace/rdf/ObjectNode.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/ObjectNode.scala
projects/SparqlTester/trunk/src/org/duraspace/rdf/PredicateNode.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/PredicateNode.scala
projects/SparqlTester/trunk/src/org/duraspace/rdf/SubjectNode.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/SubjectNode.scala
projects/SparqlTester/trunk/src/org/duraspace/rdf/Triple.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/Triple.scala
projects/SparqlTester/trunk/src/org/duraspace/rdf/URIRef.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/URIRef.scala
projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/
projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/BlankNodeImpl.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/BlankNodeImpl.scala
projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getProperties$1$$anonfun$apply$1.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getProperties$1.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getSubjects$1.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getSubjects$2.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getTriples$1$$anonfun$apply$2$$anonfun$apply$3.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getTriples$1$$anonfun$apply$2.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getTriples$1.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getValues$1.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl.scala
projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/LiteralImpl.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/LiteralImpl.scala
projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/Uri$.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/Uri.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/Uri.scala
projects/SparqlTester/trunk/src/org/duraspace/rdf/parser/
projects/SparqlTester/trunk/src/org/duraspace/rdf/parser/GraphReader.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/parser/GraphReader.scala
projects/SparqlTester/trunk/src/org/duraspace/rdf/parser/ParseException.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/parser/ParseException.scala
projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/
projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/OWL$.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/OWL.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/OWL.scala
projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/RDF$.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/RDF.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/RDF.scala
projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/XSD$.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/XSD.class
projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/XSD.scala
projects/SparqlTester/trunk/src/org/duraspace/rdf/xml/
projects/SparqlTester/trunk/src/org/duraspace/rdf/xml/BlankNodeXML.scala
projects/SparqlTester/trunk/src/org/duraspace/rdf/xml/LiteralXML.scala
projects/SparqlTester/trunk/src/org/duraspace/rdf/xml/SparqlResult.scala
projects/SparqlTester/trunk/src/org/duraspace/rdf/xml/UriXML.scala
projects/SparqlTester/trunk/src/org/duraspace/sparql/
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/DirProcessor.scala
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest$$anonfun$extractTests$1.class
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest$$anonfun$write$1.class
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest$TestType$$anon$1.class
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest$TestType$$anon$2.class
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest$TestType$$anon$3.class
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest$TestType$.class
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest$TestType.class
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest.class
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest.scala
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/ManifestExecutor.scala
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/ManifestFinder.scala
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/NegativeSyntaxTest.class
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/NegativeSyntaxTest.scala
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/PositiveSyntaxTest.class
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/PositiveSyntaxTest.scala
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/QueryEvalTest.class
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/QueryEvalTest.scala
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/TestHarness$.class
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/TestHarness.class
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/TestHarness.scala
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/TestInstance.class
projects/SparqlTester/trunk/src/org/duraspace/sparql/test/TestInstance.scala
Log:
Initial import for testing a SPARQL endpoint
Added: projects/SparqlTester/trunk/.classpath
===================================================================
--- projects/SparqlTester/trunk/.classpath (rev 0)
+++ projects/SparqlTester/trunk/.classpath 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="ch.epfl.lamp.sdt.launching.SCALA_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib" path="lib/antlr.jar"/>
+ <classpathentry kind="lib" path="lib/jena-2.5.6.jar"/>
+ <classpathentry kind="lib" path="lib/apache-mime4j-0.5.jar"/>
+ <classpathentry kind="lib" path="lib/commons-codec-1.3.jar"/>
+ <classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/>
+ <classpathentry kind="lib" path="lib/httpclient-4.0-beta2.jar"/>
+ <classpathentry kind="lib" path="lib/httpcore-4.0-beta3.jar"/>
+ <classpathentry kind="lib" path="lib/httpmime-4.0-beta2.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_BlankNode.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_BlankNode.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_Graph.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_Graph.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_Literal.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_Literal.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_Node.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_Node.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_ObjectNode.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_ObjectNode.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_PredicateNode.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_PredicateNode.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_SubjectNode.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_SubjectNode.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_Triple.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_Triple.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_URIRef.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_URIRef.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_impl_$_BlankNodeImpl.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_impl_$_BlankNodeImpl.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_impl_$_GraphImpl.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_impl_$_GraphImpl.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_impl_$_LiteralImpl.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_impl_$_LiteralImpl.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_impl_$_Uri.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_impl_$_Uri.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_parser_$_GraphReader.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_parser_$_GraphReader.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_parser_$_ParseException.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_parser_$_ParseException.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_vocab_$_OWL.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_vocab_$_OWL.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_vocab_$_RDF.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_vocab_$_RDF.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_vocab_$_XSD.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_vocab_$_XSD.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_xml_$_BlankNodeXML.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_xml_$_BlankNodeXML.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_xml_$_Literal.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_xml_$_Literal.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_xml_$_LiteralXML.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_xml_$_LiteralXML.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_xml_$_SparqlResult.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_xml_$_SparqlResult.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_xml_$_UriXML.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_rdf_$_xml_$_UriXML.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_DirProcessor.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_DirProcessor.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_Manifest.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_Manifest.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_ManifestExecutor.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_ManifestExecutor.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_ManifestFinder.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_ManifestFinder.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_ManifestRunner.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_ManifestRunner.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_NegativeSyntaxTest.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_NegativeSyntaxTest.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_PositiveSyntaxTest.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_PositiveSyntaxTest.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_QueryEvalTest.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_QueryEvalTest.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_TestHarness.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_TestHarness.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_TestInstance.scala
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/.manager/_$_Users_$_pag_$_src_$_mulgara_$_workspace_$_SparqlTester_$_src_$_org_$_duraspace_$_sparql_$_test_$_TestInstance.scala
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/.project
===================================================================
--- projects/SparqlTester/trunk/.project (rev 0)
+++ projects/SparqlTester/trunk/.project 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>SparqlTester</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>ch.epfl.lamp.sdt.core.scalabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>ch.epfl.lamp.sdt.core.scalanature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: projects/SparqlTester/trunk/build.properties
===================================================================
--- projects/SparqlTester/trunk/build.properties (rev 0)
+++ projects/SparqlTester/trunk/build.properties 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,4 @@
+scala.home= /usr/local/scala
+antlr.jar= antlr.jar
+jena.jar= jena-2.5.6.jar
+
Added: projects/SparqlTester/trunk/build.xml
===================================================================
--- projects/SparqlTester/trunk/build.xml (rev 0)
+++ projects/SparqlTester/trunk/build.xml 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE project>
+
+<project name="SparqlTest" default="dist" basedir=".">
+ <property file="build.properties"/>
+
+ <property name="src.dir" value="${basedir}/src"/>
+ <property name="lib.dir" value="${basedir}/lib"/>
+ <property name="bin.dir" value="${basedir}/bin"/>
+ <property name="dist.dir" value="${basedir}/dist"/>
+
+ <target name="init">
+ <property name="scala-library.jar" value="${scala.home}/lib/scala-library.jar"/>
+ <path id="build.classpath">
+ <pathelement location="${scala-library.jar}"/>
+ <pathelement location="${lib.dir}/antlr.jar"/>
+ <pathelement location="${lib.dir}/jena-2.5.6.jar"/>
+ <pathelement location="${lib.dir}/apache-mime4j-0.5.jar"/>
+ <pathelement location="${lib.dir}/commons-codec-1.3.jar"/>
+ <pathelement location="${lib.dir}/commons-logging-1.1.1.jar"/>
+ <pathelement location="${lib.dir}/httpclient-4.0-beta2.jar"/>
+ <pathelement location="${lib.dir}/httpcore-4.0-beta3.jar"/>
+ <pathelement location="${lib.dir}/httpmime-4.0-beta2.jar"/>
+ <pathelement location="${bin.dir}"/>
+ </path>
+ <taskdef resource="scala/tools/ant/antlib.xml">
+ <classpath>
+ <pathelement location="${scala.home}/lib/scala-compiler.jar"/>
+ <pathelement location="${scala-library.jar}"/>
+ </classpath>
+ </taskdef>
+ </target>
+
+ <target name="compile" depends="init">
+ <mkdir dir="${bin.dir}"/>
+ <scalac srcdir="${src.dir}" destdir="${bin.dir}" classpathref="build.classpath">
+ <include name="**/*.scala"/>
+ </scalac>
+ </target>
+
+ <target name="jar" depends="compile">
+ <mkdir dir="${dist.dir}"/>
+ <mkdir dir="${bin.dir}/META-INF"/>
+ <manifest file="${bin.dir}/META-INF/MANIFEST.MF">
+ <attribute name="Main-Class" value="org.duraspace.sparql.test.TestHarness"/>
+ </manifest>
+ <jar jarfile="${dist.dir}/sparqltest.jar"
+ manifest="${bin.dir}/META-INF/MANIFEST.MF">
+ <zipfileset src="${scala.home}/lib/scala-library.jar" excludes="META-INF/**"/>
+ <zipfileset src="${lib.dir}/${antlr.jar}" excludes="META-INF/**"/>
+ <zipfileset src="${lib.dir}/${jena.jar}" excludes="META-INF/**"/>
+ <zipfileset src="${lib.dir}/apache-mime4j-0.5.jar" excludes="META-INF/**"/>
+ <zipfileset src="${lib.dir}/commons-codec-1.3.jar" excludes="META-INF/**"/>
+ <zipfileset src="${lib.dir}/commons-logging-1.1.1.jar" excludes="META-INF/**"/>
+ <zipfileset src="${lib.dir}/httpclient-4.0-beta2.jar" excludes="META-INF/**"/>
+ <zipfileset src="${lib.dir}/httpcore-4.0-beta3.jar" excludes="META-INF/**"/>
+ <zipfileset src="${lib.dir}/httpmime-4.0-beta2.jar" excludes="META-INF/**"/>
+ <fileset dir="${bin.dir}"/>
+ </jar>
+ </target>
+
+ <target name="clean">
+ <delete dir="${bin.dir}"/>
+ </target>
+
+ <target name="dist" depends="jar"/>
+
+</project>
Added: projects/SparqlTester/trunk/dist/sparqltest.jar
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/dist/sparqltest.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/lib/antlr.jar
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/lib/antlr.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/lib/apache-mime4j-0.5.jar
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/lib/apache-mime4j-0.5.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/lib/commons-codec-1.3.jar
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/lib/commons-codec-1.3.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/lib/commons-logging-1.1.1.jar
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/lib/commons-logging-1.1.1.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/lib/httpclient-4.0-beta2.jar
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/lib/httpclient-4.0-beta2.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/lib/httpcore-4.0-beta3.jar
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/lib/httpcore-4.0-beta3.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/lib/httpmime-4.0-beta2.jar
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/lib/httpmime-4.0-beta2.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/lib/jena-2.5.6.jar
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/lib/jena-2.5.6.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/BlankNode.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/BlankNode.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/BlankNode.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/BlankNode.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/BlankNode.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.rdf
+
+abstract class BlankNode(val label: String) extends Node with SubjectNode with ObjectNode
\ No newline at end of file
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/Graph$$anonfun$write$1.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/Graph$$anonfun$write$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/Graph.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/Graph.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/Graph.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/Graph.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/Graph.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.rdf
+
+import java.io.PrintStream
+
+abstract class Graph {
+
+ /**
+ * Add a triple consisting of a subject, predicate and object to the graph.
+ * @param subject The subject of the triple.
+ * @param predicate The subject of the triple.
+ * @param object The subject of the triple.
+ * @return <code>true</code> if the data was added, <code>false</code> if it was already there.
+ */
+ def add(subject: SubjectNode, predicate: PredicateNode, obj: ObjectNode): Boolean
+
+ /**
+ * Add a triple to the graph.
+ * @param triple The triple to add.
+ * @return <code>true</code> if the data was added, <code>false</code> if it was already there.
+ */
+ def add(triple: Triple): Boolean = add(triple.subj, triple.pred, triple.obj)
+
+ /**
+ * Add a property and value to a node in the graph.
+ * @param subject The subject to set the property for.
+ * @param propVal The property and value to set on the subject.
+ * @return <code>true</code> if the data was added, <code>false</code> if it was already there.
+ */
+ def add(subject: SubjectNode, propVal: (PredicateNode,ObjectNode)): Boolean =
+ add(subject, propVal._1, propVal._2)
+
+ /**
+ * Gets all the properties for a given subject.
+ * @param s The subject.
+ * @return A list of property/value pairs.
+ */
+ def getProperties(s: SubjectNode): List[(PredicateNode,ObjectNode)]
+
+ /**
+ * Gets all the values for a given property on a subject.
+ * @param s The subject to get the properties for.
+ * @param p The property of interest.
+ * @return The list of values for the property on that subject.
+ */
+ def getValues(s: SubjectNode, p: PredicateNode): List[ObjectNode]
+
+ /**
+ * Gets a single value for a given property on a subject. If more than one
+ * value exists for this property, then returns the first.
+ * @param s The subject to get the property for.
+ * @param p The property of interest.
+ * @return The value for the property on that subject.
+ */
+ def getValue(s: SubjectNode, p: PredicateNode): ObjectNode = {
+ val values = getValues(s, p)
+ if (values.isEmpty) null
+ else values.head
+ }
+
+ /**
+ * Gets an rdf:List property from an object. If more than one
+ * value exists for this property, then returns the first and assumes it's a list.
+ * @param s The subject to get the property for.
+ * @param p The property of interest.
+ * @return The list associates with the property on that subject.
+ */
+ def getList(s: SubjectNode, p: PredicateNode): List[ObjectNode]
+
+ /**
+ * Gets all the subjects that share a given property/value.
+ * @param propVal The property and value being looked for.
+ * @return The subjects that have the value for the property.
+ */
+ def getSubjects(propVal: (PredicateNode,ObjectNode)): List[SubjectNode] = getSubjects(propVal._1, propVal._2)
+
+ /**
+ * Gets all the subjects that share a given property/value.
+ * @param property The property being looked for.
+ * @param value The value being looked for.
+ * @return The subjects that have the value for the property.
+ */
+ def getSubjects(property: PredicateNode, value: ObjectNode): List[SubjectNode]
+
+ /**
+ * Gets the entire graph as a set of triples.
+ * @return All the triples in the graph.
+ */
+ def getTriples: List[Triple]
+
+ /**
+ * Writes the parsed graph to a print stream.
+ * @param out The print stream to write to.
+ */
+ def write(out: PrintStream) {
+ for (triple <- getTriples) {
+ out.print(triple.subj)
+ out.print(" ")
+ out.print(triple.pred)
+ out.print(" ")
+ out.print(triple.obj)
+ out.print(" .")
+ }
+ }
+
+
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/Literal.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/Literal.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/Literal.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/Literal.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/Literal.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.rdf
+
+import java.net.URI
+
+abstract class Literal extends Node with ObjectNode {
+
+ val text: String
+ val language: Option[String]
+ val datatype: Option[URI]
+
+ override def toString = {
+ "'" + text + "'" +
+ (if (language == None) "^^" + datatype.toString
+ else "@" + language)
+ }
+
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/Node.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/Node.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/Node.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/Node.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/Node.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.rdf
+
+abstract class Node {
+
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/ObjectNode.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/ObjectNode.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/ObjectNode.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/ObjectNode.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/ObjectNode.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.rdf
+
+trait ObjectNode extends Node {
+
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/PredicateNode.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/PredicateNode.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/PredicateNode.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/PredicateNode.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/PredicateNode.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.rdf
+
+trait PredicateNode extends Node {
+
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/SubjectNode.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/SubjectNode.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/SubjectNode.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/SubjectNode.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/SubjectNode.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.rdf
+
+trait SubjectNode extends Node {
+
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/Triple.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/Triple.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/Triple.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/Triple.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/Triple.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.rdf
+
+class Triple (val subj: SubjectNode, val pred: PredicateNode, val obj: ObjectNode) {
+ def propertyValue = (pred, obj)
+
+ override def equals(other: Any) = other match {
+ case that: Triple => subj == that.subj && pred == that.pred && obj == that.obj
+ case _ => false
+ }
+
+ override def hashCode = subj.hashCode * 7 + pred.hashCode * 3 + obj.hashCode
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/URIRef.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/URIRef.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/URIRef.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/URIRef.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/URIRef.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,11 @@
+package org.duraspace.rdf
+import java.net.URI
+import java.io.File
+import java.io.InputStream
+
+abstract class URIRef extends Node with SubjectNode with PredicateNode with ObjectNode {
+
+ val uri: URI
+ def toFile: File
+ def getStream: InputStream
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/BlankNodeImpl.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/BlankNodeImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/BlankNodeImpl.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/BlankNodeImpl.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/BlankNodeImpl.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.rdf.impl
+
+/**
+ * Implementation for representing a blank node.
+ */
+class BlankNodeImpl(label: String) extends BlankNode(label) {
+ override def toString = label
+
+ override def equals(that: Any) = that match {
+ case n: Node => label.equals(that.toString)
+ case _ => false
+ }
+
+ override def hashCode() = label.hashCode
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getProperties$1$$anonfun$apply$1.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getProperties$1$$anonfun$apply$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getProperties$1.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getProperties$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getSubjects$1.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getSubjects$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getSubjects$2.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getSubjects$2.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getTriples$1$$anonfun$apply$2$$anonfun$apply$3.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getTriples$1$$anonfun$apply$2$$anonfun$apply$3.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getTriples$1$$anonfun$apply$2.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getTriples$1$$anonfun$apply$2.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getTriples$1.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getTriples$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getValues$1.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl$$anonfun$getValues$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/GraphImpl.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.rdf.impl
+
+import scala.collection.mutable
+import scala.collection.mutable.Map
+import org.duraspace.rdf.impl.Uri._
+import org.duraspace.rdf.vocab.RDF
+
+/**
+ * Represents a collection of triples.
+ */
+class GraphImpl extends Graph {
+
+ /** The triples structure */
+ private val spo = Map[SubjectNode,Map[PredicateNode,mutable.Set[ObjectNode]]]()
+
+ /**
+ * Adds three elements that make up a triple into the graph
+ * @return <code>true</code> if the triple is new to the graph.
+ */
+ def add(subject: SubjectNode, predicate: PredicateNode, obj: ObjectNode): Boolean = {
+ var po = if (spo.contains(subject)) spo(subject)
+ else {
+ val tmp = Map[PredicateNode,mutable.Set[ObjectNode]]()
+ spo += (subject -> tmp)
+ tmp
+ }
+
+ var o = if (po.contains(predicate)) po(predicate)
+ else {
+ val tmp = mutable.Set[ObjectNode](obj)
+ po += (predicate -> tmp)
+ tmp
+ }
+ if (o.contains(obj)) true
+ else {
+ o += obj
+ false
+ }
+ }
+
+ /**
+ * Gets all the properties for a given subject.
+ * @param s The subject.
+ * @return A list of property/value pairs.
+ */
+ def getProperties(s: SubjectNode): List[(PredicateNode,ObjectNode)] = {
+ if (spo.isDefinedAt(s)) (for (po <- spo(s); obj <- po._2) yield (po._1, obj)).toList
+ else List()
+ }
+
+ /**
+ * Gets all the values for a given property on a subject.
+ * @param s The subject to get the properties for.
+ * @param p The property of interest.
+ * @return The list of values for the property on that subject.
+ */
+ def getValues(s: SubjectNode, p: PredicateNode): List[ObjectNode] = {
+ if (spo.isDefinedAt(s) && spo(s).isDefinedAt(p)) (for (o <- spo(s)(p)) yield o).toList
+ else List()
+ }
+
+ /**
+ * Gets an rdf:List property from an object. If more than one
+ * value exists for this property, then returns the first and assumes it's a list.
+ * @param s The subject to get the property for.
+ * @param p The property of interest.
+ * @return The list associates with the property on that subject.
+ */
+ def getList(s: SubjectNode, p: PredicateNode): List[ObjectNode] = getList(getValue(s, p))
+
+ /**
+ * Get an RDF list from an object node that is refered to as being of type rdf:List
+ * @param head The head of the list. This came from the object of a statement.
+ * If invalid as a list, then an empty list is returned.
+ * @return The contents of the RDF list.
+ */
+ private def getList(head: ObjectNode): List[ObjectNode] = {
+ head match {
+ case h: SubjectNode => {
+ val headData = getValue(h, RDF.First)
+ if (headData == null) List()
+ else headData :: getList(getValue(h, RDF.Rest))
+ }
+ case _ => List()
+ }
+ }
+
+ /**
+ * Gets all the subjects that share a given property/value.
+ * @param property The property being looked for.
+ * @param value The value being looked for.
+ * @return The subjects that have the value for the property.
+ */
+ def getSubjects(property: PredicateNode, value: ObjectNode): List[SubjectNode] = {
+ (for (e <- spo if e._2.isDefinedAt(property) && e._2(property).contains(value)) yield e._1).toList
+ }
+
+ /**
+ * Gets the entire graph as a set of triples.
+ * @return All the triples in the graph.
+ */
+ def getTriples: List[Triple] = {
+ (for (e <- spo; pv <- e._2; o <- pv._2) yield new Triple(e._1, pv._1, o)).toList
+ }
+
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/LiteralImpl.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/LiteralImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/LiteralImpl.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/LiteralImpl.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/LiteralImpl.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.rdf.impl
+
+import java.net.URI
+
+class LiteralImpl (val text: String, val language: Option[String], val datatype: Option[URI]) extends Literal {
+
+ def this(text: String) = this(text, None, None)
+
+ def this(text: String, language: String) = this(text, Some(language), None)
+
+ def this(text: String, datatype: URI) = this(text, None, Some(datatype))
+
+ override def equals(other: Any) = other match {
+ case that: Literal => text == that.text && language == that.language && datatype == that.datatype
+ case _ => false
+ }
+
+ override def hashCode = text.hashCode + language.hashCode * 3 + datatype.hashCode * 7
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/Uri$.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/Uri$.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/Uri.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/Uri.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/Uri.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/Uri.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/impl/Uri.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.rdf.impl
+
+import java.io.File
+import java.net.URI
+
+/**
+ * A URI reference.
+ */
+class Uri (val uri: URI) extends URIRef {
+
+ def this(str: String) = this(new URI(str))
+
+ def apply = uri
+
+ /** Get the file this URI refers to. */
+ def toFile = new File(uri.toURL().getPath())
+
+ /** Gets a stream from the URI, if it is a valid URL. */
+ def getStream = uri.toURL().openStream()
+
+ override def toString = uri.toString
+
+ override def equals(that: Any) = that match {
+ case u: URIRef => uri.equals(u.uri)
+ case _ => false
+ }
+
+ override def hashCode() = uri.hashCode
+
+}
+
+object Uri {
+
+ implicit def toUri(u: URI) = new Uri(u)
+
+ implicit def toUri(u: String) = new Uri(u)
+
+}
\ No newline at end of file
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/parser/GraphReader.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/parser/GraphReader.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/parser/GraphReader.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/parser/GraphReader.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/parser/GraphReader.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.rdf.parser
+
+import java.io.File
+import java.io.FileInputStream
+import java.util.logging.Logger
+import java.util.logging.Level
+import java.net.URI
+import java.net.URISyntaxException
+
+import com.hp.hpl.jena.n3.N3Parser
+import com.hp.hpl.jena.n3.N3AntlrParserTokenTypes._
+import com.hp.hpl.jena.n3.N3ParserEventHandler
+import antlr.collections.AST
+
+import org.duraspace.rdf.impl._
+import org.duraspace.rdf.vocab.XSD
+import org.duraspace.rdf.vocab.RDF
+import org.duraspace.rdf.vocab.OWL
+
+
+class GraphReader(val graphFile: File) extends N3ParserEventHandler {
+
+ /** The first identifier for anonymous nodes. */
+ val AnonTag1 = "_:"
+
+ /** The second identifier for anonymous nodes. */
+ val AnonTag2 = "=:"
+
+ /** Map of <code>prefix</code> directives. */
+ var prefixMap = Map[String,String]()
+
+ /** The graph representing the manifest. */
+ val graph = new GraphImpl()
+
+ // kick it all off
+ parse
+
+ def parse {
+ try {
+ val inputStream = new FileInputStream(graphFile)
+ (new N3Parser(inputStream, this)).parse()
+ } catch {
+ case e => throw new ParseException("Error reading from file: " + graphFile, e)
+ }
+ }
+
+ /**
+ * Convenience method for logging debug data.
+ * @param msg The message to log.
+ */
+ private def debug(msg: String) { GraphReader.logger.log(Level.FINE, msg) }
+
+ /**
+ * Convenience method for logging error data.
+ * @param msg The message to log.
+ */
+ private def error(msg: String) { GraphReader.logger.log(Level.WARNING, msg) }
+
+ def endDocument { debug("Finishing N3 document") }
+
+ def endFormula(line: Int, arg1: String) { debug("End of formula. " + line + ": " + arg1) }
+
+ def error(arg0: Exception, arg1: String) { error("Error in data. " + arg0 + ": " + arg1) }
+
+ def startDocument() { debug("Starting N3 document") }
+
+ def startFormula(line: Int, arg1: String) { error("Unexpected formula. " + line + ": " + arg1) }
+
+ def directive(line: Int, directive: AST, args: Array[AST], context: String) {
+ directive.getType match {
+ case AT_PREFIX => {
+ debug("Adding prefix: " + args(0) + args(1))
+ prefixMap += (args(0).toString -> args(1).toString)
+ }
+ case _ => error("Ignoring directive. " + line + ": " + directive + " {" + context + "}")
+ }
+ }
+
+ def quad(line: Int, subj: AST, pred: AST, obj: AST, context: String) {
+ debug("line: " + line + ". " + List(subj.getText(), pred.getText(), obj.getText()).mkString(" ") + " :- " + context)
+ try {
+ graph.add(toNode(subj).asInstanceOf[SubjectNode], toNode(pred).asInstanceOf[PredicateNode], toNode(obj).asInstanceOf[ObjectNode])
+ } catch {
+ case e: Throwable => {
+ error("Error parsing node: " + e.getMessage() + " at line: " + line + " [" + subj + ", " + pred + ", " + obj + "]")
+ }
+ }
+ }
+
+ def toNode(ast: AST) = {
+ ast.getType() match {
+ case LITERAL => {
+ val a1 = ast.getNextSibling
+ val a2 = if (a1 == null) null else a1.getNextSibling
+ val lang = getLang(a1, a2)
+ val datatype = getDatatype(a1, a2)
+ new LiteralImpl(ast.toString, lang, datatype)
+ }
+ case NUMBER => new LiteralImpl(ast.toString, getNumberType(ast.toString))
+ case ANON => new BlankNodeImpl(ast.toString())
+ case QNAME => {
+ val s = ast.toString()
+ if (isAnonymous(ast)) new BlankNodeImpl(s)
+ else {
+ val colonIndex = s.indexOf(':')
+ val qnamePrefix = s.substring(0, colonIndex + 1)
+ val uriPrefix = prefixMap(qnamePrefix)
+ require (uriPrefix != null, "No @prefix for " + s)
+ new Uri(uriPrefix + s.substring(colonIndex + 1))
+ }
+ }
+ case URIREF => new Uri(ast.toString())
+ case KW_A => new Uri(RDF.Type)
+ case TK_LIST_FIRST => new Uri(RDF.First)
+ case TK_LIST_REST => new Uri(RDF.Rest)
+ case TK_LIST_NIL => new Uri(RDF.Nil)
+ case TK_LIST => new Uri(RDF.List)
+ case EQUAL => new Uri(OWL.SameAs)
+ case FORMULA => throw new ParseException("Formulas are not supported. file=[" + graphFile + "]")
+ case _ => throw new ParseException("Unsupported N3 parser token type: " + ast.getType() + " '" + ast + "' file=[" + graphFile + "]");
+ }
+ }
+
+ private def getLang(a1: AST, a2: AST): Option[String] = {
+ if (a1 != null) {
+ val lang = getLang(a1)
+ if (lang == None) getLang(a2) else lang
+ } else getLang(a2)
+ }
+
+ private def getLang(a: AST): Option[String] =
+ if (a == null || a.getType != AT_LANG) None else Some(a.getText.substring(1))
+
+ private def getDatatype(a1: AST, a2: AST): Option[URI] = {
+ val datatype = getDatatype(a1)
+ if (datatype == None) getDatatype(a2) else datatype
+ }
+
+ private def getDatatype(a: AST): Option[URI] = {
+ if (a == null || a.getType() != DATATYPE) None
+ else {
+ val dt = a.getFirstChild
+ try {
+ if (dt == null) None else Some(new URI(dt.toString()))
+ } catch {
+ case e: URISyntaxException => error("Error parsing N3 datatype: " + dt.toString())
+ None
+ }
+ }
+ }
+
+ private def getNumberType(n: String) = {
+ if (n.indexOf('.') >= 0) XSD.Double
+ else {
+ try {
+ val l = n.toLong
+ if (l <= Math.MAX_INT && l >= Math.MIN_INT) XSD.Int else XSD.Long
+ } catch {
+ case _ => XSD.Integer
+ }
+ }
+ }
+
+ def isAnonymous(node: AST) = {
+ val s = node.toString()
+ s.startsWith(AnonTag1) || s.startsWith(AnonTag2)
+ }
+
+}
+
+object GraphReader {
+ /** The logging object. */
+ val logger = Logger.getLogger("GraphReader")
+}
\ No newline at end of file
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/parser/ParseException.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/parser/ParseException.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/parser/ParseException.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/parser/ParseException.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/parser/ParseException.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.rdf.parser
+
+class ParseException(message: String, cause: Throwable) extends Exception(message, cause) {
+
+ def this(message: String) = this(message, null)
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/OWL$.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/OWL$.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/OWL.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/OWL.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/OWL.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/OWL.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/OWL.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,156 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.rdf.vocab
+
+import java.net.URI;
+
+/**
+ * Vocabulary for OWL.
+ */
+object OWL {
+
+ /** The QName prefix for OWL */
+ val Prefix = "owl"
+
+ /** The OWL namespace. */
+ val Base = "http://www.w3.org/2002/07/owl#"
+
+ /** Top */
+ val Thing = URI.create(Base + "Thing")
+
+ /** Bottom */
+ val Nothing = URI.create(Base + "Thing")
+
+ /** The class of classes. */
+ val Class = URI.create(Base + "Class")
+
+ /** The class of things that are all different. */
+ val AllDifferent = URI.create(Base + "AllDifferent")
+
+ /** The class of things that are restricted. */
+ val Restriction = URI.create(Base + "Restriction")
+
+ /** The class of object properties. */
+ val ObjectProperty = URI.create(Base + "ObjectProperty")
+
+ /** The class of datatype properties (where the value is a literal). */
+ val DatatypeProperty = URI.create(Base + "DatatypeProperty")
+
+ /** The class of transitive object properties. */
+ val TransitiveProperty = URI.create(Base + "TransitiveProperty")
+
+ /** The class of symmetric object properties. */
+ val SymmetricProperty = URI.create(Base + "SymmetricProperty")
+
+ /** The class of functional object properties. */
+ val FunctionalProperty = URI.create(Base + "FunctionalProperty")
+
+ /** The class of inverse functional object properties. */
+ val InverseFunctionalProperty = URI.create(Base + "InverseFunctionalProperty")
+
+ /** The class of annotation properties. */
+ val AnnotationProperty = URI.create(Base + "AnnotationProperty")
+
+ /** The class of ontologies. */
+ val Ontology = URI.create(Base + "Ontology")
+
+ /** The class properties of an ontology. */
+ val OntologyProperty = URI.create(Base + "OntologyProperty")
+
+ /** The class for classes that should no longer be used. */
+ val DeprecatedClass = URI.create(Base + "DeprecatedClass")
+
+ /** The class for properties that should no longer be used. */
+ val DeprecatedProperty = URI.create(Base + "DeprecatedProperty")
+
+ /** The class for a range of data that a property can refer to. */
+ val DataRange = URI.create(Base + "DataRange")
+
+ ////////////////////////////////////
+ // Properties
+ ////////////////////////////////////
+
+ /** Equivalent class property. */
+ val EquivalentClass = URI.create(Base + "equivalentClass")
+
+ /** Disjoint With property. */
+ val DisjointWith = URI.create(Base + "disjointWith")
+
+ /** Equivalent property property. */
+ val EquivalentProperty = URI.create(Base + "equivalentProperty")
+
+ /** Same As property. */
+ val SameAs = URI.create(Base + "sameAs")
+
+ /** Different From property. */
+ val DifferentFrom = URI.create(Base + "differentFrom")
+
+ /** Distinct Members property. */
+ val DistinctMembers = URI.create(Base + "distinctMembers")
+
+ /** A property for a union of other classes. */
+ val UnionOf = URI.create(Base + "unionOf")
+
+ /** A property for an intersection of other classes. */
+ val IntersectionOf = URI.create(Base + "intersectionOf")
+
+ /** A property for the complement of another class. */
+ val ComplementOf = URI.create(Base + "complementOf")
+
+ /** A property for an enumeration class. */
+ val OneOf = URI.create(Base + "oneOf")
+
+ /** A property for associating a restriction with a property. */
+ val OnProperty = URI.create(Base + "onProperty")
+
+ /** A restriction property for the universal qualifier. */
+ val AllValuesFrom = URI.create(Base + "allValuesFrom")
+
+ /** A restriction property for specifying a property value. */
+ val HasValue = URI.create(Base + "hasValue")
+
+ /** A restriction property for the existential qualifier. */
+ val SomeValuesFrom = URI.create(Base + "someValuesFrom")
+
+ /** A restriction property for minimal numeric cardinality. */
+ val MinCardinality = URI.create(Base + "minCardinality")
+
+ /** A restriction property for maximum numeric cardinality. */
+ val MaxCardinality = URI.create(Base + "maxCardinality")
+
+ /** A restriction property synonymous with max and min cardinality set to the same value. */
+ val Cardinality = URI.create(Base + "cardinality")
+
+ /** A property for describing that two properties are the inverse of each other. */
+ val InverseOf = URI.create(Base + "inverseOf")
+
+ /** An ontology property for importing another ontology. */
+ val Imports = URI.create(Base + "imports")
+
+ /** An annotation property for versioning. */
+ val VersionInfo = URI.create(Base + "versionInfo")
+
+ /** An ontology property for describing a previous version. */
+ val PriorVersion = URI.create(Base + "priorVersion")
+
+ /** An ontology property for describing compatibility with a previous version. */
+ val BackwardCompatibleWith = URI.create(Base + "backwardCompatibleWith")
+
+ /** An ontology property for describing incompatibility with a previous version. */
+ val IncompatibleWith = URI.create(Base + "incompatibleWith")
+
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/RDF$.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/RDF$.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/RDF.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/RDF.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/RDF.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/RDF.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/RDF.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.rdf.vocab
+
+import java.net.URI
+
+/**
+ * Vocabulary for RDF.
+ */
+object RDF {
+
+ /** The QName prefix for RDF */
+ val Prefix = "rdf"
+
+ /** The RDF namespace */
+ val Base = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+
+ /** The class of unordered containers. */
+ val Bag = URI.create(Base + "Bag")
+
+ /** The class of ordered containers. */
+ val Seq = URI.create(Base + "Seq")
+
+ /** The class of containers of alternatives. */
+ val Alt = URI.create(Base + "Alt")
+
+ /** The class of RDF statements. */
+ val Statement = URI.create(Base + "Statement")
+
+ /** The class of RDF properties. */
+ val Property = URI.create(Base + "Property")
+
+ /** The class of XML literal values. */
+ val XmlLiteral = URI.create(Base + "XMLLiteral")
+
+ /** The class of RDF Lists. */
+ val List = URI.create(Base + "List")
+
+ /**
+ * A special property element that is equivalent to rdf:_1, rdf:_2 in order.
+ * Only used in RDF/XML as inserting members of containers using LI normally
+ * will result in duplicate instances not being recorded.
+ */
+ val Li = URI.create(Base + "li")
+
+ /**
+ * The empty list, with no items in it. If the rest of a list is nil then
+ * the list has no more items in it.
+ */
+ val Nil = URI.create(Base + "nil")
+
+ /** The subject of the subject RDF statement. */
+ val Subject = URI.create(Base + "subject")
+
+ /** The predicate of the subject RDF statement. */
+ val Predicate = URI.create(Base + "predicate")
+
+ /** The object of the subject RDF statement. */
+ val Object = URI.create(Base + "object")
+
+ /** The subject is an instance of a class. */
+ val Type = URI.create(Base + "type")
+
+ /** Idiomatic property used for structured values. */
+ val Value = URI.create(Base + "value")
+
+ /** The first item in the subject RDF list. */
+ val First = URI.create(Base + "first")
+
+ /** The rest of the subject RDF list after the first item. */
+ val Rest = URI.create(Base + "rest")
+
+ /** The abbreviation for the class of XML literal values. */
+ val XmlLiteralQName = URI.create(Prefix + ":XMLLiteral");
+
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/XSD$.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/XSD$.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/XSD.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/XSD.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/XSD.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/XSD.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/vocab/XSD.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.rdf.vocab
+
+import java.net.URI
+
+/**
+ * Vocabulary for XSD.
+ */
+object XSD {
+
+ /** The namespace for XSD data. */
+ val Base = "http://www.w3.org/2001/XMLSchema#";
+
+ /** URI for the XML Schema <code>xsd:float</code> datatype; */
+ val Float = URI.create(Base + "float")
+
+ /** URI for the XML Schema <code>xsd:double</code> datatype; */
+ val Double = URI.create(Base + "double")
+
+ /** URI for the XML Schema <code>xsd:decimal</code> datatype. */
+ val Decimal = URI.create(Base + "decimal")
+
+ /** URI for the XML Schema <code>integer</code> datatype. Subtype of {@link #Decimal}. */
+ val Integer = URI.create(Base + "integer")
+
+ /** URI for the XML Schema <code>long</code> datatype. Subtype of {@link #Integer}. */
+ val Long = URI.create(Base + "long")
+
+ /** URI for the XML Schema <code>int</code> datatype. Subtype of {@link #Long}. */
+ val Int = URI.create(Base + "int")
+
+ /** URI for the XML Schema <code>short</code> datatype. Subtype of {@link #Int}. */
+ val Short = URI.create(Base + "short")
+
+ /** URI for the XML Schema <code>byte</code> datatype. Subtype of {@link #Short}. */
+ val Byte = URI.create(Base + "byte")
+
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/xml/BlankNodeXML.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/xml/BlankNodeXML.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/xml/BlankNodeXML.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.rdf.xml
+
+import scala.xml.Node
+import org.duraspace.rdf.impl.BlankNodeImpl
+
+/**
+ * A class of BlankNode that has an XML serialization.
+ */
+class BlankNodeXML(text: String) extends BlankNodeImpl(text)
+
+/**
+ * Defines extractors for XML nodes to BlankNodeXML
+ */
+object BlankNodeXML {
+
+ /** Builds XML for a blank node */
+ def apply(label: String) = <bnode>{label}</bnode>
+
+ /** Extractor for converting XML for a blank node into a string label. */
+ def unapply(node: Node): Option[String] = node match {
+ case <bnode>{b}</bnode> => Some(b.text)
+ case _ => None
+ }
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/xml/LiteralXML.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/xml/LiteralXML.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/xml/LiteralXML.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.duraspace.rdf.xml
+
+import java.net.URI
+import scala.xml.Node
+import org.duraspace.rdf.impl.LiteralImpl
+
+/**
+ * A class of Literal that has an XML serialization.
+ */
+class LiteralXML(text: String, language: Option[String], datatype: Option[URI])
+ extends LiteralImpl(text, language, datatype)
+
+/**
+ * Defines extractors for XML nodes to LiteralXML
+ */
+object LiteralXML {
+
+ /**
+ * A builder for XML nodes
+ */
+ def apply(text: String, language: Option[String], datatype: Option[URI]) = {
+ language match {
+ case Some(lang) => <literal xml:lang={lang}>{text}</literal>
+ case None => datatype match {
+ case Some(t) => <literal datatype={t.toString}>{text}</literal>
+ case None => <literal>{text}</literal>
+ }
+ }
+ }
+
+ /**
+ * An extractor to take an XML node and create a Literal
+ */
+ def unapply(node: Node): Option[(String, Option[String], Option[URI])] = node match {
+ case <literal>{lit}</literal> => Some((lit.text, findLang(node), findDatatype(node)))
+ case _ => None
+ }
+
+ /**
+ * Utility function to look for an xml:lang attribute. This will succeed even when
+ * the xml namespace is not declared.
+ */
+ private def findLang(node: Node): Option[String] = {
+ val langs = node.attributes.filter(_.key == "lang")
+ if (langs.key == "lang") Some(langs.value.text) else None
+ }
+
+ /**
+ * Utility to find a possible datatype associated with a literal
+ */
+ private def findDatatype(node: Node): Option[URI] = {
+ val dt = node \ "@datatype"
+ if (!dt.isEmpty) Some(new URI(dt.text)) else None
+ }
+
+}
\ No newline at end of file
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/xml/SparqlResult.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/xml/SparqlResult.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/xml/SparqlResult.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.rdf.xml
+
+import scala.xml.Node
+import scala.xml.Text
+import org.duraspace.rdf.impl._
+
+/**
+ * Represents a set of SPARQL results, coming from XML.
+ */
+class SparqlResult(root: Node) {
+
+ /** The head node of the XML */
+ val headNode = root \ "head"
+ /** The results node of the XML */
+ val resultsNode = root \ "results"
+
+ /** The list of variables */
+ val variables = for (vnode <- headNode \ "variable") yield vnode \ "@name" text
+
+ /** A list of variable bindings, one binding per entry */
+ val results = Set() ++ (for (rnode <- resultsNode \ "result") yield bindingMap(rnode))
+
+ /** A map of each variable to a single value */
+ def bindingMap(rnode: Node) = Map() ++ (for (binding <- rnode \ "binding") yield ((binding \ "@name" text) -> bindingVal(binding)))
+
+ /** The binding value represented by an XML node */
+ def bindingVal(b: Node): org.duraspace.rdf.Node = {
+ val boundVals = for (value <- b.child; if nonText(value)) yield(
+ value match {
+ case LiteralXML(text, lang, datatype) => new LiteralImpl(text, lang, datatype)
+ case UriXML(u) => new Uri(u)
+ case BlankNodeXML(label) => new BlankNodeImpl(label)
+ case _ => throw new Exception("Unexpected XML node in binding: " + b.text)
+ }
+ )
+ require (boundVals.size == 1)
+ boundVals(0)
+ }
+
+ /** Convenience method to test if an XML node is plain text */
+ def nonText(node: Node) = node match {
+ case _: Text => false
+ case _ => true
+ }
+
+ /** String representation of the entire result set */
+ override def toString = results.toString
+
+ /** Compares this result set to another for equality */
+ override def equals(that: Any) = that match {
+ case r: SparqlResult => results == r.results
+ case _ => false
+ }
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/rdf/xml/UriXML.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/rdf/xml/UriXML.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/rdf/xml/UriXML.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.rdf.xml
+
+import java.net.URI
+import scala.xml.Node
+
+/**
+ * A class of Uri that has an XML serialization.
+ */
+class UriXML(u: URI) extends org.duraspace.rdf.impl.Uri(u)
+
+/**
+ * Defines extractors for XML nodes to UriXML
+ */
+object UriXML {
+
+ /** Builds XML for a URI */
+ def apply(u: URI) = <uri>{u.toString}</uri>
+
+ /** Extractor for converting XML for a URI into a URI. */
+ def unapply(node: Node): Option[URI] = node match {
+ case <uri>{u}</uri> => Some(new URI(u.text))
+ case _ => None
+ }
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/DirProcessor.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/sparql/test/DirProcessor.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/sparql/test/DirProcessor.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.sparql.test
+
+import java.io.File
+import java.io.FileFilter
+
+/**
+ * An object for applying an action to files in a directory, recursing down
+ * the directories.
+ * @param dir The directory to start processing at
+ * @param filter Returns true to indicate files that should have the action applied to them.
+ */
+class DirProcessor(dir: File, filter: (File) => Boolean) {
+ require (dir.isDirectory)
+
+ /**
+ * This constructor is used to apply the action to all files
+ * @param dir The directory to start processing at
+ */
+ def this(dir: File) = this(dir, (f) => true)
+
+ /**
+ * Apply a function to all files that this processor represents.
+ * @param fn The function to the apply to each file
+ */
+ def apply(fn: (File) => Unit) {
+ // process the files in the current directory
+ val files = dir.listFiles(new FileFilter { def accept(path: File) = filter(path) })
+ for (f <- files) fn(f)
+
+ // process each of the subdirectories
+ val dirs = dir.listFiles(new FileFilter { def accept(path: File) = path.isDirectory })
+ for (d <- dirs) new DirProcessor(d, filter).apply(fn)
+ }
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest$$anonfun$extractTests$1.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest$$anonfun$extractTests$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest$$anonfun$write$1.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest$$anonfun$write$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest$TestType$$anon$1.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest$TestType$$anon$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest$TestType$$anon$2.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest$TestType$$anon$2.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest$TestType$$anon$3.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest$TestType$$anon$3.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest$TestType$.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest$TestType$.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest$TestType.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest$TestType.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/sparql/test/Manifest.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,182 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.sparql.test
+
+import java.io.File
+import java.io.PrintStream
+import java.net.URI
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.duraspace.rdf._
+import org.duraspace.rdf.impl.Uri
+import org.duraspace.rdf.impl.Uri._
+import org.duraspace.rdf.parser.GraphReader
+import org.duraspace.rdf.vocab._
+
+class Manifest(manifest: File) {
+
+ /** The logging object. */
+ val logger = Logger.getLogger("Manifest");
+
+ val Mf = "http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#";
+ val Qt = "http://www.w3.org/2001/sw/DataAccess/tests/test-query#";
+ val Dawgt = "http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#";
+
+ // constructor code
+ val file = manifest.getAbsoluteFile
+ val graph = new GraphReader(file).graph
+ val tests = extractTests
+
+ /**
+ * Write this manifest to a print stream.
+ * @param out The print stream to write to.
+ */
+ def writeTo(out: PrintStream) {
+ out.println("Manifest: " + file)
+ for (test <- tests) out.println(" " + test)
+ out.println
+ }
+
+
+ /**
+ * Populate the list of tests with the data from the graph.
+ */
+ private def extractTests: List[TestInstance] = {
+ // get the manifest instance
+ val manifestNodes = graph.getSubjects(RDF.Type, Mf + "Manifest")
+ if (manifestNodes.isEmpty) {
+ System.out.println("No tests found!")
+ return List()
+ }
+
+ // this is not a loop, but a guard against multiple elements in the manifest
+ val manifestNode = manifestNodes.head
+
+ try {
+ // get the tests for this manifest
+ for (t <- graph.getList(manifestNode, Mf + "entries")) yield {
+ t match {
+ case sn: SubjectNode => readTest(sn)
+ case _ => throw new IllegalArgumentException("Tests must be based on a subject: " + t)
+ }
+ }
+ } catch {
+ case e => System.err.println("Error in file: " + manifest)
+ throw e
+ }
+ }
+
+ private def readTest(node: SubjectNode): TestInstance = {
+ // get the name
+ val nameNode = graph.getValue(node, Mf + "name")
+ val name = nameNode match {
+ case nn: Literal => nn.text
+ case _ => warn("Name for %s was not a literal", node.toString)
+ null
+ }
+
+ // get the type
+ val typeNode = graph.getValue(node, RDF.Type)
+ val testType = typeNode match {
+ case tn: Uri => TestType.forUri(tn)
+ case _ => throw new IllegalArgumentException("Test must have a valid type: " + node + ": " + typeNode)
+ }
+
+ // test for approval
+ val approved = (Dawgt + "Approved") == graph.getValue(node, Dawgt + "approval")
+
+ // get action
+ val actionNode = graph.getValue(node, Mf + "action")
+ actionNode match {
+ case _: Literal => throw new IllegalArgumentException("Test action may not be literal: " + typeNode)
+ case anode: Uri => {
+ val query = if (testType.simple) anode.uri else throw new IllegalArgumentException("Simple action required for test: " + node)
+ testType.create(name, normalize(query), null, null, approved)
+ }
+ case snode: SubjectNode => {
+ graph.getValue(snode, Qt + "query") match {
+ case queryNode: Uri => {
+ val results = graph.getValue(node, Mf + "result") match {
+ case rnode: Uri => rnode.uri
+ case _ => throw new IllegalArgumentException("Query action requires a file for the query: " + node + " " + queryNode)
+ }
+ graph.getValue(snode, Qt + "data") match {
+ case dataNode: Uri => testType.create(name, normalize(queryNode.uri), normalize(dataNode.uri), normalize(results), approved)
+ case null => testType.create(name, normalize(queryNode.uri), null, normalize(results), approved)
+ case dataNode => throw new IllegalArgumentException("Query action requires a file for the data: " + node + " " + dataNode)
+ }
+ }
+ case queryNode => throw new IllegalArgumentException("Query action requires a file for the query: " + node + " " + queryNode)
+ }
+ }
+ case _ => throw new IllegalArgumentException("Test action may not be literal: " + typeNode)
+ }
+ }
+
+
+ /**
+ * Normalize a file URI with respect to the manifest location.
+ * @param f The relative file to normalize.
+ * @return A File object that is relative to the manifest.
+ */
+ private def normalize(f: URI): File = {
+ if (f == null) null
+ else {
+ if (f.isAbsolute) new File(f)
+ else new File(file.getParentFile, f.getPath)
+ }
+ }
+
+ /**
+ * Utility for logging a warning.
+ * @param msg The message format.
+ * @param args Additional arguments for the format.
+ */
+ private def warn(msg: String, args: Any*) {
+ logger.log(Level.WARNING, String.format(msg, args))
+ }
+
+
+ abstract class TestType(u: Uri, val simple: Boolean) {
+ val uri: Uri = Mf + u
+
+ def create(name: String, query: File, data: File, results: File, approved: Boolean): TestInstance
+ }
+
+
+ object TestType {
+
+ val PosSyntax = new TestType("PositiveSyntaxTest", true) {
+ def create(name: String, query: File, data: File, results: File, approved: Boolean) = new PositiveSyntaxTest(name, query, approved)
+ }
+ val NegSyntax = new TestType("NegativeSyntaxTest", true) {
+ def create(name: String, query: File, data: File, results: File, approved: Boolean) = new NegativeSyntaxTest(name, query, approved)
+ }
+ val QueryEval = new TestType("QueryEvaluationTest", false) {
+ def create(name: String, query: File, data: File, results: File, approved: Boolean) = new QueryEvalTest(name, query, data, results, approved)
+ }
+
+ def forUri(u: Uri) = u match {
+ case PosSyntax.uri => PosSyntax
+ case NegSyntax.uri => NegSyntax
+ case QueryEval.uri => QueryEval
+ case _ => throw new IllegalArgumentException("Unknown test type: " + u)
+ }
+
+ }
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/ManifestExecutor.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/sparql/test/ManifestExecutor.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/sparql/test/ManifestExecutor.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.sparql.test
+
+import java.net.URI
+
+class ManifestExecutor(val endpoint: URI) {
+
+ def this(s: String) = this(new URI(s))
+
+ def execute(m: Manifest) {
+ System.out.println("Executing manifest: " + m.file)
+ for (t <- m.tests) t.run(endpoint)
+ }
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/ManifestFinder.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/sparql/test/ManifestFinder.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/sparql/test/ManifestFinder.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.sparql.test
+
+import java.io.File
+
+/**
+ * This object contains methods to find manifests in a directory tree and run a function on them.
+ */
+object ManifestFinder {
+ def run(dir: File, fn: (Manifest) => Unit) {
+ val directory = new DirProcessor(dir, f => f.getName.toLowerCase == "manifest.ttl")
+ directory.apply(f => {
+ val m = new Manifest(f)
+ fn(m)
+ })
+ }
+
+ def run(file: String, fn: (Manifest) => Unit) { run(new File(file), fn) }
+
+}
\ No newline at end of file
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/NegativeSyntaxTest.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/NegativeSyntaxTest.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/NegativeSyntaxTest.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/sparql/test/NegativeSyntaxTest.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/sparql/test/NegativeSyntaxTest.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.sparql.test
+
+import java.io.File
+import java.net.URI
+
+import org.apache.http.HttpResponse
+
+class NegativeSyntaxTest (name: String, queryFile: File, approved: Boolean) extends TestInstance(name, queryFile, approved) {
+
+ override def toString = "NegativeSyntaxTest: \"" + name + "\", file=" + queryFile + ", approved=" + approved
+
+ def getURL(endpoint: URI) = endpoint.toString + "?query=" + query
+
+ // return true if an error code in the response
+ def handleResponse(response: HttpResponse) = response.getStatusLine.getStatusCode >= 400
+
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/PositiveSyntaxTest.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/PositiveSyntaxTest.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/PositiveSyntaxTest.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/sparql/test/PositiveSyntaxTest.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/sparql/test/PositiveSyntaxTest.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.sparql.test
+
+import java.io.File
+import java.io.Reader
+import java.net.URI
+import TestInstance.readFile
+
+import org.apache.http.HttpResponse
+
+/**
+ * This class represents a test whereby a query is issued against a SPARQL endpoint,
+ * where the query is expected to succeed. The results of the query are not relevant.
+ */
+class PositiveSyntaxTest (name: String, queryFile: File, approved: Boolean) extends TestInstance(name, queryFile, approved) {
+
+ override def toString = "PositiveSyntaxTest: \"" + name + "\", file=" + queryFile + ", approved=" + approved
+
+ def getURL(endpoint: URI) = endpoint.toString + "?query=" + query
+
+ // return true if not an error code on the stream
+ def handleResponse(response: HttpResponse) = {
+ val code = response.getStatusLine.getStatusCode
+ code >= 200 && code < 300
+ }
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/QueryEvalTest.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/QueryEvalTest.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/QueryEvalTest.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/sparql/test/QueryEvalTest.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/sparql/test/QueryEvalTest.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.sparql.test
+
+import java.io.File
+import java.io.InputStream
+import java.net.URI
+import scala.xml.XML
+import org.apache.http.HttpResponse
+
+import org.duraspace.rdf.xml.SparqlResult
+
+class QueryEvalTest(name: String, queryFile: File, val dataFile: File, val resultFile: File, approved: Boolean)
+ extends TestInstance(name, queryFile, approved) {
+
+ override def toString = "QueryEvalTest: \"" + name + "\", file=" + queryFile + ", approved=" + approved +
+ ", [data=" + dataFileName + ", results=" + resultFile + "]"
+
+ def dataFileName = if (dataFile == null) "<<default>>" else dataFile.toString
+
+ def getURL(endpoint: URI) = {
+ endpoint.toString +
+ (if (dataFile == null) "?query=" + query
+ else "?default-graph-uri=" + dataFile.toURI + "&query=" + query)
+ }
+
+ // return true if not an error code on the stream
+ def handleResponse(response: HttpResponse) = {
+ val code = response.getStatusLine.getStatusCode
+ (code >= 200 && code < 300) && expectedData(response.getEntity.getContent)
+ }
+
+ // compare the resulting stream to the data in the expected results file
+ def expectedData(content: InputStream) = {
+ val results = new SparqlResult(XML.load(content))
+ val expectedResults = new SparqlResult(XML.loadFile(resultFile))
+ results == expectedResults
+ }
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/TestHarness$.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/TestHarness$.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/TestHarness.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/TestHarness.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/TestHarness.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/sparql/test/TestHarness.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/sparql/test/TestHarness.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.sparql.test
+
+import java.io.File
+import java.io.FileNotFoundException
+import org.duraspace.rdf.parser.ParseException
+
+object TestHarness {
+ val endpoint = "http://localhost:8080/sparql/"
+
+ def main(args : Array[String]) : Unit = {
+ if (args.size == 0) {
+ System.err.println("File must be provided")
+ return
+ }
+
+ val executor = new ManifestExecutor(endpoint)
+ try {
+ ManifestFinder.run(args(0), executor.execute(_))
+ } catch {
+ case e: ParseException => System.err.println("Error reading file")
+ e.printStackTrace()
+ }
+ }
+
+}
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/TestInstance.class
===================================================================
(Binary files differ)
Property changes on: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/TestInstance.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/SparqlTester/trunk/src/org/duraspace/sparql/test/TestInstance.scala
===================================================================
--- projects/SparqlTester/trunk/src/org/duraspace/sparql/test/TestInstance.scala (rev 0)
+++ projects/SparqlTester/trunk/src/org/duraspace/sparql/test/TestInstance.scala 2009-11-13 08:55:07 UTC (rev 1837)
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2009 DuraSpace.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.duraspace.sparql.test
+
+import java.io.BufferedReader
+import java.io.InputStreamReader
+import java.io.IOException
+import java.io.File
+import java.io.FileReader
+import java.io.Reader
+import java.net.URI
+import java.net.URLEncoder
+
+import org.apache.http.HttpResponse
+import org.apache.http.client.ClientProtocolException
+import org.apache.http.impl.client.DefaultHttpClient
+import org.apache.http.client.methods.HttpGet
+import org.apache.http.client.methods.HttpUriRequest
+import org.apache.http.params.CoreProtocolPNames
+
+import TestInstance._
+
+abstract class TestInstance(val name: String, val queryFile: File, val approved: Boolean) {
+
+ def run(endpoint: URI): Boolean = {
+ print(name + ": ")
+ val client = new DefaultHttpClient()
+ val url = getURL(endpoint)
+ // println("Accessing: " + url)
+ val get = new HttpGet(url)
+
+ client.getParams.setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, false)
+
+ try {
+ val result = handleResponse(client.execute(get))
+ if (result) println("PASSED") else println("FAILED")
+ result
+ } catch {
+ case e: ClientProtocolException => throw new Exception("Error in protocol: " + e.getMessage())
+ case e: IOException => throw new Exception("Error executing GET: " + e.getMessage())
+ case t: Throwable => throw new Exception("Unexpected exception", t)
+ }
+ }
+
+ def getURL(endpoint: URI): String
+
+ def query = URLEncoder.encode(readFile(queryFile), UTF8)
+
+ def handleResponse(response: HttpResponse): Boolean
+
+}
+
+object TestInstance {
+ val UTF8 = "UTF-8"
+ private val BufferSize = 1024
+
+ def readFile(file: File): String = {
+ val buffer = new Array[Char](BufferSize)
+ val result = new StringBuilder
+ val reader = new FileReader(file)
+
+ var length = reader.read(buffer)
+ while (length >= 0) {
+ result.append(buffer, 0, length)
+ length = reader.read(buffer)
+ }
+ result.toString
+ }
+}
\ No newline at end of file
More information about the Mulgara-svn
mailing list