jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ki...@apache.org
Subject jena git commit: Replace tabs by spaces in the Jena spatial example source code
Date Sat, 08 Oct 2016 10:48:30 GMT
Repository: jena
Updated Branches:
  refs/heads/master f26031ff5 -> b3af7f2d2


Replace tabs by spaces in the Jena spatial example source code


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/b3af7f2d
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/b3af7f2d
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/b3af7f2d

Branch: refs/heads/master
Commit: b3af7f2d2b26ad9f325e075fded1162264df3117
Parents: f26031f
Author: Bruno P. Kinoshita <brunodepaulak@yahoo.com.br>
Authored: Sat Oct 8 23:47:52 2016 +1300
Committer: Bruno P. Kinoshita <brunodepaulak@yahoo.com.br>
Committed: Sat Oct 8 23:47:52 2016 +1300

----------------------------------------------------------------------
 .../main/java/examples/JenaSpatialExample1.java | 540 +++++++++----------
 1 file changed, 270 insertions(+), 270 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/b3af7f2d/jena-spatial/src/main/java/examples/JenaSpatialExample1.java
----------------------------------------------------------------------
diff --git a/jena-spatial/src/main/java/examples/JenaSpatialExample1.java b/jena-spatial/src/main/java/examples/JenaSpatialExample1.java
index 57f9fed..6583d56 100644
--- a/jena-spatial/src/main/java/examples/JenaSpatialExample1.java
+++ b/jena-spatial/src/main/java/examples/JenaSpatialExample1.java
@@ -37,49 +37,49 @@ import org.slf4j.LoggerFactory ;
 
 /** Build a spatial search dataset */
 public class JenaSpatialExample1 {
-	static {
-		LogCtl.setLog4j();
-	}
-	static Logger log = LoggerFactory.getLogger("JenaSpatialExample");
-	
-	private static final String LUCENE_INDEX_PATH = "target/test/TDBDatasetWithLuceneSpatialIndex";
-	private static final File LUCENE_INDEX_DIR = new File(LUCENE_INDEX_PATH);
-	private static final String LUCENE_TDB_PATH = "target/test/TDB";
-	private static final File LUCENE_TDB_DIR = new File(LUCENE_TDB_PATH);
-	
+    static {
+        LogCtl.setLog4j();
+    }
+    static Logger log = LoggerFactory.getLogger("JenaSpatialExample");
+    
+    private static final String LUCENE_INDEX_PATH = "target/test/TDBDatasetWithLuceneSpatialIndex";
+    private static final File LUCENE_INDEX_DIR = new File(LUCENE_INDEX_PATH);
+    private static final String LUCENE_TDB_PATH = "target/test/TDB";
+    private static final File LUCENE_TDB_DIR = new File(LUCENE_TDB_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);
 
-	public static void main(String... argv) throws IOException {
-		Dataset spatialDataset = initInMemoryDatasetWithLuceneSpatitalIndex(LUCENE_INDEX_DIR);
-		//Dataset spatialDataset = initTDBDatasetWithLuceneSpatitalIndex(indexDir, TDBDir);
-		//Dataset spatialDataset = createLuceneAssembler() ;
-		//Dataset spatialDataset = createSolrAssembler() ;
-		
-		loadData(spatialDataset, "src/test/resources/geoarq-data-1.ttl");
-		queryData(spatialDataset);
-		
-		destroy(spatialDataset);
-	}
-	
-	private static void destroy(Dataset spatialDataset){
+    public static void main(String... argv) throws IOException {
+        Dataset spatialDataset = initInMemoryDatasetWithLuceneSpatitalIndex(LUCENE_INDEX_DIR);
+        //Dataset spatialDataset = initTDBDatasetWithLuceneSpatitalIndex(indexDir, TDBDir);
+        //Dataset spatialDataset = createLuceneAssembler() ;
+        //Dataset spatialDataset = createSolrAssembler() ;
+        
+        loadData(spatialDataset, "src/test/resources/geoarq-data-1.ttl");
+        queryData(spatialDataset);
+        
+        destroy(spatialDataset);
+    }
+    
+    private static void destroy(Dataset spatialDataset){
 
-		SpatialIndex index = (SpatialIndex)spatialDataset.getContext().get(SpatialQuery.spatialIndex);
-		if (index instanceof SpatialIndexLucene){
-			deleteOldFiles(LUCENE_INDEX_DIR);
-			deleteOldFiles(LUCENE_TDB_DIR);
-		}
-		
-//		else if (index instanceof SpatialIndexSolr){
-//			SolrServer server = ((SpatialIndexSolr)index).getServer();
-//			
-//			if (server instanceof EmbeddedSolrServer){
-//				server.shutdown();
-//				deleteOldFiles(SOLR_DATA_DIR);
-//			}
-//		} 
-		
-	}
+        SpatialIndex index = (SpatialIndex)spatialDataset.getContext().get(SpatialQuery.spatialIndex);
+        if (index instanceof SpatialIndexLucene){
+            deleteOldFiles(LUCENE_INDEX_DIR);
+            deleteOldFiles(LUCENE_TDB_DIR);
+        }
+        
+//        else if (index instanceof SpatialIndexSolr){
+//            SolrServer server = ((SpatialIndexSolr)index).getServer();
+//            
+//            if (server instanceof EmbeddedSolrServer){
+//                server.shutdown();
+//                deleteOldFiles(SOLR_DATA_DIR);
+//            }
+//        } 
+        
+    }
     private static void emptyAndDeleteDirectory(File dir) {
         File[] contents = dir.listFiles() ;
         if (contents != null) {
@@ -95,262 +95,262 @@ public class JenaSpatialExample1 {
     }
     
     private static Dataset initInMemoryDatasetWithLuceneSpatitalIndex(File indexDir) throws
IOException{
-		deleteOldFiles(indexDir);
-		indexDir.mkdirs();
-		return createDatasetByCode(indexDir);
+        deleteOldFiles(indexDir);
+        indexDir.mkdirs();
+        return createDatasetByCode(indexDir);
     }
     
     private static Dataset initTDBDatasetWithLuceneSpatitalIndex(File indexDir, File TDBDir)
throws IOException{
-		deleteOldFiles(indexDir);
-		deleteOldFiles(TDBDir);
-		indexDir.mkdirs();
-		TDBDir.mkdir();
-		return createDatasetByCode(indexDir, TDBDir);
+        deleteOldFiles(indexDir);
+        deleteOldFiles(TDBDir);
+        indexDir.mkdirs();
+        TDBDir.mkdir();
+        return createDatasetByCode(indexDir, TDBDir);
     }
     
-	private static void deleteOldFiles(File indexDir) {
-		if (indexDir.exists())
-			emptyAndDeleteDirectory(indexDir);
-	}
-	
-	private static Dataset createDatasetByCode(File indexDir) throws IOException {
-		// Base data
-		Dataset ds1 = DatasetFactory.create();
-		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("entityField", "geoField");
-		
-		// you need JTS lib in the classpath to run the examples
-		entDef.setSpatialContextFactory(SpatialQuery.JTS_SPATIAL_CONTEXT_FACTORY_CLASS);
-		
-		// set custom goe predicates
-		entDef.addSpatialPredicatePair(ResourceFactory.createResource("http://localhost/jena_example/#latitude_1"),
ResourceFactory.createResource("http://localhost/jena_example/#longitude_1"));
-		entDef.addSpatialPredicatePair(ResourceFactory.createResource("http://localhost/jena_example/#latitude_2"),
ResourceFactory.createResource("http://localhost/jena_example/#longitude_2"));
-		entDef.addWKTPredicate(ResourceFactory.createResource("http://localhost/jena_example/#wkt_1"));
-		entDef.addWKTPredicate(ResourceFactory.createResource("http://localhost/jena_example/#wkt_2"));
-		
+    private static void deleteOldFiles(File indexDir) {
+        if (indexDir.exists())
+            emptyAndDeleteDirectory(indexDir);
+    }
+    
+    private static Dataset createDatasetByCode(File indexDir) throws IOException {
+        // Base data
+        Dataset ds1 = DatasetFactory.create();
+        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("entityField", "geoField");
+        
+        // you need JTS lib in the classpath to run the examples
+        entDef.setSpatialContextFactory(SpatialQuery.JTS_SPATIAL_CONTEXT_FACTORY_CLASS);
+        
+        // set custom goe predicates
+        entDef.addSpatialPredicatePair(ResourceFactory.createResource("http://localhost/jena_example/#latitude_1"),
ResourceFactory.createResource("http://localhost/jena_example/#longitude_1"));
+        entDef.addSpatialPredicatePair(ResourceFactory.createResource("http://localhost/jena_example/#latitude_2"),
ResourceFactory.createResource("http://localhost/jena_example/#longitude_2"));
+        entDef.addWKTPredicate(ResourceFactory.createResource("http://localhost/jena_example/#wkt_1"));
+        entDef.addWKTPredicate(ResourceFactory.createResource("http://localhost/jena_example/#wkt_2"));
+        
 
-		// Lucene, index in File system.
-		Directory dir = FSDirectory.open(indexDir);
+        // Lucene, index in File system.
+        Directory dir = FSDirectory.open(indexDir);
 
-		// Join together into a dataset
-		Dataset ds = SpatialDatasetFactory.createLucene(baseDataset, dir, entDef);
+        // Join together into a dataset
+        Dataset ds = SpatialDatasetFactory.createLucene(baseDataset, dir, entDef);
 
-		return ds;
-	}
+        return ds;
+    }
 
-	public static Dataset createLuceneAssembler() {
-		log.info("Construct lucene spatial dataset using an assembler description");
+    public static Dataset createLuceneAssembler() {
+        log.info("Construct lucene spatial dataset using an assembler description");
 
-		Dataset ds = DatasetFactory.assemble("src/test/resources/spatial-config.ttl",
-				"http://localhost/jena_example/#spatial_dataset");
-		
+        Dataset ds = DatasetFactory.assemble("src/test/resources/spatial-config.ttl",
+                "http://localhost/jena_example/#spatial_dataset");
+        
 
-		return ds;
-	}
-	
-	public static Dataset createSolrAssembler() {
-		log.info("Construct solr spatial dataset using an assembler description");
-		
-		Dataset ds = DatasetFactory.assemble("src/test/resources/spatial-solr-config.ttl",
-				"http://localhost/jena_example/#spatial_dataset");
-		return ds;
-	}
+        return ds;
+    }
+    
+    public static Dataset createSolrAssembler() {
+        log.info("Construct solr spatial dataset using an assembler description");
+        
+        Dataset ds = DatasetFactory.assemble("src/test/resources/spatial-solr-config.ttl",
+                "http://localhost/jena_example/#spatial_dataset");
+        return ds;
+    }
 
-	public static void loadData(Dataset spatialDataset, String file) {
-		log.info("Start loading");
-		long startTime = System.nanoTime();
-		spatialDataset.begin(ReadWrite.WRITE);
-		try {
-			Model m = spatialDataset.getDefaultModel();
-			RDFDataMgr.read(m, file);
-			// RDFDataMgr.read(dataset, "D.ttl") ;
-			spatialDataset.commit();
-		} finally {
-			spatialDataset.end();
-		}
+    public static void loadData(Dataset spatialDataset, String file) {
+        log.info("Start loading");
+        long startTime = System.nanoTime();
+        spatialDataset.begin(ReadWrite.WRITE);
+        try {
+            Model m = spatialDataset.getDefaultModel();
+            RDFDataMgr.read(m, file);
+            // RDFDataMgr.read(dataset, "D.ttl") ;
+            spatialDataset.commit();
+        } finally {
+            spatialDataset.end();
+        }
 
-		long finishTime = System.nanoTime();
-		double time = (finishTime - startTime) / 1.0e6;
-		log.info(String.format("Finish loading - %.2fms", time));
-	}
+        long finishTime = System.nanoTime();
+        double time = (finishTime - startTime) / 1.0e6;
+        log.info(String.format("Finish loading - %.2fms", time));
+    }
 
-	public static void queryData(Dataset spatialDataset) {
-		log.info("START");
-		long startTime = System.nanoTime();
-		String pre = StrUtils.strjoinNL("PREFIX : <http://example/>",
-				"PREFIX spatial: <http://jena.apache.org/spatial#>",
-				"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>");
+    public static void queryData(Dataset spatialDataset) {
+        log.info("START");
+        long startTime = System.nanoTime();
+        String pre = StrUtils.strjoinNL("PREFIX : <http://example/>",
+                "PREFIX spatial: <http://jena.apache.org/spatial#>",
+                "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>");
 
-		System.out.println("nearby");
-		String qs = StrUtils.strjoinNL("SELECT * ",
-				" { ?s spatial:nearby (51.3000 -2.71000 100.0 'miles') ;",
-				"      rdfs:label ?label", " }");
+        System.out.println("nearby");
+        String qs = StrUtils.strjoinNL("SELECT * ",
+                " { ?s spatial:nearby (51.3000 -2.71000 100.0 'miles') ;",
+                "      rdfs:label ?label", " }");
 
-		spatialDataset.begin(ReadWrite.READ);
-		try {
-			Query q = QueryFactory.create(pre + "\n" + qs);
-			QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
-			QueryExecUtils.executeQuery(q, qexec);
-		} finally {
-			spatialDataset.end();
-		}
-		long finishTime = System.nanoTime();
-		double time = (finishTime - startTime) / 1.0e6;
-		log.info(String.format("FINISH - %.2fms", time));
+        spatialDataset.begin(ReadWrite.READ);
+        try {
+            Query q = QueryFactory.create(pre + "\n" + qs);
+            QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
+            QueryExecUtils.executeQuery(q, qexec);
+        } finally {
+            spatialDataset.end();
+        }
+        long finishTime = System.nanoTime();
+        double time = (finishTime - startTime) / 1.0e6;
+        log.info(String.format("FINISH - %.2fms", time));
 
-		System.out.println("withinCircle");
-		startTime = System.nanoTime();
-		qs = StrUtils.strjoinNL("SELECT * ",
-				" { ?s spatial:withinCircle (51.3000 -2.71000 100.0 'miles' 3) ;",
-				"      rdfs:label ?label", " }");
+        System.out.println("withinCircle");
+        startTime = System.nanoTime();
+        qs = StrUtils.strjoinNL("SELECT * ",
+                " { ?s spatial:withinCircle (51.3000 -2.71000 100.0 'miles' 3) ;",
+                "      rdfs:label ?label", " }");
 
-		spatialDataset.begin(ReadWrite.READ);
-		try {
-			Query q = QueryFactory.create(pre + "\n" + qs);
-			QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
-			QueryExecUtils.executeQuery(q, qexec);
-		} finally {
-			spatialDataset.end();
-		}
-		finishTime = System.nanoTime();
-		time = (finishTime - startTime) / 1.0e6;
-		log.info(String.format("FINISH - %.2fms", time));
-		
-		System.out.println("withinBox");
-		startTime = System.nanoTime();
-		qs = StrUtils.strjoinNL("SELECT * ",
-				" { ?s spatial:withinBox (51.1000 -4.0000 51.4000 0.0000 -1) ;",
-				"      rdfs:label ?label", " }");
+        spatialDataset.begin(ReadWrite.READ);
+        try {
+            Query q = QueryFactory.create(pre + "\n" + qs);
+            QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
+            QueryExecUtils.executeQuery(q, qexec);
+        } finally {
+            spatialDataset.end();
+        }
+        finishTime = System.nanoTime();
+        time = (finishTime - startTime) / 1.0e6;
+        log.info(String.format("FINISH - %.2fms", time));
+        
+        System.out.println("withinBox");
+        startTime = System.nanoTime();
+        qs = StrUtils.strjoinNL("SELECT * ",
+                " { ?s spatial:withinBox (51.1000 -4.0000 51.4000 0.0000 -1) ;",
+                "      rdfs:label ?label", " }");
 
-		spatialDataset.begin(ReadWrite.READ);
-		try {
-			Query q = QueryFactory.create(pre + "\n" + qs);
-			QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
-			QueryExecUtils.executeQuery(q, qexec);
-		} finally {
-			spatialDataset.end();
-		}
-		finishTime = System.nanoTime();
-		time = (finishTime - startTime) / 1.0e6;
-		log.info(String.format("FINISH - %.2fms", time));
+        spatialDataset.begin(ReadWrite.READ);
+        try {
+            Query q = QueryFactory.create(pre + "\n" + qs);
+            QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
+            QueryExecUtils.executeQuery(q, qexec);
+        } finally {
+            spatialDataset.end();
+        }
+        finishTime = System.nanoTime();
+        time = (finishTime - startTime) / 1.0e6;
+        log.info(String.format("FINISH - %.2fms", time));
 
-		System.out.println("interesectBox");
-		startTime = System.nanoTime();
-		qs = StrUtils.strjoinNL("SELECT * ",
-				" { ?s spatial:intersectBox (51.1000 -4.0000 51.4000 0.0000) ;",
-				"      rdfs:label ?label", " }");
+        System.out.println("interesectBox");
+        startTime = System.nanoTime();
+        qs = StrUtils.strjoinNL("SELECT * ",
+                " { ?s spatial:intersectBox (51.1000 -4.0000 51.4000 0.0000) ;",
+                "      rdfs:label ?label", " }");
 
-		spatialDataset.begin(ReadWrite.READ);
-		try {
-			Query q = QueryFactory.create(pre + "\n" + qs);
-			QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
-			QueryExecUtils.executeQuery(q, qexec);
-		} finally {
-			spatialDataset.end();
-		}
-		finishTime = System.nanoTime();
-		time = (finishTime - startTime) / 1.0e6;
-		log.info(String.format("FINISH - %.2fms", time));
-		
-		
-		System.out.println("north");
-		startTime = System.nanoTime();
-		qs = StrUtils.strjoinNL("SELECT * ",
-				" { ?s spatial:north (51.3000 0.0000) ;",
-				"      rdfs:label ?label", " }");
+        spatialDataset.begin(ReadWrite.READ);
+        try {
+            Query q = QueryFactory.create(pre + "\n" + qs);
+            QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
+            QueryExecUtils.executeQuery(q, qexec);
+        } finally {
+            spatialDataset.end();
+        }
+        finishTime = System.nanoTime();
+        time = (finishTime - startTime) / 1.0e6;
+        log.info(String.format("FINISH - %.2fms", time));
+        
+        
+        System.out.println("north");
+        startTime = System.nanoTime();
+        qs = StrUtils.strjoinNL("SELECT * ",
+                " { ?s spatial:north (51.3000 0.0000) ;",
+                "      rdfs:label ?label", " }");
 
-		spatialDataset.begin(ReadWrite.READ);
-		try {
-			Query q = QueryFactory.create(pre + "\n" + qs);
-			QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
-			QueryExecUtils.executeQuery(q, qexec);
-		} finally {
-			spatialDataset.end();
-		}
-		finishTime = System.nanoTime();
-		time = (finishTime - startTime) / 1.0e6;
-		log.info(String.format("FINISH - %.2fms", time));
-		
-		System.out.println("south");
-		startTime = System.nanoTime();
-		qs = StrUtils.strjoinNL("SELECT * ",
-				" { ?s spatial:south (51.3000 0.0000) ;",
-				"      rdfs:label ?label", " }");
+        spatialDataset.begin(ReadWrite.READ);
+        try {
+            Query q = QueryFactory.create(pre + "\n" + qs);
+            QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
+            QueryExecUtils.executeQuery(q, qexec);
+        } finally {
+            spatialDataset.end();
+        }
+        finishTime = System.nanoTime();
+        time = (finishTime - startTime) / 1.0e6;
+        log.info(String.format("FINISH - %.2fms", time));
+        
+        System.out.println("south");
+        startTime = System.nanoTime();
+        qs = StrUtils.strjoinNL("SELECT * ",
+                " { ?s spatial:south (51.3000 0.0000) ;",
+                "      rdfs:label ?label", " }");
 
-		spatialDataset.begin(ReadWrite.READ);
-		try {
-			Query q = QueryFactory.create(pre + "\n" + qs);
-			QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
-			QueryExecUtils.executeQuery(q, qexec);
-		} finally {
-			spatialDataset.end();
-		}
-		finishTime = System.nanoTime();
-		time = (finishTime - startTime) / 1.0e6;
-		log.info(String.format("FINISH - %.2fms", time));
-		
-		System.out.println("east");
-		startTime = System.nanoTime();
-		qs = StrUtils.strjoinNL("SELECT * ",
-				" { ?s spatial:east (51.3000 0.0000) ;",
-				"      rdfs:label ?label", " }");
+        spatialDataset.begin(ReadWrite.READ);
+        try {
+            Query q = QueryFactory.create(pre + "\n" + qs);
+            QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
+            QueryExecUtils.executeQuery(q, qexec);
+        } finally {
+            spatialDataset.end();
+        }
+        finishTime = System.nanoTime();
+        time = (finishTime - startTime) / 1.0e6;
+        log.info(String.format("FINISH - %.2fms", time));
+        
+        System.out.println("east");
+        startTime = System.nanoTime();
+        qs = StrUtils.strjoinNL("SELECT * ",
+                " { ?s spatial:east (51.3000 0.0000) ;",
+                "      rdfs:label ?label", " }");
 
-		spatialDataset.begin(ReadWrite.READ);
-		try {
-			Query q = QueryFactory.create(pre + "\n" + qs);
-			QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
-			QueryExecUtils.executeQuery(q, qexec);
-		} finally {
-			spatialDataset.end();
-		}
-		finishTime = System.nanoTime();
-		time = (finishTime - startTime) / 1.0e6;
-		log.info(String.format("FINISH - %.2fms", time));
-		
-		System.out.println("west");
-		startTime = System.nanoTime();
-		qs = StrUtils.strjoinNL("SELECT * ",
-				" { ?s spatial:west (51.3000 0.0000) ;",
-				"      rdfs:label ?label", " }");
+        spatialDataset.begin(ReadWrite.READ);
+        try {
+            Query q = QueryFactory.create(pre + "\n" + qs);
+            QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
+            QueryExecUtils.executeQuery(q, qexec);
+        } finally {
+            spatialDataset.end();
+        }
+        finishTime = System.nanoTime();
+        time = (finishTime - startTime) / 1.0e6;
+        log.info(String.format("FINISH - %.2fms", time));
+        
+        System.out.println("west");
+        startTime = System.nanoTime();
+        qs = StrUtils.strjoinNL("SELECT * ",
+                " { ?s spatial:west (51.3000 0.0000) ;",
+                "      rdfs:label ?label", " }");
 
-		spatialDataset.begin(ReadWrite.READ);
-		try {
-			Query q = QueryFactory.create(pre + "\n" + qs);
-			QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
-			QueryExecUtils.executeQuery(q, qexec);
-		} finally {
-			spatialDataset.end();
-		}
-		finishTime = System.nanoTime();
-		time = (finishTime - startTime) / 1.0e6;
-		log.info(String.format("FINISH - %.2fms", time));
-		
-		System.out.println("west2");
-		startTime = System.nanoTime();
-		qs = StrUtils.strjoinNL("SELECT * ",
-				" { ?s spatial:withinBox (51.1 -180.0000 51.9 0.0000) ;",
-				"      rdfs:label ?label", " }");
+        spatialDataset.begin(ReadWrite.READ);
+        try {
+            Query q = QueryFactory.create(pre + "\n" + qs);
+            QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
+            QueryExecUtils.executeQuery(q, qexec);
+        } finally {
+            spatialDataset.end();
+        }
+        finishTime = System.nanoTime();
+        time = (finishTime - startTime) / 1.0e6;
+        log.info(String.format("FINISH - %.2fms", time));
+        
+        System.out.println("west2");
+        startTime = System.nanoTime();
+        qs = StrUtils.strjoinNL("SELECT * ",
+                " { ?s spatial:withinBox (51.1 -180.0000 51.9 0.0000) ;",
+                "      rdfs:label ?label", " }");
 
-		spatialDataset.begin(ReadWrite.READ);
-		try {
-			Query q = QueryFactory.create(pre + "\n" + qs);
-			QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
-			QueryExecUtils.executeQuery(q, qexec);
-		} finally {
-			spatialDataset.end();
-		}
-		finishTime = System.nanoTime();
-		time = (finishTime - startTime) / 1.0e6;
-		log.info(String.format("FINISH - %.2fms", time));
-	}
+        spatialDataset.begin(ReadWrite.READ);
+        try {
+            Query q = QueryFactory.create(pre + "\n" + qs);
+            QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
+            QueryExecUtils.executeQuery(q, qexec);
+        } finally {
+            spatialDataset.end();
+        }
+        finishTime = System.nanoTime();
+        time = (finishTime - startTime) / 1.0e6;
+        log.info(String.format("FINISH - %.2fms", time));
+    }
 
 }


Mime
View raw message