From abf3d00996d212e6e8b3d9cbbeda3b164718d77f Mon Sep 17 00:00:00 2001 From: Jim Blake Date: Mon, 30 Mar 2015 13:47:31 -0400 Subject: [PATCH] VIVO-1009 Apply the UNION content models at the proper level. The ContentTripleSourceTDB and ContentTripleSourceSPARQL need to have union models on the short-term OntModelCache. But they shouldn't be required to add them. They should be added to the long-term OntModelCache and let ContentTripleSourceSDB override them when it overrides the long-term models. --- .../triplesource/impl/BasicCombinedTripleSource.java | 10 +++++----- .../triplesource/impl/sdb/ContentTripleSourceSDB.java | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/triplesource/impl/BasicCombinedTripleSource.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/triplesource/impl/BasicCombinedTripleSource.java index 905dc65a6..612f47b56 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/triplesource/impl/BasicCombinedTripleSource.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/triplesource/impl/BasicCombinedTripleSource.java @@ -72,14 +72,14 @@ public class BasicCombinedTripleSource implements CombinedTripleSource { sources.put(CONFIGURATION, configurationSource); ontModels = new EnumMap<>(WhichService.class); - ontModels.put(CONTENT, new ModelMakerOntModelCache( - getModelMaker(CONTENT))); + ontModels.put(CONTENT, new UnionModelsOntModelsCache( + new ModelMakerOntModelCache(getModelMaker(CONTENT)), + CONTENT_UNIONS)); ontModels.put(CONFIGURATION, new ModelMakerOntModelCache( getModelMaker(CONFIGURATION))); - ontModelCache = new UnionModelsOntModelsCache(new JoinedOntModelCache( - ontModels.get(CONTENT), ontModels.get(CONFIGURATION)), - CONTENT_UNIONS); + ontModelCache = new JoinedOntModelCache(ontModels.get(CONTENT), + ontModels.get(CONFIGURATION)); } protected OntModelCache getOntModels(WhichService whichService) { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/triplesource/impl/sdb/ContentTripleSourceSDB.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/triplesource/impl/sdb/ContentTripleSourceSDB.java index d89ca29b7..eec10e046 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/triplesource/impl/sdb/ContentTripleSourceSDB.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/triplesource/impl/sdb/ContentTripleSourceSDB.java @@ -4,7 +4,6 @@ package edu.cornell.mannlib.vitro.webapp.triplesource.impl.sdb; import static edu.cornell.mannlib.vitro.webapp.triplesource.impl.BasicCombinedTripleSource.CONTENT_UNIONS; -import java.lang.reflect.Method; import java.sql.Driver; import java.sql.DriverManager; import java.sql.SQLException; @@ -194,6 +193,9 @@ public class ContentTripleSourceSDB extends ContentTripleSource { * Use models from the short-term RDFService, since there is less contention * for the database connections that way. The exceptions are the * memory-mapped models. By keeping them, we also keep their sub-models. + * + * Set up the Union models again also, so they will reference the short-term + * models. */ @Override public OntModelCache getShortTermOntModels(RDFService shortTermRdfService,