diff --git a/webapp/lib/sdb.jar b/webapp/lib/sdb.jar index 6a11cfaec..35f0ab4a2 100644 Binary files a/webapp/lib/sdb.jar and b/webapp/lib/sdb.jar differ diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/JenaModelUtils.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/JenaModelUtils.java index b07b00940..7f666fd3d 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/JenaModelUtils.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/JenaModelUtils.java @@ -130,10 +130,6 @@ public class JenaModelUtils { } } catch (Exception e) { log.error("Unable to create class groups automatically based on class hierarchy"); - Individual thingsClassGroup = tempModel.createIndividual(wadf.getDefaultNamespace()+"vitroClassGroupThings",classGroupClass); - thingsClassGroup.addLabel("Things",null); - thingsClassGroup.addProperty(tempModel.getProperty(VitroVocabulary.DISPLAY_RANK_ANNOT),"50",XSDDatatype.XSDint); - tempModel.add(OWL.Thing, inClassGroupProperty, thingsClassGroup); } vitroInternalsSubmodel.enterCriticalSection(Lock.WRITE); try { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/VClassDaoJena.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/VClassDaoJena.java index 290b8e386..dd308cf59 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/VClassDaoJena.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/VClassDaoJena.java @@ -800,22 +800,13 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao { public void addVClassesToGroups(List groups) { getOntModel().enterCriticalSection(Lock.READ); try { - if ((groups != null) && (groups.size()>0)) { + if (groups != null) { Iterator groupIt = groups.iterator(); while (groupIt.hasNext()) { VClassGroup g = (VClassGroup) groupIt.next(); addVClassesToGroup(g); } - } else { - VClassGroup vcg = new VClassGroup(); - vcg.setURI("null://null#0"); - vcg.setNamespace("null://null#"); - vcg.setLocalName("0"); - vcg.setPublicName("Browse Categories"); - vcg.addAll(getAllVclasses()); - java.util.Collections.sort(vcg.getVitroClassList()); - groups.add(vcg); - } + } } finally { getOntModel().leaveCriticalSection(); } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/JenaDataSourceSetup.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/JenaDataSourceSetup.java index c068a4a24..ac652e23c 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/JenaDataSourceSetup.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/JenaDataSourceSetup.java @@ -8,6 +8,7 @@ import javax.servlet.ServletContextEvent; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; import com.hp.hpl.jena.ontology.Individual; import com.hp.hpl.jena.ontology.OntModel; import com.hp.hpl.jena.rdf.model.Literal; @@ -16,6 +17,7 @@ import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.ResourceFactory; import com.hp.hpl.jena.shared.Lock; import com.hp.hpl.jena.util.iterator.ClosableIterator; +import com.hp.hpl.jena.vocabulary.OWL; import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; @@ -79,6 +81,7 @@ public class JenaDataSourceSetup extends JenaDataSourceSetupBase implements java if (isEmpty(memModel)) { loadDataFromFilesystem(memModel, sce.getServletContext()); } + if (userAccountsModel.size() == 0) { readOntologyFilesInPathSet(AUTHPATH, sce.getServletContext(), userAccountsModel); if (userAccountsModel.size() == 0) { @@ -145,11 +148,9 @@ public class JenaDataSourceSetup extends JenaDataSourceSetupBase implements java essentialInterfaceData = InitialJenaModelUtils.loadInitialModel(sce.getServletContext(), defaultNamespace); if (essentialInterfaceData.size() == 0) { essentialInterfaceData = InitialJenaModelUtils.basicPortalAndRootTab(defaultNamespace); + essentialInterfaceData.add(InitialJenaModelUtils.basicClassgroup(wadf.getDefaultNamespace())); } //JenaModelUtils.makeClassGroupsFromRootClasses(wadf,memModel,essentialInterfaceData); - if (!essentialInterfaceData.isEmpty()) { - memModel.addSubModel(essentialInterfaceData); - } memModel.add(essentialInterfaceData); } else { //Set the default namespace to the namespace of the first portal object we find. diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/jena/InitialJenaModelUtils.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/jena/InitialJenaModelUtils.java index df5160894..fe02ccac2 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/jena/InitialJenaModelUtils.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/jena/InitialJenaModelUtils.java @@ -11,6 +11,7 @@ import javax.servlet.ServletContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; import com.hp.hpl.jena.ontology.Individual; import com.hp.hpl.jena.ontology.OntModel; import com.hp.hpl.jena.ontology.OntModelSpec; @@ -22,6 +23,7 @@ import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.rdf.model.ResourceFactory; import com.hp.hpl.jena.util.ResourceUtils; import com.hp.hpl.jena.util.iterator.ClosableIterator; +import com.hp.hpl.jena.vocabulary.OWL; import com.hp.hpl.jena.vocabulary.RDF; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; @@ -86,7 +88,6 @@ public class InitialJenaModelUtils { } public static Model basicPortalAndRootTab(String defaultNamespace) { - OntModel essentialInterfaceData = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM); Resource portalClass = essentialInterfaceData.getResource(VitroVocabulary.PORTAL); Property themeDirProperty = essentialInterfaceData.getProperty(VitroVocabulary.PORTAL_THEMEDIR); @@ -110,8 +111,22 @@ public class InitialJenaModelUtils { rootTab.addProperty(tabInPortalProperty, portal1); portal1.addProperty(rootTabProperty, rootTab); - return essentialInterfaceData; - + return essentialInterfaceData; } + public static Model basicClassgroup(String defaultNamespace) { + OntModel m = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM); + Individual thingsClassGroup = m.createIndividual( + defaultNamespace+"vitroClassGroupThings", + m.createResource(VitroVocabulary.CLASSGROUP)); + thingsClassGroup.addLabel("Things", null); + thingsClassGroup.addProperty( + m.getProperty(VitroVocabulary.DISPLAY_RANK_ANNOT), + "50", XSDDatatype.XSDint); + m.add(OWL.Thing, + m.getProperty(VitroVocabulary.IN_CLASSGROUP), thingsClassGroup); + return m; + } + + }