http://git-wip-us.apache.org/repos/asf/jena/blob/3d70d735/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestIsWithinCirclePF.java ---------------------------------------------------------------------- diff --git a/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestIsWithinCirclePF.java b/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestIsWithinCirclePF.java index 95c65c0..5f460fa 100644 --- a/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestIsWithinCirclePF.java +++ b/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestIsWithinCirclePF.java @@ -1,336 +1,336 @@ -/* - * 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 AbstractTestIsWithinCirclePF 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:withinCircle (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:withinCircle (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); - } - - @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:withinCircle (51.3000 -2.71000) .", "}"); - doTestSearchThrowException(turtle, queryString); - - queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", - "WHERE {", - " ?s spatial:withinCircle (51.3000 -2.71000 100 'miles' 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.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:withinCircle (51.3000 -2.71000 100.0 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:withinCircle (51.3000 -2.71000 100.0 -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:withinCircle (51.3000 -2.71000 100.0 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:withinCircle (51.3000 -2.71000 100.0 'something not an integer') .", "}"); - expectedURIs = (new HashSet<String>()); - doTestSearch(turtle, queryString, expectedURIs); - } - - @Test - public void testDistanceUnits() { - String label = "testDistanceUnits"; - 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 ;", ".", - "<" + RESOURCE_BASE + label + "3>", - " geo:lat '52.4539'^^xsd:float ;", - " geo:long '-1.74803'^^xsd:float ;", "."); - String queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", - "WHERE {", - " ?s spatial:withinCircle (51.3000 -2.71000 100.0 'miles') .", "}"); - 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", - "http://example.org/data/resource/" + label + "3" - } - ))); - doTestSearch(turtle, queryString, expectedURIs); - - queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", - "WHERE {", - " ?s spatial:withinCircle (51.3000 -2.71000 100.0 'mi') .", "}"); - expectedURIs = (new HashSet<String>()); - expectedURIs.addAll( Arrays.asList(( - new String[] - { - "http://example.org/data/resource/" + label + "1", - "http://example.org/data/resource/" + label + "2", - "http://example.org/data/resource/" + label + "3" - } - ))); - doTestSearch(turtle, queryString, expectedURIs); - - queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", - "WHERE {", - " ?s spatial:withinCircle (51.3000 -2.71000 100.0 'kilometers') .", "}"); - 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:withinCircle (51.3000 -2.71000 100.0 'km') .", "}"); - 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:withinCircle (51.3000 -2.71000 10000.0 'metres') .", "}"); - expectedURIs = (new HashSet<String>()); - expectedURIs.addAll( Arrays.asList(( - new String[] - { - "http://example.org/data/resource/" + label + "1" - } - ))); - doTestSearch(turtle, queryString, expectedURIs); - queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", - "WHERE {", - " ?s spatial:withinCircle (51.3000 -2.71000 10000.0 'm') .", "}"); - expectedURIs = (new HashSet<String>()); - expectedURIs.addAll( Arrays.asList(( - new String[] - { - "http://example.org/data/resource/" + label + "1" - } - ))); - doTestSearch(turtle, queryString, expectedURIs); - - queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", - "WHERE {", - " ?s spatial:withinCircle (51.3000 -2.71000 1000000.0 'centimetres') .", "}"); - expectedURIs = (new HashSet<String>()); - expectedURIs.addAll( Arrays.asList(( - new String[] - { - "http://example.org/data/resource/" + label + "1" - } - ))); - doTestSearch(turtle, queryString, expectedURIs); - queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", - "WHERE {", - " ?s spatial:withinCircle (51.3000 -2.71000 1000000.0 'cm') .", "}"); - expectedURIs = (new HashSet<String>()); - expectedURIs.addAll( Arrays.asList(( - new String[] - { - "http://example.org/data/resource/" + label + "1" - } - ))); - doTestSearch(turtle, queryString, expectedURIs); - - queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", - "WHERE {", - " ?s spatial:withinCircle (51.3000 -2.71000 10000000.0 'millimeters') .", "}"); - expectedURIs = (new HashSet<String>()); - expectedURIs.addAll( Arrays.asList(( - new String[] - { - "http://example.org/data/resource/" + label + "1" - } - ))); - doTestSearch(turtle, queryString, expectedURIs); - queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", - "WHERE {", - " ?s spatial:withinCircle (51.3000 -2.71000 10000000.0 'mm') .", "}"); - expectedURIs = (new HashSet<String>()); - expectedURIs.addAll( Arrays.asList(( - new String[] - { - "http://example.org/data/resource/" + label + "1" - } - ))); - doTestSearch(turtle, queryString, expectedURIs); - - queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", - "WHERE {", - " ?s spatial:withinCircle (51.3000 -2.71000 0.09 'degrees') .", "}"); - expectedURIs = (new HashSet<String>()); - expectedURIs.addAll( Arrays.asList(( - new String[] - { - "http://example.org/data/resource/" + label + "1" - } - ))); - doTestSearch(turtle, queryString, expectedURIs); - queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", - "WHERE {", - " ?s spatial:withinCircle (51.3000 -2.71000 0.09 'de') .", "}"); - expectedURIs = (new HashSet<String>()); - expectedURIs.addAll( Arrays.asList(( - new String[] - { - "http://example.org/data/resource/" + label + "1" - } - ))); - doTestSearch(turtle, queryString, expectedURIs); - - - queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", - "WHERE {", - " ?s spatial:withinCircle (51.3000 -2.71000 100.0 1 'mi') .", "}"); - expectedURIs = (new HashSet<String>()); - doTestSearch(turtle, queryString, expectedURIs); - - queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", - "WHERE {", - " ?s spatial:withinCircle (51.3000 -2.71000 100.0 'other unsupported unit' -1) .", "}"); - expectedURIs = (new HashSet<String>()); - doTestSearch(turtle, queryString, expectedURIs); - } - - @Test - public void testLatLongBound() { - final String turtle = StrUtils.strjoinNL(TURTLE_PROLOG, "<" - + RESOURCE_BASE + "testLatLongBound>", - " geo:lat '51.3827'^^xsd:float ;", - " geo:long '-2.71909'^^xsd:float ", ". ", - "<" + RESOURCE_BASE + "center>", - " geo:lat '51.3000'^^xsd:float ;", - " geo:long '-2.71000'^^xsd:float ", ". "); - String queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", - "WHERE {", - " <http://example.org/data/resource/center> geo:lat ?lat .", - " <http://example.org/data/resource/center> geo:long ?long .", - " ?s spatial:nearby (?lat ?long 100.0 'miles' -1) .", "}"); - Set<String> expectedURIs = (new HashSet<String>()); - expectedURIs - .addAll(Arrays - .asList((new String[] { "http://example.org/data/resource/testLatLongBound", "http://example.org/data/resource/center" }))); - doTestSearch(turtle, queryString, expectedURIs); - } - -} +/* + * 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 AbstractTestIsWithinCirclePF 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:withinCircle (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:withinCircle (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); + } + + @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:withinCircle (51.3000 -2.71000) .", "}"); + doTestSearchThrowException(turtle, queryString); + + queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", + "WHERE {", + " ?s spatial:withinCircle (51.3000 -2.71000 100 'miles' 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.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:withinCircle (51.3000 -2.71000 100.0 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:withinCircle (51.3000 -2.71000 100.0 -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:withinCircle (51.3000 -2.71000 100.0 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:withinCircle (51.3000 -2.71000 100.0 'something not an integer') .", "}"); + expectedURIs = (new HashSet<String>()); + doTestSearch(turtle, queryString, expectedURIs); + } + + @Test + public void testDistanceUnits() { + String label = "testDistanceUnits"; + 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 ;", ".", + "<" + RESOURCE_BASE + label + "3>", + " geo:lat '52.4539'^^xsd:float ;", + " geo:long '-1.74803'^^xsd:float ;", "."); + String queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", + "WHERE {", + " ?s spatial:withinCircle (51.3000 -2.71000 100.0 'miles') .", "}"); + 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", + "http://example.org/data/resource/" + label + "3" + } + ))); + doTestSearch(turtle, queryString, expectedURIs); + + queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", + "WHERE {", + " ?s spatial:withinCircle (51.3000 -2.71000 100.0 'mi') .", "}"); + expectedURIs = (new HashSet<String>()); + expectedURIs.addAll( Arrays.asList(( + new String[] + { + "http://example.org/data/resource/" + label + "1", + "http://example.org/data/resource/" + label + "2", + "http://example.org/data/resource/" + label + "3" + } + ))); + doTestSearch(turtle, queryString, expectedURIs); + + queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", + "WHERE {", + " ?s spatial:withinCircle (51.3000 -2.71000 100.0 'kilometers') .", "}"); + 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:withinCircle (51.3000 -2.71000 100.0 'km') .", "}"); + 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:withinCircle (51.3000 -2.71000 10000.0 'metres') .", "}"); + expectedURIs = (new HashSet<String>()); + expectedURIs.addAll( Arrays.asList(( + new String[] + { + "http://example.org/data/resource/" + label + "1" + } + ))); + doTestSearch(turtle, queryString, expectedURIs); + queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", + "WHERE {", + " ?s spatial:withinCircle (51.3000 -2.71000 10000.0 'm') .", "}"); + expectedURIs = (new HashSet<String>()); + expectedURIs.addAll( Arrays.asList(( + new String[] + { + "http://example.org/data/resource/" + label + "1" + } + ))); + doTestSearch(turtle, queryString, expectedURIs); + + queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", + "WHERE {", + " ?s spatial:withinCircle (51.3000 -2.71000 1000000.0 'centimetres') .", "}"); + expectedURIs = (new HashSet<String>()); + expectedURIs.addAll( Arrays.asList(( + new String[] + { + "http://example.org/data/resource/" + label + "1" + } + ))); + doTestSearch(turtle, queryString, expectedURIs); + queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", + "WHERE {", + " ?s spatial:withinCircle (51.3000 -2.71000 1000000.0 'cm') .", "}"); + expectedURIs = (new HashSet<String>()); + expectedURIs.addAll( Arrays.asList(( + new String[] + { + "http://example.org/data/resource/" + label + "1" + } + ))); + doTestSearch(turtle, queryString, expectedURIs); + + queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", + "WHERE {", + " ?s spatial:withinCircle (51.3000 -2.71000 10000000.0 'millimeters') .", "}"); + expectedURIs = (new HashSet<String>()); + expectedURIs.addAll( Arrays.asList(( + new String[] + { + "http://example.org/data/resource/" + label + "1" + } + ))); + doTestSearch(turtle, queryString, expectedURIs); + queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", + "WHERE {", + " ?s spatial:withinCircle (51.3000 -2.71000 10000000.0 'mm') .", "}"); + expectedURIs = (new HashSet<String>()); + expectedURIs.addAll( Arrays.asList(( + new String[] + { + "http://example.org/data/resource/" + label + "1" + } + ))); + doTestSearch(turtle, queryString, expectedURIs); + + queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", + "WHERE {", + " ?s spatial:withinCircle (51.3000 -2.71000 0.09 'degrees') .", "}"); + expectedURIs = (new HashSet<String>()); + expectedURIs.addAll( Arrays.asList(( + new String[] + { + "http://example.org/data/resource/" + label + "1" + } + ))); + doTestSearch(turtle, queryString, expectedURIs); + queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", + "WHERE {", + " ?s spatial:withinCircle (51.3000 -2.71000 0.09 'de') .", "}"); + expectedURIs = (new HashSet<String>()); + expectedURIs.addAll( Arrays.asList(( + new String[] + { + "http://example.org/data/resource/" + label + "1" + } + ))); + doTestSearch(turtle, queryString, expectedURIs); + + + queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", + "WHERE {", + " ?s spatial:withinCircle (51.3000 -2.71000 100.0 1 'mi') .", "}"); + expectedURIs = (new HashSet<String>()); + doTestSearch(turtle, queryString, expectedURIs); + + queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", + "WHERE {", + " ?s spatial:withinCircle (51.3000 -2.71000 100.0 'other unsupported unit' -1) .", "}"); + expectedURIs = (new HashSet<String>()); + doTestSearch(turtle, queryString, expectedURIs); + } + + @Test + public void testLatLongBound() { + final String turtle = StrUtils.strjoinNL(TURTLE_PROLOG, "<" + + RESOURCE_BASE + "testLatLongBound>", + " geo:lat '51.3827'^^xsd:float ;", + " geo:long '-2.71909'^^xsd:float ", ". ", + "<" + RESOURCE_BASE + "center>", + " geo:lat '51.3000'^^xsd:float ;", + " geo:long '-2.71000'^^xsd:float ", ". "); + String queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", + "WHERE {", + " <http://example.org/data/resource/center> geo:lat ?lat .", + " <http://example.org/data/resource/center> geo:long ?long .", + " ?s spatial:nearby (?lat ?long 100.0 'miles' -1) .", "}"); + Set<String> expectedURIs = (new HashSet<String>()); + expectedURIs + .addAll(Arrays + .asList((new String[] { "http://example.org/data/resource/testLatLongBound", "http://example.org/data/resource/center" }))); + doTestSearch(turtle, queryString, expectedURIs); + } + +}
http://git-wip-us.apache.org/repos/asf/jena/blob/3d70d735/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestNorthPF.java ---------------------------------------------------------------------- diff --git a/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestNorthPF.java b/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestNorthPF.java index 01e9a7d..3eb61b8 100644 --- a/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestNorthPF.java +++ b/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestNorthPF.java @@ -1,142 +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 AbstractTestNorthPF 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:north (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.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: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); - } - - @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:north (51.3000) .", "}"); - doTestSearchThrowException(turtle, queryString); - - queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", - "WHERE {", - " ?s spatial:north (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.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: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:north (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:north (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:north (51.3000 0.0000 'something not an integer') .", "}"); - expectedURIs = (new HashSet<String>()); - doTestSearch(turtle, queryString, expectedURIs); - } - -} +/* + * 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 AbstractTestNorthPF 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:north (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.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: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); + } + + @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:north (51.3000) .", "}"); + doTestSearchThrowException(turtle, queryString); + + queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", + "WHERE {", + " ?s spatial:north (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.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: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:north (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:north (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:north (51.3000 0.0000 'something not an integer') .", "}"); + expectedURIs = (new HashSet<String>()); + doTestSearch(turtle, queryString, expectedURIs); + } + +} http://git-wip-us.apache.org/repos/asf/jena/blob/3d70d735/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestSouthPF.java ---------------------------------------------------------------------- diff --git a/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestSouthPF.java b/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestSouthPF.java index a2fad14..b7a04ef 100644 --- a/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestSouthPF.java +++ b/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestSouthPF.java @@ -1,142 +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 AbstractTestSouthPF extends AbstractTestDatasetWithSpatialIndex { - - @Test - public void testOneSimpleResult() { - final String turtle = StrUtils.strjoinNL(TURTLE_PROLOG, "<" - + RESOURCE_BASE + "testOneSimpleResult>", - " geo:lat '51.1481'^^xsd:float ;", - " geo:long '-0.190278'^^xsd:float ", "."); - String queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", - "WHERE {", - " ?s spatial:south (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.1481'^^xsd:float ;", - " geo:long '-0.190278'^^xsd:float ;" , ".", - "<" + RESOURCE_BASE + label + "2>", - " geo:lat '51.0123'^^xsd:float ;", - " geo:long '-0.123456'^^xsd:float ;", "."); - - String queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", - "WHERE {", - " ?s spatial:south (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:south (51.3000) .", "}"); - doTestSearchThrowException(turtle, queryString); - - queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", - "WHERE {", - " ?s spatial:south (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.1481'^^xsd:float ;", - " geo:long '-0.190278'^^xsd:float ;" , ".", - "<" + RESOURCE_BASE + label + "2>", - " geo:lat '51.0123'^^xsd:float ;", - " geo:long '-0.123456'^^xsd:float ;", "."); - String queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", - "WHERE {", - " ?s spatial:south (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:south (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:south (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:south (51.3000 0.0000 'something not an integer') .", "}"); - expectedURIs = (new HashSet<String>()); - doTestSearch(turtle, queryString, expectedURIs); - } - -} +/* + * 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 AbstractTestSouthPF extends AbstractTestDatasetWithSpatialIndex { + + @Test + public void testOneSimpleResult() { + final String turtle = StrUtils.strjoinNL(TURTLE_PROLOG, "<" + + RESOURCE_BASE + "testOneSimpleResult>", + " geo:lat '51.1481'^^xsd:float ;", + " geo:long '-0.190278'^^xsd:float ", "."); + String queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", + "WHERE {", + " ?s spatial:south (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.1481'^^xsd:float ;", + " geo:long '-0.190278'^^xsd:float ;" , ".", + "<" + RESOURCE_BASE + label + "2>", + " geo:lat '51.0123'^^xsd:float ;", + " geo:long '-0.123456'^^xsd:float ;", "."); + + String queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", + "WHERE {", + " ?s spatial:south (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:south (51.3000) .", "}"); + doTestSearchThrowException(turtle, queryString); + + queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", + "WHERE {", + " ?s spatial:south (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.1481'^^xsd:float ;", + " geo:long '-0.190278'^^xsd:float ;" , ".", + "<" + RESOURCE_BASE + label + "2>", + " geo:lat '51.0123'^^xsd:float ;", + " geo:long '-0.123456'^^xsd:float ;", "."); + String queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", + "WHERE {", + " ?s spatial:south (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:south (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:south (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:south (51.3000 0.0000 'something not an integer') .", "}"); + expectedURIs = (new HashSet<String>()); + doTestSearch(turtle, queryString, expectedURIs); + } + +} http://git-wip-us.apache.org/repos/asf/jena/blob/3d70d735/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestWestPF.java ---------------------------------------------------------------------- diff --git a/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestWestPF.java b/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestWestPF.java index ed63e5d..15eb5bc 100644 --- a/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestWestPF.java +++ b/jena-spatial/src/test/java/org/apache/jena/query/spatial/pfunction/AbstractTestWestPF.java @@ -1,141 +1,141 @@ -/* - * 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 AbstractTestWestPF 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:west (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.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:west (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:west (51.3000) .", "}"); - doTestSearchThrowException(turtle, queryString); - - queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", - "WHERE {", - " ?s spatial:west (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.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:west (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:west (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:west (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:west (51.3000 0.0000 'something not an integer') .", "}"); - expectedURIs = (new HashSet<String>()); - doTestSearch(turtle, queryString, expectedURIs); - } -} +/* + * 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 AbstractTestWestPF 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:west (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.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:west (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:west (51.3000) .", "}"); + doTestSearchThrowException(turtle, queryString); + + queryString = StrUtils.strjoinNL(QUERY_PROLOG, "SELECT ?s", + "WHERE {", + " ?s spatial:west (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.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:west (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:west (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:west (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:west (51.3000 0.0000 'something not an integer') .", "}"); + expectedURIs = (new HashSet<String>()); + doTestSearch(turtle, queryString, expectedURIs); + } +} http://git-wip-us.apache.org/repos/asf/jena/blob/3d70d735/jena-spatial/src/test/resources/SolrHome/SolrARQCollection/conf/schema.xml ---------------------------------------------------------------------- diff --git a/jena-spatial/src/test/resources/SolrHome/SolrARQCollection/conf/schema.xml b/jena-spatial/src/test/resources/SolrHome/SolrARQCollection/conf/schema.xml index c6137a2..a5848ff 100644 --- a/jena-spatial/src/test/resources/SolrHome/SolrARQCollection/conf/schema.xml +++ b/jena-spatial/src/test/resources/SolrHome/SolrARQCollection/conf/schema.xml @@ -1,56 +1,56 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - 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. ---> -<schema name="spatial" version="1.0"> - - <fields> - - <field name="uri" type="string" indexed="true" stored="true" required="true" multiValued="false" /> - - <field name="geo" type="location_rpt" indexed="true" stored="true" multiValued="true" /> - - <field name="_version_" type="long" indexed="true" stored="true" multiValued="false" /> - </fields> - - - <!-- Field to use to determine and enforce document uniqueness. - Unless this field is marked with required="false", it will be a required field - --> - <uniqueKey>uri</uniqueKey> - - <types> - <!-- field type definitions. The "name" attribute is - just a label to be used by field definitions. The "class" - attribute and any other attributes determine the real - behavior of the fieldType. - Class names starting with "solr" refer to java classes in a - standard package such as org.apache.solr.analysis - --> - - <!-- The StrField type is not analyzed, but indexed/stored verbatim. - It supports doc values but in that case the field needs to be - single-valued and either required or have a default value. - --> - <fieldType name="string" class="solr.StrField" sortMissingLast="true" /> - - <fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType" - geo="true" distErrPct="0.025" maxDistErr="0.000009" units="degrees" /> - - <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/> - </types> - -</schema> +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> +<schema name="spatial" version="1.0"> + + <fields> + + <field name="uri" type="string" indexed="true" stored="true" required="true" multiValued="false" /> + + <field name="geo" type="location_rpt" indexed="true" stored="true" multiValued="true" /> + + <field name="_version_" type="long" indexed="true" stored="true" multiValued="false" /> + </fields> + + + <!-- Field to use to determine and enforce document uniqueness. + Unless this field is marked with required="false", it will be a required field + --> + <uniqueKey>uri</uniqueKey> + + <types> + <!-- field type definitions. The "name" attribute is + just a label to be used by field definitions. The "class" + attribute and any other attributes determine the real + behavior of the fieldType. + Class names starting with "solr" refer to java classes in a + standard package such as org.apache.solr.analysis + --> + + <!-- The StrField type is not analyzed, but indexed/stored verbatim. + It supports doc values but in that case the field needs to be + single-valued and either required or have a default value. + --> + <fieldType name="string" class="solr.StrField" sortMissingLast="true" /> + + <fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType" + geo="true" distErrPct="0.025" maxDistErr="0.000009" units="degrees" /> + + <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/> + </types> + +</schema> http://git-wip-us.apache.org/repos/asf/jena/blob/3d70d735/jena-spatial/src/test/resources/SolrHome/SolrARQCollection/conf/solrconfig.xml ---------------------------------------------------------------------- diff --git a/jena-spatial/src/test/resources/SolrHome/SolrARQCollection/conf/solrconfig.xml b/jena-spatial/src/test/resources/SolrHome/SolrARQCollection/conf/solrconfig.xml index 01967fb..55e4e46 100644 --- a/jena-spatial/src/test/resources/SolrHome/SolrARQCollection/conf/solrconfig.xml +++ b/jena-spatial/src/test/resources/SolrHome/SolrARQCollection/conf/solrconfig.xml @@ -1,77 +1,77 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - 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. ---> - -<config> - - <luceneMatchVersion>LUCENE_43</luceneMatchVersion> - - - - <!-- Request Handlers - - http://wiki.apache.org/solr/SolrRequestHandler - - Incoming queries will be dispatched to a specific handler by name - based on the path specified in the request. - - Legacy behavior: If the request path uses "/select" but no Request - Handler has that name, and if handleSelect="true" has been specified in - the requestDispatcher, then the Request Handler is dispatched based on - the qt parameter. Handlers without a leading '/' are accessed this way - like so: http://host/app/[core/]select?qt=name If no qt is - given, then the requestHandler that declares default="true" will be - used or the one named "standard". - - If a Request Handler is declared with startup="lazy", then it will - not be initialized until the first request that uses it. - - --> - <!-- SearchHandler - - http://wiki.apache.org/solr/SearchHandler - - For processing Search Queries, the primary Request Handler - provided with Solr is "SearchHandler" It delegates to a sequent - of SearchComponents (see below) and supports distributed - queries across multiple shards - --> - <requestHandler name="/select" class="solr.SearchHandler"> - </requestHandler> - - <!-- Update Request Handler. - - http://wiki.apache.org/solr/UpdateXmlMessages - - The canonical Request Handler for Modifying the Index through - commands specified using XML, JSON, CSV, or JAVABIN - - Note: Since solr1.1 requestHandlers requires a valid content - type header if posted in the body. For example, curl now - requires: -H 'Content-type:text/xml; charset=utf-8' - - To override the request content type and force a specific - Content-type, use the request parameter: - ?update.contentType=text/csv - - This handler will pick a response format to match the input - if the 'wt' parameter is not explicit - --> - <requestHandler name="/update" class="solr.UpdateRequestHandler"> - </requestHandler> - -</config> +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + 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. +--> + +<config> + + <luceneMatchVersion>LUCENE_43</luceneMatchVersion> + + + + <!-- Request Handlers + + http://wiki.apache.org/solr/SolrRequestHandler + + Incoming queries will be dispatched to a specific handler by name + based on the path specified in the request. + + Legacy behavior: If the request path uses "/select" but no Request + Handler has that name, and if handleSelect="true" has been specified in + the requestDispatcher, then the Request Handler is dispatched based on + the qt parameter. Handlers without a leading '/' are accessed this way + like so: http://host/app/[core/]select?qt=name If no qt is + given, then the requestHandler that declares default="true" will be + used or the one named "standard". + + If a Request Handler is declared with startup="lazy", then it will + not be initialized until the first request that uses it. + + --> + <!-- SearchHandler + + http://wiki.apache.org/solr/SearchHandler + + For processing Search Queries, the primary Request Handler + provided with Solr is "SearchHandler" It delegates to a sequent + of SearchComponents (see below) and supports distributed + queries across multiple shards + --> + <requestHandler name="/select" class="solr.SearchHandler"> + </requestHandler> + + <!-- Update Request Handler. + + http://wiki.apache.org/solr/UpdateXmlMessages + + The canonical Request Handler for Modifying the Index through + commands specified using XML, JSON, CSV, or JAVABIN + + Note: Since solr1.1 requestHandlers requires a valid content + type header if posted in the body. For example, curl now + requires: -H 'Content-type:text/xml; charset=utf-8' + + To override the request content type and force a specific + Content-type, use the request parameter: + ?update.contentType=text/csv + + This handler will pick a response format to match the input + if the 'wt' parameter is not explicit + --> + <requestHandler name="/update" class="solr.UpdateRequestHandler"> + </requestHandler> + +</config> http://git-wip-us.apache.org/repos/asf/jena/blob/3d70d735/jena-spatial/src/test/resources/SolrHome/solr.xml ---------------------------------------------------------------------- diff --git a/jena-spatial/src/test/resources/SolrHome/solr.xml b/jena-spatial/src/test/resources/SolrHome/solr.xml index 8d364d9..212e4b6 100644 --- a/jena-spatial/src/test/resources/SolrHome/solr.xml +++ b/jena-spatial/src/test/resources/SolrHome/solr.xml @@ -1,8 +1,8 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<solr persistent="true"> -<cores adminPath="/admin/cores" defaultCoreName="SolrARQCollection"> -<core name="SolrARQCollection" instanceDir="SolrARQCollection" > -<property name="dataDir" value="../../../../../target/test/SolrARQCollection/data" /> -</core> -</cores> +<?xml version="1.0" encoding="UTF-8" ?> +<solr persistent="true"> +<cores adminPath="/admin/cores" defaultCoreName="SolrARQCollection"> +<core name="SolrARQCollection" instanceDir="SolrARQCollection" > +<property name="dataDir" value="../../../../../target/test/SolrARQCollection/data" /> +</core> +</cores> </solr> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jena/blob/3d70d735/jena-spatial/src/test/resources/geoarq-data-1.ttl ---------------------------------------------------------------------- diff --git a/jena-spatial/src/test/resources/geoarq-data-1.ttl b/jena-spatial/src/test/resources/geoarq-data-1.ttl index f3b3ea2..50242d7 100644 --- a/jena-spatial/src/test/resources/geoarq-data-1.ttl +++ b/jena-spatial/src/test/resources/geoarq-data-1.ttl @@ -1,86 +1,86 @@ -@prefix : <http://localhost/jena_example/#> . -@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . - -@prefix dbp: <http://dbpedia.org/resource/> . -@prefix airports: <http://airports.dataincubator.org/airports/> . -@prefix airports_sc: <http://airports.dataincubator.org/schema/> . - -@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> . -@prefix wkt: <http://www.opengis.net/ont/geosparql#> . - -airports:EGBB rdf:type airports_sc:LargeAirport ; - geo:lat "52.4539"^^xsd:float ; - geo:long "-1.74803"^^xsd:float ; - rdfs:label "Birmingham International Airport" - . - -airports:EGBB__Pair_1 rdf:type airports_sc:LargeAirport ; - :latitude_1 "52.4539"^^xsd:float ; - :longitude_1 "-1.74803"^^xsd:float ; - rdfs:label "Birmingham International Airport (Pair_1)" - . - -airports:EGBB_Pair_2 rdf:type airports_sc:LargeAirport ; - :latitude_2 "52.4539"^^xsd:float ; - :longitude_2 "-1.74803"^^xsd:float ; - rdfs:label "Birmingham International Airport (Pair_2)" - . - -airports:EGBB_WKT rdf:type airports_sc:LargeAirport ; - wkt:asWKT "POINT(-1.74803 52.4539)"^^wkt:wktLiteral ; - rdfs:label "Birmingham International Airport (wktLiteral)" - . - -airports:EGBB_WKT_1 rdf:type airports_sc:LargeAirport ; - :wkt_1 "POINT(-1.74803 52.4539)"^^wkt:wktLiteral ; - rdfs:label "Birmingham International Airport (wktLiteral_1)" - . - -airports:EGBB_WKT_2 rdf:type airports_sc:LargeAirport ; - :wkt_2 "POINT(-1.74803 52.4539)"^^wkt:wktLiteral ; - rdfs:label "Birmingham International Airport (wktLiteral_2)" - . - -airports:EGBB_String rdf:type airports_sc:LargeAirport ; - geo:lat "52.4539" ; - geo:long "-1.74803" ; - rdfs:label "Birmingham International Airport (String)" - . - -airports:EGFF rdf:type airports_sc:LargeAirport ; - geo:lat "51.3967"^^xsd:float ; - geo:long "-3.34333"^^xsd:float ; - rdfs:label "Cardiff International Airport" - . - -airports:EGGD rdf:type airports_sc:LargeAirport ; - geo:lat "51.3827"^^xsd:float ; - geo:long "-2.71909"^^xsd:float ; - rdfs:label "Bristol International Airport" - . - -airports:EGKK rdf:type airports_sc:LargeAirport ; - geo:lat "51.1481"^^xsd:float ; - geo:long "-0.190278"^^xsd:float ; - rdfs:label "London Gatwick Airport" - . - -airports:EGSS rdf:type airports_sc:LargeAirport ; - geo:lat "51.885"^^xsd:float ; - geo:long "0.235"^^xsd:float ; - rdfs:label "London Stansted Airport" - . - -airports:EGBB_Fake_In_Box rdf:type airports_sc:LargeAirport ; - wkt:asWKT "Polygon ((-2.0000 51.2000, 1.0000 51.2000, 1.0000 51.8000, -2.0000 51.8000, -2.0000 51.2000))"^^wkt:wktLiteral ; - rdfs:label "Fake in Box Airport (wktLiteral)" - . - -airports:EGBB_Fake_out_of_Box rdf:type airports_sc:LargeAirport ; - wkt:asWKT "Polygon ((-2.0000 50.2000, 1.0000 50.2000, 1.0000 50.8000, -2.0000 50.8000, -2.0000 50.2000))"^^wkt:wktLiteral ; - rdfs:label "Fake out of Box Airport (wktLiteral)" - . - - +@prefix : <http://localhost/jena_example/#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +@prefix dbp: <http://dbpedia.org/resource/> . +@prefix airports: <http://airports.dataincubator.org/airports/> . +@prefix airports_sc: <http://airports.dataincubator.org/schema/> . + +@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> . +@prefix wkt: <http://www.opengis.net/ont/geosparql#> . + +airports:EGBB rdf:type airports_sc:LargeAirport ; + geo:lat "52.4539"^^xsd:float ; + geo:long "-1.74803"^^xsd:float ; + rdfs:label "Birmingham International Airport" + . + +airports:EGBB__Pair_1 rdf:type airports_sc:LargeAirport ; + :latitude_1 "52.4539"^^xsd:float ; + :longitude_1 "-1.74803"^^xsd:float ; + rdfs:label "Birmingham International Airport (Pair_1)" + . + +airports:EGBB_Pair_2 rdf:type airports_sc:LargeAirport ; + :latitude_2 "52.4539"^^xsd:float ; + :longitude_2 "-1.74803"^^xsd:float ; + rdfs:label "Birmingham International Airport (Pair_2)" + . + +airports:EGBB_WKT rdf:type airports_sc:LargeAirport ; + wkt:asWKT "POINT(-1.74803 52.4539)"^^wkt:wktLiteral ; + rdfs:label "Birmingham International Airport (wktLiteral)" + . + +airports:EGBB_WKT_1 rdf:type airports_sc:LargeAirport ; + :wkt_1 "POINT(-1.74803 52.4539)"^^wkt:wktLiteral ; + rdfs:label "Birmingham International Airport (wktLiteral_1)" + . + +airports:EGBB_WKT_2 rdf:type airports_sc:LargeAirport ; + :wkt_2 "POINT(-1.74803 52.4539)"^^wkt:wktLiteral ; + rdfs:label "Birmingham International Airport (wktLiteral_2)" + . + +airports:EGBB_String rdf:type airports_sc:LargeAirport ; + geo:lat "52.4539" ; + geo:long "-1.74803" ; + rdfs:label "Birmingham International Airport (String)" + . + +airports:EGFF rdf:type airports_sc:LargeAirport ; + geo:lat "51.3967"^^xsd:float ; + geo:long "-3.34333"^^xsd:float ; + rdfs:label "Cardiff International Airport" + . + +airports:EGGD rdf:type airports_sc:LargeAirport ; + geo:lat "51.3827"^^xsd:float ; + geo:long "-2.71909"^^xsd:float ; + rdfs:label "Bristol International Airport" + . + +airports:EGKK rdf:type airports_sc:LargeAirport ; + geo:lat "51.1481"^^xsd:float ; + geo:long "-0.190278"^^xsd:float ; + rdfs:label "London Gatwick Airport" + . + +airports:EGSS rdf:type airports_sc:LargeAirport ; + geo:lat "51.885"^^xsd:float ; + geo:long "0.235"^^xsd:float ; + rdfs:label "London Stansted Airport" + . + +airports:EGBB_Fake_In_Box rdf:type airports_sc:LargeAirport ; + wkt:asWKT "Polygon ((-2.0000 51.2000, 1.0000 51.2000, 1.0000 51.8000, -2.0000 51.8000, -2.0000 51.2000))"^^wkt:wktLiteral ; + rdfs:label "Fake in Box Airport (wktLiteral)" + . + +airports:EGBB_Fake_out_of_Box rdf:type airports_sc:LargeAirport ; + wkt:asWKT "Polygon ((-2.0000 50.2000, 1.0000 50.2000, 1.0000 50.8000, -2.0000 50.8000, -2.0000 50.2000))"^^wkt:wktLiteral ; + rdfs:label "Fake out of Box Airport (wktLiteral)" + . + + http://git-wip-us.apache.org/repos/asf/jena/blob/3d70d735/jena-spatial/src/test/resources/spatial-config-spatialindexer.ttl ---------------------------------------------------------------------- diff --git a/jena-spatial/src/test/resources/spatial-config-spatialindexer.ttl b/jena-spatial/src/test/resources/spatial-config-spatialindexer.ttl index e1fae4d..8655092 100644 --- a/jena-spatial/src/test/resources/spatial-config-spatialindexer.ttl +++ b/jena-spatial/src/test/resources/spatial-config-spatialindexer.ttl @@ -1,52 +1,52 @@ -## Example of a TDB dataset and spatial index - -@prefix : <http://localhost/jena_example/#> . -@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . -@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . -@prefix spatial: <http://jena.apache.org/spatial#> . - -# Spatial -[] ja:loadClass "org.apache.jena.query.spatial.SpatialQuery" . -spatial:SpatialtDataset rdfs:subClassOf ja:RDFDataset . -#spatial:SpatialIndexSolr rdfs:subClassOf spatial:SpatialIndex . -spatial:SpatialIndexLucene rdfs:subClassOf spatial:SpatialIndex . - -## --------------------------------------------------------------- -## This URI must be fixed - it's used to assemble the spatial dataset. - -:spatial_dataset rdf:type spatial:SpatialDataset ; - spatial:dataset <#dataset> ; - ##spaital:index <#indexSolr> ; - spatial:index <#indexLucene> ; - . - -<#dataset> rdf:type ja:RDFDataset ; - ja:defaultGraph <#graph>; - . - -<#graph> rdf:type ja:MemoryModel ; - ja:content [ja:externalContent <file:geoarq-data-1.ttl> ] ; - . - -<#indexLucene> a spatial:SpatialIndexLucene ; - spatial:directory <file:Lucene> ; - #spatial:directory "mem" ; - spatial:definition <#definition> ; - . - -<#definition> a spatial:EntityDefinition ; - spatial:entityField "uri" ; - spatial:geoField "geo" ; - # custom geo predicates for 1) latitude/longitude - spatial:hasSpatialPredicatePairs ( - [ spatial:latitude :latitude_1 ; spatial:longitude :longitude_1 ] - [ spatial:latitude :latitude_2 ; spatial:longitude :longitude_2 ] - ) ; - # custom geo predicates for 2) Well Known Text Literal - spatial:hasWKTPredicates (:wkt_1 :wkt_2) ; - # custom SpatialContextFactory for 2) Well Known Text Literal - spatial:spatialContextFactory - "com.spatial4j.core.context.jts.JtsSpatialContextFactory" - . +## Example of a TDB dataset and spatial index + +@prefix : <http://localhost/jena_example/#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . +@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . +@prefix spatial: <http://jena.apache.org/spatial#> . + +# Spatial +[] ja:loadClass "org.apache.jena.query.spatial.SpatialQuery" . +spatial:SpatialtDataset rdfs:subClassOf ja:RDFDataset . +#spatial:SpatialIndexSolr rdfs:subClassOf spatial:SpatialIndex . +spatial:SpatialIndexLucene rdfs:subClassOf spatial:SpatialIndex . + +## --------------------------------------------------------------- +## This URI must be fixed - it's used to assemble the spatial dataset. + +:spatial_dataset rdf:type spatial:SpatialDataset ; + spatial:dataset <#dataset> ; + ##spaital:index <#indexSolr> ; + spatial:index <#indexLucene> ; + . + +<#dataset> rdf:type ja:RDFDataset ; + ja:defaultGraph <#graph>; + . + +<#graph> rdf:type ja:MemoryModel ; + ja:content [ja:externalContent <file:geoarq-data-1.ttl> ] ; + . + +<#indexLucene> a spatial:SpatialIndexLucene ; + spatial:directory <file:Lucene> ; + #spatial:directory "mem" ; + spatial:definition <#definition> ; + . + +<#definition> a spatial:EntityDefinition ; + spatial:entityField "uri" ; + spatial:geoField "geo" ; + # custom geo predicates for 1) latitude/longitude + spatial:hasSpatialPredicatePairs ( + [ spatial:latitude :latitude_1 ; spatial:longitude :longitude_1 ] + [ spatial:latitude :latitude_2 ; spatial:longitude :longitude_2 ] + ) ; + # custom geo predicates for 2) Well Known Text Literal + spatial:hasWKTPredicates (:wkt_1 :wkt_2) ; + # custom SpatialContextFactory for 2) Well Known Text Literal + spatial:spatialContextFactory + "com.spatial4j.core.context.jts.JtsSpatialContextFactory" + . http://git-wip-us.apache.org/repos/asf/jena/blob/3d70d735/jena-spatial/src/test/resources/spatial-config.ttl ---------------------------------------------------------------------- diff --git a/jena-spatial/src/test/resources/spatial-config.ttl b/jena-spatial/src/test/resources/spatial-config.ttl index 258c965..0c90874 100644 --- a/jena-spatial/src/test/resources/spatial-config.ttl +++ b/jena-spatial/src/test/resources/spatial-config.ttl @@ -1,54 +1,54 @@ -## Example of a TDB dataset and spatial index - -@prefix : <http://localhost/jena_example/#> . -@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . -@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . -@prefix spatial: <http://jena.apache.org/spatial#> . - -# TDB -[] ja:loadClass "org.apache.jena.tdb.TDB" . -tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset . -tdb:GraphTDB rdfs:subClassOf ja:Model . - -# Spatial -[] ja:loadClass "org.apache.jena.query.spatial.SpatialQuery" . -spatial:SpatialtDataset rdfs:subClassOf ja:RDFDataset . -#spatial:SpatialIndexSolr rdfs:subClassOf spatial:SpatialIndex . -spatial:SpatialIndexLucene rdfs:subClassOf spatial:SpatialIndex . - -## --------------------------------------------------------------- -## This URI must be fixed - it's used to assemble the spatial dataset. - -:spatial_dataset rdf:type spatial:SpatialDataset ; - spatial:dataset <#dataset> ; - ##spaital:index <#indexSolr> ; - spatial:index <#indexLucene> ; - . - -<#dataset> rdf:type tdb:DatasetTDB ; - tdb:location "--mem--" ; - tdb:unionDefaultGraph true ; - . - -<#indexLucene> a spatial:SpatialIndexLucene ; - #spatial:directory <file:Lucene> ; - spatial:directory "mem" ; - spatial:definition <#definition> ; - . - -<#definition> a spatial:EntityDefinition ; - spatial:entityField "uri" ; - spatial:geoField "geo" ; - # custom geo predicates for 1) latitude/longitude - spatial:hasSpatialPredicatePairs ( - [ spatial:latitude :latitude_1 ; spatial:longitude :longitude_1 ] - [ spatial:latitude :latitude_2 ; spatial:longitude :longitude_2 ] - ) ; - # custom geo predicates for 2) Well Known Text Literal - spatial:hasWKTPredicates (:wkt_1 :wkt_2) ; - # custom SpatialContextFactory for 2) Well Known Text Literal - spatial:spatialContextFactory - "com.spatial4j.core.context.jts.JtsSpatialContextFactory" - . +## Example of a TDB dataset and spatial index + +@prefix : <http://localhost/jena_example/#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . +@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . +@prefix spatial: <http://jena.apache.org/spatial#> . + +# TDB +[] ja:loadClass "org.apache.jena.tdb.TDB" . +tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset . +tdb:GraphTDB rdfs:subClassOf ja:Model . + +# Spatial +[] ja:loadClass "org.apache.jena.query.spatial.SpatialQuery" . +spatial:SpatialtDataset rdfs:subClassOf ja:RDFDataset . +#spatial:SpatialIndexSolr rdfs:subClassOf spatial:SpatialIndex . +spatial:SpatialIndexLucene rdfs:subClassOf spatial:SpatialIndex . + +## --------------------------------------------------------------- +## This URI must be fixed - it's used to assemble the spatial dataset. + +:spatial_dataset rdf:type spatial:SpatialDataset ; + spatial:dataset <#dataset> ; + ##spaital:index <#indexSolr> ; + spatial:index <#indexLucene> ; + . + +<#dataset> rdf:type tdb:DatasetTDB ; + tdb:location "--mem--" ; + tdb:unionDefaultGraph true ; + . + +<#indexLucene> a spatial:SpatialIndexLucene ; + #spatial:directory <file:Lucene> ; + spatial:directory "mem" ; + spatial:definition <#definition> ; + . + +<#definition> a spatial:EntityDefinition ; + spatial:entityField "uri" ; + spatial:geoField "geo" ; + # custom geo predicates for 1) latitude/longitude + spatial:hasSpatialPredicatePairs ( + [ spatial:latitude :latitude_1 ; spatial:longitude :longitude_1 ] + [ spatial:latitude :latitude_2 ; spatial:longitude :longitude_2 ] + ) ; + # custom geo predicates for 2) Well Known Text Literal + spatial:hasWKTPredicates (:wkt_1 :wkt_2) ; + # custom SpatialContextFactory for 2) Well Known Text Literal + spatial:spatialContextFactory + "com.spatial4j.core.context.jts.JtsSpatialContextFactory" + .
