diff --git a/.classpath b/.classpath new file mode 100644 index 000000000..af265b0e4 --- /dev/null +++ b/.classpath @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 000000000..5888f882a --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + vitro-core-rel-1.1-maint + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/Individual.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/Individual.java index 92200a2e6..9c5cdb867 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/Individual.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/Individual.java @@ -19,6 +19,13 @@ public interface Individual extends ResourceBean, VitroTimeWindowedResource, Com String getName(); void setName(String in); + /** + * Returns an rdfs:label if there is one on the individual. Returns null + * if none can be found. If more than one rdfs:label can be found for the individual + * one of the labels will be returned, which one is undefined. + */ + String getRdfsLabel(); + String getVClassURI(); void setVClassURI(String in); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/IndividualImpl.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/IndividualImpl.java index 79b7c15c2..8d8f3bcf9 100755 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/IndividualImpl.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/IndividualImpl.java @@ -25,6 +25,7 @@ public class IndividualImpl extends BaseResourceBean implements Individual, Comp protected static final String NOT_INITIALIZED = "__%NOT_INITIALIZED%__"; public String name = null; + protected String rdfsLabel = null; public String vClassURI = null; protected VClass vClass = null; protected List directVClasses = null; @@ -81,6 +82,9 @@ public class IndividualImpl extends BaseResourceBean implements Individual, Comp public String getName(){return name;} public void setName(String in){name=in;} + public String getRdfsLabel(){ return rdfsLabel; } + public void setRdfsLabel(String s){ rdfsLabel = s; } + // private String modTime = null; // public String getModtime(){return modTime;} // public void setModtime(String in){modTime=in;} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/IndividualFiltering.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/IndividualFiltering.java index 8ded4c455..23eea572f 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/IndividualFiltering.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/IndividualFiltering.java @@ -292,6 +292,9 @@ public class IndividualFiltering implements Individual { return _innerIndividual.getName(); } + public String getRdfsLabel(){ + return _innerIndividual.getRdfsLabel(); + } public String getNamespace() { return _innerIndividual.getNamespace(); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/IndividualJena.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/IndividualJena.java index 72044505b..39b8b9468 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/IndividualJena.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/IndividualJena.java @@ -50,6 +50,7 @@ public class IndividualJena extends IndividualImpl implements Individual { private OntResource ind = null; private WebappDaoFactoryJena webappDaoFactory = null; private Float _searchBoostJena = null; + private boolean retreivedNullRdfsLabel = false; public IndividualJena(OntResource ind, WebappDaoFactoryJena wadf) { this.ind = ind; @@ -81,6 +82,23 @@ public class IndividualJena extends IndividualImpl implements Individual { } } + public String getRdfsLabel() { + if (this.rdfsLabel != null) { + return rdfsLabel; + } else if( this.rdfsLabel == null && retreivedNullRdfsLabel ){ + return null; + } else { + ind.getOntModel().enterCriticalSection(Lock.READ); + try { + this.rdfsLabel = webappDaoFactory.getJenaBaseDao().getLabel(ind); + retreivedNullRdfsLabel = this.rdfsLabel == null; + return this.rdfsLabel; + } finally { + ind.getOntModel().leaveCriticalSection(); + } + } + } + public String getVClassURI() { if (this.vClassURI != null) { return vClassURI;