diff --git a/productMods/edit/forms/organizationHasPositionHistory.jsp b/productMods/edit/forms/organizationHasPositionHistory.jsp index ce93da8c..cc488a89 100644 --- a/productMods/edit/forms/organizationHasPositionHistory.jsp +++ b/productMods/edit/forms/organizationHasPositionHistory.jsp @@ -1,3 +1,5 @@ +<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%> + <%@ page import="com.hp.hpl.jena.rdf.model.Literal"%> <%@ page import="com.hp.hpl.jena.rdf.model.Model"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual"%> @@ -11,8 +13,6 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%> <%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %> -<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%> - <%-- This form is for the object property between Organizations and Positions. --%> <% VitroRequest vreq = new VitroRequest(request); diff --git a/productMods/edit/forms/personHasPositionHistory.jsp b/productMods/edit/forms/personHasPositionHistory.jsp index 7726b778..73c5ea27 100644 --- a/productMods/edit/forms/personHasPositionHistory.jsp +++ b/productMods/edit/forms/personHasPositionHistory.jsp @@ -1,3 +1,5 @@ +<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%> + <%@ page import="com.hp.hpl.jena.rdf.model.Literal"%> <%@ page import="com.hp.hpl.jena.rdf.model.Model"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual"%> @@ -11,8 +13,6 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%> <%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %> -<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%> - <% VitroRequest vreq = new VitroRequest(request); WebappDaoFactory wdf = vreq.getWebappDaoFactory(); diff --git a/productMods/edit/forms/personHasServiceActivity.jsp b/productMods/edit/forms/personHasServiceActivity.jsp new file mode 100644 index 00000000..98352420 --- /dev/null +++ b/productMods/edit/forms/personHasServiceActivity.jsp @@ -0,0 +1,252 @@ +<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%> + +<%@ page import="com.hp.hpl.jena.rdf.model.Literal"%> +<%@ 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.dao.VitroVocabulary"%> +<%@ page + import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration"%> +<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory"%> +<%@ page + import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%> + +<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%> +<%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %> + +<% + VitroRequest vreq = new VitroRequest(request); + WebappDaoFactory wdf = vreq.getWebappDaoFactory(); + vreq.setAttribute("defaultNamespace", wdf.getDefaultNamespace()); + + String flagURI = null; + if (vreq.getAppBean().isFlag1Active()) { + flagURI = VitroVocabulary.vitroURI+"Flag1Value"+vreq.getPortal().getPortalId()+"Thing"; + } else { + flagURI = wdf.getVClassDao().getTopConcept().getURI(); // fall back to owl:Thing if not portal filtering + } + vreq.setAttribute("flagURI",flagURI); +%> + + +<%-- Then enter a SPARQL query for each field, by convention concatenating the field id with "Existing" + to convey that the expression is used to retrieve any existing value for the field in an existing individual. + Each of these must then be referenced in the sparqlForExistingLiterals section of the JSON block below + and in the literalsOnForm --%> + + SELECT ?titleExisting WHERE { + ?activityUri ?titleExisting } + + +<%-- Pair the "existing" query with the skeleton of what will be asserted for a new statement involving this field. + The actual assertion inserted in the model will be created via string substitution into the ? variables. + NOTE the pattern of punctuation (a period after the prefix URI and after the ?field) --%> + + ?activityUri ?title . + ?activityUri ?title. + + + + SELECT ?descriptionExisting WHERE { + ?activityUri ?descriptionExisting } + + + ?activityUri ?description . + + + + SELECT ?existingOrgName WHERE { + ?activityUri ?existingOrgName } + + + ?activityUri ?organizationName . + + + + SELECT ?startYearMonthExisting WHERE { + ?activityUri ?startYearMonthExisting } + + + ?activityUri ?startYearMonth . + + + + SELECT ?endYearMonthExisting WHERE { + ?activityUri ?endYearMonthExisting } + + + ?activityUri ?endYearMonth . + + +<%-- Note there is really no difference in how things are set up for an object property except + below in the n3ForEdit section, in whether the ..Existing variable goes in SparqlForExistingLiterals + or in the SparqlForExistingUris, as well as perhaps in how the options are prepared --%> + + SELECT ?existingOrgUri WHERE { + ?activityUri ?existingOrgUri } + + + ?activityUri ?organizationUri . + ?organizationUri ?activityUri . + + + + @prefix rdf: . + @prefix core: . + + ?person core:professionalServiceActivity ?activityUri . + ?activityUri core:professionalServiceActivityBy ?person . + ?activityUri rdf:type core:ServiceActivity . + ?activityUri rdf:type <${flagURI}> . + + +http://vivoweb.org/ontology/core#ServiceActivity +http://xmlns.com/foaf/0.1/Organization + + + + { + "formUrl" : "${formUrl}", + "editKey" : "${editKey}", + "urlPatternToReturnTo" : "/entity", + + "subject" : ["person", "${subjectUriJson}" ], + "predicate" : ["predicate", "${predicateUriJson}" ], + "object" : ["activityUri", "${objectUriJson}", "URI" ], + + "n3required" : [ "${n3ForStmtToPerson}", "${titleAssertion}" ], + "n3optional" : [ "${descriptionAssertion}", "${organizationNameAssertion}","${organizationUriAssertion}", + "${startYearMonthAssertion}","${endYearMonthAssertion}"], + "newResources" : { "activityUri" : "${defaultNamespace}/serviceactivity" }, + "urisInScope" : { }, + "literalsInScope": { }, + "urisOnForm" : [ "organizationUri" ], + "literalsOnForm" : [ "title", "description", "organizationName", + "startYearMonth", "endYearMonth" ], + "filesOnForm" : [ ], + "sparqlForLiterals" : { }, + "sparqlForUris" : { }, + "sparqlForExistingLiterals" : { + "title" : "${titleExisting}", + "description" : "${descriptionExisting}", + "organizationName" : "${organizationNameExisting}", + "startYearMonth" : "${startYearMonthExisting}", + "endYearMonth" : "${endYearMonthExisting}" + }, + "sparqlForExistingUris" : { + "organizationUri" : "${organizationUriExisting}" + }, + "fields" : { + "title" : { + "newResource" : "false", + "validators" : [ "nonempty" ], + "optionsType" : "UNDEFINED", + "literalOptions" : [ ], + "predicateUri" : "", + "objectClassUri" : "", + "rangeDatatypeUri" : "", + "rangeLang" : "", + "assertions" : [ "${titleAssertion}" ] + }, + "description" : { + "newResource" : "false", + "validators" : [ ], + "optionsType" : "UNDEFINED", + "literalOptions" : [ ], + "predicateUri" : "", + "objectClassUri" : "", + "rangeDatatypeUri" : "", + "rangeLang" : "", + "assertions" : [ "${descriptionAssertion}" ] + }, + "organizationUri" : { + "newResource" : "false", + "validators" : [ ], + "optionsType" : "INDIVIDUALS_VIA_VCLASS", + "literalOptions" : [ "--" ], + "predicateUri" : "", + "objectClassUri" : "${organizationClass}", + "rangeDatatypeUri" : "", + "rangeLang" : "", + "assertions" : [ "${organizationUriAssertion}" ] + }, + "organizationName" : { + "newResource" : "false", + "validators" : [ ], + "optionsType" : "UNDEFINED", + "literalOptions" : [ ], + "predicateUri" : "", + "objectClassUri" : "", + "rangeDatatypeUri" : "http://www.w3.org/2001/XMLSchema#string", + "rangeLang" : "", + "assertions" : [ "${organizationNameAssertion}" ] + }, + "startYearMonth" : { + "newResource" : "false", + "validators" : [ "datatype:http://www.w3.org/2001/XMLSchema#gYearMonth" ], + "optionsType" : "UNDEFINED", + "literalOptions" : [ ], + "predicateUri" : "", + "objectClassUri" : "", + "rangeDatatypeUri" : "http://www.w3.org/2001/XMLSchema#gYearMonth", + "rangeLang" : "", + "assertions" : ["${startYearMonthAssertion}"] + }, + "endYearMonth" : { + "newResource" : "false", + "validators" : [ "datatype:http://www.w3.org/2001/XMLSchema#gYearMonth" ], + "optionsType" : "UNDEFINED", + "literalOptions" : [ ], + "predicateUri" : "", + "objectClassUri" : "", + "rangeDatatypeUri" : "http://www.w3.org/2001/XMLSchema#gYearMonth", + "rangeLang" : "", + "assertions" : ["${endYearMonthAssertion}"] + } + } +} + +<% + + EditConfiguration editConfig = EditConfiguration.getConfigFromSession(session,request); + if (editConfig == null) { + editConfig = new EditConfiguration( + (String) request + .getAttribute("editjson")); + EditConfiguration.putConfigInSession(editConfig,session); + } + + Model model = (Model) application.getAttribute("jenaOntModel"); + String objectUri = (String) request.getAttribute("objectUri"); + if (objectUri != null) { + editConfig.prepareForObjPropUpdate(model); + } else { + editConfig.prepareForNonUpdate(model); + } + + /* prepare the and text for the submit button */ + Individual subject = (Individual) request.getAttribute("subject"); + String submitLabel = ""; + if (objectUri != null) { + request.setAttribute("title","Edit professional service activity entry for "+ subject.getName()); + submitLabel = "Save changes"; + } else { + request.setAttribute("title","Create a new professional service activity entry for " + subject.getName()); + submitLabel = "Create new professional service activity entry"; + } +%> + +<jsp:include page="${preForm}"/> + +<h2>${title}</h2> +<form action="<c:url value="/edit/processRdfForm2.jsp"/>" > + <v:input type="text" label="title" id="title" size="30" /> + <v:input type="textarea" label="description" id="description" rows="5" cols="30" /> + <v:input type="select" label="organization" id="organizationUri" /> + <v:input type="text" label="organization name (if not in dropdown above)" id="organizationName" size="30" /> + <v:input type="text" label="start year and month (YYYY-MM)" id="startYearMonth" size="7"/> + <v:input type="text" label="end year and month (YYYY-MM)" id="endYearMonth" size="7"/> + <p class="submit"><v:input type="submit" id="submit" value="<%=submitLabel%>" cancel="${param.subjectUri}"/></p> +</form> + +<jsp:include page="${postForm}"/> +