From ebf4e3338e5124688fbf62ded523909b6ceed4b1 Mon Sep 17 00:00:00 2001 From: Igor Date: Thu, 4 Jul 2019 03:35:19 +0500 Subject: [PATCH] Support for TempTripleStore in GeoSpatialServiceFactory This allows using temp store for unit tests using geo services Bug: T175840 Change-Id: I0b34ec741774bf7d81b404d7037dbbf9eb896bf1 --- .../ast/eval/GeoSpatialServiceFactory.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/bigdata-core/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/GeoSpatialServiceFactory.java b/bigdata-core/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/GeoSpatialServiceFactory.java index 590d6e34fe..71a78e3db9 100644 --- a/bigdata-core/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/GeoSpatialServiceFactory.java +++ b/bigdata-core/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/GeoSpatialServiceFactory.java @@ -98,6 +98,7 @@ import com.bigdata.rdf.spo.SPO; import com.bigdata.rdf.spo.SPOKeyOrder; import com.bigdata.rdf.store.AbstractTripleStore; +import com.bigdata.rdf.store.TempTripleStore; import com.bigdata.relation.IRelation; import com.bigdata.relation.accesspath.AccessPath; import com.bigdata.relation.accesspath.BlockingBuffer; @@ -166,11 +167,7 @@ public BigdataServiceCall create(final ServiceCallCreateParams createParams) { final AbstractTripleStore store = createParams.getTripleStore(); - final Properties props = store.getIndexManager() != null - && store.getIndexManager() instanceof AbstractJournal ? ((AbstractJournal) store - .getIndexManager()).getProperties() : null; - - final GeoSpatialDefaults dflts = new GeoSpatialDefaults(props); + final GeoSpatialDefaults dflts = new GeoSpatialDefaults(getStoreProperties(store)); final ServiceNode serviceNode = createParams.getServiceNode(); @@ -199,7 +196,7 @@ public BigdataServiceCall create(final ServiceCallCreateParams createParams) { validateSearch(searchVar, statementPatterns); - /** + /* * Get the service call configuration from annotations (attachable via query hints). * Here's how to define the hints: * @@ -255,6 +252,20 @@ public BigdataServiceCall create(final ServiceCallCreateParams createParams) { } + /** + * Extract properties from store. + */ + private static Properties getStoreProperties(AbstractTripleStore store) { + if ( store.getIndexManager() != null + && store.getIndexManager() instanceof AbstractJournal) { + return ((AbstractJournal) store + .getIndexManager()).getProperties(); + } else if (store instanceof TempTripleStore) { + return store.getProperties(); + } + throw new IllegalArgumentException("Failed to get store properties"); + } + /** * Validate the search request. This looks for search magic predicates and * returns them all. It is an error if anything else is found in the group.