VIVO-112 ongoing updates and VIVO-256 ORCID iD changes

This commit is contained in:
tworrall 2013-10-03 13:13:49 -04:00
parent 0896b37c3c
commit 791db61269
13 changed files with 386 additions and 113 deletions

View file

@ -29,7 +29,7 @@
WHERE {
?subject ?property ?authorship .
?authorship core:relates ?infoResource .
?infoResource a bibo:Document .
?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> .
?infoResource rdfs:label ?infoResourceName .
OPTIONAL { ?infoResource bibo:volume ?volume }
@ -72,13 +72,13 @@
?subject ?property ?authorship .
?authorship a core:Authorship .
?authorship core:relates ?infoResource .
?infoResource a bibo:Document .
?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> .
?infoResource vitro:mostSpecificType ?subclass
} WHERE {
?subject ?property ?authorship .
?authorship a core:Authorship .
?authorship core:relates ?infoResource .
?infoResource a bibo:Document .
?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> .
?infoResource vitro:mostSpecificType ?subclass
}
</query-construct>
@ -91,7 +91,7 @@
?subject ?property ?authorship .
?authorship ?authorshipProperty ?authorshipValue .
?authorship core:relates ?infoResource .
?infoResource a bibo:Document .
?infoResource a &lt;http://purl.obolibrary.org/obo/IAO_0000030&gt; .
?infoResource rdfs:label ?infoResourceName .
?infoResource core:hasPublicationVenue ?publishedIn .
?publishedIn rdfs:label ?journal
@ -108,24 +108,24 @@
?subject ?property ?authorship .
?authorship a core:Authorship .
?authorship core:relates ?infoResource .
?infoResource a bibo:Document
?infoResource a &lt;http://purl.obolibrary.org/obo/IAO_0000030&gt;
} UNION {
?subject ?property ?authorship .
?authorship a core:Authorship .
?authorship core:relates ?infoResource .
?infoResource a bibo:Document .
?infoResource a &lt;http://purl.obolibrary.org/obo/IAO_0000030&gt; .
?infoResource rdfs:label ?infoResourceName
} UNION {
?subject ?property ?authorship .
?authorship a core:Authorship .
?authorship core:relates ?infoResource .
?infoResource a bibo:Document .
?infoResource a &lt;http://purl.obolibrary.org/obo/IAO_0000030&gt; .
?infoResource core:hasPublicationVenue ?publishedIn
} UNION {
?subject ?property ?authorship .
?authorship a core:Authorship .
?authorship core:relates ?infoResource .
?infoResource a bibo:Document .
?infoResource a &lt;http://purl.obolibrary.org/obo/IAO_0000030&gt; .
?infoResource core:hasPublicationVenue ?publishedIn .
?publishedIn rdfs:label ?journal
}
@ -143,7 +143,7 @@
?authorship a core:Authorship .
?authorship ?authorshipProperty ?authorshipValue .
?authorship core:relates ?infoResource .
?infoResource a bibo:Document .
?infoResource a &lt;http://purl.obolibrary.org/obo/IAO_0000030&gt; .
?infoResource ?infoResourceProperty ?infoResourceValue .
?infoResource bibo:reproducedIn ?appearsInObj .
?infoResource core:publisher ?publisherObj .
@ -169,32 +169,32 @@
?subject ?property ?authorship .
?authorship a core:Authorship .
?authorship core:relates ?infoResource .
?infoResource a bibo:Document .
?infoResource a &lt;http://purl.obolibrary.org/obo/IAO_0000030&gt; .
} UNION {
?subject ?property ?authorship .
?authorship a core:Authorship .
?authorship core:relates ?infoResource .
?infoResource a bibo:Document .
?infoResource a &lt;http://purl.obolibrary.org/obo/IAO_0000030&gt; .
?infoResource ?infoResourceProperty ?infoResourceValue
} UNION {
?subject ?property ?authorship .
?authorship a core:Authorship .
?authorship core:relates ?infoResource .
?infoResource a bibo:Document .
?infoResource a &lt;http://purl.obolibrary.org/obo/IAO_0000030&gt; .
?infoResource bibo:reproducedIn ?appearsInObj .
?appearsInObj rdfs:label ?appearsIn
} UNION {
?subject ?property ?authorship .
?authorship a core:Authorship .
?authorship core:relates ?infoResource .
?infoResource a bibo:Document .
?infoResource a &lt;http://purl.obolibrary.org/obo/IAO_0000030&gt; .
?infoResource core:publisher ?publisherObj .
?publisherObj rdfs:label ?publisher
} UNION {
?subject ?property ?authorship .
?authorship a core:Authorship .
?authorship core:relates ?infoResource .
?infoResource a bibo:Document .
?infoResource a &lt;http://purl.obolibrary.org/obo/IAO_0000030&gt; .
?infoResource core:relatedBy ?editorship .
?editorship core:relates ?editorObj .
?editorObj rdfs:label ?editor
@ -202,7 +202,7 @@
?subject ?property ?authorship .
?authorship a core:Authorship .
?authorship core:relates ?infoResource .
?infoResource a bibo:Document .
?infoResource a &lt;http://purl.obolibrary.org/obo/IAO_0000030&gt; .
?infoResource core:partOf ?partOfObj .
?partOfObj rdfs:label ?partOf
}
@ -217,14 +217,14 @@
?subject ?property ?authorship .
?authorship a core:Authorship .
?authorship core:relates ?infoResource .
?infoResource a bibo:Document .
?infoResource a &lt;http://purl.obolibrary.org/obo/IAO_0000030&gt; .
?infoResource core:dateTimeValue ?dateTimeValue .
?dateTimeValue core:dateTime ?dateTime
} WHERE {
?subject ?property ?authorship .
?authorship a core:Authorship .
?authorship core:relates ?infoResource .
?infoResource a bibo:Document .
?infoResource a &lt;http://purl.obolibrary.org/obo/IAO_0000030&gt; .
?infoResource core:dateTimeValue ?dateTimeValue .
?dateTimeValue core:dateTime ?dateTime
}

View file

@ -13,7 +13,6 @@
SELECT DISTINCT <collated> ?subclass </collated>
?edTraining
?trainingType
?typeName
?org ?orgName
?degreeName ?degreeAbbr
@ -22,7 +21,7 @@
WHERE {
?subject ?property ?edTraining .
?edTraining a core:EducationalProcess
OPTIONAL {?edTraining vitro:mostSpecificType ?trainingType .
OPTIONAL {?edTraining vitro:mostSpecificType ?subclass .
?trainingType rdfs:subClassOf core:EducationalProcess .
?trainingType rdfs:label ?typeName
}
@ -32,13 +31,9 @@
OPTIONAL { ?degree rdfs:label ?degreeName }
OPTIONAL { ?degree core:abbreviation ?degreeAbbr }
}
OPTIONAL { ?awardedDegree core:assignedBy ?org .
OPTIONAL { ?edTraining &lt;http://purl.obolibrary.org/obo/RO_0000057&gt; ?org .
?org a foaf:Organization .
?org rdfs:label ?orgName
<collated>
OPTIONAL { ?org vitro:mostSpecificType ?subclass .
?subclass rdfs:subClassOf foaf:Organization
}
</collated>
}
OPTIONAL { ?edTraining core:majorField ?majorField }
OPTIONAL { ?edTraining core:departmentOrSchool ?deptOrSchool }
@ -57,12 +52,11 @@
<query-construct>
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;
PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt;
CONSTRUCT {
?subclass rdfs:subClassOf foaf:Organization .
?subclass rdfs:subClassOf core:EducationalProcess .
} WHERE {
?subclass rdfs:subClassOf foaf:Organization .
?subclass rdfs:subClassOf core:EducationalProcess .
}
</query-construct>
@ -75,8 +69,6 @@
?edTraining a core:EducationalProcess .
?edTraining ?edTrainingProp ?edTrainingValue .
?edTraining &lt;http://purl.obolibrary.org/obo/RO_0002234&gt; ?awardedDegree .
?awardedDegree core:assignedBy ?org .
?org rdfs:label ?orgName .
?awardedDegree core:relates ?degree .
?edTraining core:dateTimeInterval ?dateTimeInterval
} WHERE {
@ -98,8 +90,6 @@
?subject ?property ?edTraining .
?edTraining a core:EducationalProcess .
?edTraining &lt;http://purl.obolibrary.org/obo/RO_0002234&gt; ?awardedDegree .
?awardedDegree core:assignedBy ?org .
?org rdfs:label ?orgName
}
UNION {
?subject ?property ?edTraining .
@ -115,6 +105,44 @@
}
</query-construct>
<query-construct>
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;
PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt;
CONSTRUCT {
?subject ?property ?edTraining .
?edTraining a core:EducationalProcess .
?edTraining ?edTrainingProp ?edTrainingValue .
?edTraining &lt;http://purl.obolibrary.org/obo/RO_0000057&gt; ?org .
?org a foaf:Organization .
?org rdfs:label ?orgName .
} WHERE {
{
?subject ?property ?edTraining .
?edTraining a core:EducationalProcess
}
UNION {
?subject ?property ?edTraining .
?edTraining a core:EducationalProcess .
?edTraining ?edTrainingProp ?edTrainingValue
}
UNION {
?subject ?property ?edTraining .
?edTraining a core:EducationalProcess .
?edTraining &lt;http://purl.obolibrary.org/obo/RO_0000057&gt; ?org .
?org a foaf:Organization .
}
UNION {
?subject ?property ?edTraining .
?edTraining a core:EducationalProcess .
?edTraining &lt;http://purl.obolibrary.org/obo/RO_0000057&gt; ?org .
?org a foaf:Organization .
?org rdfs:label ?orgName
}
}
</query-construct>
<query-construct>
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<!-- VIVO-specific default list view config file for object properties
See guidelines in vitro/doc/list_view_configuration_guidelines.txt -->
<list-view-config>
<query-select>
PREFIX afn: &lt;http://jena.hpl.hp.com/ARQ/function#&gt;
SELECT ?value ?localName
WHERE {
?subject ?property ?value
LET (?localName := afn:localname(?value))
} LIMIT 1
</query-select>
<query-construct>
CONSTRUCT {
?subject ?property ?value
} WHERE {
?subject ?property ?value
}
</query-construct>
<template>propStatement-orcidId.ftl</template>
</list-view-config>

View file

@ -0,0 +1,17 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- VIVO-specific default data property statement template.
This template must be self-contained and not rely on other variables set for the individual page, because it
is also used to generate the property statement during a deletion.
-->
<@showStatement statement />
<#macro showStatement statement>
<a href="${statement.value!}" title="ORCID iD" target="_blank">${statement.localName!statement.value!}</a>
</#macro>

View file

@ -0,0 +1,87 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- this is in request.subject.name -->
<#-- leaving this edit/add mode code in for reference in case we decide we need it -->
<#import "lib-vivo-form.ftl" as lvf>
<#--Retrieve certain edit configuration information-->
<#if editConfiguration.objectUri?has_content>
<#assign editMode = "edit">
<#else>
<#assign editMode = "add">
</#if>
<#assign htmlForElements = editConfiguration.pageData.htmlForElements />
<#--Retrieve variables needed-->
<#assign orcidIdFromConf = lvf.getFormFieldValue(editSubmission, editConfiguration, "orcidId") />
<#assign orcidIdValue = orcidIdFromConf?replace("http://www.orcid.org/","") />
<#--If edit submission exists, then retrieve validation errors if they exist-->
<#if editSubmission?has_content && editSubmission.submissionExists = true && editSubmission.validationErrors?has_content>
<#assign submissionErrors = editSubmission.validationErrors/>
</#if>
<#if editMode == "edit">
<#assign titleVerb="${i18n().edit_capitalized}">
<#assign submitButtonText="${titleVerb}" + " ORCID iD">
<#assign disabledVal="disabled">
<#else>
<#assign titleVerb="${i18n().create_capitalized}">
<#assign submitButtonText="${titleVerb}" + " ORCID iD">
<#assign disabledVal=""/>
</#if>
<#assign requiredHint = "<span class='requiredHint'> *</span>" />
<h2>${titleVerb}&nbsp;ORCID iD&nbsp;${i18n().for} ${editConfiguration.subjectName}</h2>
<#--Display error messages if any-->
<#if submissionErrors?has_content>
<section id="error-alert" role="alert">
<img src="${urls.images}/iconAlert.png" width="24" height="24" alert="${i18n().error_alert_icon}" />
<p>
<#--Checking if any required fields are empty-->
<#if lvf.submissionErrorExists(editSubmission, "orcidId")>
${i18n().required_fields}: ORCID iD<br />
</#if>
</p>
</section>
</#if>
<@lvf.unsupportedBrowser urls.base />
<section id="personHasOrcidId" role="region">
<form id="personHasOrcidId" class="customForm noIE67" action="${submitUrl}" role="add/edit orcidId">
<p>
<label for="orcidId">ORCID iD ${requiredHint}</label>
<input size="35" type="text" id="orcidId" name="orcidId" value="${orcidIdValue}" />
</p>
<input type="hidden" id="editKey" name="editKey" value="${editKey}"/>
<p class="submit">
<input type="submit" id="submit" value="${submitButtonText}"/><span class="or"> ${i18n().or} </span>
<a class="cancel" href="${cancelUrl}" title="${i18n().cancel_title}">${i18n().cancel_link}</a>
</p>
<p id="requiredLegend" class="requiredHint">* ${i18n().required_fields}</p>
</form>
</section>
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/js/jquery-ui/css/smoothness/jquery-ui-1.8.9.custom.css" />')}
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/templates/freemarker/edit/forms/css/customForm.css" />')}
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/templates/freemarker/edit/forms/css/customFormWithAutocomplete.css" />')}
${scripts.add('<script type="text/javascript" src="${urls.base}/js/jquery-ui/js/jquery-ui-1.8.9.custom.min.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/extensions/String.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/browserUtils.js"></script>',
'<script type="text/javascript" src="${urls.base}/templates/freemarker/edit/forms/js/addOrcidIdToPersonUtils.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/jquery_plugins/jquery.bgiframe.pack.js"></script>')}

View file

@ -0,0 +1,39 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
var addOrcidIdToPersonUtils = {
onLoad: function() {
this.initObjectReferences();
this.bindEventListeners();
},
initObjectReferences: function() {
this.form = $('#personHasOrcidId');
this.orcidId = $('#orcidId');
},
bindEventListeners: function() {
this.form.submit(function() {
addOrcidIdToPersonUtils.buildOrcidIdURL();
});
},
buildOrcidIdURL: function() {
var orcidBase = "http://www.orcid.org/";
var orcidIdVal = "";
if ( this.orcidId.val().length > 0 ) {
orcidIdVal = orcidBase + this.orcidId.val();
this.orcidId.val(orcidIdVal);
}
},
}
$(document).ready(function() {
addOrcidIdToPersonUtils.onLoad();
});

View file

@ -105,7 +105,6 @@ var awardReceiptUtils = {
rdfsLabel += " (" + this.subjectName + ")";
}
this.recLabel.val(rdfsLabel);
alert(this.recLabel.val());
},
setYearAwardedValue: function() {

View file

@ -37,8 +37,9 @@ Set this flag on the input acUriReceiver where you would like this behavior to o
<#assign awardedDegreeLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "awardedDegreeLabel") />
<#assign existingOrgValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "existingOrg") />
<#assign trainingTypeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "trainingType")/>
<#--
<#assign existingADLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "existingAwardedDegreeLabel") />
-->
<#-- If edit submission exists, then retrieve validation errors if they exist-->
<#if editSubmission?has_content && editSubmission.submissionExists = true && editSubmission.validationErrors?has_content>
<#assign submissionErrors = editSubmission.validationErrors/>
@ -164,12 +165,15 @@ Set this flag on the input acUriReceiver where you would like this behavior to o
<option value="${key}" <#if degreeValue = key>selected</#if>>${degreeOpts[key]}</option>
</#list>
</select>
<#--
<#if editMode == "edit" || editMode == "repair">
<input type="hidden" id="newAwardedDegreeLabel" name="awardedDegreeLabel" value=""/>
<input type="hidden" id="awardedDegreeLabel" name="existingAwardedDegreeLabel" value="${existingADLabelValue!}"/>
<#else>
<input type="hidden" id="awardedDegreeLabel" name="awardedDegreeLabel" value=""/>
</#if>
-->
<input type="hidden" id="awardedDegreeLabel" name="awardedDegreeLabel" value=""/>
</div>
<p>

View file

@ -358,6 +358,21 @@ local:informationResourceInEditorshipConfig a :ObjectPropertyDisplayConfig ;
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddEditorsToInformationResourceGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupbibobscure> .
local:editorOfContext a :ConfigContext ;
:hasConfiguration local:editorOfConfig ;
:configContextFor <http://vivoweb.org/ontology/core#relatedBy> ;
:qualifiedByDomain <http://xmlns.com/foaf/0.1/Person> ;
:qualifiedBy <http://vivoweb.org/ontology/core#Editorship> .
local:editorOfConfig a :ObjectPropertyDisplayConfig ;
:listViewConfigFile "listViewConfig-editorship.xml"^^xsd:string ;
:displayName "editor of" ;
vitro:displayRankAnnot 20;
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddEditorshipToPersonGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupbibliographic> .
### vcard properties ###
local:mailingAddressContext a :ConfigContext ;
@ -450,21 +465,6 @@ local:fullNameConfig a :ObjectPropertyDisplayConfig ;
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddFullNameToPersonGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupaddress> .
local:editorOfContext a :ConfigContext ;
:hasConfiguration local:editorOfConfig ;
:configContextFor <http://vivoweb.org/ontology/core#relatedBy> ;
:qualifiedByDomain <http://xmlns.com/foaf/0.1/Person> ;
:qualifiedBy <http://vivoweb.org/ontology/core#Editorship> .
local:editorOfConfig a :ObjectPropertyDisplayConfig ;
:listViewConfigFile "listViewConfig-editorship.xml"^^xsd:string ;
:displayName "editor of" ;
vitro:displayRankAnnot 20;
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddEditorshipToPersonGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupbibliographic> .
### properties using default editing form ##
local:eventWithinContext a :ConfigContext ;

View file

@ -96,6 +96,10 @@
<display:listViewConfigFile rdf:datatype="http://www.w3.org/2001/XMLSchema#string">listViewConfig-hasAssociatedConcept.xml</display:listViewConfigFile>
</rdf:Description>
<rdf:Description rdf:about="http://vivoweb.org/ontology/core#orcidId">
<display:listViewConfigFile rdf:datatype="http://www.w3.org/2001/XMLSchema#string">listViewConfig-orcidId.xml</display:listViewConfigFile>
</rdf:Description>
<!--
******************************************************************
data property custom list views

View file

@ -109,7 +109,7 @@ public class AddEditorshipToPersonGenerator extends VivoBaseGenerator implements
"PREFIX bibo: <http://purl.org/ontology/bibo/> . \n" +
"SELECT ?documentType WHERE { \n" +
" ?editorship vivo:relates ?existingDocument . \n" +
" ?existingDocument a bibo:Document . \n" +
" ?existingDocument a <http://purl.obolibrary.org/obo/IAO_0000030> . \n" +
" ?existingDocument vitro:mostSpecificType ?documentType . \n" +
"}";
@ -119,7 +119,7 @@ public class AddEditorshipToPersonGenerator extends VivoBaseGenerator implements
"PREFIX bibo: <http://purl.org/ontology/bibo/> . \n" +
"SELECT ?documentLabel WHERE { \n" +
" ?editorship vivo:relates ?existingDocument . \n" +
" ?existingDocument a bibo:Document . \n" +
" ?existingDocument a <http://purl.obolibrary.org/obo/IAO_0000030> . \n" +
" ?existingDocument <" + label + "> ?documentLabel . \n" +
"}";
@ -129,7 +129,7 @@ public class AddEditorshipToPersonGenerator extends VivoBaseGenerator implements
"PREFIX bibo: <http://purl.org/ontology/bibo/> . \n" +
"SELECT existingDocument WHERE { \n" +
" ?editorship vivo:relates ?existingDocument . \n" +
" ?existingDocument a bibo:Document . \n" +
" ?existingDocument a <http://purl.obolibrary.org/obo/IAO_0000030> . \n" +
"}";
//Adding form specific data such as edit mode

View file

@ -0,0 +1,81 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpSession;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.vocabulary.XSD;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ChildVClassesOptions;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.IndividualsViaVClassOptions;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation;
public class AddOrcidIdToPersonGenerator extends VivoBaseGenerator implements
EditConfigurationGenerator {
private Log log = LogFactory.getLog(AddOrcidIdToPersonGenerator.class);
@Override
public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq,
HttpSession session) throws Exception {
EditConfigurationVTwo conf = new EditConfigurationVTwo();
initBasics(conf, vreq);
initPropertyParameters(vreq, session, conf);
initObjectPropForm(conf, vreq);
conf.setTemplate("addOrcidIdToPerson.ftl");
conf.setVarNameForSubject("person");
conf.setVarNameForPredicate("predicate");
conf.setVarNameForObject("orcidId");
conf.setN3Required( Arrays.asList( n3ForOrcidId ) );
conf.addNewResource("orcidId", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.setUrisOnform(Arrays.asList("orcidId"));
// conf.addSparqlForAdditionalUrisInScope("orcidId", orcidIdQuery);
conf.addSparqlForExistingUris("orcidId", orcidIdQuery);
conf.addField( new FieldVTwo().
setName("orcidId").
setValidators( list("nonempty") ));
conf.addValidator(new AntiXssValidation());
prepare(vreq, conf);
return conf;
}
/* N3 assertions */
final static String n3ForOrcidId =
"@prefix owl: <http://www.w3.org/2002/07/owl#> .\n"+
"?person <http://vivoweb.org/ontology/core#orcidId> ?orcidId . \n" +
"?orcidId a owl:Thing . " ;
/* Queries for editing an existing entry */
final static String orcidIdQuery =
"SELECT ?existingOrcidId WHERE { \n" +
"?person <http://vivoweb.org/ontology/core#orcidId> ?existingOrcidId . \n" +
"}";
}

View file

@ -89,14 +89,11 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
conf.setVarNameForObject("edTraining");
conf.setN3Required( Arrays.asList( n3ForNewEdTraining, trainingTypeAssertion ) );
conf.setN3Optional(Arrays.asList(
n3ForNewOrgExistingAwardedDegree, n3ForExistingOrgExistingAwardedDegree, n3ForNewAwardedDegreeNewOrg,
majorFieldAssertion, n3ForNewAwardedDegreeExistingOrg,
//existingDegreeTypeAssertion,
existingAwardedDegreeLabel, deptAssertion, infoAssertion, n3ForStart, n3ForEnd ));
conf.setN3Optional(Arrays.asList( majorFieldAssertion, n3ForAwardedDegree, n3ForNewOrganization, n3ForExistingOrganization,
n3ForNewOrgAwardedDegree, n3ForExistingOrgAwardedDegree, deptAssertion, infoAssertion, n3ForStart, n3ForEnd ));
conf.addNewResource("edTraining", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("newAwardedDegree",DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("awardedDegree",DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("newOrg",DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("intervalNode",DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("startNode",DEFAULT_NS_FOR_NEW_RESOURCE);
@ -105,12 +102,12 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
//uris in scope: none
//literals in scope: none
conf.setUrisOnform( Arrays.asList( "existingOrg", "orgType", "existingAwardedDegree", "degreeType", "trainingType"));
conf.setLiteralsOnForm( Arrays.asList("orgLabel", "orgLabelDisplay", "awardedDegreeLabel", "existingAwardedDegreeLabel",
conf.setUrisOnform( Arrays.asList( "existingOrg", "orgType", "degreeType", "trainingType"));
conf.setLiteralsOnForm( Arrays.asList("orgLabel", "orgLabelDisplay", "awardedDegreeLabel",
"majorField", "dept", "info"));
conf.addSparqlForExistingLiteral("orgLabel", orgLabelQuery);
conf.addSparqlForExistingLiteral("existingAwardedDegreeLabel", existingAwardedDegreeLabelQuery);
// conf.addSparqlForExistingLiteral("existingAwardedDegreeLabel", existingAwardedDegreeLabelQuery);
conf.addSparqlForExistingLiteral("majorField", majorFieldQuery);
conf.addSparqlForExistingLiteral("dept", deptQuery);
conf.addSparqlForExistingLiteral("info", infoQuery);
@ -118,7 +115,7 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
conf.addSparqlForExistingLiteral("endField-value", existingEndDateQuery);
conf.addSparqlForExistingUris("existingAwardedDegree", existingAwardedDegreeQuery);
conf.addSparqlForExistingUris("awardedDegree", existingAwardedDegreeQuery);
conf.addSparqlForExistingUris("existingOrg", existingOrgQuery);
conf.addSparqlForExistingUris("orgType", orgTypeQuery);
conf.addSparqlForExistingUris("trainingType", trainingTypeQuery);
@ -147,7 +144,7 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
);
conf.addField( new FieldVTwo().
setName("existingAwardedDegree")
setName("awardedDegree")
//options will be added in browser by auto complete JS
);
@ -217,7 +214,6 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
return conf;
}
/* N3 assertions for working with educational training */
final static String n3ForNewEdTraining =
@ -229,54 +225,39 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
final static String trainingTypeAssertion =
"?edTraining a ?trainingType .";
final static String n3ForNewAwardedDegreeNewOrg =
final static String n3ForAwardedDegree =
"@prefix core: <"+ vivoCore +"> .\n"+
"?edTraining <http://purl.obolibrary.org/obo/RO_0002234> ?newAwardedDegree . \n" +
"?newAwardedDegree <http://purl.obolibrary.org/obo/RO_0002353> ?edTraining . \n" +
"?newAwardedDegree <http://vivoweb.org/ontology/core#relates> ?person . \n" +
"?person <http://vivoweb.org/ontology/core#relatedBy> ?newAwardedDegree . \n" +
"?newAwardedDegree <"+ label +"> ?awardedDegreeLabel . \n" +
"?newAwardedDegree <http://vivoweb.org/ontology/core#assignedBy> ?newOrg . \n" +
"?newOrg <http://vivoweb.org/ontology/core#assigns> ?newAwardedDegree . \n" +
"?newOrg a ?orgType . \n" +
"?newOrg <"+ label +"> ?orgLabel . \n" +
"?edTraining <http://purl.obolibrary.org/obo/RO_0002234> ?awardedDegree . \n" +
"?awardedDegree <http://purl.obolibrary.org/obo/RO_0002353> ?edTraining . \n" +
"?awardedDegree <http://vivoweb.org/ontology/core#relates> ?person . \n" +
"?person <http://vivoweb.org/ontology/core#relatedBy> ?awardedDegree . \n" +
"?awardedDegree <"+ label +"> ?awardedDegreeLabel . \n" +
"?awardedDegree <http://vivoweb.org/ontology/core#relates> ?degreeType .\n"+
"?degreeType <http://vivoweb.org/ontology/core#relatedBy> ?awardedDegree . \n"+
"?awardedDegree a core:AwardedDegree .";
final static String n3ForNewOrganization =
"?edTraining <http://purl.obolibrary.org/obo/RO_0000057> ?newOrg . \n" +
"?newOrg <http://purl.obolibrary.org/obo/RO_0000056> ?edTraining . \n" +
"?newAwardedDegree <http://vivoweb.org/ontology/core#relates> ?degreeType .\n"+
"?degreeType <http://vivoweb.org/ontology/core#relatedBy> ?newAwardedDegree . \n"+
"?newAwardedDegree a core:AwardedDegree .";
"?newOrg a ?orgType . \n" +
"?newOrg <"+ label +"> ?orgLabel . ";
final static String n3ForNewAwardedDegreeExistingOrg =
"@prefix core: <"+ vivoCore +"> .\n"+
"?edTraining <http://purl.obolibrary.org/obo/RO_0002234> ?newAwardedDegree . \n" +
"?newAwardedDegree <http://purl.obolibrary.org/obo/RO_0002353> ?edTraining . \n" +
"?newAwardedDegree <http://vivoweb.org/ontology/core#relates> ?person . \n" +
"?person <http://vivoweb.org/ontology/core#relatedBy> ?newAwardedDegree . \n" +
"?newAwardedDegree <"+ label +"> ?awardedDegreeLabel . \n" +
"?existingOrg <http://vivoweb.org/ontology/core#assigns> ?newAwardedDegree . \n" +
"?newAwardedDegree <http://vivoweb.org/ontology/core#assignedBy> ?existingOrg . \n" +
"?newAwardedDegree <http://vivoweb.org/ontology/core#relates> ?degreeType .\n"+
final static String n3ForExistingOrganization =
"?edTraining <http://purl.obolibrary.org/obo/RO_0000057> ?existingOrg . \n" +
"?existingOrg <http://purl.obolibrary.org/obo/RO_0000056> ?edTraining . \n" +
"?degreeType <http://vivoweb.org/ontology/core#relatedBy> ?newAwardedDegree . \n"+
"?newAwardedDegree a core:AwardedDegree .";
"?existingOrg a ?orgType . ";
final static String existingAwardedDegreeLabel =
"?edTraining <http://purl.obolibrary.org/obo/RO_0002234> ?existingAwardedDegree . \n" +
"?existingAwardedDegree <http://purl.obolibrary.org/obo/RO_0002353> ?edTraining . \n" +
"?existingAwardedDegree <http://vivoweb.org/ontology/core#relates> ?degreeType .\n"+
"?degreeType <http://vivoweb.org/ontology/core#relatedBy> ?existingAwardedDegree . \n"+
"?existingAwardedDegree <"+ label +"> ?existingAwardedDegreeLabel . " ;
final static String n3ForNewOrgAwardedDegree =
"?awardedDegree <http://vivoweb.org/ontology/core#assignedBy> ?newOrg . \n" +
"?newOrg <http://vivoweb.org/ontology/core#assigns> ?awardedDegree . \n" +
"?newOrg a ?orgType . \n" +
"?awardedDegree <"+ label +"> ?awardedDegreeLabel . \n" +
"?newOrg <"+ label +"> ?orgLabel . ";
final static String n3ForNewOrgExistingAwardedDegree =
"?existingAwardedDegree <http://vivoweb.org/ontology/core#assignedBy> ?newOrg . \n" +
"?newOrg <http://vivoweb.org/ontology/core#assigns> ?existingAwardedDegree . \n" +
"?newOrg <"+ label +"> ?orgLabel . \n" +
"?newOrg a ?orgType .";
final static String n3ForExistingOrgExistingAwardedDegree =
"?existingAwardedDegree <http://vivoweb.org/ontology/core#assignedBy> ?existingOrg . \n" +
"?existingOrg <http://vivoweb.org/ontology/core#assigns> ?existingAwardedDegree . \n" +
final static String n3ForExistingOrgAwardedDegree =
"?awardedDegree <http://vivoweb.org/ontology/core#assignedBy> ?existingOrg . \n" +
"?existingOrg <http://vivoweb.org/ontology/core#assigns> ?awardedDegree . \n" +
"?awardedDegree <"+ label +"> ?awardedDegreeLabel . \n" +
"?existingOrg a ?orgType . ";
final static String majorFieldAssertion =
@ -316,16 +297,21 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
"?existingAwardedDegree <"+ label +"> ?existingAwardedDegreeLabel }\n";
final static String existingOrgQuery =
"PREFIX rdfs: <"+ rdfs +"> \n"+
"SELECT ?existingOrg WHERE {\n"+
"?edTraining <http://purl.obolibrary.org/obo/RO_0002234> ?existingAwardedDegree . \n" +
"?existingAwardedDegree <http://vivoweb.org/ontology/core#assignedBy> ?existingOrg . }\n";
"?edTraining <http://purl.obolibrary.org/obo/RO_0000057> ?existingOrg . \n" +
"?existingOrg <http://purl.obolibrary.org/obo/RO_0000056> ?edTraining . \n" +
"?existingOrg a ?existingOrgType . \n " +
"?existingOrgType rdfs:subClassOf <"+ orgClass +"> . }";
final static String orgLabelQuery =
"PREFIX rdfs: <"+ rdfs +"> \n"+
"SELECT ?existingOrgLabel WHERE {\n"+
"?edTraining <http://purl.obolibrary.org/obo/RO_0002234> ?existingAwardedDegree . \n" +
"?existingAwardedDegree <http://vivoweb.org/ontology/core#assignedBy> ?existingOrg .\n"+
"?edTraining <http://purl.obolibrary.org/obo/RO_0000057> ?existingOrg . \n" +
"?existingOrg <http://purl.obolibrary.org/obo/RO_0000056> ?edTraining .\n"+
"?existingOrg <"+ label +"> ?existingOrgLabel .\n"+
"}";
"?existingOrg a ?existingOrgType . \n " +
"?existingOrgType rdfs:subClassOf <"+ orgClass +"> . }";
/* Limit type to subclasses of foaf:Organization. Otherwise, sometimes owl:Thing or another
type is returned and we don't get a match to the select element options. */