When you run the build script to compile and deploy Vitro
- (see installation step VI, below),
+ (see installation step V, below),
the files will be deployed to a
directory inside Tomcat. This is the actual executing code for Vitro,
but you won’t need to look at it or change it. If you need to change
@@ -86,7 +86,7 @@
build.properties file (see installation step IV,
below). You must create this directory before starting Vitro,
you must create the runtime.properties file in this directory
- (see Step V, below), and you
+ (see Step VI, below), and you
must ensure that Tomcat has permission to read and write to this
directory when it runs.
These properties are used in compilation and deployment.
They will be incorporated into Vitro when it is compiled in
- Step VI. If you want to change these properties at
- a later date, you will need to stop Tomcat, repeat Step VI,
+ Step V. If you want to change these properties at
+ a later date, you will need to stop Tomcat, repeat Step V,
and restart Tomcat.
@@ -394,22 +393,64 @@
-
V. Specify runtime properties
+
V. Compile and deploy
- In Step IV, you defined the location of the Vitro home directory,
+ In Step IV, you defined the location of the VIVO home directory,
by specifying vitro.home in the build.properties file.
Create that directory now.
- In the webapp/config subdirectory of the Vitro distribution, you will find a file called
- example.runtime.properties. Copy this to the Vitro home directory you have created,
- renaming the copy to runtime.properties.
- Edit the file to suit your installation, as described in the following table.
+ At the command line, change to the webapp directory inside the Vitro distribution
+ directory. Then type:
+
+
ant all
+
+ to build Vitro and deploy to Tomcat's webapps directory.
+
+
+ The build script may run for as much as five minutes,
+ and creates more than 100 lines of output.
+ The process comprises several steps:
+
+
collecting the source files from the distribution directory,
+
compiling the Java source code,
+
compiling and running unit tests,
+
preparing the Solr search engine,
+
deploying Vitro and Solr to Tomcat.
+
+
+
+ The output of the build may include a variety of warning messages.
+ The Java compiler may warn of code that is outdated.
+ Unit tests may produce warning messages,
+ and some tests may be ignored if they do not produce consistent results.
+
+
+ BUILD SUCCESSFUL Total time: 1 minute 49 seconds
+
+
+ If the output ends with a success message, the build was successful.
+ Proceed to the next step.
+
+
+ BUILD FAILED Total time: 35 seconds
+
+
+ If the output ends with a failure message, the build has failed.
+ Find the cause of the failure, fix the problem, and run the script again.
+
+
+
VI. Specify runtime properties
+
+ The build process in Step V created a file called example.runtime.properties
+ in your Vitro home directory (vitro.home in the build.properties file).
+ Rename this file to runtime.properties, and
+ edit the file to suit your installation, as described in the following table.
These properties are loaded when Vitro starts up. If you want to change these
properties at a later date, you will need to restart Tomcat for them to take
- effect. You will not need to repeat Step VI.
+ effect. You will not need to repeat Step V.
Windows:
@@ -800,47 +841,6 @@
-
VI. Compile and deploy
-
- At the command line, change to the webapp directory inside the Vitro distribution
- directory. Then type:
-
-
ant all
-
- to build Vitro and deploy to Tomcat's webapps directory.
-
-
- The build script may run for as much as five minutes,
- and creates more than 100 lines of output.
- The process comprises several steps:
-
-
collecting the source files from the distribution directory,
-
compiling the Java source code,
-
compiling and running unit tests,
-
preparing the Solr search engine,
-
deploying Vitro and Solr to Tomcat.
-
-
-
- The output of the build may include a variety of warning messages.
- The Java compiler may warn of code that is outdated.
- Unit tests may produce warning messages,
- and some tests may be ignored if they do not produce consistent results.
-
-
- BUILD SUCCESSFUL Total time: 1 minute 49 seconds
-
-
- If the output ends with a success message, the build was successful.
- Proceed to the next step.
-
-
- BUILD FAILED Total time: 35 seconds
-
-
- If the output ends with a failure message, the build has failed.
- Find the cause of the failure, fix the problem, and run the script again.
-
VII. Configure Tomcat
Set JVM parameters
@@ -921,8 +921,8 @@
problem is detected, the normal Vitro pages will redirect
to a startup status page describing the problem. You
can stop tomcat, attempt to fix the problem and
- proceeded from Step VI. The
- startup status page may offer a continue link which
+ proceed from Step V. If the problem is not serious, the
+ startup status page may offer a continue link which
will allow you to use VIVO in spite of the problems.
diff --git a/webapp/build.xml b/webapp/build.xml
index 6b60d1fe4..00f61f423 100644
--- a/webapp/build.xml
+++ b/webapp/build.xml
@@ -102,6 +102,24 @@
+
+
+
+
+
+
+ Tomcat home directory '${tomcat.home}' does not exist.
+ Check the value of 'tomcat.home' in your build.properties file.
+
+
+
+
+
+
+
+ '${tomcat.home}' does not refer to a valid Tomcat instance: it has no 'webapps' sub-directory.
+ Check the value of 'tomcat.home' in your build.properties file."
+
diff --git a/webapp/languages/example/i18n/all_es.properties b/webapp/languages/example/i18n/all_es.properties
index e556063d6..49e8eb110 100644
--- a/webapp/languages/example/i18n/all_es.properties
+++ b/webapp/languages/example/i18n/all_es.properties
@@ -126,10 +126,6 @@ submit_add_new_account = Añadir nueva cuenta
account_created = Su {0} cuenta ha sido creada.
account_created_subject = Su {0} cuenta ha sido creada.
-account_created_email_html = @@file files/accountCreatedEmail.html
-account_created_email_text = @@file files/accountCreatedEmail.txt
-account_created_external_email_html = @@file files/accountCreatedExternalOnlyEmail.html
-account_created_external_email_text = @@file files/accountCreatedExternalOnlyEmail.txt
confirm_delete_account_singular = ¿Está seguro de que desea eliminar esta cuenta?
confirm_delete_account_plural = ¿Está seguro de que desea eliminar estas cuentas?
@@ -148,21 +144,11 @@ select_associated_profile = Seleccione el perfil asociado
create_associated_profile = Cree el perfil asociado
email_changed_subject = Su {0} cuenta de correo electrónico ha cambiado.
-email_changed_html = @@file files/accountEmailChanged.html
-email_changed_text = @@file files/accountEmailChanged.txt
create_your_password = Crea tu Contraseña
password_created_subject = Su {0} contraseña ha sido creado con éxito.
-password_created_email_html = @@file files/passwordCreatedEmail.html
-password_created_email_text = @@file files/passwordCreatedEmail.txt
-
password_reset_pending_subject = {0} restablecer solicitud de contraseña
-password_reset_pending_email_html = @@file files/passwordResetPending.html
-password_reset_pending_email_text = @@file files/passwordResetPending.txt
-
password_reset_complete_subject = Su {0} ha cambiado la contraseña.
-password_reset_complete_email_html = @@file files/passwordResetComplete.html
-password_reset_complete_email_text = @@file files/passwordResetComplete.txt
reset_your_password = Renovar su contraseña
first_time_login = Log Por primera vez en
@@ -181,8 +167,6 @@ password_saved_please_login = Su contraseña ha sido guardada. Por favor, ingres
please_provide_contact_information = Por favor proporcione su información de contacto para terminar de crear la cuenta.
first_time_login_note = Nota: Un correo electrónico será enviado a la dirección indicada anteriormente notificar que una cuenta ha sido creada.
-first_time_external_email_html = @@file files/accountFirstTimeExternal.html
-first_time_external_email_text = @@file files/accountFirstTimeExternal.txt
myAccount_heading = Mi cuenta
myAccount_confirm_changes = Los cambios se han guardado.
diff --git a/webapp/languages/example/templates/freemarker/userAccounts-acctCreatedEmail.ftl b/webapp/languages/example/templates/freemarker/userAccounts-acctCreatedEmail.ftl
new file mode 100644
index 000000000..e5ab4bc0b
--- /dev/null
+++ b/webapp/languages/example/templates/freemarker/userAccounts-acctCreatedEmail.ftl
@@ -0,0 +1,68 @@
+<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
+
+<#-- Confirmation that an account has been created. -->
+
+<#assign subject = "Su cuenta ${siteName} ha sido creado." />
+
+<#assign html>
+
+
+ ${subject}
+
+
+
+ Si el enlace no funciona, puedes copiar y pegar el enlace directamente en la barra de direcciones de su navegador.
+
+
+
+ ¡Gracias!
+
+
+
+#assign>
+
+<#assign text>
+${userAccount.firstName} ${userAccount.lastName}
+
+Enhorabuena!
+
+Hemos creado la nueva cuenta en ${siteName},
+asociada con ${userAccount.emailAddress}.
+
+Si no has solicitado esta nueva cuenta puede ignorar este mensaje.
+Esta solicitud caducará si no se hubiere pronunciado sobre durante 30 días.
+
+Pega el siguiente enlace en la barra de direcciones de su navegador para
+crear su contraseña para su nueva cuenta usando nuestro servidor seguro.
+
+${passwordLink}
+
+¡Gracias!
+#assign>
+
+<@email subject=subject html=html text=text />
diff --git a/webapp/languages/example/templates/freemarker/userAccounts-acctCreatedExternalOnlyEmail.ftl b/webapp/languages/example/templates/freemarker/userAccounts-acctCreatedExternalOnlyEmail.ftl
new file mode 100644
index 000000000..0b91545fe
--- /dev/null
+++ b/webapp/languages/example/templates/freemarker/userAccounts-acctCreatedExternalOnlyEmail.ftl
@@ -0,0 +1,43 @@
+<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
+
+<#-- Confirmation that an account has been created. -->
+
+<#assign subject = "Su cuenta ${siteName} ha sido creada." />
+
+<#assign html>
+
+
+ ${subject}
+
+
+
+ Hemos creado la nueva cuenta VIVO asociado con ${userAccount.emailAddress}.
+
+
+
+ ¡Gracias!
+
+
+
+#assign>
+
+<#assign text>
+${userAccount.firstName} ${userAccount.lastName}
+
+¡Enhorabuena!
+
+Hemos creado la nueva cuenta VIVO asociado con
+${userAccount.emailAddress}.
+
+¡Gracias!
+#assign>
+
+<@email subject=subject html=html text=text />
diff --git a/webapp/languages/example/templates/freemarker/userAccounts-confirmEmailChangedEmail.ftl b/webapp/languages/example/templates/freemarker/userAccounts-confirmEmailChangedEmail.ftl
new file mode 100644
index 000000000..a3674c8cf
--- /dev/null
+++ b/webapp/languages/example/templates/freemarker/userAccounts-confirmEmailChangedEmail.ftl
@@ -0,0 +1,38 @@
+<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
+
+<#-- Confirmation that the user has changed his email account. -->
+
+<#assign subject = "Su cuenta de correo electrónico ${siteName} ha cambiado." />
+
+<#assign html>
+
+
+ ${subject}
+
+
+
+ Ha cambiado recientemente la dirección de correo electrónico asociada a
+ ${userAccount.firstName} ${userAccount.lastName}
+
+
+
+ Gracias.
+
+
+
+#assign>
+
+<#assign text>
+Hola, ${userAccount.firstName} ${userAccount.lastName}
+
+Ha cambiado recientemente la dirección de correo electrónico asociada a
+${userAccount.firstName} ${userAccount.lastName}
+
+Gracias.
+#assign>
+
+<@email subject=subject html=html text=text />
diff --git a/webapp/languages/example/templates/freemarker/userAccounts-firstTimeExternalEmail.ftl b/webapp/languages/example/templates/freemarker/userAccounts-firstTimeExternalEmail.ftl
new file mode 100644
index 000000000..5c6558a52
--- /dev/null
+++ b/webapp/languages/example/templates/freemarker/userAccounts-firstTimeExternalEmail.ftl
@@ -0,0 +1,43 @@
+<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
+
+<#-- Confirmation that an account has been created for an externally-authenticated user. -->
+
+<#assign subject = "Su cuenta ${siteName} ha sido creada." />
+
+<#assign html>
+
+
+ ${subject}
+
+
+
+ Hemos creado la nueva cuenta VIVO asociado con ${userAccount.emailAddress}.
+
+
+
+ ¡Gracias!
+
+
+
+#assign>
+
+<#assign text>
+${userAccount.firstName} ${userAccount.lastName}
+
+¡Enhorabuena!
+
+Hemos creado la nueva cuenta VIVO asociado con
+${userAccount.emailAddress}.
+
+¡Gracias!
+#assign>
+
+<@email subject=subject html=html text=text />
diff --git a/webapp/languages/example/templates/freemarker/userAccounts-passwordCreatedEmail.ftl b/webapp/languages/example/templates/freemarker/userAccounts-passwordCreatedEmail.ftl
new file mode 100644
index 000000000..f3e272055
--- /dev/null
+++ b/webapp/languages/example/templates/freemarker/userAccounts-passwordCreatedEmail.ftl
@@ -0,0 +1,43 @@
+<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
+
+<#-- Confirmation that an password has been created. -->
+
+<#assign subject = "El ${siteName} contraseña ha sido creado con éxito." />
+
+<#assign html>
+
+
+ ${subject}
+
+
+
+ Hemos recibido una solicitud para restablecer la contraseña de su cuenta ${siteName}
+ (${userAccount.emailAddress}).
+
+
+
+ Por favor, siga las siguientes instrucciones para proceder con su restablecimiento de contraseña.
+
+
+
+ Si no has solicitado esta nueva cuenta puede ignorar este mensaje.
+ Esta solicitud caducará si no se hubiere pronunciado en un plazo de 30 días.
+
+
+
+ Haga clic en el enlace de abajo o pegarlo en la barra de direcciones de su navegador para
+ restablecer su contraseña usando nuestro servidor seguro.
+
+
+
${passwordLink}
+
+
¡Gracias!
+
+
+#assign>
+
+<#assign text>
+Estimado ${userAccount.firstName} ${userAccount.lastName}:
+
+Hemos recibido una solicitud para restablecer la contraseña de su cuenta ${siteName}
+(${userAccount.emailAddress}).
+
+Por favor, siga las siguientes instrucciones para proceder con su restablecimiento de contraseña.
+
+Si no has solicitado esta nueva cuenta puede ignorar este mensaje.
+Esta solicitud caducará si no se hubiere pronunciado en un plazo de 30 días.
+
+Pega el siguiente enlace en la barra de direcciones de su navegador para
+restablecer su contraseña usando nuestro servidor seguro.
+
+${passwordLink}
+
+¡Gracias!
+#assign>
+
+<@email subject=subject html=html text=text />
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/PolicyHelper.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/PolicyHelper.java
index 11c351044..d8a606efb 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/PolicyHelper.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/PolicyHelper.java
@@ -11,7 +11,6 @@ import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.ontology.OntModelSpec;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
-import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.RDFNode;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.Statement;
@@ -20,7 +19,6 @@ import com.hp.hpl.jena.rdf.model.StmtIterator;
import edu.cornell.mannlib.vitro.webapp.auth.identifier.ActiveIdentifierBundleFactories;
import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle;
import edu.cornell.mannlib.vitro.webapp.auth.identifier.RequestIdentifiers;
-import edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission;
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyIface;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction;
@@ -136,7 +134,8 @@ public class PolicyHelper {
.asResource().getURI());
} else {
action = new AddDataPropertyStatement(modelToBeModified,
- subject.getURI(), predicate.getURI());
+ subject.getURI(), predicate.getURI(), objectNode
+ .asLiteral().getString());
}
return isAuthorizedForActions(req, action);
}
@@ -169,7 +168,8 @@ public class PolicyHelper {
.asResource().getURI());
} else {
action = new DropDataPropertyStatement(modelToBeModified,
- subject.getURI(), predicate.getURI());
+ subject.getURI(), predicate.getURI(), objectNode
+ .asLiteral().getString());
}
return isAuthorizedForActions(req, action);
}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/AbstractDataPropertyStatementAction.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/AbstractDataPropertyStatementAction.java
index bfcf98c2a..8e49ec193 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/AbstractDataPropertyStatementAction.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/AbstractDataPropertyStatementAction.java
@@ -16,15 +16,17 @@ public abstract class AbstractDataPropertyStatementAction extends
private final String subjectUri;
private final String predicateUri;
private final Property predicate;
+ private final String dataValue;
public AbstractDataPropertyStatementAction(OntModel ontModel,
- String subjectUri, String predicateUri) {
+ String subjectUri, String predicateUri, String dataValue) {
super(ontModel);
this.subjectUri = subjectUri;
this.predicateUri = predicateUri;
Property dataProperty = new Property();
dataProperty.setURI(predicateUri);
this.predicate = dataProperty;
+ this.dataValue = dataValue;
}
public AbstractDataPropertyStatementAction(OntModel ontModel,
@@ -36,12 +38,14 @@ public abstract class AbstractDataPropertyStatementAction extends
Property dataProperty = new Property();
dataProperty.setURI(predicateUri);
this.predicate = dataProperty;
+ this.dataValue = dps.getData();
}
public String getSubjectUri() {
return subjectUri;
}
+ @Override
public Property getPredicate() {
return predicate;
}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/AddDataPropertyStatement.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/AddDataPropertyStatement.java
index 5f550d058..39c1e20ab 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/AddDataPropertyStatement.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/AddDataPropertyStatement.java
@@ -13,8 +13,8 @@ public class AddDataPropertyStatement extends
AbstractDataPropertyStatementAction {
public AddDataPropertyStatement(OntModel ontModel, String subjectUri,
- String predicateUri) {
- super(ontModel, subjectUri, predicateUri);
+ String predicateUri, String dataValue) {
+ super(ontModel, subjectUri, predicateUri, dataValue);
}
public AddDataPropertyStatement(OntModel ontModel, DataPropertyStatement dps) {
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/DropDataPropertyStatement.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/DropDataPropertyStatement.java
index 07138aa8f..b1f84cb2a 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/DropDataPropertyStatement.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/DropDataPropertyStatement.java
@@ -14,8 +14,8 @@ public class DropDataPropertyStatement extends
AbstractDataPropertyStatementAction {
public DropDataPropertyStatement(OntModel ontModel, String subjectUri,
- String predicateUri) {
- super(ontModel, subjectUri, predicateUri);
+ String predicateUri, String dataValue) {
+ super(ontModel, subjectUri, predicateUri, dataValue);
}
public DropDataPropertyStatement(OntModel ontModel,
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/EditDataPropertyStatement.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/EditDataPropertyStatement.java
index 5ef3b918f..8243a2031 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/EditDataPropertyStatement.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/EditDataPropertyStatement.java
@@ -12,8 +12,8 @@ import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
public class EditDataPropertyStatement extends
AbstractDataPropertyStatementAction {
public EditDataPropertyStatement(OntModel ontModel, String subjectUri,
- String predicateUri) {
- super(ontModel, subjectUri, predicateUri);
+ String predicateUri, String dataValue) {
+ super(ontModel, subjectUri, predicateUri, dataValue);
}
public EditDataPropertyStatement(OntModel ontModel,
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 e9892ba4b..0f19cc9c7 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/Individual.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/Individual.java
@@ -34,6 +34,13 @@ public interface Individual extends ResourceBean, Comparable {
List getObjectPropertyList();
void setPropertyList(List propertyList);
+ /**
+ * Returns a list of ObjectProperty objects for which statements exist about
+ * the individual. Note that this method now returns multiple copies of
+ * a given predicate, with the rangeVClassURI changed to indicate the distinct
+ * types of the related objects. This supports finding the approriate list
+ * views for the "faux" qualified properties.
+ */
List getPopulatedObjectPropertyList();
void setPopulatedObjectPropertyList(List propertyList);
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/ObjectProperty.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/ObjectProperty.java
index 1c4e8a9b1..7d1d908fb 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/ObjectProperty.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/ObjectProperty.java
@@ -22,7 +22,7 @@ import com.hp.hpl.jena.datatypes.xsd.XSDDatatype;
* a class representing an object property
*
*/
-public class ObjectProperty extends Property implements Comparable, ResourceBean
+public class ObjectProperty extends Property implements Comparable, ResourceBean, Cloneable
{
private static final Log log = LogFactory.getLog(ObjectProperty.class.getName());
@@ -610,6 +610,55 @@ public class ObjectProperty extends Property implements Comparable map = getResultsForVClass(
+ IndividualListResults vcResults = getResultsForVClass(
vclass.getURI(),
page,
alpha,
vreq.getWebappDaoFactory().getIndividualDao(),
getServletContext());
- body.putAll(map);
+ body.putAll(vcResults.asFreemarkerMap());
- @SuppressWarnings("unchecked")
- List inds = (List)map.get("entities");
+ List inds = vcResults.getEntities();
List indsTm = new ArrayList();
if (inds != null) {
for ( Individual ind : inds ) {
@@ -154,13 +149,12 @@ public class IndividualListController extends FreemarkerHttpServlet {
return SolrQueryUtils.getPageParameter(request);
}
- public static Map getResultsForVClass(String vclassURI, int page, String alpha, IndividualDao indDao, ServletContext context)
+ public static IndividualListResults getResultsForVClass(String vclassURI, int page, String alpha, IndividualDao indDao, ServletContext context)
throws SearchException{
- Map rvMap = new HashMap();
try{
List classUris = Collections.singletonList(vclassURI);
IndividualListQueryResults results = SolrQueryUtils.buildAndExecuteVClassQuery(classUris, alpha, page, INDIVIDUALS_PER_PAGE, context, indDao);
- rvMap = getResultsForVClassQuery(results, page, INDIVIDUALS_PER_PAGE, alpha);
+ return getResultsForVClassQuery(results, page, INDIVIDUALS_PER_PAGE, alpha);
} catch (SolrServerException e) {
String msg = "An error occurred retrieving results for vclass query";
log.error(msg, e);
@@ -168,31 +162,29 @@ public class IndividualListController extends FreemarkerHttpServlet {
throw new SearchException(msg);
} catch(Throwable th) {
log.error("An error occurred retrieving results for vclass query", th);
+ return IndividualListResults.EMPTY;
}
- return rvMap;
}
- public static Map getResultsForVClassIntersections(List vclassURIs, int page, int pageSize, String alpha, IndividualDao indDao, ServletContext context) {
- Map rvMap = new HashMap();
+ public static IndividualListResults getResultsForVClassIntersections(List vclassURIs, int page, int pageSize, String alpha, IndividualDao indDao, ServletContext context) {
try{
IndividualListQueryResults results = SolrQueryUtils.buildAndExecuteVClassQuery(vclassURIs, alpha, page, pageSize, context, indDao);
- rvMap = getResultsForVClassQuery(results, page, pageSize, alpha);
+ return getResultsForVClassQuery(results, page, pageSize, alpha);
} catch(Throwable th) {
log.error("Error retrieving individuals corresponding to intersection multiple classes." + vclassURIs.toString(), th);
+ return IndividualListResults.EMPTY;
}
- return rvMap;
}
- public static Map getRandomResultsForVClass(String vclassURI, int page, int pageSize, IndividualDao indDao, ServletContext context) {
- Map rvMap = new HashMap();
+ public static IndividualListResults getRandomResultsForVClass(String vclassURI, int page, int pageSize, IndividualDao indDao, ServletContext context) {
try{
List classUris = Collections.singletonList(vclassURI);
IndividualListQueryResults results = SolrQueryUtils.buildAndExecuteRandomVClassQuery(classUris, page, pageSize, context, indDao);
- rvMap = getResultsForVClassQuery(results, page, pageSize, "");
+ return getResultsForVClassQuery(results, page, pageSize, "");
} catch(Throwable th) {
log.error("An error occurred retrieving random results for vclass query", th);
+ return IndividualListResults.EMPTY;
}
- return rvMap;
}
//TODO: Get rid of this method and utilize SolrQueryUtils - currently appears to be referenced
@@ -201,24 +193,13 @@ public class IndividualListController extends FreemarkerHttpServlet {
return SolrQueryUtils.getIndividualCount(vclassUris, indDao, context);
}
- private static Map getResultsForVClassQuery(IndividualListQueryResults results, int page, int pageSize, String alpha) {
- Map rvMap = new HashMap();
-
+ private static IndividualListResults getResultsForVClassQuery(IndividualListQueryResults results, int page, int pageSize, String alpha) {
long hitCount = results.getHitCount();
if ( hitCount > pageSize ){
- rvMap.put("showPages", Boolean.TRUE);
- List pageRecords = makePagesList(hitCount, pageSize, page);
- rvMap.put("pages", pageRecords);
+ return new IndividualListResults(hitCount, results.getIndividuals(), alpha, true, makePagesList(hitCount, pageSize, page));
}else{
- rvMap.put("showPages", Boolean.FALSE);
- rvMap.put("pages", Collections.emptyList());
+ return new IndividualListResults(hitCount, results.getIndividuals(), alpha, false, Collections.emptyList());
}
-
- rvMap.put("alpha",alpha);
- rvMap.put("totalCount", hitCount);
- rvMap.put("entities", results.getIndividuals());
-
- return rvMap;
}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individual/IndividualRequestAnalysisContextImpl.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individual/IndividualRequestAnalysisContextImpl.java
index 5f3ebc7e4..a6ad31af7 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individual/IndividualRequestAnalysisContextImpl.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individual/IndividualRequestAnalysisContextImpl.java
@@ -4,11 +4,6 @@ package edu.cornell.mannlib.vitro.webapp.controller.individual;
import java.util.List;
-import javax.servlet.ServletContext;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.SelfEditingConfiguration;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
@@ -22,18 +17,13 @@ import edu.cornell.mannlib.vitro.webapp.filestorage.model.FileInfo;
*/
public class IndividualRequestAnalysisContextImpl implements
IndividualRequestAnalysisContext {
- private static final Log log = LogFactory
- .getLog(IndividualRequestAnalysisContextImpl.class);
-
-
- private final VitroRequest vreq;
- private final ServletContext ctx;
+
+ private final VitroRequest vreq;
private final WebappDaoFactory wadf;
private final IndividualDao iDao;
public IndividualRequestAnalysisContextImpl(VitroRequest vreq) {
- this.vreq = vreq;
- this.ctx = vreq.getSession().getServletContext();
+ this.vreq = vreq;
this.wadf = vreq.getWebappDaoFactory();
this.iDao = wadf.getIndividualDao();
}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualJsonWrapper.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualJsonWrapper.java
new file mode 100644
index 000000000..1fda3985a
--- /dev/null
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualJsonWrapper.java
@@ -0,0 +1,48 @@
+/* $This file is distributed under the terms of the license in /doc/license.txt$ */
+
+package edu.cornell.mannlib.vitro.webapp.controller.individuallist;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import edu.cornell.mannlib.vitro.webapp.beans.Individual;
+import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
+import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
+import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyStatementDao;
+import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
+
+/**
+ * Wrap an Individual in a JSON object for display by the script.
+ *
+ * This will be overridden in VIVO so we can have more info in the display.
+ */
+public class IndividualJsonWrapper {
+ static JSONObject packageIndividualAsJson(VitroRequest vreq, Individual ind)
+ throws JSONException {
+ // need an unfiltered dao to get firstnames and lastnames
+ WebappDaoFactory fullWdf = vreq.getUnfilteredWebappDaoFactory();
+
+ JSONObject jo = new JSONObject();
+ jo.put("URI", ind.getURI());
+ jo.put("label", ind.getRdfsLabel());
+ jo.put("name", ind.getName());
+ jo.put("thumbUrl", ind.getThumbUrl());
+ jo.put("imageUrl", ind.getImageUrl());
+ jo.put("profileUrl", UrlBuilder.getIndividualProfileUrl(ind, vreq));
+ jo.put("mostSpecificTypes", getMostSpecificTypes(ind, fullWdf));
+ return jo;
+ }
+
+ public static Collection getMostSpecificTypes(
+ Individual individual, WebappDaoFactory wdf) {
+ ObjectPropertyStatementDao opsDao = wdf.getObjectPropertyStatementDao();
+ Map mostSpecificTypes = opsDao
+ .getMostSpecificTypesInClassgroupsForIndividual(individual
+ .getURI());
+ return mostSpecificTypes.values();
+ }
+
+}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualListResults.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualListResults.java
new file mode 100644
index 000000000..68cbc1d09
--- /dev/null
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualListResults.java
@@ -0,0 +1,87 @@
+/* $This file is distributed under the terms of the license in /doc/license.txt$ */
+
+package edu.cornell.mannlib.vitro.webapp.controller.individuallist;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import edu.cornell.mannlib.vitro.webapp.beans.Individual;
+import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController.PageRecord;
+
+/**
+ * These are the paged results of a query for Individuals.
+ *
+ * The criteria for the search are the index of the desired page, the number of
+ * results displayed on each page, and an optional initial letter to search
+ * against.
+ *
+ * By the time this is built, the results have already been partially processed.
+ * A list of PageRecord object is included, with values that the GUI can use to
+ * create Alphabetical links. Maybe this processing should have been done later.
+ * Maybe it should have been left to the GUI.
+ */
+public class IndividualListResults {
+ private static final Log log = LogFactory
+ .getLog(IndividualListResults.class);
+
+ public static final IndividualListResults EMPTY = new IndividualListResults();
+
+ private final long totalCount;
+ private final List entities;
+ private final String alpha;
+ private final boolean showPages;
+ private final List pages;
+
+ public IndividualListResults(long totalCount, List entities,
+ String alpha, boolean showPages, List pages) {
+ this.totalCount = totalCount;
+ this.entities = entities;
+ this.alpha = alpha;
+ this.showPages = showPages;
+ this.pages = pages;
+ }
+
+ private IndividualListResults() {
+ this(0L, Collections. emptyList(), "", false, Collections
+ . emptyList());
+ }
+
+ public long getTotalCount() {
+ return totalCount;
+ }
+
+ public String getAlpha() {
+ return alpha;
+ }
+
+ public List getEntities() {
+ return entities;
+ }
+
+ public List getPages() {
+ return pages;
+ }
+
+ public boolean isShowPages() {
+ return showPages;
+ }
+
+ /**
+ * Some controllers put this data directly into the Freemarker body map.
+ * Others wrap it in JSON.
+ */
+ public Map asFreemarkerMap() {
+ Map m = new HashMap<>();
+ m.put("showPages", showPages);
+ m.put("pages", pages);
+ m.put("alpha", alpha);
+ m.put("totalCount", totalCount);
+ m.put("entities", entities);
+ return m;
+ }
+}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualListResultsUtils.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualListResultsUtils.java
new file mode 100644
index 000000000..e06f35af9
--- /dev/null
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualListResultsUtils.java
@@ -0,0 +1,148 @@
+/* $This file is distributed under the terms of the license in /doc/license.txt$ */
+
+package edu.cornell.mannlib.vitro.webapp.controller.individuallist;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import edu.cornell.mannlib.vitro.webapp.beans.Individual;
+import edu.cornell.mannlib.vitro.webapp.beans.VClass;
+import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
+import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
+import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController.PageRecord;
+
+/**
+ * Utility methods for procesing the paged results of a query for a list of Individuals.
+ *
+ * Right now, there is only a method to wrap the results in Json.
+ */
+public class IndividualListResultsUtils {
+ private static final Log log = LogFactory
+ .getLog(IndividualListResultsUtils.class);
+
+ /**
+ * Process results related to VClass or vclasses. Handles both single and
+ * multiple vclasses being sent.
+ */
+ public static JSONObject wrapIndividualListResultsInJson(IndividualListResults results, VitroRequest vreq,
+ boolean multipleVclasses) {
+ JSONObject rObj = new JSONObject();
+
+ if (log.isDebugEnabled()) {
+ dumpParametersFromRequest(vreq);
+ }
+
+ try {
+ List vclasses = buildListOfRequestedVClasses(vreq);
+
+ VClass vclass = null;
+ // if single vclass expected, then include vclass.
+ // This relates to what the expected behavior is, not size of list
+ if (!multipleVclasses) {
+ vclass = vclasses.get(0);
+ // currently used for ClassGroupPage
+ } else {
+ // For now, utilize very last VClass (assume that that is the one to be employed)
+ // TODO: Find more general way of dealing with this: put multiple ones in?
+ vclass = vclasses.get(vclasses.size() - 1);
+ // rObj.put("vclasses", new JSONObject().put("URIs",vitroClassIdStr).put("name",vclass.getName()));
+ }
+
+ rObj.put("vclass", packageVClassAsJson(vclass));
+ rObj.put("totalCount", results.getTotalCount());
+ rObj.put("alpha", results.getAlpha());
+ rObj.put("individuals", packageIndividualsAsJson(vreq, results.getEntities()));
+ rObj.put("pages", packagePageRecordsAsJson(results.getPages()));
+ rObj.put("letters", packageLettersAsJson());
+ } catch (Exception ex) {
+ log.error("Error occurred in processing JSON object", ex);
+ }
+ return rObj;
+ }
+
+ private static List buildListOfRequestedVClasses(VitroRequest vreq)
+ throws Exception {
+ String[] vitroClassIdStr = vreq.getParameterValues("vclassId");
+ if (ArrayUtils.isEmpty(vitroClassIdStr)) {
+ log.error("parameter vclassId URI parameter expected ");
+ throw new Exception("parameter vclassId URI parameter expected ");
+ }
+
+ List list = new ArrayList<>();
+ for (String vclassId : vitroClassIdStr) {
+ VClass vclass = vreq.getWebappDaoFactory().getVClassDao()
+ .getVClassByURI(vclassId);
+ if (vclass == null) {
+ log.error("Couldn't retrieve vclass ");
+ throw new Exception("Class " + vclassId + " not found");
+ }
+ list.add(vclass);
+ }
+ return list;
+ }
+
+ private static JSONObject packageVClassAsJson(VClass vclass)
+ throws JSONException {
+ JSONObject jvclass = new JSONObject();
+ jvclass.put("URI", vclass.getURI());
+ jvclass.put("name", vclass.getName());
+ return jvclass;
+ }
+
+ private static JSONArray packageLettersAsJson() throws JSONException,
+ UnsupportedEncodingException {
+ List letters = Controllers.getLetters();
+ JSONArray jletters = new JSONArray();
+ for (String s : letters) {
+ JSONObject jo = new JSONObject();
+ jo.put("text", s);
+ jo.put("param", "alpha=" + URLEncoder.encode(s, "UTF-8"));
+ jletters.put(jo);
+ }
+ return jletters;
+ }
+
+ private static JSONArray packagePageRecordsAsJson(List pages)
+ throws JSONException {
+ JSONArray wpages = new JSONArray();
+ for (PageRecord pr : pages) {
+ JSONObject p = new JSONObject();
+ p.put("text", pr.text);
+ p.put("param", pr.param);
+ p.put("index", pr.index);
+ wpages.put(p);
+ }
+ return wpages;
+ }
+
+ private static JSONArray packageIndividualsAsJson(VitroRequest vreq,
+ List inds) throws JSONException {
+ log.debug("Number of individuals returned from request: " + inds.size());
+
+ JSONArray jInds = new JSONArray();
+ for (Individual ind : inds) {
+ jInds.put(IndividualJsonWrapper.packageIndividualAsJson(vreq, ind));
+ }
+ return jInds;
+ }
+
+ private static void dumpParametersFromRequest(VitroRequest vreq) {
+ Map pMap = vreq.getParameterMap();
+ for (String name : pMap.keySet()) {
+ for (String value : pMap.get(name)) {
+ log.debug("value for " + name + ": '" + value + "'");
+ }
+ }
+ }
+
+}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/json/JsonServlet.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/json/JsonServlet.java
index baf72ec82..6ed8a362e 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/json/JsonServlet.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/json/JsonServlet.java
@@ -3,11 +3,8 @@
package edu.cornell.mannlib.vitro.webapp.controller.json;
import java.io.IOException;
-import java.net.URLEncoder;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import java.util.Enumeration;
import java.util.List;
import java.util.Map;
@@ -18,18 +15,15 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.json.JSONArray;
import org.json.JSONObject;
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
-import edu.cornell.mannlib.vitro.webapp.beans.VClass;
-import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController;
-import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController.PageRecord;
-import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
+import edu.cornell.mannlib.vitro.webapp.controller.individuallist.IndividualListResultsUtils;
+import edu.cornell.mannlib.vitro.webapp.controller.individuallist.IndividualListResults;
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyStatementDao;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.utils.log.LogUtils;
@@ -94,29 +88,28 @@ public class JsonServlet extends VitroHttpServlet {
List vclassURIs = Collections.singletonList(vclassURI);
VitroRequest vreq = new VitroRequest(req);
- Map map = getSolrVClassIntersectionResults(vclassURIs, vreq, context);
+ IndividualListResults vcResults = getSolrVClassIntersectionResults(vclassURIs, vreq, context);
//last parameter indicates single vclass instead of multiple vclasses
- return processVclassResultsJSON(map, vreq, false);
+ return IndividualListResultsUtils.wrapIndividualListResultsInJson(vcResults, vreq, false);
}
public static JSONObject getSolrIndividualsByVClasses(List vclassURIs, HttpServletRequest req, ServletContext context) throws Exception {
VitroRequest vreq = new VitroRequest(req);
log.debug("Retrieve solr results for vclasses" + vclassURIs.toString());
- Map map = getSolrVClassIntersectionResults(vclassURIs, vreq, context);
- log.debug("Results returned from Solr for " + vclassURIs.toString() + " are of size " + map.size());
+ IndividualListResults vcResults = getSolrVClassIntersectionResults(vclassURIs, vreq, context);
+ log.debug("Results returned from Solr for " + vclassURIs.toString() + " are of size " + vcResults.getTotalCount());
- return processVclassResultsJSON(map, vreq, true);
+ return IndividualListResultsUtils.wrapIndividualListResultsInJson(vcResults, vreq, true);
}
//Including version for Solr query for Vclass Intersections
- private static Map getSolrVClassIntersectionResults(List vclassURIs, VitroRequest vreq, ServletContext context){
+ private static IndividualListResults getSolrVClassIntersectionResults(List vclassURIs, VitroRequest vreq, ServletContext context){
log.debug("Retrieving Solr intersection results for " + vclassURIs.toString());
String alpha = IndividualListController.getAlphaParameter(vreq);
int page = IndividualListController.getPageParameter(vreq);
log.debug("Alpha and page parameters are " + alpha + " and " + page);
- Map map = null;
try {
- map = IndividualListController.getResultsForVClassIntersections(
+ return IndividualListController.getResultsForVClassIntersections(
vclassURIs,
page, INDIVIDUALS_PER_PAGE,
alpha,
@@ -124,23 +117,10 @@ public class JsonServlet extends VitroHttpServlet {
context);
} catch(Exception ex) {
log.error("Error in retrieval of search results for VClass " + vclassURIs.toString(), ex);
+ return IndividualListResults.EMPTY;
}
-
- return map;
}
- // Map given to process method includes the actual individuals returned from the search
-// public static JSONObject processVClassResults(Map map, VitroRequest vreq, ServletContext context, boolean multipleVclasses) throws Exception{
-// JSONObject rObj = processVclassResultsJSON(map, vreq, multipleVclasses);
-// return rObj;
-// }
-
- public static Collection getMostSpecificTypes(Individual individual, WebappDaoFactory wdf) {
- ObjectPropertyStatementDao opsDao = wdf.getObjectPropertyStatementDao();
- Map mostSpecificTypes = opsDao.getMostSpecificTypesInClassgroupsForIndividual(individual.getURI());
- return mostSpecificTypes.values();
- }
-
public static String getDataPropertyValue(Individual ind, DataProperty dp, WebappDaoFactory wdf){
String value = ind.getDataValue(dp.getURI());
if( value == null || value.isEmpty() )
@@ -152,21 +132,20 @@ public class JsonServlet extends VitroHttpServlet {
public static JSONObject getRandomSolrIndividualsByVClass(String vclassURI, HttpServletRequest req, ServletContext context) throws Exception {
VitroRequest vreq = new VitroRequest(req);
- Map map = getRandomSolrVClassResults(vclassURI, vreq, context);
+ IndividualListResults vcResults = getRandomSolrVClassResults(vclassURI, vreq, context);
//last parameter indicates single vclass instead of multiple vclasses
- return processVclassResultsJSON(map, vreq, false);
+ return IndividualListResultsUtils.wrapIndividualListResultsInJson(vcResults, vreq, false);
}
//Including version for Random Solr query for Vclass Intersections
- private static Map getRandomSolrVClassResults(String vclassURI, VitroRequest vreq, ServletContext context){
+ private static IndividualListResults getRandomSolrVClassResults(String vclassURI, VitroRequest vreq, ServletContext context){
log.debug("Retrieving random Solr intersection results for " + vclassURI);
int page = IndividualListController.getPageParameter(vreq);
int pageSize = Integer.parseInt(vreq.getParameter("pageSize"));
log.debug("page and pageSize parameters = " + page + " and " + pageSize);
- Map map = null;
try {
- map = IndividualListController.getRandomResultsForVClass(
+ return IndividualListController.getRandomResultsForVClass(
vclassURI,
page,
pageSize,
@@ -174,126 +153,8 @@ public class JsonServlet extends VitroHttpServlet {
context);
} catch(Exception ex) {
log.error("Error in retrieval of search results for VClass " + vclassURI, ex);
+ return IndividualListResults.EMPTY;
}
-
- return map;
}
-
- /**
- * Process results related to VClass or vclasses. Handles both single and multiple vclasses being sent.
- */
- public static JSONObject processVclassResultsJSON(Map map, VitroRequest vreq, boolean multipleVclasses) {
- JSONObject rObj = new JSONObject();
- VClass vclass=null;
-
- try {
-
- // Properties from ontologies used by VIVO - should not be in vitro
- DataProperty fNameDp = (new DataProperty());
- fNameDp.setURI("http://xmlns.com/foaf/0.1/firstName");
- DataProperty lNameDp = (new DataProperty());
- lNameDp.setURI("http://xmlns.com/foaf/0.1/lastName");
- DataProperty preferredTitleDp = (new DataProperty());
- preferredTitleDp.setURI("http://vivoweb.org/ontology/core#preferredTitle");
-
- if( log.isDebugEnabled() ){
- @SuppressWarnings("unchecked")
- Enumeration e = vreq.getParameterNames();
- while(e.hasMoreElements()){
- String name = e.nextElement();
- log.debug("parameter: " + name);
- for( String value : vreq.getParameterValues(name) ){
- log.debug("value for " + name + ": '" + value + "'");
- }
- }
- }
-
- //need an unfiltered dao to get firstnames and lastnames
- WebappDaoFactory fullWdf = vreq.getUnfilteredWebappDaoFactory();
-
- String[] vitroClassIdStr = vreq.getParameterValues("vclassId");
- if ( vitroClassIdStr != null && vitroClassIdStr.length > 0){
- for(String vclassId: vitroClassIdStr) {
- vclass = vreq.getWebappDaoFactory().getVClassDao().getVClassByURI(vclassId);
- if (vclass == null) {
- log.error("Couldn't retrieve vclass ");
- throw new Exception ("Class " + vclassId + " not found");
- }
- }
- }else{
- log.error("parameter vclassId URI parameter expected ");
- throw new Exception("parameter vclassId URI parameter expected ");
- }
- List vclassIds = Arrays.asList(vitroClassIdStr);
- //if single vclass expected, then include vclass. This relates to what the expected behavior is, not size of list
- if(!multipleVclasses) {
- //currently used for ClassGroupPage
- rObj.put("vclass",
- new JSONObject().put("URI",vclass.getURI())
- .put("name",vclass.getName()));
- } else {
- //For now, utilize very last VClass (assume that that is the one to be employed)
- //TODO: Find more general way of dealing with this
- //put multiple ones in?
- if(vclassIds.size() > 0) {
- int numberVClasses = vclassIds.size();
- vclass = vreq.getWebappDaoFactory().getVClassDao().getVClassByURI(vclassIds.get(numberVClasses - 1));
- rObj.put("vclass", new JSONObject().put("URI",vclass.getURI())
- .put("name",vclass.getName()));
- }
- // rObj.put("vclasses", new JSONObject().put("URIs",vitroClassIdStr)
- // .put("name",vclass.getName()));
- }
- if (vclass != null) {
-
- rObj.put("totalCount", map.get("totalCount"));
- rObj.put("alpha", map.get("alpha"));
-
- List inds = (List)map.get("entities");
- log.debug("Number of individuals returned from request: " + inds.size());
- JSONArray jInds = new JSONArray();
- for(Individual ind : inds ){
- JSONObject jo = new JSONObject();
- jo.put("URI", ind.getURI());
- jo.put("label",ind.getRdfsLabel());
- jo.put("name",ind.getName());
- jo.put("thumbUrl", ind.getThumbUrl());
- jo.put("imageUrl", ind.getImageUrl());
- jo.put("profileUrl", UrlBuilder.getIndividualProfileUrl(ind, vreq));
-
- jo.put("mostSpecificTypes", JsonServlet.getMostSpecificTypes(ind,fullWdf));
- jo.put("preferredTitle", JsonServlet.getDataPropertyValue(ind, preferredTitleDp, fullWdf));
-
- jInds.put(jo);
- }
- rObj.put("individuals", jInds);
-
- JSONArray wpages = new JSONArray();
- //Made sure that PageRecord here is SolrIndividualListController not IndividualListController
- List pages = (List)map.get("pages");
- for( PageRecord pr: pages ){
- JSONObject p = new JSONObject();
- p.put("text", pr.text);
- p.put("param", pr.param);
- p.put("index", pr.index);
- wpages.put( p );
- }
- rObj.put("pages",wpages);
-
- JSONArray jletters = new JSONArray();
- List letters = Controllers.getLetters();
- for( String s : letters){
- JSONObject jo = new JSONObject();
- jo.put("text", s);
- jo.put("param", "alpha=" + URLEncoder.encode(s, "UTF-8"));
- jletters.put( jo );
- }
- rObj.put("letters", jletters);
- }
- } catch(Exception ex) {
- log.error("Error occurred in processing JSON object", ex);
- }
- return rObj;
- }
}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/ObjectPropertyDao.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/ObjectPropertyDao.java
index 6c120ee79..76eddf603 100755
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/ObjectPropertyDao.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/ObjectPropertyDao.java
@@ -16,6 +16,18 @@ public interface ObjectPropertyDao extends PropertyDao {
public ObjectProperty getObjectPropertyByURI(String objectPropertyURI);
public ObjectProperty getObjectPropertyByURIs(String objectPropertyURI, String domainURI, String rangeURI);
+
+ /**
+ * Use this method to supply a base ObjectProperty whose fields will be updated
+ * as necessary to correspond to the configuration for the specified Domain
+ * and Range.
+ * @param objectPropertyURI
+ * @param domainURI
+ * @param rangeURI
+ * @param base
+ * @return ObjectProperty
+ */
+ public ObjectProperty getObjectPropertyByURIs(String objectPropertyURI, String domainURI, String rangeURI, ObjectProperty base);
public List getObjectPropertiesForObjectPropertyStatements(List /*of ObjectPropertyStatement */ objectPropertyStatements);
@@ -54,8 +66,22 @@ public interface ObjectPropertyDao extends PropertyDao {
List getRootObjectProperties();
+ /**
+ * Returns a list of ObjectProperty objects for which statements exist about
+ * the individual. Note that this method now returns multiple copies of
+ * a given predicate, with the rangeVClassURI changed to indicate the distinct
+ * types of the related objects. This supports finding the approriate list
+ * views for the "faux" qualified properties.
+ */
public List getObjectPropertyList(Individual subject);
+ /**
+ * Returns a list of ObjectProperty objects for which statements exist about
+ * the individual. Note that this method now returns multiple copies of
+ * a given predicate, with the rangeVClassURI changed to indicate the distinct
+ * types of the related objects. This supports finding the approriate list
+ * views for the "faux" qualified properties.
+ */
public List getObjectPropertyList(String subjectUri);
public String getCustomListViewConfigFileName(ObjectProperty objectProperty);
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactoryConfig.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactoryConfig.java
index aea5acc1c..ee5eaf2de 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactoryConfig.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactoryConfig.java
@@ -5,14 +5,20 @@ package edu.cornell.mannlib.vitro.webapp.dao;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
+import org.openjena.atlas.lib.Pair;
+
+import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
+
public class WebappDaoFactoryConfig {
private List preferredLanguages;
private String defaultNamespace;
private Set nonUserNamespaces;
private boolean isUnderlyingStoreReasoned = false;
+ public Map>, String> customListViewConfigFileMap;
public WebappDaoFactoryConfig() {
preferredLanguages = Arrays.asList("en-US", "en", "EN");
@@ -53,4 +59,13 @@ public class WebappDaoFactoryConfig {
return this.isUnderlyingStoreReasoned;
}
+ public Map>, String> getCustomListViewConfigFileMap() {
+ return this.getCustomListViewConfigFileMap();
+ }
+
+ public void setCustomListViewConfigFileMap(
+ Map>, String> map) {
+ this.customListViewConfigFileMap = map;
+ }
+
}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/ObjectPropertyDaoFiltering.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/ObjectPropertyDaoFiltering.java
index 525301c3b..0a5848d98 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/ObjectPropertyDaoFiltering.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/ObjectPropertyDaoFiltering.java
@@ -54,6 +54,11 @@ class ObjectPropertyDaoFiltering extends BaseFiltering implements ObjectProperty
return (newOprop == null) ? null : new ObjectPropertyFiltering(newOprop, filters);
}
+ public ObjectProperty getObjectPropertyByURIs(String objectPropertyURI, String domainURI, String rangeURI, ObjectProperty base) {
+ ObjectProperty newOprop=innerObjectPropertyDao.getObjectPropertyByURIs(objectPropertyURI, domainURI, rangeURI, base);
+ return (newOprop == null) ? null : new ObjectPropertyFiltering(newOprop, filters);
+ }
+
public List getStatementsUsingObjectProperty(ObjectProperty op) {
return ObjectPropertyStatementDaoFiltering.filterAndWrapList(innerObjectPropertyDao.getStatementsUsingObjectProperty(op),filters);
}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/DataPropertyDaoJena.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/DataPropertyDaoJena.java
index c137de39c..71714fae7 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/DataPropertyDaoJena.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/DataPropertyDaoJena.java
@@ -45,15 +45,14 @@ import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean;
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
-import edu.cornell.mannlib.vitro.webapp.beans.Ontology;
import edu.cornell.mannlib.vitro.webapp.beans.PropertyInstance;
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
import edu.cornell.mannlib.vitro.webapp.dao.InsertException;
-import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent;
import edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.PelletListener;
+import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
public class DataPropertyDaoJena extends PropertyDaoJena implements
DataPropertyDao {
@@ -71,9 +70,10 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
}
}
- public DataPropertyDaoJena(DatasetWrapperFactory dwf,
+ public DataPropertyDaoJena(RDFService rdfService,
+ DatasetWrapperFactory dwf,
WebappDaoFactoryJena wadf) {
- super(dwf, wadf);
+ super(rdfService, dwf, wadf);
}
public void deleteDataProperty(DataProperty dtp) {
@@ -672,7 +672,7 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
PREFIXES + "\n" +
"SELECT DISTINCT ?property WHERE { \n" +
" ?subject ?property ?object . \n" +
- " ?property a owl:DatatypeProperty . \n" +
+ //" ?property a owl:DatatypeProperty . \n" +
" FILTER ( \n" +
" isLiteral(?object) && \n" +
" ( !regex(str(?property), \"^" + VitroVocabulary.PUBLIC + "\" )) && \n" +
@@ -708,7 +708,7 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
}
log.debug("Data property query string:\n" + query);
- ResultSet results = getPropertyQueryResults(query);
+ ResultSet results = getPropertyQueryResults(queryString);
List properties = new ArrayList();
while (results.hasNext()) {
QuerySolution sol = results.next();
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/ObjectPropertyDaoJena.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/ObjectPropertyDaoJena.java
index fbaef1052..9c38774ab 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/ObjectPropertyDaoJena.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/ObjectPropertyDaoJena.java
@@ -13,11 +13,13 @@ import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.openjena.atlas.lib.Pair;
import com.hp.hpl.jena.datatypes.xsd.XSDDatatype;
import com.hp.hpl.jena.ontology.ConversionException;
import com.hp.hpl.jena.ontology.DatatypeProperty;
import com.hp.hpl.jena.ontology.OntModel;
+import com.hp.hpl.jena.ontology.OntModelSpec;
import com.hp.hpl.jena.ontology.OntProperty;
import com.hp.hpl.jena.ontology.OntResource;
import com.hp.hpl.jena.ontology.ProfileException;
@@ -28,7 +30,6 @@ import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.QuerySolution;
import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.rdf.model.Literal;
-import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.RDFNode;
@@ -37,30 +38,31 @@ import com.hp.hpl.jena.rdf.model.ResourceFactory;
import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.rdf.model.StmtIterator;
import com.hp.hpl.jena.shared.Lock;
-import com.hp.hpl.jena.sparql.expr.NodeValue;
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.RDFS;
-import com.hp.hpl.jena.sdb.util.Pair;
import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
-import edu.cornell.mannlib.vitro.webapp.beans.Ontology;
import edu.cornell.mannlib.vitro.webapp.dao.InsertException;
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao;
-import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent;
+import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectPropertyDao {
private static final Log log = LogFactory.getLog(ObjectPropertyDaoJena.class.getName());
-
- public ObjectPropertyDaoJena(DatasetWrapperFactory dwf,
+
+ public ObjectPropertyDaoJena(RDFService rdfService,
+ DatasetWrapperFactory dwf,
+ Map>, String>
+ customListViewConfigFileMap,
WebappDaoFactoryJena wadf) {
- super(dwf, wadf);
+ super(rdfService, dwf, wadf);
+ this.customListViewConfigFileMap = customListViewConfigFileMap;
}
@Override
@@ -69,7 +71,6 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
}
public void deleteObjectProperty(String propertyURI) {
- OntProperty p = getOntModel().getOntProperty(propertyURI);
ObjectProperty op = new ObjectProperty();
op.setURI(propertyURI);
deleteObjectProperty(op);
@@ -269,22 +270,35 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
}
public ObjectProperty getObjectPropertyByURI(String propertyURI) {
+
+ long start = System.currentTimeMillis();
if( propertyURI == null ) return null;
- getOntModel().enterCriticalSection(Lock.READ);
+ OntModel ontModel = getOntModel();
+ OntModel localModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
+
+ ontModel.enterCriticalSection(Lock.READ);
try {
- OntProperty op = getOntModel().getObjectProperty(propertyURI);
+ localModel.add(ontModel.listStatements(ontModel.getResource(propertyURI), null, (RDFNode) null));
+ OntProperty op = localModel.getObjectProperty(propertyURI);
return propertyFromOntProperty(op);
} finally {
- getOntModel().leaveCriticalSection();
+ ontModel.leaveCriticalSection();
}
}
- public ObjectProperty getObjectPropertyByURIs(String propertyURI, String domainURI, String rangeURI) {
+ public ObjectProperty getObjectPropertyByURIs(String propertyURI,
+ String domainURI, String rangeURI) {
+ return getObjectPropertyByURIs(propertyURI, domainURI, rangeURI, null);
+ }
+
+ public ObjectProperty getObjectPropertyByURIs(String propertyURI,
+ String domainURI, String rangeURI, ObjectProperty base) {
if(log.isDebugEnabled()) {
log.debug("Getting " + propertyURI + " with domain " + domainURI + " and range " + rangeURI);
}
- ObjectProperty op = getObjectPropertyByURI(propertyURI);
+ long start = System.currentTimeMillis();
+ ObjectProperty op = (base != null) ? base : getObjectPropertyByURI(propertyURI);
if (op == null || rangeURI == null) {
return op;
}
@@ -293,7 +307,7 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
String propQuery = "PREFIX rdfs: \n" +
"PREFIX config: \n" +
"PREFIX vitro: \n" +
- "SELECT ?range ?label ?group ?customForm ?displayRank ?displayLevel " +
+ "SELECT ?range ?rangeRoot ?label ?group ?customForm ?displayRank ?displayLevel " +
" ?updateLevel ?editLinkSuppressed ?addLinkSuppressed ?deleteLinkSuppressed \n" +
" ?collateBySubclass ?displayLimit ?individualSortProperty \n" +
" ?entitySortDirection ?selectFromExisting ?offerCreateNew \n" +
@@ -308,7 +322,8 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
if (rangeURI != null) {
propQuery += " ?context config:qualifiedBy <" + rangeURI + "> . \n";
};
- propQuery += " ?context config:hasConfiguration ?configuration . \n" +
+ propQuery += " OPTIONAL { ?context config:qualifiedByRoot ?rangeRoot } \n" +
+ " ?context config:hasConfiguration ?configuration . \n" +
" ?configuration a config:ObjectPropertyDisplayConfig . \n" +
" OPTIONAL { ?configuration config:propertyGroup ?group } \n" +
" OPTIONAL { ?configuration config:displayName ?label } \n" +
@@ -334,6 +349,15 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
ResultSet rs = qe.execSelect();
if (rs.hasNext()) {
QuerySolution qsoln = rs.nextSolution();
+ // This is a bit of hack, used for things where the type of the
+ // immediately-related object ("root," for lack of a better term)
+ // is important to record but not the type directly associated with
+ // a configuration
+ Resource rangeRootRes = qsoln.getResource("rangeRoot");
+ if (rangeRootRes != null) {
+ // reusing this obsolete field for now
+ op.setRangeEntityURI(rangeRootRes.getURI());
+ }
Resource groupRes = qsoln.getResource("group");
if (groupRes != null) {
op.setGroupURI(groupRes.getURI());
@@ -407,7 +431,7 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
}
} finally {
qe.close();
- }
+ }
return op;
}
@@ -918,24 +942,30 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
"?property = vitro:additionalLink ||" +
"!regex(str(?property), \"^http://vitro.mannlib.cornell.edu/ns/vitro/0.7#\" ))");
PROPERTY_FILTERS = StringUtils.join(namespaceFilters, " && ");
- }
+ }
protected static final String OBJECT_PROPERTY_QUERY_STRING =
PREFIXES + "\n" +
- "SELECT DISTINCT ?property WHERE { \n" +
- " ?subject ?property ?object . \n" +
+ "SELECT DISTINCT ?property ?objType WHERE { \n" +
+ " ?subject ?property ?object . \n" +
+ " ?object a ?objType . \n" +
// " ?property a owl:ObjectProperty . \n" +
" FILTER ( \n" +
" isURI(?object) && \n" +
PROPERTY_FILTERS + "\n" +
" ) \n" +
- "}";
+ "} ORDER BY ?property ?objType";
@Override
public List getObjectPropertyList(Individual subject) {
return getObjectPropertyList(subject.getURI());
}
-
+
+ // Returns a list of ObjectProperty objects for which statements exist about
+ // the individual. Note that this method now returns additional copies of
+ // a given predicate, with the rangeVClassURI changed to indicate the distinct
+ // types of the related objects. This supports finding the approriate list
+ // views for the "faux" qualified properties.
@Override
public List getObjectPropertyList(String subjectUri) {
@@ -954,15 +984,35 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
}
log.debug("Object property query:\n" + query);
- ResultSet results = getPropertyQueryResults(query);
+ ObjectProperty propRegister = new ObjectProperty();
+ propRegister.setURI("");
+
+ ResultSet results = getPropertyQueryResults(queryString);
List properties = new ArrayList();
while (results.hasNext()) {
QuerySolution soln = results.next();
Resource resource = soln.getResource("property");
String uri = resource.getURI();
- log.debug("Found populated object property " + uri);
- ObjectProperty property = getObjectPropertyByURI(uri);
+ Resource objType = soln.getResource("objType");
+ String objTypeUri = objType.getURI();
+ log.debug("Found populated object property " + uri +
+ " with object type " + objType);
+ ObjectProperty property = null;
+ if (uri.equals(propRegister.getURI())) {
+ property = propRegister.clone();
+ } else {
+ property = getObjectPropertyByURI(uri);
+ if (property != null) {
+ propRegister = property;
+ // add canonical instance of the property first in the list
+ // before the range-changed versions
+ properties.add(property);
+ // isolate the canonical prop from what's about to happen next
+ property = property.clone();
+ }
+ }
if (property != null) {
+ property.setRangeVClassURI(objTypeUri);
properties.add(property);
}
}
@@ -998,12 +1048,15 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
// Map key is inner pair of object property and range class URI,
// with first member of outer pair being a domain class URI.
// If domain or range is unspecified, OWL.Thing.getURI() is used in the key.
- Map>, String> customListViewConfigFileMap = null;
+ Map>, String> customListViewConfigFileMap;
@Override
public String getCustomListViewConfigFileName(ObjectProperty op) {
if (customListViewConfigFileMap == null) {
customListViewConfigFileMap = new HashMap>, String>();
+ }
+ if (customListViewConfigFileMap.isEmpty()) {
+ long start = System.currentTimeMillis();
OntModel displayModel = getOntModelSelector().getDisplayModel();
//Get all property to list view config file mappings in the system
QueryExecution qexec = QueryExecutionFactory.create(listViewConfigFileQuery, displayModel);
@@ -1036,10 +1089,19 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
domainUri, new Pair(
prop, rangeUri)), filename);
}
- }
+ }
+ // If there are no custom list views, put a bogus entry in the map
+ // to avoid further recomputation
+ if (customListViewConfigFileMap.isEmpty()) {
+ ObjectProperty bottom = new ObjectProperty();
+ bottom.setURI(OWL.NS + "bottomObjectProperty");
+ customListViewConfigFileMap.put(
+ new Pair>(
+ null, new Pair(
+ bottom, null)), "nothing");
+ }
qexec.close();
- }
-
+ }
String customListViewConfigFileName = customListViewConfigFileMap.get(new Pair>(op.getDomainVClassURI(), new Pair(op, op.getRangeVClassURI())));
if (customListViewConfigFileName == null) {
log.debug("no list view found for " + op.getURI() + " qualified by range " + op.getRangeVClassURI() + " and domain " + op.getDomainVClassURI());
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/ObjectPropertyStatementDaoJena.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/ObjectPropertyStatementDaoJena.java
index 45810e361..34eeb6dd8 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/ObjectPropertyStatementDaoJena.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/ObjectPropertyStatementDaoJena.java
@@ -11,7 +11,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -25,6 +24,7 @@ import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.QuerySolution;
import com.hp.hpl.jena.query.QuerySolutionMap;
import com.hp.hpl.jena.query.ResultSet;
+import com.hp.hpl.jena.query.ResultSetFactory;
import com.hp.hpl.jena.query.Syntax;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
@@ -35,6 +35,7 @@ import com.hp.hpl.jena.rdf.model.ResourceFactory;
import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.rdf.model.StmtIterator;
import com.hp.hpl.jena.shared.Lock;
+import com.hp.hpl.jena.sparql.resultset.ResultSetMem;
import com.hp.hpl.jena.util.iterator.ClosableIterator;
import com.hp.hpl.jena.vocabulary.OWL;
@@ -46,6 +47,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyStatementDao;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.IndividualUpdateEvent;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
+import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceException;
public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements ObjectPropertyStatementDao {
@@ -92,7 +94,8 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
else {
Map uriToObjectProperty = new HashMap();
- ObjectPropertyDaoJena opDaoJena = new ObjectPropertyDaoJena(dwf, getWebappDaoFactory());
+ ObjectPropertyDaoJena opDaoJena = (ObjectPropertyDaoJena) getWebappDaoFactory().getObjectPropertyDao();
+ //new ObjectPropertyDaoJena(rdfService, dwf, getWebappDaoFactory());
OntModel ontModel = getOntModelSelector().getABoxModel();
ontModel.enterCriticalSection(Lock.READ);
@@ -278,26 +281,77 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
Set constructQueryStrings,
String sortDirection) {
- Model constructedModel = constructModelForSelectQueries(
- subjectUri, propertyUri, constructQueryStrings);
-
- if(log.isDebugEnabled()) {
- log.debug("Constructed model has " + constructedModel.size() + " statements.");
+ List