Merged to trunk. Changed the way a new individual is created on the siteAdmin NIHVIVO-881
This commit is contained in:
parent
4a6aa63393
commit
7911fa6490
4 changed files with 56 additions and 7 deletions
|
@ -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() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -66,7 +66,7 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
|
||||||
String typeOfNew = request.getParameter("typeOfNew");
|
String typeOfNew = request.getParameter("typeOfNew");
|
||||||
|
|
||||||
//If there is no specified editForm then the subjectURI and the predicate
|
//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 (formParam == null || "".equals(formParam)) {
|
||||||
if (subjectUri == null || subjectUri.trim().length() == 0)
|
if (subjectUri == null || subjectUri.trim().length() == 0)
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
@ -114,9 +114,6 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
|
||||||
|
|
||||||
if( subjectUri != null ){
|
if( subjectUri != null ){
|
||||||
Individual subject = wdf.getIndividualDao().getIndividualByURI(subjectUri);
|
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 ){
|
if( subject != null ){
|
||||||
request.setAttribute("subject", subject);
|
request.setAttribute("subject", subject);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,12 @@
|
||||||
if( editConfig != null ){
|
if( editConfig != null ){
|
||||||
String predicateUri = editConfig.getPredicateUri();
|
String predicateUri = editConfig.getPredicateUri();
|
||||||
if( predicateUri != null ){
|
if( predicateUri != null ){
|
||||||
Property prop = ResourceFactory.createProperty(predicateUri);
|
try{
|
||||||
predicateLocalName = prop.getLocalName();
|
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("?") ){
|
if( editConfig.getEntityToReturnTo() != null && editConfig.getEntityToReturnTo().startsWith("?") ){
|
||||||
|
|
|
@ -5,13 +5,22 @@
|
||||||
|
|
||||||
<h3>Data Input</h3>
|
<h3>Data Input</h3>
|
||||||
|
|
||||||
<form action="editForm" method="get">
|
<%-- <form action="editForm" method="get">
|
||||||
<select id="VClassURI" name="VClassURI" class="form-item">
|
<select id="VClassURI" name="VClassURI" class="form-item">
|
||||||
<form:option name="VClassId"/>
|
<form:option name="VClassId"/>
|
||||||
</select>
|
</select>
|
||||||
<input type="submit" class="add-action-button" value="Add individual of this class"/>
|
<input type="submit" class="add-action-button" value="Add individual of this class"/>
|
||||||
<input type="hidden" name="home" value="<%=portal.getPortalId()%>" />
|
<input type="hidden" name="home" value="<%=portal.getPortalId()%>" />
|
||||||
<input type="hidden" name="controller" value="Entity"/>
|
<input type="hidden" name="controller" value="Entity"/>
|
||||||
|
</form> --%>
|
||||||
|
|
||||||
|
<c:url var="editRequestDisUrl" value="/edit/editRequestDispatch.jsp"/>
|
||||||
|
<form action="${editRequestDisUrl}" method="get">
|
||||||
|
<select id="VClassURI" name="typeOfNew" class="form-item">
|
||||||
|
<form:option name="VClassId"/>
|
||||||
|
</select>
|
||||||
|
<input type="hidden" name="editform" value="newIndividualForm.jsp"/>
|
||||||
|
<input type="submit" class="add-action-button" value="Add individual of this class"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue