VIVO-313: vcards for organizations
This commit is contained in:
parent
8fd14cb2cf
commit
5cd482d6df
10 changed files with 373 additions and 14 deletions
|
@ -819,6 +819,9 @@ item_capitalized = Artículo
|
|||
telephone_number_for = número de teléfono para
|
||||
telephone_number = Número de Teléfono
|
||||
enter_telephone_number = Por favor, introduzca un valor en el campo Número de teléfono.
|
||||
fax_number_for = número de fax para
|
||||
fax_number = Número de Fax
|
||||
enter_fax_number = Por favor, introduzca un valor en el campo Número de fax.
|
||||
email_address = Dirección de Correo Electrónico
|
||||
email_address_for = dirección de correo electrónico para
|
||||
enter_email_address = Por favor, introduzca un valor en el campo Dirección de Correo Electrónico.
|
||||
|
|
46
productMods/config/listViewConfig-faxNumber.xml
Normal file
46
productMods/config/listViewConfig-faxNumber.xml
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||
|
||||
<!-- See guidelines in vitro/doc/list_view_configuration_guidelines.txt -->
|
||||
|
||||
<list-view-config>
|
||||
<query-select>
|
||||
PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>
|
||||
|
||||
SELECT DISTINCT ?vcard ?phone
|
||||
?number
|
||||
WHERE {
|
||||
?subject ?property ?vcard .
|
||||
?vcard vcard:hasTelephone ?phone .
|
||||
?phone a vcard:Fax
|
||||
OPTIONAL { ?phone vcard:telephone ?number }
|
||||
|
||||
}
|
||||
</query-select>
|
||||
|
||||
<query-construct>
|
||||
PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>
|
||||
CONSTRUCT {
|
||||
?subject ?property ?vcard .
|
||||
?vcard vcard:hasTelephone ?phone .
|
||||
?phone a vcard:Fax .
|
||||
?phone ?phoneProperty ?phoneValue
|
||||
} WHERE {
|
||||
{
|
||||
?subject ?property ?vcard
|
||||
} UNION {
|
||||
?subject ?property ?vcard .
|
||||
?vcard vcard:hasTelephone ?phone .
|
||||
?phone a vcard:Fax
|
||||
} UNION {
|
||||
?subject ?property ?vcard .
|
||||
?vcard vcard:hasTelephone ?phone .
|
||||
?phone a vcard:Fax .
|
||||
?phone ?phoneProperty ?phoneValue
|
||||
}
|
||||
}
|
||||
</query-construct>
|
||||
|
||||
<template>propStatement-phoneFaxNumber.ftl</template>
|
||||
<postprocessor>edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.MaintainDuplicatesObjectPropertyDataPostProcessor</postprocessor>
|
||||
</list-view-config>
|
|
@ -13,7 +13,7 @@
|
|||
?subject ?property ?vcard .
|
||||
?vcard vcard:hasTelephone ?phone
|
||||
OPTIONAL { ?phone vcard:telephone ?number }
|
||||
|
||||
MINUS {?phone a vcard:Fax}
|
||||
}
|
||||
</query-select>
|
||||
|
||||
|
@ -37,6 +37,6 @@
|
|||
}
|
||||
</query-construct>
|
||||
|
||||
<template>propStatement-telephoneNumber.ftl</template>
|
||||
<template>propStatement-phoneFaxNumber.ftl</template>
|
||||
<postprocessor>edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.MaintainDuplicatesObjectPropertyDataPostProcessor</postprocessor>
|
||||
</list-view-config>
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
<#-- $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 telephoneNumberValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "telephoneNumber") />
|
||||
<#assign numberType = lvf.getEditConfigLiteralValue(editConfiguration, "numberType") />
|
||||
|
||||
<#--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 numberType?? && numberType == "fax" >
|
||||
<#assign labelString = "${i18n().fax_number}" />
|
||||
<#assign errorString = "${i18n().enter_fax_number}" />
|
||||
<#assign titleString = "${i18n().fax_number_for}" />
|
||||
<#else>
|
||||
<#assign labelString = "${i18n().telephone_number}" />
|
||||
<#assign errorString = "${i18n().enter_telephone_number}" />
|
||||
<#assign titleString = "${i18n().telephone_number_for}" />
|
||||
</#if>
|
||||
|
||||
<#if editMode == "edit">
|
||||
<#assign titleVerb="${i18n().edit_capitalized}">
|
||||
<#assign submitButtonText="${titleVerb}" + " ${labelString}">
|
||||
<#assign disabledVal="disabled">
|
||||
<#else>
|
||||
<#assign titleVerb="${i18n().create_capitalized}">
|
||||
<#assign submitButtonText="${titleVerb}" + " ${labelString}">
|
||||
<#assign disabledVal=""/>
|
||||
</#if>
|
||||
|
||||
<#assign requiredHint = "<span class='requiredHint'> *</span>" />
|
||||
|
||||
<h2>${titleVerb} ${titleString} ${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, "telephoneNumber")>
|
||||
${errorString}<br />
|
||||
</#if>
|
||||
</p>
|
||||
</section>
|
||||
</#if>
|
||||
|
||||
<@lvf.unsupportedBrowser urls.base />
|
||||
|
||||
<section id="personHasTelephoneNumber" role="region">
|
||||
|
||||
<form id="personHasTelephoneNumber" class="customForm noIE67" action="${submitUrl}" role="add/edit phone">
|
||||
|
||||
<p>
|
||||
<label for="telephoneNumber">${labelString} ${requiredHint}</label>
|
||||
<input size="25" type="text" id="telephoneNumber" name="telephoneNumber" value="${telephoneNumberValue}" />
|
||||
</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}/js/jquery_plugins/jquery.bgiframe.pack.js"></script>')}
|
|
@ -404,22 +404,82 @@ local:mailingAddressConfig a :ObjectPropertyDisplayConfig ;
|
|||
vitro:displayRankAnnot 80;
|
||||
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
|
||||
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
|
||||
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.PersonHasMailingAddressGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
|
||||
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.SubjectHasMailingAddressGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
|
||||
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupaddress> .
|
||||
|
||||
local:telephoneContext a :ConfigContext ;
|
||||
:hasConfiguration local:telephoneConfig ;
|
||||
local:mailingAddressContext a :ConfigContext ;
|
||||
:hasConfiguration local:mailingAddressConfig ;
|
||||
:configContextFor <http://purl.obolibrary.org/obo/ARG_2000028> ;
|
||||
:qualifiedByDomain <http://xmlns.com/foaf/0.1/Organization> ;
|
||||
:qualifiedBy <http://www.w3.org/2006/vcard/ns#Address> .
|
||||
|
||||
local:mailingAddressConfig a :ObjectPropertyDisplayConfig ;
|
||||
:listViewConfigFile "listViewConfig-mailingAddress.xml"^^xsd:string ;
|
||||
:displayName "mailing address" ;
|
||||
vitro:displayRankAnnot 80;
|
||||
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
|
||||
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
|
||||
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.SubjectHasMailingAddressGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
|
||||
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupaddress> .
|
||||
|
||||
local:personTelephoneContext a :ConfigContext ;
|
||||
:hasConfiguration local:personTelephoneConfig ;
|
||||
:configContextFor <http://purl.obolibrary.org/obo/ARG_2000028> ;
|
||||
:qualifiedByDomain <http://xmlns.com/foaf/0.1/Person> ;
|
||||
:qualifiedBy <http://www.w3.org/2006/vcard/ns#Telephone> .
|
||||
|
||||
local:telephoneConfig a :ObjectPropertyDisplayConfig ;
|
||||
local:personTelephoneConfig a :ObjectPropertyDisplayConfig ;
|
||||
:listViewConfigFile "listViewConfig-telephoneNumber.xml"^^xsd:string ;
|
||||
:displayName "phone" ;
|
||||
vitro:displayRankAnnot 60;
|
||||
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
|
||||
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
|
||||
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.PersonHasTelephoneNumberGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
|
||||
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.SubjectHasPhoneFaxNumberGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
|
||||
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupaddress> .
|
||||
|
||||
local:orgTelephoneContext a :ConfigContext ;
|
||||
:hasConfiguration local:orgTelephoneConfig ;
|
||||
:configContextFor <http://purl.obolibrary.org/obo/ARG_2000028> ;
|
||||
:qualifiedByDomain <http://xmlns.com/foaf/0.1/Organization> ;
|
||||
:qualifiedBy <http://www.w3.org/2006/vcard/ns#Telephone> .
|
||||
|
||||
local:orgTelephoneConfig a :ObjectPropertyDisplayConfig ;
|
||||
:listViewConfigFile "listViewConfig-telephoneNumber.xml"^^xsd:string ;
|
||||
:displayName "phone" ;
|
||||
vitro:displayRankAnnot 10;
|
||||
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
|
||||
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
|
||||
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.SubjectHasPhoneFaxNumberGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
|
||||
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupaddress> .
|
||||
|
||||
local:personFaxContext a :ConfigContext ;
|
||||
:hasConfiguration local:personFaxConfig ;
|
||||
:configContextFor <http://purl.obolibrary.org/obo/ARG_2000028> ;
|
||||
:qualifiedByDomain <http://xmlns.com/foaf/0.1/Person> ;
|
||||
:qualifiedBy <http://www.w3.org/2006/vcard/ns#Fax> .
|
||||
|
||||
local:personFaxConfig a :ObjectPropertyDisplayConfig ;
|
||||
:listViewConfigFile "listViewConfig-faxNumber.xml"^^xsd:string ;
|
||||
:displayName "fax" ;
|
||||
vitro:displayRankAnnot 60;
|
||||
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
|
||||
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
|
||||
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.SubjectHasPhoneFaxNumberGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
|
||||
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupaddress> .
|
||||
|
||||
local:orgFaxContext a :ConfigContext ;
|
||||
:hasConfiguration local:orgFaxConfig ;
|
||||
:configContextFor <http://purl.obolibrary.org/obo/ARG_2000028> ;
|
||||
:qualifiedByDomain <http://xmlns.com/foaf/0.1/Organization> ;
|
||||
:qualifiedBy <http://www.w3.org/2006/vcard/ns#Fax> .
|
||||
|
||||
local:orgFaxConfig a :ObjectPropertyDisplayConfig ;
|
||||
:listViewConfigFile "listViewConfig-faxNumber.xml"^^xsd:string ;
|
||||
:displayName "fax" ;
|
||||
vitro:displayRankAnnot 10;
|
||||
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
|
||||
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
|
||||
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.SubjectHasPhoneFaxNumberGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
|
||||
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupaddress> .
|
||||
|
||||
local:additionalEmailContext a :ConfigContext ;
|
||||
|
@ -467,6 +527,21 @@ local:webpageConfig a :ObjectPropertyDisplayConfig ;
|
|||
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ManageWebpagesForIndividualGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
|
||||
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupaddress> .
|
||||
|
||||
local:webpageContext a :ConfigContext ;
|
||||
:hasConfiguration local:webpageConfig ;
|
||||
:configContextFor <http://purl.obolibrary.org/obo/ARG_2000028> ;
|
||||
:qualifiedByDomain <http://xmlns.com/foaf/0.1/Organization> ;
|
||||
:qualifiedBy <http://www.w3.org/2006/vcard/ns#URL> .
|
||||
|
||||
local:webpageConfig a :ObjectPropertyDisplayConfig ;
|
||||
:listViewConfigFile "listViewConfig-webpage.xml"^^xsd:string ;
|
||||
:displayName "webpage" ;
|
||||
vitro:displayRankAnnot 40;
|
||||
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
|
||||
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
|
||||
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ManageWebpagesForIndividualGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
|
||||
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupother> .
|
||||
|
||||
local:fullNameContext a :ConfigContext ;
|
||||
:hasConfiguration local:fullNameConfig ;
|
||||
:configContextFor <http://purl.obolibrary.org/obo/ARG_2000028> ;
|
||||
|
|
|
@ -25,9 +25,9 @@ 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 PersonHasMailingAddressGenerator extends VivoBaseGenerator implements
|
||||
public class SubjectHasMailingAddressGenerator extends VivoBaseGenerator implements
|
||||
EditConfigurationGenerator {
|
||||
private Log log = LogFactory.getLog(PersonHasMailingAddressGenerator.class);
|
||||
private Log log = LogFactory.getLog(SubjectHasMailingAddressGenerator.class);
|
||||
|
||||
@Override
|
||||
public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq,
|
||||
|
@ -40,9 +40,9 @@ public class PersonHasMailingAddressGenerator extends VivoBaseGenerator implemen
|
|||
initObjectPropForm(conf, vreq);
|
||||
String addressUri = vreq.getParameter("addressUri");
|
||||
|
||||
conf.setTemplate("personHasMailingAddress.ftl");
|
||||
conf.setTemplate("subjectHasMailingAddress.ftl");
|
||||
|
||||
conf.setVarNameForSubject("person");
|
||||
conf.setVarNameForSubject("subject");
|
||||
conf.setVarNameForPredicate("predicate");
|
||||
conf.setVarNameForObject("individualVcard");
|
||||
|
||||
|
@ -107,9 +107,9 @@ public class PersonHasMailingAddressGenerator extends VivoBaseGenerator implemen
|
|||
/* N3 assertions */
|
||||
|
||||
final static String n3ForNewAddress =
|
||||
"?person <http://purl.obolibrary.org/obo/ARG_2000028> ?individualVcard . \n" +
|
||||
"?subject <http://purl.obolibrary.org/obo/ARG_2000028> ?individualVcard . \n" +
|
||||
"?individualVcard a <http://www.w3.org/2006/vcard/ns#Individual> . \n" +
|
||||
"?individualVcard <http://purl.obolibrary.org/obo/ARG_2000029> ?person . \n" +
|
||||
"?individualVcard <http://purl.obolibrary.org/obo/ARG_2000029> ?subject . \n" +
|
||||
"?individualVcard <http://www.w3.org/2006/vcard/ns#hasAddress> ?address . \n" +
|
||||
"?address a <http://www.w3.org/2006/vcard/ns#Address> . " ;
|
||||
|
||||
|
@ -133,7 +133,7 @@ public class PersonHasMailingAddressGenerator extends VivoBaseGenerator implemen
|
|||
|
||||
final static String individualVcardQuery =
|
||||
"SELECT ?individualVcard WHERE { \n" +
|
||||
"?person <http://purl.obolibrary.org/obo/ARG_2000028> ?individualVcard . \n" +
|
||||
"?subject <http://purl.obolibrary.org/obo/ARG_2000028> ?individualVcard . \n" +
|
||||
"}";
|
||||
|
||||
final static String streetAddressQuery =
|
|
@ -0,0 +1,137 @@
|
|||
/* $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 org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Literal;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
||||
|
||||
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 SubjectHasPhoneFaxNumberGenerator extends VivoBaseGenerator implements
|
||||
EditConfigurationGenerator {
|
||||
private Log log = LogFactory.getLog(SubjectHasPhoneFaxNumberGenerator.class);
|
||||
|
||||
@Override
|
||||
public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq,
|
||||
HttpSession session) throws Exception {
|
||||
|
||||
EditConfigurationVTwo conf = new EditConfigurationVTwo();
|
||||
Model model = ModelFactory.createDefaultModel();
|
||||
|
||||
initBasics(conf, vreq);
|
||||
initPropertyParameters(vreq, session, conf);
|
||||
initObjectPropForm(conf, vreq);
|
||||
String phoneUri = getPhoneUri(vreq);
|
||||
String rangeUri = getRangeUri(vreq);
|
||||
Literal numberType = null;
|
||||
|
||||
conf.setTemplate("subjectHasPhoneFaxNumber.ftl");
|
||||
|
||||
conf.setVarNameForSubject("subject");
|
||||
conf.setVarNameForPredicate("predicate");
|
||||
conf.setVarNameForObject("individualVcard");
|
||||
|
||||
if ( rangeUri.equals("http://www.w3.org/2006/vcard/ns#Fax") ) {
|
||||
conf.setN3Required( Arrays.asList( n3ForNewFaxNumber ) );
|
||||
numberType = model.createLiteral("fax");
|
||||
}
|
||||
else {
|
||||
conf.setN3Required( Arrays.asList( n3ForNewPhoneNumber ) );
|
||||
numberType = model.createLiteral("phone");
|
||||
}
|
||||
|
||||
conf.setN3Optional( Arrays.asList( telephoneNumberAssertion ) );
|
||||
|
||||
conf.addNewResource("phone", DEFAULT_NS_FOR_NEW_RESOURCE);
|
||||
conf.addNewResource("individualVcard", DEFAULT_NS_FOR_NEW_RESOURCE);
|
||||
|
||||
conf.setLiteralsOnForm(Arrays.asList("telephoneNumber" ));
|
||||
|
||||
conf.addSparqlForExistingLiteral("telephoneNumber", telephoneNumberQuery);
|
||||
conf.addSparqlForAdditionalUrisInScope("individualVcard", individualVcardQuery);
|
||||
|
||||
conf.addLiteralInScope("numberType", numberType);
|
||||
|
||||
if ( conf.isUpdate() ) {
|
||||
HashMap<String, List<String>> urisInScope = new HashMap<String, List<String>>();
|
||||
urisInScope.put("phone", Arrays.asList(new String[]{phoneUri}));
|
||||
conf.addUrisInScope(urisInScope);
|
||||
}
|
||||
|
||||
conf.addField( new FieldVTwo().
|
||||
setName("telephoneNumber")
|
||||
.setRangeDatatypeUri( XSD.xstring.toString() ).
|
||||
setValidators( list("nonempty") ));
|
||||
|
||||
conf.addValidator(new AntiXssValidation());
|
||||
|
||||
prepare(vreq, conf);
|
||||
return conf;
|
||||
}
|
||||
|
||||
/* N3 assertions */
|
||||
|
||||
final static String n3ForNewPhoneNumber =
|
||||
"?subject <http://purl.obolibrary.org/obo/ARG_2000028> ?individualVcard . \n" +
|
||||
"?individualVcard a <http://www.w3.org/2006/vcard/ns#Individual> . \n" +
|
||||
"?individualVcard <http://purl.obolibrary.org/obo/ARG_2000029> ?subject . \n" +
|
||||
"?individualVcard <http://www.w3.org/2006/vcard/ns#hasTelephone> ?phone . \n" +
|
||||
"?phone a <http://www.w3.org/2006/vcard/ns#Telephone> . " ;
|
||||
|
||||
final static String n3ForNewFaxNumber =
|
||||
"?subject <http://purl.obolibrary.org/obo/ARG_2000028> ?individualVcard . \n" +
|
||||
"?individualVcard a <http://www.w3.org/2006/vcard/ns#Individual> . \n" +
|
||||
"?individualVcard <http://purl.obolibrary.org/obo/ARG_2000029> ?subject . \n" +
|
||||
"?individualVcard <http://www.w3.org/2006/vcard/ns#hasTelephone> ?phone . \n" +
|
||||
"?phone a <http://www.w3.org/2006/vcard/ns#Telephone> . \n " +
|
||||
"?phone a <http://www.w3.org/2006/vcard/ns#Fax> . " ;
|
||||
|
||||
final static String telephoneNumberAssertion =
|
||||
"?phone <http://www.w3.org/2006/vcard/ns#telephone> ?telephoneNumber .";
|
||||
|
||||
/* Queries for editing an existing entry */
|
||||
|
||||
final static String individualVcardQuery =
|
||||
"SELECT ?existingIndividualVcard WHERE { \n" +
|
||||
"?subject <http://purl.obolibrary.org/obo/ARG_2000028> ?existingIndividualVcard . \n" +
|
||||
"}";
|
||||
|
||||
final static String telephoneNumberQuery =
|
||||
"SELECT ?existingTelephoneNumber WHERE {\n"+
|
||||
"?phone <http://www.w3.org/2006/vcard/ns#telephone> ?existingTelephoneNumber . }";
|
||||
|
||||
private String getPhoneUri(VitroRequest vreq) {
|
||||
String phoneUri = vreq.getParameter("phoneUri");
|
||||
|
||||
return phoneUri;
|
||||
}
|
||||
private String getRangeUri(VitroRequest vreq) {
|
||||
String rangeUri = vreq.getParameter("rangeUri");
|
||||
|
||||
return rangeUri;
|
||||
}
|
||||
|
||||
}
|
|
@ -867,3 +867,6 @@ please_select_type = Please select a type from the drop-down list.
|
|||
preferred_title = Preferred Title
|
||||
preferred_title_for = preferred title for
|
||||
enter_preferred_title = Please enter a value in the Preferred Title field.
|
||||
fax_number_for = fax number for
|
||||
fax_number = Fax Number
|
||||
enter_fax_number = Please enter a value in the Fax Number field.
|
||||
|
|
Loading…
Add table
Reference in a new issue