Github user isper3at commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/179#discussion_r128340484 --- Diff: extras/rya.geoindexing/src/test/java/org/apache/rya/indexing/mongo/MongoGeoIT.java --- @@ -0,0 +1,135 @@ +package org.apache.rya.indexing.mongo; + +import static org.junit.Assert.assertEquals; + +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.TemporalInstant; +import org.apache.rya.indexing.TemporalInstantRfc3339; +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.model.vocabulary.RDF; +import org.openrdf.model.vocabulary.RDFS; +import org.openrdf.query.QueryLanguage; +import org.openrdf.query.Update; +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; + +public class MongoGeoIT { + 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(true) + .setUseMongoTemporalIndex(true) + .setMongoFreeTextPredicates(RDFS.LABEL.stringValue()) + .setMongoTemporalPredicates("Property:atTime") + .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 deleteTest() throws Exception { + populateRya(); + + assertEquals(8, client.getDatabase("indexerTests").getCollection("rya__triples").count()); + assertEquals(4, client.getDatabase("indexerTests").getCollection("rya_rya_geo").count()); + assertEquals(1, client.getDatabase("indexerTests").getCollection("rya_rya_temporal").count()); + assertEquals(2, client.getDatabase("indexerTests").getCollection("rya_rya_freetext").count()); + + //free text -- remove one from many + String delete = "DELETE DATA \n" // + + "{\n" + + " <urn:people> <http://www.w3.org/2000/01/rdf-schema#label> \"Alice Palace Hose\" " + + "}"; + Update update = conn.prepareUpdate(QueryLanguage.SPARQL, delete); + update.execute(); + + // temporal -- remove one from one + delete = "DELETE DATA \n" // + + "{\n" + + " <foo:time> <Property:atTime> \"0001-02-03T04:05:06Z\" " + + "}"; + --- End diff -- the geo test is being added here after the task I'm now working on: implementing near. The underlying issue with this bug was the missing delete calls in the dao to the indexers. Other issues were found in Geo that went outside the scope of this task but inside the scope of near implementation. You'll see that test there
--- 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. ---