bugfix for initial site config in SDB

This commit is contained in:
bjl23 2011-01-25 18:17:31 +00:00
parent f243f48b3b
commit b174bdcaf0

View file

@ -28,6 +28,7 @@ import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.ResourceFactory; import com.hp.hpl.jena.rdf.model.ResourceFactory;
import com.hp.hpl.jena.rdf.model.Statement; import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.rdf.model.StmtIterator; import com.hp.hpl.jena.rdf.model.StmtIterator;
import com.hp.hpl.jena.sdb.SDB;
import com.hp.hpl.jena.sdb.SDBFactory; import com.hp.hpl.jena.sdb.SDBFactory;
import com.hp.hpl.jena.sdb.Store; import com.hp.hpl.jena.sdb.Store;
import com.hp.hpl.jena.sdb.StoreDesc; import com.hp.hpl.jena.sdb.StoreDesc;
@ -99,6 +100,7 @@ public class JenaDataSourceSetupSDB extends JenaDataSourceSetupBase implements j
checkForNamespaceMismatch( memModel, defaultNamespace ); checkForNamespaceMismatch( memModel, defaultNamespace );
// SDB setup // SDB setup
StoreDesc storeDesc = makeStoreDesc(); StoreDesc storeDesc = makeStoreDesc();
setApplicationStoreDesc(storeDesc, sce.getServletContext()); setApplicationStoreDesc(storeDesc, sce.getServletContext());
@ -251,15 +253,14 @@ public class JenaDataSourceSetupSDB extends JenaDataSourceSetupBase implements j
sce.getServletContext().setAttribute("unionOntModelSelector", unionOms); //assertions and inferences sce.getServletContext().setAttribute("unionOntModelSelector", unionOms); //assertions and inferences
sce.getServletContext().setAttribute("baseOntModelSelector", baseOms); //assertions sce.getServletContext().setAttribute("baseOntModelSelector", baseOms); //assertions
sce.getServletContext().setAttribute("inferenceOntModelSelector", inferenceOms); //inferences sce.getServletContext().setAttribute("inferenceOntModelSelector", inferenceOms); //inferences
ApplicationBean appBean = getApplicationBeanFromOntModel(unionOms.getFullModel(),wadf); ApplicationBean appBean = getApplicationBeanFromOntModel(unionOms.getFullModel(),wadf);
if (appBean != null) { if (appBean != null) {
sce.getServletContext().setAttribute("applicationBean", appBean); sce.getServletContext().setAttribute("applicationBean", appBean);
} }
if (isEmpty(unionOms.getFullModel())) { //if (isEmpty(unionOms.getFullModel())) {
loadDataFromFilesystem(unionOms.getFullModel(), sce.getServletContext()); // loadDataFromFilesystem(unionOms.getFullModel(), sce.getServletContext());
} //}
if (userAccountsModel.size() == 0) { if (userAccountsModel.size() == 0) {
readOntologyFilesInPathSet(AUTHPATH, sce.getServletContext(), userAccountsModel); readOntologyFilesInPathSet(AUTHPATH, sce.getServletContext(), userAccountsModel);
@ -268,7 +269,7 @@ public class JenaDataSourceSetupSDB extends JenaDataSourceSetupBase implements j
} }
} }
ensureEssentialInterfaceData(unionOms.getFullModel(), sce, wadf); ensureEssentialInterfaceData(unionOms.getApplicationMetadataModel(), sce, wadf);
NamespaceMapper namespaceMapper = new NamespaceMapperJena(masterUnion, masterUnion, defaultNamespace); NamespaceMapper namespaceMapper = new NamespaceMapperJena(masterUnion, masterUnion, defaultNamespace);
sce.getServletContext().setAttribute("NamespaceMapper", namespaceMapper); sce.getServletContext().setAttribute("NamespaceMapper", namespaceMapper);
@ -417,7 +418,9 @@ public class JenaDataSourceSetupSDB extends JenaDataSourceSetupBase implements j
} }
private boolean isEmpty(Model model) { private boolean isEmpty(Model model) {
ClosableIterator<Statement> closeIt = model.listStatements(); ClosableIterator<Statement> closeIt = model.listStatements(
null, RDF.type, ResourceFactory.createResource(
VitroVocabulary.PORTAL));
try { try {
if (closeIt.hasNext()) { if (closeIt.hasNext()) {
return false; return false;