<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%> <%@ page import="com.hp.hpl.jena.rdf.model.Model" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.VClass" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.ModelSelector" %> <%@ page import="com.hp.hpl.jena.ontology.OntModel"%> <%@ page import="org.apache.commons.logging.Log" %> <%@ page import="org.apache.commons.logging.LogFactory" %> <%@page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary"%> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %> <%! public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.edit.forms.admin.mayEditAs.jsp"); public static String RANGE_CLASS = "http://xmlns.com/foaf/0.1/Person"; public static String PREDICATE = VitroVocabulary.MAY_EDIT_AS; %> <% String subjectUri = (String)request.getAttribute("subjectUri"); VitroRequest vreq = new VitroRequest(request); WebappDaoFactory wdf = vreq.getWebappDaoFactory(); VClass rangeClass = wdf.getVClassDao().getVClassByURI( RANGE_CLASS ); if( rangeClass == null ) log.debug("Cannot find class for range for property." + " Looking for " + RANGE_CLASS); request.setAttribute("rangeClassUriJson", MiscWebUtils.escape(RANGE_CLASS)); request.setAttribute("predicateUriJson", MiscWebUtils.escape(PREDICATE)); request.setAttribute("objectUriJson" , MiscWebUtils.escape((String)request.getAttribute("objectUri"))); %> ?subject ?predicate ?objectVar. { "formUrl" : "${formUrl}", "editKey" : "${editKey}", "urlPatternToReturnTo" : "/userEdit", "subject" : [ "subject", "${subjectUriJson}" ] , "predicate" : [ "predicate", "${predicateUriJson}" ], "object" : [ "objectVar" , "${objectUriJson}" , "URI"], "n3required" : [ "${n3ForEdit}" ], "n3optional" : [ ], "newResources" : { }, "urisInScope" : { }, "literalsInScope" : { }, "urisOnForm" : ["objectVar"], "literalsOnForm" : [ ], "filesOnForm" : [ ], "sparqlForLiterals" : { }, "sparqlForUris" : { }, "sparqlForExistingLiterals" : { }, "sparqlForExistingUris" : { }, "fields" : { "objectVar" : { "newResource" : "false", "queryForExisting" : { }, "validators" : [ ], "optionsType" : "INDIVIDUALS_VIA_VCLASS", "subjectUri" : "${subjectUriJson}", "subjectClassUri" : "", "predicateUri" : "", "objectClassUri" : "${rangeClassUriJson}", "rangeDatatypeUri" : "", "rangeLang" : "", "literalOptions" : [ ] , "assertions" : ["${n3ForEdit}"] } } } <% /* now put edit configuration Json object into session */ EditConfiguration editConfig = new EditConfiguration((String)request.getAttribute("editjson")); EditConfiguration.putConfigInSession(editConfig, session); String formTitle =""; String submitLabel =""; Model model = (Model)application.getAttribute("jenaOntModel"); editConfig.setWriteModelSelector( new ModelSelector(){ public OntModel getModel(HttpServletRequest request, ServletContext context){ return (OntModel)context.getAttribute("userAccountsOntModel"); } }); if( request.getAttribute("object") != null ){//this block is for an edit of an existing object property statement editConfig.prepareForObjPropUpdate( model ); formTitle = "Change person associated with this user account"; submitLabel = "Save Change"; } else { editConfig.prepareForNonUpdate( model ); formTitle = "Select person to associate with this user account"; submitLabel = "Create Association"; } %>

<%=formTitle%>

" method="post">
" method="post">