fixing initial classgroup
This commit is contained in:
parent
5ebd33a6ea
commit
e06c6d0cba
5 changed files with 24 additions and 21 deletions
Binary file not shown.
|
@ -130,10 +130,6 @@ public class JenaModelUtils {
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Unable to create class groups automatically based on class hierarchy");
|
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);
|
vitroInternalsSubmodel.enterCriticalSection(Lock.WRITE);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -800,21 +800,12 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
||||||
public void addVClassesToGroups(List <VClassGroup> groups) {
|
public void addVClassesToGroups(List <VClassGroup> groups) {
|
||||||
getOntModel().enterCriticalSection(Lock.READ);
|
getOntModel().enterCriticalSection(Lock.READ);
|
||||||
try {
|
try {
|
||||||
if ((groups != null) && (groups.size()>0)) {
|
if (groups != null) {
|
||||||
Iterator groupIt = groups.iterator();
|
Iterator groupIt = groups.iterator();
|
||||||
while (groupIt.hasNext()) {
|
while (groupIt.hasNext()) {
|
||||||
VClassGroup g = (VClassGroup) groupIt.next();
|
VClassGroup g = (VClassGroup) groupIt.next();
|
||||||
addVClassesToGroup(g);
|
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 {
|
} finally {
|
||||||
getOntModel().leaveCriticalSection();
|
getOntModel().leaveCriticalSection();
|
||||||
|
|
|
@ -8,6 +8,7 @@ import javax.servlet.ServletContextEvent;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
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.Individual;
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
import com.hp.hpl.jena.rdf.model.Literal;
|
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.rdf.model.ResourceFactory;
|
||||||
import com.hp.hpl.jena.shared.Lock;
|
import com.hp.hpl.jena.shared.Lock;
|
||||||
import com.hp.hpl.jena.util.iterator.ClosableIterator;
|
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.beans.ApplicationBean;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
|
@ -79,6 +81,7 @@ public class JenaDataSourceSetup extends JenaDataSourceSetupBase implements java
|
||||||
if (isEmpty(memModel)) {
|
if (isEmpty(memModel)) {
|
||||||
loadDataFromFilesystem(memModel, sce.getServletContext());
|
loadDataFromFilesystem(memModel, sce.getServletContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userAccountsModel.size() == 0) {
|
if (userAccountsModel.size() == 0) {
|
||||||
readOntologyFilesInPathSet(AUTHPATH, sce.getServletContext(), userAccountsModel);
|
readOntologyFilesInPathSet(AUTHPATH, sce.getServletContext(), userAccountsModel);
|
||||||
if (userAccountsModel.size() == 0) {
|
if (userAccountsModel.size() == 0) {
|
||||||
|
@ -145,11 +148,9 @@ public class JenaDataSourceSetup extends JenaDataSourceSetupBase implements java
|
||||||
essentialInterfaceData = InitialJenaModelUtils.loadInitialModel(sce.getServletContext(), defaultNamespace);
|
essentialInterfaceData = InitialJenaModelUtils.loadInitialModel(sce.getServletContext(), defaultNamespace);
|
||||||
if (essentialInterfaceData.size() == 0) {
|
if (essentialInterfaceData.size() == 0) {
|
||||||
essentialInterfaceData = InitialJenaModelUtils.basicPortalAndRootTab(defaultNamespace);
|
essentialInterfaceData = InitialJenaModelUtils.basicPortalAndRootTab(defaultNamespace);
|
||||||
|
essentialInterfaceData.add(InitialJenaModelUtils.basicClassgroup(wadf.getDefaultNamespace()));
|
||||||
}
|
}
|
||||||
//JenaModelUtils.makeClassGroupsFromRootClasses(wadf,memModel,essentialInterfaceData);
|
//JenaModelUtils.makeClassGroupsFromRootClasses(wadf,memModel,essentialInterfaceData);
|
||||||
if (!essentialInterfaceData.isEmpty()) {
|
|
||||||
memModel.addSubModel(essentialInterfaceData);
|
|
||||||
}
|
|
||||||
memModel.add(essentialInterfaceData);
|
memModel.add(essentialInterfaceData);
|
||||||
} else {
|
} else {
|
||||||
//Set the default namespace to the namespace of the first portal object we find.
|
//Set the default namespace to the namespace of the first portal object we find.
|
||||||
|
|
|
@ -11,6 +11,7 @@ import javax.servlet.ServletContext;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
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.Individual;
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
import com.hp.hpl.jena.ontology.OntModelSpec;
|
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.rdf.model.ResourceFactory;
|
||||||
import com.hp.hpl.jena.util.ResourceUtils;
|
import com.hp.hpl.jena.util.ResourceUtils;
|
||||||
import com.hp.hpl.jena.util.iterator.ClosableIterator;
|
import com.hp.hpl.jena.util.iterator.ClosableIterator;
|
||||||
|
import com.hp.hpl.jena.vocabulary.OWL;
|
||||||
import com.hp.hpl.jena.vocabulary.RDF;
|
import com.hp.hpl.jena.vocabulary.RDF;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
|
@ -86,7 +88,6 @@ public class InitialJenaModelUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Model basicPortalAndRootTab(String defaultNamespace) {
|
public static Model basicPortalAndRootTab(String defaultNamespace) {
|
||||||
|
|
||||||
OntModel essentialInterfaceData = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
|
OntModel essentialInterfaceData = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
|
||||||
Resource portalClass = essentialInterfaceData.getResource(VitroVocabulary.PORTAL);
|
Resource portalClass = essentialInterfaceData.getResource(VitroVocabulary.PORTAL);
|
||||||
Property themeDirProperty = essentialInterfaceData.getProperty(VitroVocabulary.PORTAL_THEMEDIR);
|
Property themeDirProperty = essentialInterfaceData.getProperty(VitroVocabulary.PORTAL_THEMEDIR);
|
||||||
|
@ -111,7 +112,21 @@ public class InitialJenaModelUtils {
|
||||||
portal1.addProperty(rootTabProperty, rootTab);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue