diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/FoafNameToRdfsLabelPreprocessor.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/FoafNameToRdfsLabelPreprocessor.java new file mode 100644 index 000000000..512d4e80e --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/FoafNameToRdfsLabelPreprocessor.java @@ -0,0 +1,39 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.edit.n3editing; + +import javax.servlet.http.HttpServletRequest; + +import com.hp.hpl.jena.rdf.model.Model; +import com.hp.hpl.jena.rdf.model.Property; +import com.hp.hpl.jena.rdf.model.ResIterator; +import com.hp.hpl.jena.rdf.model.Resource; +import com.hp.hpl.jena.rdf.model.Statement; + +import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; + +public class FoafNameToRdfsLabelPreprocessor implements ModelChangePreprocessor { + + private static final String FOAF = "http://xmlns.com/foaf/0.1/"; + + @Override + public void preprocess(Model retractionsModel, Model additionsModel, + HttpServletRequest request) { + Property firstNameP = additionsModel.getProperty(FOAF+"firstName"); + Property lastNameP = additionsModel.getProperty(FOAF+"lastName"); + Property rdfsLabelP = additionsModel.getProperty(VitroVocabulary.LABEL); + + ResIterator subs = + additionsModel.listSubjectsWithProperty(firstNameP); + while( subs.hasNext() ){ + Resource sub = subs.nextResource(); + Statement fname = sub.getProperty( firstNameP ); + Statement lname = sub.getProperty( lastNameP ); + if( fname != null && lname != null && fname.getString() != null && lname.getString() != null ){ + additionsModel.add(sub, rdfsLabelP, lname.getString() + ", " + fname.getString() ); + } + } + + } + +} diff --git a/webapp/web/edit/editRequestDispatch.jsp b/webapp/web/edit/editRequestDispatch.jsp index 048be3193..fe89a1cc5 100644 --- a/webapp/web/edit/editRequestDispatch.jsp +++ b/webapp/web/edit/editRequestDispatch.jsp @@ -66,7 +66,7 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp. String typeOfNew = request.getParameter("typeOfNew"); //If there is no specified editForm then the subjectURI and the predicate - //are needed to determin which form to use for this edit. + //are needed to determine which form to use for this edit. if (formParam == null || "".equals(formParam)) { if (subjectUri == null || subjectUri.trim().length() == 0) throw new Error( @@ -114,9 +114,6 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp. if( subjectUri != null ){ Individual subject = wdf.getIndividualDao().getIndividualByURI(subjectUri); - //if (subject == null && formParam == null) - // throw new Error("In editRequestDispatch.jsp, could not find subject in model: '" - // + subjectUri + "'"); if( subject != null ){ request.setAttribute("subject", subject); } diff --git a/webapp/web/edit/postEditCleanUp.jsp b/webapp/web/edit/postEditCleanUp.jsp index 22c4ec531..07ba4911c 100644 --- a/webapp/web/edit/postEditCleanUp.jsp +++ b/webapp/web/edit/postEditCleanUp.jsp @@ -30,8 +30,12 @@ if( editConfig != null ){ String predicateUri = editConfig.getPredicateUri(); if( predicateUri != null ){ - Property prop = ResourceFactory.createProperty(predicateUri); - predicateLocalName = prop.getLocalName(); + try{ + Property prop = ResourceFactory.createProperty(predicateUri); + predicateLocalName = prop.getLocalName(); + }catch (com.hp.hpl.jena.shared.InvalidPropertyURIException e){ + log.debug("could not convert predicateUri into a valid URI",e); + } } if( editConfig.getEntityToReturnTo() != null && editConfig.getEntityToReturnTo().startsWith("?") ){ diff --git a/webapp/web/siteAdmin/dataInput.jsp b/webapp/web/siteAdmin/dataInput.jsp index e9e6455a3..580308c7f 100644 --- a/webapp/web/siteAdmin/dataInput.jsp +++ b/webapp/web/siteAdmin/dataInput.jsp @@ -5,13 +5,22 @@

Data Input

-
+ <%-- +
--%> + + +
+ + +