Github user isper3at commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/187#discussion_r129985187 --- Diff: extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/mongo/MongoGeoIndexerFilterIT.java --- @@ -0,0 +1,266 @@ +/* + * 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.rya.indexing.mongo; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.rya.api.domain.RyaStatement; +import org.apache.rya.api.resolver.RdfToRyaConversions; +import org.apache.rya.api.resolver.RyaToRdfConversions; +import org.apache.rya.indexing.GeoConstants; +import org.apache.rya.indexing.GeoRyaSailFactory; +import org.apache.rya.indexing.OptionalConfigUtils; +import org.apache.rya.indexing.accumulo.ConfigUtils; +import org.apache.rya.indexing.mongodb.MongoIndexingConfiguration; +import org.apache.rya.mongodb.MockMongoFactory; +import org.junit.Before; +import org.junit.Test; +import org.openrdf.model.Resource; +import org.openrdf.model.Statement; +import org.openrdf.model.URI; +import org.openrdf.model.Value; +import org.openrdf.model.ValueFactory; +import org.openrdf.model.impl.StatementImpl; +import org.openrdf.model.impl.ValueFactoryImpl; +import org.openrdf.query.BindingSet; +import org.openrdf.query.MalformedQueryException; +import org.openrdf.query.QueryEvaluationException; +import org.openrdf.query.QueryLanguage; +import org.openrdf.query.TupleQueryResult; +import org.openrdf.repository.sail.SailRepository; +import org.openrdf.repository.sail.SailRepositoryConnection; +import org.openrdf.sail.Sail; + +import com.mongodb.MongoClient; +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.Geometry; +import com.vividsolutions.jts.geom.GeometryFactory; +import com.vividsolutions.jts.io.ParseException; +import com.vividsolutions.jts.io.WKTReader; +import com.vividsolutions.jts.io.WKTWriter; + +public class MongoGeoIndexerFilterIT { + private static final GeometryFactory GF = new GeometryFactory(); + private static final Geometry WASHINGTON_MONUMENT = GF.createPoint(new Coordinate(38.8895, 77.0353)); + private static final Geometry LINCOLN_MEMORIAL = GF.createPoint(new Coordinate(38.8893, 77.0502)); + private static final Geometry CAPITAL_BUILDING = GF.createPoint(new Coordinate(38.8899, 77.0091)); + private static final Geometry WHITE_HOUSE = GF.createPoint(new Coordinate(38.8977, 77.0365)); + + private MongoClient client; + private Sail sail; + private SailRepositoryConnection conn; + + @Before + public void before() throws Exception { + final MongoIndexingConfiguration indxrConf = MongoIndexingConfiguration.builder() + .setMongoCollectionPrefix("rya_") + .setMongoDBName("indexerTests") + .setUseMongoFreetextIndex(false) + .setUseMongoTemporalIndex(false) + .build(); + + client = MockMongoFactory.newFactory().newMongoClient(); + indxrConf.setBoolean(OptionalConfigUtils.USE_GEO, true); + indxrConf.set(ConfigUtils.GEO_PREDICATES_LIST, "http://www.opengis.net/ont/geosparql#asWKT"); + indxrConf.setBoolean(ConfigUtils.USE_MONGO, true); + indxrConf.setMongoClient(client); + + sail = GeoRyaSailFactory.getInstance(indxrConf); + conn = new SailRepository(sail).getConnection(); + conn.begin(); + } + + @Test + public void nearHappyUsesTest() throws Exception { + populateRya(); + + //Only captial + String query = + "PREFIX geo: <http://www.opengis.net/ont/geosparql#>\n" + + "PREFIX geof: <http://www.opengis.net/def/function/geosparql/>\n" + + "SELECT * \n" // + + "WHERE { \n" + + " <urn:geo> geo:asWKT ?point .\n" + + " FILTER(geof:sfNear(?point, \"POINT(38.8895 77.0353)\"^^geo:wktLiteral, 0.0, 2000))" --- End diff -- 2000 is an arbitrary distance so as the points specified between 0 and 2k meters are not returned.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---