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.
This commit is contained in:
Jim Blake 2015-03-30 13:47:31 -04:00
parent 6981838348
commit abf3d00996
2 changed files with 8 additions and 6 deletions

View file

@ -72,14 +72,14 @@ public class BasicCombinedTripleSource implements CombinedTripleSource {
sources.put(CONFIGURATION, configurationSource); sources.put(CONFIGURATION, configurationSource);
ontModels = new EnumMap<>(WhichService.class); ontModels = new EnumMap<>(WhichService.class);
ontModels.put(CONTENT, new ModelMakerOntModelCache( ontModels.put(CONTENT, new UnionModelsOntModelsCache(
getModelMaker(CONTENT))); new ModelMakerOntModelCache(getModelMaker(CONTENT)),
CONTENT_UNIONS));
ontModels.put(CONFIGURATION, new ModelMakerOntModelCache( ontModels.put(CONFIGURATION, new ModelMakerOntModelCache(
getModelMaker(CONFIGURATION))); getModelMaker(CONFIGURATION)));
ontModelCache = new UnionModelsOntModelsCache(new JoinedOntModelCache( ontModelCache = new JoinedOntModelCache(ontModels.get(CONTENT),
ontModels.get(CONTENT), ontModels.get(CONFIGURATION)), ontModels.get(CONFIGURATION));
CONTENT_UNIONS);
} }
protected OntModelCache getOntModels(WhichService whichService) { protected OntModelCache getOntModels(WhichService whichService) {

View file

@ -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 static edu.cornell.mannlib.vitro.webapp.triplesource.impl.BasicCombinedTripleSource.CONTENT_UNIONS;
import java.lang.reflect.Method;
import java.sql.Driver; import java.sql.Driver;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.SQLException; 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 * Use models from the short-term RDFService, since there is less contention
* for the database connections that way. The exceptions are the * for the database connections that way. The exceptions are the
* memory-mapped models. By keeping them, we also keep their sub-models. * 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 @Override
public OntModelCache getShortTermOntModels(RDFService shortTermRdfService, public OntModelCache getShortTermOntModels(RDFService shortTermRdfService,