jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpz6311...@apache.org
Subject svn commit: r1519358 [3/5] - in /jena/trunk/jena-spatial: ./ src/ src/main/ src/main/java/ src/main/java/examples/ src/main/java/jena/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/jena/ src/main/java/org/apache/jena/query/ src/...
Date Mon, 02 Sep 2013 06:46:21 GMT
Propchange: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/IntersectsBoxPF.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/IsNearByPF.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/IsNearByPF.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/IsNearByPF.java (added)
+++ jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/IsNearByPF.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.jena.query.spatial.pfunction.library;
+
+public class IsNearByPF extends IsWithinCirclePF {
+
+}

Propchange: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/IsNearByPF.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/IsWithinBoxPF.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/IsWithinBoxPF.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/IsWithinBoxPF.java (added)
+++ jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/IsWithinBoxPF.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.jena.query.spatial.pfunction.library;
+
+import org.apache.jena.query.spatial.pfunction.SpatialOperationWithBoxPFBase;
+import org.apache.lucene.spatial.query.SpatialOperation;
+
+public class IsWithinBoxPF extends SpatialOperationWithBoxPFBase {
+
+	public IsWithinBoxPF() {
+	}
+
+	@Override
+	protected SpatialOperation getSpatialOperation() {
+		return SpatialOperation.IsWithin;
+	}
+
+}

Propchange: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/IsWithinBoxPF.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/IsWithinCirclePF.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/IsWithinCirclePF.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/IsWithinCirclePF.java (added)
+++ jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/IsWithinCirclePF.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.jena.query.spatial.pfunction.library;
+
+import org.apache.jena.query.spatial.pfunction.SpatialOperationWithCircleBase;
+import org.apache.lucene.spatial.query.SpatialOperation;
+
+public class IsWithinCirclePF extends SpatialOperationWithCircleBase {
+
+	public IsWithinCirclePF() {
+		// TODO Auto-generated constructor stub
+	}
+
+	@Override
+	protected SpatialOperation getSpatialOperation() {
+		return SpatialOperation.IsWithin;
+	}
+
+}

Propchange: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/IsWithinCirclePF.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/NorthPF.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/NorthPF.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/NorthPF.java (added)
+++ jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/NorthPF.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.jena.query.spatial.pfunction.library;
+
+import org.apache.jena.query.spatial.SpatialQuery;
+import org.apache.jena.query.spatial.pfunction.DirectionWithPointPFBase;
+import org.apache.jena.query.spatial.pfunction.SpatialMatch;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class NorthPF extends DirectionWithPointPFBase {
+
+	private static Logger log = LoggerFactory.getLogger(NorthPF.class);
+
+	public NorthPF() {
+		// TODO Auto-generated constructor stub
+	}
+
+	/** Deconstruct the node or list object argument and make a SpatialMatch */
+	protected SpatialMatch getSpatialMatch(Double latitude, Double longitude,
+			int limit) {
+		SpatialMatch match = new SpatialMatch(latitude, SpatialQuery.ctx
+				.getWorldBounds().getMinX(), SpatialQuery.ctx.getWorldBounds()
+				.getMaxY(), SpatialQuery.ctx.getWorldBounds().getMaxX(), limit,
+				getSpatialOperation());
+		return match;
+	}
+
+}

Propchange: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/NorthPF.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/SouthPF.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/SouthPF.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/SouthPF.java (added)
+++ jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/SouthPF.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.jena.query.spatial.pfunction.library;
+
+import org.apache.jena.query.spatial.SpatialQuery;
+import org.apache.jena.query.spatial.pfunction.DirectionWithPointPFBase;
+import org.apache.jena.query.spatial.pfunction.SpatialMatch;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SouthPF extends DirectionWithPointPFBase {
+
+	private static Logger log = LoggerFactory.getLogger(SouthPF.class);
+
+	public SouthPF() {
+		// TODO Auto-generated constructor stub
+	}
+
+	/** Deconstruct the node or list object argument and make a SpatialMatch */
+	protected SpatialMatch getSpatialMatch(Double latitude, Double longitude,
+			int limit) {
+		SpatialMatch match = new SpatialMatch(SpatialQuery.ctx.getWorldBounds().getMinY(),
+				SpatialQuery.ctx.getWorldBounds().getMinX(), latitude, SpatialQuery.ctx.getWorldBounds()
+						.getMaxX(), limit, getSpatialOperation());
+		return match;
+	}
+
+}

Propchange: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/SouthPF.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/WestPF.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/WestPF.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/WestPF.java (added)
+++ jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/WestPF.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.jena.query.spatial.pfunction.library;
+
+import org.apache.jena.query.spatial.SpatialQuery;
+import org.apache.jena.query.spatial.pfunction.DirectionWithPointPFBase;
+import org.apache.jena.query.spatial.pfunction.SpatialMatch;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WestPF extends DirectionWithPointPFBase {
+
+	private static Logger log = LoggerFactory.getLogger(WestPF.class);
+
+	public WestPF() {
+		// TODO Auto-generated constructor stub
+	}
+
+	/** Deconstruct the node or list object argument and make a SpatialMatch */
+	protected SpatialMatch getSpatialMatch(Double latitude, Double longitude,
+			int limit) {
+		SpatialMatch match = new SpatialMatch(SpatialQuery.ctx.getWorldBounds().getMinY(),
+				SpatialQuery.ctx.getWorldBounds().getMinX(), SpatialQuery.ctx.getWorldBounds().getMaxY(),
+				longitude, limit, getSpatialOperation());
+		return match;
+	}
+
+}

Propchange: jena/trunk/jena-spatial/src/main/java/org/apache/jena/query/spatial/pfunction/library/WestPF.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/main/resources/org/apache/jena/query/spatial/properties.xml
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/main/resources/org/apache/jena/query/spatial/properties.xml?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/main/resources/org/apache/jena/query/spatial/properties.xml (added)
+++ jena/trunk/jena-spatial/src/main/resources/org/apache/jena/query/spatial/properties.xml Mon Sep  2 06:46:19 2013
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+<!--  Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 -->
+<properties version="1.0">
+  <comment>jena-spatial system properties</comment>
+  <entry key="org.apache.jena.query.spatial.version">${project.version}</entry>
+  <entry key="org.apache.jena.query.spatial.datetime">${build.time.xsd}</entry>
+</properties>

Propchange: jena/trunk/jena-spatial/src/main/resources/org/apache/jena/query/spatial/properties.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/AbstractTestDatasetWithSpatialIndex.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/AbstractTestDatasetWithSpatialIndex.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/AbstractTestDatasetWithSpatialIndex.java (added)
+++ jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/AbstractTestDatasetWithSpatialIndex.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.jena.query.spatial;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.Set;
+
+import org.apache.jena.atlas.lib.StrUtils;
+
+import com.hp.hpl.jena.query.Dataset;
+import com.hp.hpl.jena.query.Query;
+import com.hp.hpl.jena.query.QueryException;
+import com.hp.hpl.jena.query.QueryExecution;
+import com.hp.hpl.jena.query.QueryExecutionFactory;
+import com.hp.hpl.jena.query.QueryFactory;
+import com.hp.hpl.jena.query.ReadWrite;
+import com.hp.hpl.jena.query.ResultSet;
+import com.hp.hpl.jena.rdf.model.Model;
+
+/*
+ * This abstract class defines a collection of test methods for testing
+ * test searches.  Its subclasses create a dataset using the index to 
+ * to be tested and then call the test methods in this class to run
+ * the actual tests.
+ */
+public abstract class AbstractTestDatasetWithSpatialIndex {
+	protected static final String RESOURCE_BASE = "http://example.org/data/resource/";
+	protected static Dataset dataset;
+	protected static final String QUERY_PROLOG = 
+			StrUtils.strjoinNL(
+				"PREFIX spatial: <http://jena.apache.org/spatial#>",
+				"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>"
+				);
+	
+	protected static final String TURTLE_PROLOG = 
+				StrUtils.strjoinNL(
+						"@prefix spatial: <http://jena.apache.org/spatial#> .",
+						"@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .",
+						"@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .",
+						"@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .",
+						"@prefix wkt: <http://www.opengis.net/ont/geosparql#> ."
+						);
+	
+	
+	protected void doTestSearchThrowException(String turtle, String queryString) {
+		doTestSearch(turtle, queryString, null, -1, true);
+	}
+    
+	protected void doTestSearch(String turtle, String queryString, Set<String> expectedEntityURIs) {
+		doTestSearch(turtle, queryString, expectedEntityURIs, expectedEntityURIs.size(), false);
+	}
+	
+	protected void doTestSearch(String turtle, String queryString, Set<String> expectedEntityURIs, int expectedNumResults) {
+		doTestSearch(turtle, queryString, expectedEntityURIs, expectedNumResults, false);
+	}
+	
+	private void doTestSearch(String turtle, String queryString, Set<String> expectedEntityURIs, int expectedNumResults, boolean throwException) {
+		Model model = dataset.getDefaultModel();
+		Reader reader = new StringReader(turtle);
+		dataset.begin(ReadWrite.WRITE);
+		model.read(reader, "", "TURTLE");
+		dataset.commit();
+		doTestQuery(dataset, queryString, expectedEntityURIs, expectedNumResults, throwException);
+	}
+	
+	public static void doTestQuery(Dataset dataset, String queryString, Set<String> expectedEntityURIs, int expectedNumResults, boolean throwException) {
+		Query query = QueryFactory.create(queryString) ;
+		
+		QueryExecution qexec = QueryExecutionFactory.create(query, dataset) ;
+		try {
+			dataset.begin(ReadWrite.READ);
+		    ResultSet results = qexec.execSelect() ;
+
+		    boolean b = ( (expectedNumResults > 0) == results.hasNext() ) ;
+		    if ( !b ) {
+		        System.out.println(queryString) ;
+		        System.out.println(expectedNumResults) ;
+		        
+		    }
+		    if (throwException){
+		    	fail("An exception is supposed to be thrown!");
+		    }
+		    assertEquals( expectedNumResults > 0, results.hasNext());
+		    int count;
+		    for (count=0; results.hasNext(); count++) {
+		    	String entityURI = results.next().getResource("s").getURI();
+		        assertTrue(": unexpected result: " + entityURI, expectedEntityURIs.contains(entityURI));
+		    }
+		    assertEquals(expectedNumResults, count);
+		} catch (QueryException e){
+			if (!throwException){
+				fail("The exception is not supposed to be thrown: "+ e.getMessage());
+			}	
+		} finally { qexec.close() ; dataset.end() ; }			
+		
+	
+	}
+	
+}

Propchange: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/AbstractTestDatasetWithSpatialIndex.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/SpatialSearchUtil.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/SpatialSearchUtil.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/SpatialSearchUtil.java (added)
+++ jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/SpatialSearchUtil.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.jena.query.spatial;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.jena.atlas.io.IO ;
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.FSDirectory;
+import org.apache.lucene.util.Version;
+
+import com.hp.hpl.jena.query.Dataset;
+import com.hp.hpl.jena.query.DatasetFactory;
+import com.hp.hpl.jena.tdb.TDBFactory;
+
+public class SpatialSearchUtil {
+	
+    private static Version VER = SpatialIndexLucene.VER ;
+    private static final Analyzer analyzer = new StandardAnalyzer(VER);
+    
+	private static final String LUCENE_INDEX_PATH = "target/test/LuceneSpatialIndex";
+	private static final File LUCENE_Index_DIR = new File(LUCENE_INDEX_PATH);
+	
+    private static final String  SOLR_DATA_PATH      = "src/test/resources/SolrHome/SolrARQCollection/data";
+    private static final File    SOLR_DATA_DIR       = new File(SOLR_DATA_PATH);
+    private static final String  SOLR_INDEX_PATH     = SOLR_DATA_PATH + "/index";
+    private static final File    SOLR_INDEX_DIR      = new File(SOLR_INDEX_PATH);
+    private static final String  SOLR_TEST_ASSEM     = "src/test/resources/spatial-solr-config.ttl" ;	
+	
+    public static void emptyAndDeleteDirectory(File dir) {
+        File[] contents = dir.listFiles() ;
+        if (contents != null) {
+            for (File content : contents) {
+                if (content.isDirectory()) {
+                    emptyAndDeleteDirectory(content) ;
+                } else {
+                    content.delete() ;
+                }
+            }
+        }
+        dir.delete() ;
+    }
+
+    public static void createEmptyIndex(File indexDir) {
+        try {
+            Directory directory = FSDirectory.open(indexDir) ;
+            IndexWriterConfig wConfig = new IndexWriterConfig(VER, analyzer) ;
+            IndexWriter indexWriter = new IndexWriter(directory, wConfig) ;
+            indexWriter.close() ; // force creation of the index files
+        } catch (IOException ex) {
+            IO.exception(ex) ;
+        }
+	}
+    
+    public static Dataset initInMemoryDatasetWithSolrSpatitalIndex() throws IOException{
+	    SpatialSearchUtil.deleteOldFiles(SOLR_DATA_DIR  );
+	    SOLR_INDEX_DIR.mkdirs();
+	    SpatialQuery.init() ;
+	    SpatialSearchUtil.createEmptyIndex(SOLR_INDEX_DIR);
+	    return SpatialDatasetFactory.create(SOLR_TEST_ASSEM) ;
+    }
+    
+    public static Dataset initInMemoryDatasetWithLuceneSpatitalIndex() throws IOException{
+    	return initInMemoryDatasetWithLuceneSpatitalIndex(LUCENE_Index_DIR);
+    }
+    
+    public static Dataset initInMemoryDatasetWithLuceneSpatitalIndex(File indexDir) throws IOException{
+		SpatialQuery.init();
+		deleteOldFiles(indexDir);
+		indexDir.mkdirs();
+		return createDatasetByCode(indexDir);
+    }
+    
+    public static Dataset initTDBDatasetWithLuceneSpatitalIndex(File indexDir, File TDBDir) throws IOException{
+		SpatialQuery.init();
+		deleteOldFiles(indexDir);
+		deleteOldFiles(TDBDir);
+		indexDir.mkdirs();
+		TDBDir.mkdir();
+		return createDatasetByCode(indexDir, TDBDir);
+    }
+    
+	public static void deleteOldLuceneIndexDir() {
+		deleteOldFiles(LUCENE_Index_DIR);
+	}
+	public static void deleteOldSolrDataDir() {
+		deleteOldFiles(SOLR_DATA_DIR);
+	}
+    
+	public static void deleteOldFiles(File indexDir) {
+		if (indexDir.exists())
+			emptyAndDeleteDirectory(indexDir);
+	}
+	
+	private static Dataset createDatasetByCode(File indexDir) throws IOException {
+		// Base data
+		Dataset ds1 = DatasetFactory.createMem();
+		return joinDataset(ds1, indexDir);
+	}
+	
+	private static Dataset createDatasetByCode(File indexDir, File TDBDir) throws IOException {
+		// Base data
+		Dataset ds1 = TDBFactory.createDataset(TDBDir.getAbsolutePath());
+		return joinDataset(ds1, indexDir);
+	}
+	
+	private static Dataset joinDataset(Dataset baseDataset, File indexDir) throws IOException{
+		EntityDefinition entDef = new EntityDefinition("uri", "geo");
+
+		// Lucene, index in File system.
+		Directory dir = FSDirectory.open(indexDir);
+
+		// Join together into a dataset
+		Dataset ds = SpatialDatasetFactory.createLucene(baseDataset, dir, entDef);
+
+		return ds;
+	}
+
+}

Propchange: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/SpatialSearchUtil.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TS_Spatial.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TS_Spatial.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TS_Spatial.java (added)
+++ jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TS_Spatial.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,92 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.jena.query.spatial;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+import org.apache.jena.query.spatial.assembler.TestEntityDefinitionAssembler;
+import org.apache.jena.query.spatial.assembler.TestSpatialDatasetAssembler;
+import org.apache.jena.query.spatial.assembler.TestSpatialIndexLuceneAssembler;
+import org.apache.jena.query.spatial.pfunction.lucene.TestEastPFWithLuceneSpatialIndex;
+import org.apache.jena.query.spatial.pfunction.lucene.TestIntersectsBoxPFWithLuceneSpatialIndex;
+import org.apache.jena.query.spatial.pfunction.lucene.TestIsNearByPFWithLuceneSpatialIndex;
+import org.apache.jena.query.spatial.pfunction.lucene.TestIsWithinBoxPFWithLuceneSpatialIndex;
+import org.apache.jena.query.spatial.pfunction.lucene.TestIsWithinCirclePFWithLuceneSpatialIndex;
+import org.apache.jena.query.spatial.pfunction.lucene.TestNorthPFWithLuceneSpatialIndex;
+import org.apache.jena.query.spatial.pfunction.lucene.TestSouthPFWithLuceneSpatialIndex;
+import org.apache.jena.query.spatial.pfunction.lucene.TestWestPFWithLuceneSpatialIndex;
+import org.apache.jena.query.spatial.pfunction.solr.TestEastPFWithEmbeddedSolrSpatialIndex;
+import org.apache.jena.query.spatial.pfunction.solr.TestIntersectsBoxPFWithEmbeddedSolrSpatialIndex;
+import org.apache.jena.query.spatial.pfunction.solr.TestIsNearByPFWithEmbeddedSolrSpatialIndex;
+import org.apache.jena.query.spatial.pfunction.solr.TestIsWithinBoxPFWithEmbeddedSolrSpatialIndex;
+import org.apache.jena.query.spatial.pfunction.solr.TestIsWithinCirclePFWithEmbeddedSolrSpatialIndex;
+import org.apache.jena.query.spatial.pfunction.solr.TestNorthPFWithEmbeddedSolrSpatialIndex;
+import org.apache.jena.query.spatial.pfunction.solr.TestSouthPFWithEmbeddedSolrSpatialIndex;
+import org.apache.jena.query.spatial.pfunction.solr.TestWestPFWithEmbeddedSolrSpatialIndex;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({
+	
+		TestIsWithinCirclePFWithLuceneSpatialIndex.class,
+		TestIsNearByPFWithLuceneSpatialIndex.class,
+		TestIsWithinBoxPFWithLuceneSpatialIndex.class,
+		TestIntersectsBoxPFWithLuceneSpatialIndex.class,
+		TestNorthPFWithLuceneSpatialIndex.class,
+		TestSouthPFWithLuceneSpatialIndex.class,
+		TestEastPFWithLuceneSpatialIndex.class,
+		TestWestPFWithLuceneSpatialIndex.class,
+		
+		TestIsWithinCirclePFWithEmbeddedSolrSpatialIndex.class,
+		TestIsNearByPFWithEmbeddedSolrSpatialIndex.class,
+		TestIsWithinBoxPFWithEmbeddedSolrSpatialIndex.class,
+		TestIntersectsBoxPFWithEmbeddedSolrSpatialIndex.class,
+		TestNorthPFWithEmbeddedSolrSpatialIndex.class,
+		TestSouthPFWithEmbeddedSolrSpatialIndex.class,
+		TestEastPFWithEmbeddedSolrSpatialIndex.class,
+		TestWestPFWithEmbeddedSolrSpatialIndex.class,
+		
+		TestTDBDatasetWithLuceneSpatialIndex.class,
+		TestIndexingSpatialDataWithLucene.class,
+
+		TestEntityDefinitionAssembler.class,
+		TestSpatialDatasetAssembler.class,
+		TestSpatialIndexLuceneAssembler.class,
+		TestSpatialPredicatePairValue.class
+		
+		})
+public class TS_Spatial {
+}

Propchange: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TS_Spatial.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TestIndexingSpatialDataWithLucene.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TestIndexingSpatialDataWithLucene.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TestIndexingSpatialDataWithLucene.java (added)
+++ jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TestIndexingSpatialDataWithLucene.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.jena.query.spatial;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.jena.atlas.lib.StrUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestIndexingSpatialDataWithLucene extends
+		AbstractTestDatasetWithSpatialIndex {
+	private static final String INDEX_PATH = "target/test/IsNearByPFWithLuceneSpatialIndex";
+	private static final File INDEX_DIR = new File(INDEX_PATH);
+
+	@Before
+	public void init() throws IOException {
+		dataset = SpatialSearchUtil
+				.initInMemoryDatasetWithLuceneSpatitalIndex(INDEX_DIR);
+	}
+
+	@After
+	public void destroy() {
+		SpatialSearchUtil.deleteOldFiles(INDEX_DIR);
+	}
+
+	@Test
+	public void testIndexingStringLiteral() {
+		final String turtle = StrUtils.strjoinNL(TURTLE_PROLOG, "<"
+				+ RESOURCE_BASE + "testIndexingStringLiteral>",
+				"   geo:lat '51.3827' ;", "   geo:long '-2.71909' ", ".");
+		String queryString = StrUtils
+				.strjoinNL(
+						QUERY_PROLOG,
+						"SELECT ?s",
+						"WHERE {",
+						" ?s spatial:nearby (51.3000 -2.71000 100.0 'miles' -1) .",
+						"}");
+		Set<String> expectedURIs = (new HashSet<String>());
+		expectedURIs
+				.addAll(Arrays
+						.asList((new String[] { "http://example.org/data/resource/testIndexingStringLiteral" })));
+		doTestSearch(turtle, queryString, expectedURIs);
+	}
+
+	@Test
+	public void testIndexingWKTLiteral() {
+		final String turtle = StrUtils.strjoinNL(TURTLE_PROLOG, "<"
+				+ RESOURCE_BASE + "testIndexingWKTLiteral>",
+				"   wkt:asWKT 'POINT(-1.74803 52.4539)'^^wkt:wktLiteral  ",
+				".");
+		String queryString = StrUtils
+				.strjoinNL(
+						QUERY_PROLOG,
+						"SELECT ?s",
+						"WHERE {",
+						" ?s spatial:nearby (51.3000 -2.71000 100.0 'miles' -1) .",
+						"}");
+		Set<String> expectedURIs = (new HashSet<String>());
+		expectedURIs
+				.addAll(Arrays
+						.asList((new String[] { "http://example.org/data/resource/testIndexingWKTLiteral" })));
+		doTestSearch(turtle, queryString, expectedURIs);
+	}
+
+}

Propchange: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TestIndexingSpatialDataWithLucene.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TestSpatialPredicatePairValue.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TestSpatialPredicatePairValue.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TestSpatialPredicatePairValue.java (added)
+++ jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TestSpatialPredicatePairValue.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.jena.query.spatial;
+
+import junit.framework.TestCase;
+
+import org.junit.Test;
+
+public class TestSpatialPredicatePairValue {
+
+	@Test public void testEqualsAndHashcode(){
+		SpatialPredicatePair pair1 = new SpatialPredicatePair(
+				EntityDefinition.geo_latitude.asNode(),
+				EntityDefinition.geo_longitude.asNode());
+		SpatialPredicatePair pair2 = new SpatialPredicatePair(
+				EntityDefinition.geo_latitude.asNode(),
+				EntityDefinition.geo_longitude.asNode());
+		TestCase.assertTrue(pair1.equals(pair2));
+		TestCase.assertTrue(pair1.hashCode() == pair2.hashCode());
+
+		SpatialPredicatePairValue value1 = new SpatialPredicatePairValue(pair1);
+		value1.setValue(EntityDefinition.geo_latitude.asNode(), 12.0);
+		value1.setValue(EntityDefinition.geo_longitude.asNode(), 23.0);
+
+		SpatialPredicatePairValue value2 = new SpatialPredicatePairValue(pair2);
+		value2.setValue(EntityDefinition.geo_latitude.asNode(), 12.0);
+		value2.setValue(EntityDefinition.geo_longitude.asNode(), 23.0);
+
+		TestCase.assertTrue(value1.equals(value2));
+		TestCase.assertTrue(value1.hashCode() == value2.hashCode());
+		
+		value1.setValue(EntityDefinition.geo_latitude.asNode(),null);
+		value2.setValue(EntityDefinition.geo_latitude.asNode(),null);
+		
+		TestCase.assertTrue(value1.equals(value2));
+		TestCase.assertTrue(value1.hashCode() == value2.hashCode());
+		
+		value2.setValue(EntityDefinition.geo_latitude.asNode(),23.0);
+		TestCase.assertFalse(value1.equals(value2));
+		TestCase.assertFalse(value1.hashCode() == value2.hashCode());
+	}
+
+}

Propchange: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TestSpatialPredicatePairValue.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TestTDBDatasetWithLuceneSpatialIndex.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TestTDBDatasetWithLuceneSpatialIndex.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TestTDBDatasetWithLuceneSpatialIndex.java (added)
+++ jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TestTDBDatasetWithLuceneSpatialIndex.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.jena.query.spatial;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.jena.atlas.lib.StrUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestTDBDatasetWithLuceneSpatialIndex extends
+		AbstractTestDatasetWithSpatialIndex {
+
+	private static final String INDEX_PATH = "target/test/TBDDatasetWithLuceneSpatialIndex";
+	private static final File INDEX_DIR = new File(INDEX_PATH);
+	private static final String TDB_PATH = "target/test/TDB";
+	private static final File TDB_DIR = new File(TDB_PATH);
+
+	@Before
+	public void init() throws IOException {
+		dataset = SpatialSearchUtil.initTDBDatasetWithLuceneSpatitalIndex(
+				INDEX_DIR, TDB_DIR);
+	}
+
+	@After
+	public void destroy() {
+		SpatialSearchUtil.deleteOldFiles(INDEX_DIR);
+		SpatialSearchUtil.deleteOldFiles(TDB_DIR);
+	}
+
+	@Test
+	public void testOneSimpleResult() {
+		final String turtle = StrUtils.strjoinNL(TURTLE_PROLOG, "<"
+				+ RESOURCE_BASE + "testOneSimpleResult>",
+				"   geo:lat '51.3827'^^xsd:float ;",
+				"   geo:long '-2.71909'^^xsd:float ", ".");
+		String queryString = StrUtils
+				.strjoinNL(
+						QUERY_PROLOG,
+						"SELECT ?s",
+						"WHERE {",
+						" ?s spatial:nearby (51.3000 -2.71000 100.0 'miles' -1) .",
+						"}");
+		Set<String> expectedURIs = (new HashSet<String>());
+		expectedURIs
+				.addAll(Arrays
+						.asList((new String[] { "http://example.org/data/resource/testOneSimpleResult" })));
+		doTestSearch(turtle, queryString, expectedURIs);
+	}
+
+	@Test
+	public void testMultipleResults() {
+		String label = "testMultipleResults";
+		final String turtle = StrUtils.strjoinNL(TURTLE_PROLOG, "<"
+				+ RESOURCE_BASE + label + "1>",
+				"   geo:lat '51.3827'^^xsd:float ;",
+				"   geo:long '-2.71909'^^xsd:float ;", ".", "<" + RESOURCE_BASE
+						+ label + "2>", "   geo:lat '51.3967'^^xsd:float ;",
+				"   geo:long '-3.34333'^^xsd:float ;", ".");
+
+		String queryString = StrUtils
+				.strjoinNL(
+						QUERY_PROLOG,
+						"SELECT ?s",
+						"WHERE {",
+						" ?s spatial:nearby (51.3000 -2.71000 100.0 'miles' -1) .",
+						"}");
+		Set<String> expectedURIs = (new HashSet<String>());
+		expectedURIs.addAll(Arrays.asList((new String[] {
+				"http://example.org/data/resource/" + label + "1",
+				"http://example.org/data/resource/" + label + "2" })));
+		doTestSearch(turtle, queryString, expectedURIs);
+	}
+}

Propchange: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/TestTDBDatasetWithLuceneSpatialIndex.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/AbstractTestSpatialAssembler.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/AbstractTestSpatialAssembler.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/AbstractTestSpatialAssembler.java (added)
+++ jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/AbstractTestSpatialAssembler.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.jena.query.spatial.assembler;
+
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import com.hp.hpl.jena.rdf.model.RDFNode;
+import com.hp.hpl.jena.rdf.model.Resource;
+import com.hp.hpl.jena.tdb.assembler.VocabTDB;
+import com.hp.hpl.jena.vocabulary.RDF;
+
+public abstract class AbstractTestSpatialAssembler {
+	protected static final Model model = ModelFactory.createDefaultModel();
+	private static final String TESTBASE = "http://example.org/abstractTestSpatialAssembler/";
+	protected static final Resource SIMPLE_DATASET_SPEC;
+	protected static final Resource SIMPLE_LUCENE_INDEX_SPEC;
+	protected static final Resource SIMPLE_SOLR_INDEX_SPEC;
+	protected static final Resource SIMPLE_ENTITY_DEFINITION_SPEC;
+	
+	static {
+		SIMPLE_ENTITY_DEFINITION_SPEC = 
+				model.createResource(TESTBASE + "simpleEntityDefinitionSpec")
+				     .addProperty(RDF.type, SpatialVocab.definition)
+				     .addProperty(SpatialVocab.pEntityField, "uri")
+				     .addProperty(SpatialVocab.pGeoField, "geo")
+				     .addProperty(SpatialVocab.pHasSpatialPredicatePairs,
+				    		      model.createList(
+				    		    		  new RDFNode[] {
+				    		    				model.createResource()
+				    		    				     .addProperty(SpatialVocab.pLatitude, model.createResource(TESTBASE+"latitude_1"))
+				    		    				     .addProperty(SpatialVocab.pLongitude, model.createResource(TESTBASE+"longitude_1")),
+				    		    				model.createResource()
+				    		    				     .addProperty(SpatialVocab.pLatitude, model.createResource(TESTBASE+"latitude_2"))
+				    		    				     .addProperty(SpatialVocab.pLongitude, model.createResource(TESTBASE+"longitude_2")),
+				    		    		  }))
+				     .addProperty(SpatialVocab.pHasWKTPredicates,
+				    		      model.createList(
+				    		    		  new RDFNode[] {
+				    		    				  model.createResource(TESTBASE+"wkt_1"),
+				    		    				  model.createResource(TESTBASE+"wkt_2")
+				    		    		  }))
+				     ;
+		SIMPLE_DATASET_SPEC =
+				model.createResource(TESTBASE + "simpleDatasetSpec")
+				     .addProperty(RDF.type, VocabTDB.tDatasetTDB)
+				     .addProperty(VocabTDB.pLocation, "target/test/simpleDB");
+		
+		SIMPLE_LUCENE_INDEX_SPEC =
+				model.createResource(TESTBASE + "simpleLuceneIndexSpec")
+				     .addProperty(RDF.type, SpatialVocab.spatialIndexLucene)
+				     .addProperty(SpatialVocab.pDirectory, model.createResource("file:target/test/simpleLuceneIndex"))
+				     .addProperty(SpatialVocab.pDefinition, SIMPLE_ENTITY_DEFINITION_SPEC);
+		
+		SIMPLE_SOLR_INDEX_SPEC =
+				model.createResource(TESTBASE + "simpleSolrIndexSpec")
+				     .addProperty(RDF.type, SpatialVocab.spatialIndexSolr)
+				     .addProperty(SpatialVocab.pServer, model.createResource("http://localhost:8080/solr"))
+				     .addProperty(SpatialVocab.pDefinition, SIMPLE_ENTITY_DEFINITION_SPEC);
+	}
+
+}

Propchange: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/AbstractTestSpatialAssembler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestEntityDefinitionAssembler.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestEntityDefinitionAssembler.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestEntityDefinitionAssembler.java (added)
+++ jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestEntityDefinitionAssembler.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.jena.query.spatial.assembler;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.jena.query.spatial.EntityDefinition;
+import org.apache.jena.query.spatial.SpatialIndexException;
+import org.junit.Test;
+
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import com.hp.hpl.jena.rdf.model.RDFNode;
+import com.hp.hpl.jena.rdf.model.Resource;
+import com.hp.hpl.jena.rdf.model.ResourceFactory;
+
+/**
+ * Test assembler for EntityDefinition
+ */
+public class TestEntityDefinitionAssembler {
+	
+	private static final String TESTBASE = "http://example.org/test/";
+	private static final Resource spec0;
+	private static final Resource spec1;
+	private static final Resource spec2;
+	private static final Resource specNoEntityField;
+	private static final Resource specNoGeoField;
+
+	
+	@Test public void EntityHasGeoield() {
+		EntityDefinitionAssembler emAssembler = new EntityDefinitionAssembler();
+		EntityDefinition entityDef = emAssembler.open(null, spec0, null);
+		assertEquals(SPEC0_GEO_FIELD, entityDef.getGeoField());
+	}
+	
+	@Test public void EntityHasEntityField() {
+		EntityDefinitionAssembler emAssembler = new EntityDefinitionAssembler();
+		EntityDefinition entityDef = emAssembler.open(null, spec0, null);
+		assertEquals(SPEC0_ENTITY_FIELD, entityDef.getEntityField());		
+	}
+	
+	@Test public void EntityHasPair() {
+		EntityDefinitionAssembler emAssembler = new EntityDefinitionAssembler();
+		EntityDefinition entityDef = emAssembler.open(null, spec1, null);
+		assertEquals(1, entityDef.getCustomSpatialPredicatePairCount());
+		assertEquals(true, entityDef.hasSpatialPredicatePair(SPEC1_LATITUDE.asNode(), SPEC1_LONGITUDE.asNode()));
+		
+	}
+	
+	@Test public void EntityHasWKT() {
+		EntityDefinitionAssembler emAssembler = new EntityDefinitionAssembler();
+		EntityDefinition entityDef = emAssembler.open(null, spec1, null);
+		assertEquals(1, entityDef.getCustomWKTPredicateCount());
+		assertEquals(true, entityDef.isWKTPredicate(SPEC1_WKT.asNode()));
+		
+	}
+	
+
+    @Test public void EntityHasMultiplePairsAndWKTs() {
+		EntityDefinitionAssembler emAssembler = new EntityDefinitionAssembler();
+		EntityDefinition entityDef = emAssembler.open(null, spec2, null);
+		assertEquals(2, entityDef.getCustomSpatialPredicatePairCount());
+		assertEquals(true, entityDef.hasSpatialPredicatePair(SPEC2_LATITUDE_1.asNode(), SPEC2_LONGITUDE_1.asNode()));
+		assertEquals(true, entityDef.hasSpatialPredicatePair(SPEC2_LATITUDE_2.asNode(), SPEC2_LONGITUDE_2.asNode()));
+		assertEquals(false, entityDef.hasSpatialPredicatePair(SPEC2_LATITUDE_1.asNode(), SPEC2_LONGITUDE_2.asNode()));
+		assertEquals(false, entityDef.hasSpatialPredicatePair(SPEC2_LATITUDE_2.asNode(), SPEC2_LONGITUDE_1.asNode()));
+		assertEquals(2, entityDef.getCustomWKTPredicateCount());
+		assertEquals(true, entityDef.isWKTPredicate(SPEC2_WKT_1.asNode()));
+		assertEquals(true, entityDef.isWKTPredicate(SPEC2_WKT_2.asNode()));
+		assertEquals(false, entityDef.isWKTPredicate(SPEC1_WKT.asNode()));
+	}
+	
+	@Test(expected=SpatialIndexException.class) public void errorOnNoEntityField() {
+		EntityDefinitionAssembler emAssembler = new EntityDefinitionAssembler();
+		emAssembler.open(null, specNoEntityField, null);
+	}
+	
+	@Test(expected=SpatialIndexException.class) public void errorOnNoGeoField() {
+		EntityDefinitionAssembler emAssembler = new EntityDefinitionAssembler();
+		emAssembler.open(null, specNoGeoField, null);
+	}
+
+	
+	private static final String SPEC0_ENTITY_FIELD = "spec0EntityField";
+	private static final String SPEC0_GEO_FIELD = "spec0GeoField";
+    
+    private static final String SPEC1_ENTITY_FIELD = "spec1EntityField";
+	private static final String SPEC1_GEO_FIELD = "spec1GeoField";
+	private static final Resource SPEC1_LATITUDE = ResourceFactory.createResource(TESTBASE+"latitude");
+	private static final Resource SPEC1_LONGITUDE = ResourceFactory.createResource(TESTBASE+"longitude");
+	private static final Resource SPEC1_WKT = ResourceFactory.createResource(TESTBASE+"wkt");
+	
+	private static final String SPEC2_ENTITY_FIELD = "spec2EntityField";
+	private static final String SPEC2_GEO_FIELD = "spec2DefaultField";
+	private static final Resource SPEC2_LATITUDE_1 = ResourceFactory.createResource(TESTBASE+"latitude_1");
+	private static final Resource SPEC2_LONGITUDE_1 = ResourceFactory.createResource(TESTBASE+"longitude_1");
+	private static final Resource SPEC2_LATITUDE_2 = ResourceFactory.createResource(TESTBASE+"latitude_2");
+	private static final Resource SPEC2_LONGITUDE_2 = ResourceFactory.createResource(TESTBASE+"longitude_2");
+	private static final Resource SPEC2_WKT_1 = ResourceFactory.createResource(TESTBASE+"wkt_1");
+	private static final Resource SPEC2_WKT_2 = ResourceFactory.createResource(TESTBASE+"wkt_2");
+	
+	static {
+		
+		// create a mininal specification
+		Model model = ModelFactory.createDefaultModel();
+		model = ModelFactory.createDefaultModel();
+		spec0 = model.createResource(TESTBASE + "spec0")
+				     .addProperty(SpatialVocab.pEntityField, SPEC0_ENTITY_FIELD)
+				     .addProperty(SpatialVocab.pGeoField, SPEC0_GEO_FIELD)
+				     ;
+		
+		// create a simple pair specification
+		model = ModelFactory.createDefaultModel();
+		spec1 = model.createResource(TESTBASE + "spec1")
+				     .addProperty(SpatialVocab.pEntityField, SPEC1_ENTITY_FIELD)
+				     .addProperty(SpatialVocab.pGeoField, SPEC1_GEO_FIELD)
+				     .addProperty(SpatialVocab.pHasSpatialPredicatePairs,
+				    		      model.createList(
+				    		    		  new RDFNode[] {
+				    		    				model.createResource()
+				    		    				     .addProperty(SpatialVocab.pLatitude, SPEC1_LATITUDE)
+				    		    				     .addProperty(SpatialVocab.pLongitude, SPEC1_LONGITUDE)
+				    		    		  }))
+				     .addProperty(SpatialVocab.pHasWKTPredicates,
+				    		      model.createList(
+				    		    		  new RDFNode[] {
+				    		    				  SPEC1_WKT
+				    		    		  }))
+				     ;
+		
+		// create an entity definition specification with multiple pairs and wkts
+		model = ModelFactory.createDefaultModel();
+		spec2 = model.createResource(TESTBASE + "spec2")
+			     .addProperty(SpatialVocab.pEntityField, SPEC2_ENTITY_FIELD)
+			     .addProperty(SpatialVocab.pGeoField, SPEC2_GEO_FIELD)
+			     .addProperty(SpatialVocab.pHasSpatialPredicatePairs,
+			    		      model.createList(
+			    		    		  new RDFNode[] {
+			    		    				model.createResource()
+			    		    				     .addProperty(SpatialVocab.pLatitude, SPEC2_LATITUDE_1)
+			    		    				     .addProperty(SpatialVocab.pLongitude, SPEC2_LONGITUDE_1),
+			    		    			    model.createResource()
+			    		    				     .addProperty(SpatialVocab.pLatitude, SPEC2_LATITUDE_2)
+			    		    				     .addProperty(SpatialVocab.pLongitude, SPEC2_LONGITUDE_2)
+			    		    		  }))
+			     .addProperty(SpatialVocab.pHasWKTPredicates,
+			    		      model.createList(
+			    		    		  new RDFNode[] {
+			    		    				  SPEC2_WKT_1, SPEC2_WKT_2
+			    		    		  }))
+			     ;
+		// bad assembler spec
+		model = ModelFactory.createDefaultModel();
+		specNoEntityField = 
+				model.createResource(TESTBASE + "specNoEntityField")
+				     .addProperty(SpatialVocab.pGeoField, SPEC0_GEO_FIELD)
+				     ;
+		
+		// bad assembler spec
+		model = ModelFactory.createDefaultModel();
+		specNoGeoField = 
+				model.createResource(TESTBASE + "specNoGeoField")
+				     .addProperty(SpatialVocab.pEntityField, SPEC0_ENTITY_FIELD)
+				     ;
+		
+	}
+}

Propchange: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestEntityDefinitionAssembler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestSpatialDatasetAssembler.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestSpatialDatasetAssembler.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestSpatialDatasetAssembler.java (added)
+++ jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestSpatialDatasetAssembler.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.jena.query.spatial.assembler;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.apache.jena.query.spatial.SpatialIndexLucene;
+import org.apache.jena.query.spatial.SpatialQuery;
+import org.junit.Test;
+
+import com.hp.hpl.jena.assembler.Assembler;
+import com.hp.hpl.jena.query.Dataset;
+import com.hp.hpl.jena.rdf.model.Resource;
+import com.hp.hpl.jena.tdb.assembler.AssemblerTDB;
+import com.hp.hpl.jena.vocabulary.RDF;
+
+/**
+ * Test the spatial dataset assembler.
+ */
+public class TestSpatialDatasetAssembler extends AbstractTestSpatialAssembler {
+	
+	private static final String TESTBASE = "http://example.org/testDatasetAssembler/";
+	
+	private static final Resource spec1;
+	private static final Resource noDatasetPropertySpec;
+	private static final Resource noIndexPropertySpec;
+	
+	@Test public void testSimpleDatasetAssembler() {
+		Dataset dataset = (Dataset) Assembler.general.open(spec1);
+		assertTrue(dataset.getContext().get(SpatialQuery.spatialIndex) instanceof SpatialIndexLucene);
+	}
+	
+	@Test public void testErrorOnNoDataset() {
+		try {
+		    Assembler.general.open(noDatasetPropertySpec);
+		    fail("should have thrown an exception");
+		} catch (Exception e) {}
+	}
+	
+	@Test public void testErrorOnNoIndex() {
+		try {
+		    Assembler.general.open(noIndexPropertySpec);
+		    fail("should have thrown an exception");
+		} catch (Exception e) {}
+	}
+	
+	static {
+		SpatialAssembler.init();
+		AssemblerTDB.init();
+		spec1 =
+				model.createResource(TESTBASE + "spec1")
+				     .addProperty(RDF.type, SpatialVocab.spatialDataset)
+				     .addProperty(SpatialVocab.pDataset, SIMPLE_DATASET_SPEC)
+				     .addProperty(SpatialVocab.pIndex, SIMPLE_LUCENE_INDEX_SPEC);
+		noDatasetPropertySpec =
+				model.createResource(TESTBASE + "noDatasetPropertySpec")
+				     .addProperty(RDF.type, SpatialVocab.spatialDataset)
+				     .addProperty(SpatialVocab.pIndex, SIMPLE_LUCENE_INDEX_SPEC);
+		noIndexPropertySpec =
+				model.createResource(TESTBASE + "noIndexPropertySpec")
+				     .addProperty(RDF.type, SpatialVocab.spatialDataset)
+				     .addProperty(SpatialVocab.pDataset, SIMPLE_DATASET_SPEC);
+		
+	}
+
+}

Propchange: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestSpatialDatasetAssembler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestSpatialIndexLuceneAssembler.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestSpatialIndexLuceneAssembler.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestSpatialIndexLuceneAssembler.java (added)
+++ jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestSpatialIndexLuceneAssembler.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.jena.query.spatial.assembler;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.jena.query.spatial.SpatialIndexLucene;
+import org.junit.Test;
+
+import com.hp.hpl.jena.assembler.Assembler;
+import com.hp.hpl.jena.vocabulary.RDFS;
+
+public class TestSpatialIndexLuceneAssembler extends AbstractTestSpatialAssembler {
+	
+	@Test public void testIndexHasEntityMap() {
+		SpatialIndexLucene indexLucene = (SpatialIndexLucene) Assembler.general.open(SIMPLE_LUCENE_INDEX_SPEC);
+		assertEquals("uri", indexLucene.getDocDef().getEntityField());
+		assertEquals("geo", indexLucene.getDocDef().getGeoField());	
+	}
+	
+	static {
+		SpatialAssembler.init();
+	}
+
+}

Propchange: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestSpatialIndexLuceneAssembler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestSpatialIndexSolrAssembler.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestSpatialIndexSolrAssembler.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestSpatialIndexSolrAssembler.java (added)
+++ jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestSpatialIndexSolrAssembler.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.jena.query.spatial.assembler;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.jena.query.spatial.SpatialIndexSolr;
+import org.junit.Test;
+
+import com.hp.hpl.jena.assembler.Assembler;
+
+public class TestSpatialIndexSolrAssembler extends AbstractTestSpatialAssembler {
+	
+	@Test public void testIndexHasEntityMap() {
+		SpatialIndexSolr indexSolr = (SpatialIndexSolr) Assembler.general.open(SIMPLE_SOLR_INDEX_SPEC);
+		assertEquals("uri", indexSolr.getDocDef().getEntityField());
+		assertEquals("geo", indexSolr.getDocDef().getGeoField());	
+	}
+	
+	static {
+		SpatialAssembler.init();
+	}
+
+}

Propchange: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/assembler/TestSpatialIndexSolrAssembler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestEastPF.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestEastPF.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestEastPF.java (added)
+++ jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestEastPF.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.jena.query.spatial.pfunction;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.jena.atlas.lib.StrUtils;
+import org.apache.jena.query.spatial.AbstractTestDatasetWithSpatialIndex;
+import org.junit.Test;
+
+public abstract class AbstractTestEastPF extends AbstractTestDatasetWithSpatialIndex {
+
+	@Test
+	public void testOneSimpleResult() {
+		final String turtle = StrUtils.strjoinNL(TURTLE_PROLOG, "<"
+				+ RESOURCE_BASE + "testOneSimpleResult>",
+				"   geo:lat '51.885'^^xsd:float ;",
+				"   geo:long '0.235'^^xsd:float ", ".");
+		String queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s",
+				"WHERE {",
+				" ?s spatial:east (51.3000 0.0000 -1) .", "}");
+		Set<String> expectedURIs = (new HashSet<String>());
+		expectedURIs
+				.addAll(Arrays
+						.asList((new String[] { "http://example.org/data/resource/testOneSimpleResult" })));
+		doTestSearch(turtle, queryString, expectedURIs);
+	}
+
+	@Test
+	public void testMultipleResults() {
+		String label = "testMultipleResults";
+		final String turtle = StrUtils.strjoinNL(TURTLE_PROLOG, "<"
+				+ RESOURCE_BASE + label + "1>",
+				"   geo:lat '51.885'^^xsd:float ;",
+				"   geo:long '0.234'^^xsd:float ", ".",
+				"<"	+ RESOURCE_BASE + label + "2>",
+				"   geo:lat '51.1234'^^xsd:float ;",
+				"   geo:long '1.234'^^xsd:float ;", ".");
+
+		String queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s",
+				"WHERE {",
+				" ?s spatial:east (51.3000 0.0000 -1) .", "}");
+		Set<String> expectedURIs = (new HashSet<String>());
+		expectedURIs.addAll(Arrays.asList((new String[] {
+				"http://example.org/data/resource/" + label + "1",
+				"http://example.org/data/resource/" + label + "2" })));
+		doTestSearch(turtle, queryString, expectedURIs);
+	}
+	
+	@Test
+	public void testArgumentListSize() {
+		final String turtle = StrUtils.strjoinNL(TURTLE_PROLOG, "<"
+				+ RESOURCE_BASE + "testArgumentListSize>",
+				"   geo:lat '51.3827'^^xsd:float ;",
+				"   geo:long '-2.71909'^^xsd:float ", ".");
+		String queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s",
+				"WHERE {",
+				" ?s spatial:east (51.3000) .", "}");
+		doTestSearchThrowException(turtle, queryString);
+		
+		queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s",
+				"WHERE {",
+				" ?s spatial:east (51.3000 0.0000 -1 'another argument') .", "}");
+		doTestSearchThrowException(turtle, queryString);
+	}
+	
+  @Test
+	public void testSearchLimitsResults() {
+		String label = "testSearchLimitsResults";
+		final String turtle = StrUtils.strjoinNL(TURTLE_PROLOG, "<"
+				+ RESOURCE_BASE + label + "1>",
+				"   geo:lat '51.885'^^xsd:float ;",
+				"   geo:long '0.234'^^xsd:float ", ".",
+				"<"	+ RESOURCE_BASE + label + "2>",
+				"   geo:lat '51.1234'^^xsd:float ;",
+				"   geo:long '1.234'^^xsd:float ;", ".");
+		String queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s",
+				"WHERE {",
+				" ?s spatial:north (51.3000 0.0000 1) .", "}");
+		Set<String> expectedURIs = (new HashSet<String>());
+		expectedURIs.addAll( Arrays.asList((
+				new String[]
+				{
+					    "http://example.org/data/resource/" + label + "1",
+					    "http://example.org/data/resource/" + label + "2"
+				}
+		)));
+		doTestSearch(turtle, queryString, expectedURIs, 1);
+		
+		
+		queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s",
+				"WHERE {",
+				" ?s spatial:east (51.3000 0.0000 -1) .", "}");
+		expectedURIs = (new HashSet<String>());
+		expectedURIs.addAll( Arrays.asList((
+				new String[]
+				{
+					    "http://example.org/data/resource/" + label + "1",
+					    "http://example.org/data/resource/" + label + "2"
+				}
+		)));
+		doTestSearch(turtle, queryString, expectedURIs);
+		
+		queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s",
+				"WHERE {",
+				" ?s spatial:east (51.3000 0.0000 3) .", "}");
+		expectedURIs = (new HashSet<String>());
+		expectedURIs.addAll( Arrays.asList((
+				new String[]
+				{
+					    "http://example.org/data/resource/" + label + "1",
+					    "http://example.org/data/resource/" + label + "2"
+				}
+		)));
+		doTestSearch(turtle, queryString, expectedURIs);
+		
+		queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s",
+				"WHERE {",
+				" ?s spatial:east (51.3000 0.0000 'something not an integer') .", "}");
+		expectedURIs = (new HashSet<String>());
+		doTestSearch(turtle, queryString, expectedURIs);
+	}
+  
+}

Propchange: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestEastPF.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestIntersectsBoxPF.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestIntersectsBoxPF.java?rev=1519358&view=auto
==============================================================================
--- jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestIntersectsBoxPF.java (added)
+++ jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestIntersectsBoxPF.java Mon Sep  2 06:46:19 2013
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.jena.query.spatial.pfunction;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.jena.atlas.lib.StrUtils;
+import org.apache.jena.query.spatial.AbstractTestDatasetWithSpatialIndex;
+import org.junit.Test;
+
+public abstract class AbstractTestIntersectsBoxPF extends AbstractTestDatasetWithSpatialIndex {
+
+	@Test
+	public void testOneSimpleResult() {
+		final String turtle = StrUtils.strjoinNL(TURTLE_PROLOG, "<"
+				+ RESOURCE_BASE + "testOneSimpleResult>",
+				"   geo:lat '51.3827'^^xsd:float ;",
+				"   geo:long '-2.71909'^^xsd:float ", ".");
+		String queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s",
+				"WHERE {",
+				" ?s spatial:intersectBox (51.1000 -4.0000 51.4000 0.0000 -1)  .", "}");
+		Set<String> expectedURIs = (new HashSet<String>());
+		expectedURIs
+				.addAll(Arrays
+						.asList((new String[] { "http://example.org/data/resource/testOneSimpleResult" })));
+		doTestSearch(turtle, queryString, expectedURIs);
+	}
+
+	@Test
+	public void testMultipleResults() {
+		String label = "testMultipleResults";
+		final String turtle = StrUtils.strjoinNL(TURTLE_PROLOG, "<"
+				+ RESOURCE_BASE + label + "1>",
+				"   geo:lat '51.3827'^^xsd:float ;",
+				"   geo:long '-2.71909'^^xsd:float ;" , ".",
+				"<"	+ RESOURCE_BASE + label + "2>",
+				"   geo:lat '51.3967'^^xsd:float ;",
+				"   geo:long '-3.34333'^^xsd:float ;", ".");
+
+		String queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s",
+				"WHERE {",
+				" ?s spatial:intersectBox (51.1000 -4.0000 51.4000 0.0000)  .", "}");
+		Set<String> expectedURIs = (new HashSet<String>());
+		expectedURIs.addAll(Arrays.asList((new String[] {
+				"http://example.org/data/resource/" + label + "1",
+				"http://example.org/data/resource/" + label + "2" })));
+		doTestSearch(turtle, queryString, expectedURIs);
+	}
+	
+	@Test
+	public void testArgumentListSize() {
+		final String turtle = StrUtils.strjoinNL(TURTLE_PROLOG, "<"
+				+ RESOURCE_BASE + "testArgumentListSize>",
+				"   geo:lat '51.3827'^^xsd:float ;",
+				"   geo:long '-2.71909'^^xsd:float ", ".");
+		String queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s",
+				"WHERE {",
+				" ?s spatial:intersectBox (51.1000 -4.0000 -1) .", "}");
+		doTestSearchThrowException(turtle, queryString);
+		
+		queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s",
+				"WHERE {",
+				" ?s spatial:intersectBox (51.1000 -4.0000 51.4000 0.0000 -1 'some other argument') .", "}");
+		doTestSearchThrowException(turtle, queryString);
+	}
+	
+  @Test
+	public void testSearchLimitsResults() {
+		String label = "testSearchLimitsResults";
+		final String turtle = StrUtils.strjoinNL(TURTLE_PROLOG, "<"
+				+ RESOURCE_BASE + label + "1>",
+				"   geo:lat '51.3827'^^xsd:float ;",
+				"   geo:long '-2.71909'^^xsd:float ;" , ".",
+				"<"	+ RESOURCE_BASE + label + "2>",
+				"   geo:lat '51.3967'^^xsd:float ;",
+				"   geo:long '-3.34333'^^xsd:float ;", ".");
+		String queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s",
+				"WHERE {",
+				" ?s spatial:intersectBox (51.1000 -4.0000 51.4000 0.0000 1)   .", "}");
+		Set<String> expectedURIs = (new HashSet<String>());
+		expectedURIs.addAll( Arrays.asList((
+				new String[]
+				{
+					    "http://example.org/data/resource/" + label + "1",
+					    "http://example.org/data/resource/" + label + "2"
+				}
+		)));
+		doTestSearch(turtle, queryString, expectedURIs, 1);
+		
+		
+		queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s",
+				"WHERE {",
+				" ?s spatial:intersectBox (51.1000 -4.0000 51.4000 0.0000 -1)   .", "}");
+		expectedURIs = (new HashSet<String>());
+		expectedURIs.addAll( Arrays.asList((
+				new String[]
+				{
+					    "http://example.org/data/resource/" + label + "1",
+					    "http://example.org/data/resource/" + label + "2"
+				}
+		)));
+		doTestSearch(turtle, queryString, expectedURIs);
+		
+		queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s",
+				"WHERE {",
+				" ?s spatial:intersectBox (51.1000 -4.0000 51.4000 0.0000 3)   .", "}");
+		expectedURIs = (new HashSet<String>());
+		expectedURIs.addAll( Arrays.asList((
+				new String[]
+				{
+					    "http://example.org/data/resource/" + label + "1",
+					    "http://example.org/data/resource/" + label + "2"
+				}
+		)));
+		doTestSearch(turtle, queryString, expectedURIs);
+		
+		queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s",
+				"WHERE {",
+				" ?s spatial:withinBox (51.1000 -4.0000 51.4000 0.0000 'something not an integer')  .", "}");
+		expectedURIs = (new HashSet<String>());
+		doTestSearch(turtle, queryString, expectedURIs);
+	}
+
+}

Propchange: jena/trunk/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestIntersectsBoxPF.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message