diff --git a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddAuthorsToInformationResourceGenerator.java b/api/src/main/java/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddAuthorsToInformationResourceGenerator.java
index 1fc93f697a..49db16e8d1 100644
--- a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddAuthorsToInformationResourceGenerator.java
+++ b/api/src/main/java/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddAuthorsToInformationResourceGenerator.java
@@ -41,7 +41,14 @@
* It is intended to always be an add, and never an update.
*/
public class AddAuthorsToInformationResourceGenerator extends VivoBaseGenerator implements EditConfigurationGenerator {
- public static Log log = LogFactory.getLog(AddAuthorsToInformationResourceGenerator.class);
+
+ private static Log log = LogFactory.getLog(AddAuthorsToInformationResourceGenerator.class);
+
+ private static final String prefixes =
+ "@prefix core: <" + vivoCore + "> .\n" +
+ "@prefix foaf: <" + foaf + "> . \n";
+ private static final String vcardFailPattern = "@prefix fail_pattern: ?createVCard .\n";
+ private static final String personInstanceFailPattern = "@prefix fail_pattern: ?createPersonInstance .\n";
@Override
public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq,
@@ -59,7 +66,7 @@ public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq,
editConfiguration.setVarNameForObject("authorshipUri");
// Required N3
- editConfiguration.setN3Required( list( getN3NewAuthorship() ) );
+ editConfiguration.setN3Required( list( newAuthorship ) );
// Optional N3
editConfiguration.setN3Optional( generateN3Optional());
@@ -98,47 +105,39 @@ public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq,
return editConfiguration;
}
- private void setUrlToReturnTo(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
- editConfiguration.setUrlPatternToReturnTo(EditConfigurationUtils.getFormUrlWithoutContext(vreq));
- }
-
- /***N3 strings both required and optional***/
-
- public String getN3PrefixString() {
- return "@prefix core: <" + vivoCore + "> .\n" +
- "@prefix foaf: <" + foaf + "> . \n" ;
- }
+ private void setUrlToReturnTo(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
+ editConfiguration.setUrlPatternToReturnTo(EditConfigurationUtils.getFormUrlWithoutContext(vreq));
+ }
- private String getN3NewAuthorship() {
- return getN3PrefixString() +
- "?authorshipUri a core:Authorship ;\n" +
+ private static final String newAuthorship = prefixes +
+ "?authorshipUri a core:Authorship ;\n" +
" core:relates ?infoResource .\n" +
"?infoResource core:relatedBy ?authorshipUri .";
- }
- private String getN3AuthorshipRank() {
- return getN3PrefixString() +
+ private static final String authorshipRank = prefixes +
"?authorshipUri core:rank ?rank .";
- }
-
- //first name, middle name, last name, and new perseon for new author being created, and n3 for existing person
- //if existing person selected as author
- public List generateN3Optional() {
- return list(
- getN3NewPersonFirstName() ,
- getN3NewPersonMiddleName(),
- getN3NewPersonLastName(),
- getN3NewPerson(),
- getN3AuthorshipRank(),
- getN3ForExistingPerson(),
- getN3NewOrg(),
- getN3ForExistingOrg());
-
- }
-
-
- private String getN3NewPersonFirstName() {
- return getN3PrefixString() +
+
+ //first name, middle name, last name, and new perseon for new author being created, and n3 for existing person
+ //if existing person selected as author
+ private List generateN3Optional() {
+ return list(
+ newPersonFirstName ,
+ newPersonMiddleName,
+ newPersonLastName,
+ newPerson,
+
+ newPersonVCardFirstName ,
+ newPersonVCardMiddleName,
+ newPersonVCardLastName,
+ newPersonVCard,
+
+ authorshipRank,
+ existingPerson,
+ newOrg,
+ existingOrg);
+ }
+
+ private static final String newPersonFirstName = prefixes + personInstanceFailPattern +
"@prefix vcard: . \n" +
"?newPerson ?vcardPerson . \n" +
"?vcardPerson ?newPerson . \n" +
@@ -146,10 +145,8 @@ private String getN3NewPersonFirstName() {
"?vcardPerson vcard:hasName ?vcardName . \n" +
"?vcardName a . \n" +
"?vcardName vcard:givenName ?firstName .";
- }
- private String getN3NewPersonMiddleName() {
- return getN3PrefixString() +
+ private static final String newPersonMiddleName = prefixes + personInstanceFailPattern +
"@prefix vcard: . \n" +
"?newPerson ?vcardPerson . \n" +
"?vcardPerson ?newPerson . \n" +
@@ -157,10 +154,8 @@ private String getN3NewPersonMiddleName() {
"?vcardPerson vcard:hasName ?vcardName . \n" +
"?vcardName a vcard:Name . \n" +
"?vcardName ?middleName .";
- }
- private String getN3NewPersonLastName() {
- return getN3PrefixString() +
+ private static final String newPersonLastName = prefixes + personInstanceFailPattern +
"@prefix vcard: . \n" +
"?newPerson ?vcardPerson . \n" +
"?vcardPerson ?newPerson . \n" +
@@ -168,247 +163,260 @@ private String getN3NewPersonLastName() {
"?vcardPerson vcard:hasName ?vcardName . \n" +
"?vcardName a . \n" +
"?vcardName vcard:familyName ?lastName .";
- }
- private String getN3NewPerson() {
- return getN3PrefixString() +
+ private static final String newPerson = prefixes + personInstanceFailPattern +
"?newPerson a foaf:Person ;\n" +
"<" + RDFS.label.getURI() + "> ?label .\n" +
"?authorshipUri core:relates ?newPerson .\n" +
"?newPerson core:relatedBy ?authorshipUri . ";
- }
- private String getN3ForExistingPerson() {
- return getN3PrefixString() +
- "?authorshipUri core:relates ?personUri .\n" +
- "?personUri core:relatedBy ?authorshipUri .";
- }
+ // Changes here for creating vcards for external authors
+ private static final String newPersonVCardFirstName = prefixes + vcardFailPattern +
+ "@prefix vcard: . \n" +
+ "?vcardPerson a . \n" +
+ "?vcardPerson vcard:hasName ?vcardName . \n" +
+ "?vcardName a . \n" +
+ "?vcardName vcard:givenName ?firstName .";
+
+ private static final String newPersonVCardMiddleName = prefixes + vcardFailPattern +
+ "@prefix vcard: . \n" +
+ "?vcardPerson a vcard:Individual . \n" +
+ "?vcardPerson vcard:hasName ?vcardName . \n" +
+ "?vcardName a vcard:Name . \n" +
+ "?vcardName ?middleName .";
+
+ private static final String newPersonVCardLastName = prefixes + vcardFailPattern +
+ "@prefix vcard: . \n" +
+ "?vcardPerson a . \n" +
+ "?vcardPerson vcard:hasName ?vcardName . \n" +
+ "?vcardName a . \n" +
+ "?vcardName vcard:familyName ?lastName .";
+
+ // Changes here for creating vcards for external authors
+ private static final String newPersonVCard = prefixes + vcardFailPattern +
+ "@prefix vcard: . \n" +
+ "?vcardPerson a vcard:Individual ;\n" +
+ "<" + RDFS.label.getURI() + "> ?label .\n" +
+ "?authorshipUri core:relates ?vcardPerson .\n" +
+ "?vcardPerson core:relatedBy ?authorshipUri . ";
- private String getN3NewOrg() {
- return getN3PrefixString() +
+ private static final String existingPerson = prefixes +
+ "?authorshipUri core:relates ?personUri .\n" +
+ "?personUri core:relatedBy ?authorshipUri .";
+
+ private static final String newOrg = prefixes +
"?newOrg a foaf:Organization ;\n" +
"<" + RDFS.label.getURI() + "> ?orgName .\n" +
"?authorshipUri core:relates ?newOrg .\n" +
"?newOrg core:relatedBy ?authorshipUri . ";
- }
-
- private String getN3ForExistingOrg() {
- return getN3PrefixString() +
- "?authorshipUri core:relates ?orgUri .\n" +
- "?orgUri core:relatedBy ?authorshipUri .";
- }
- /** Get new resources */
- //A new authorship uri will always be created when an author is added
- //A new person may be added if a person not in the system will be added as author
- private Map generateNewResources(VitroRequest vreq) {
-
-
- HashMap newResources = new HashMap();
- newResources.put("authorshipUri", DEFAULT_NS_TOKEN);
- newResources.put("newPerson", DEFAULT_NS_TOKEN);
- newResources.put("vcardPerson", DEFAULT_NS_TOKEN);
- newResources.put("vcardName", DEFAULT_NS_TOKEN);
- newResources.put("newOrg", DEFAULT_NS_TOKEN);
- return newResources;
- }
-
- /** Set URIS and Literals In Scope and on form and supporting methods */
+
+ private static final String existingOrg = prefixes +
+ "?authorshipUri core:relates ?orgUri .\n" +
+ "?orgUri core:relatedBy ?authorshipUri .";
+
+ /** Set URIS and Literals In Scope and on form and supporting methods */
private void setUrisAndLiteralsInScope(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
- //Uris in scope always contain subject and predicate
- HashMap> urisInScope = new HashMap>();
- urisInScope.put(editConfiguration.getVarNameForSubject(),
- Arrays.asList(new String[]{editConfiguration.getSubjectUri()}));
- urisInScope.put(editConfiguration.getVarNameForPredicate(),
- Arrays.asList(new String[]{editConfiguration.getPredicateUri()}));
- editConfiguration.setUrisInScope(urisInScope);
- //no literals in scope
+ //Uris in scope always contain subject and predicate
+ HashMap> urisInScope = new HashMap>();
+ urisInScope.put(editConfiguration.getVarNameForSubject(),
+ Arrays.asList(new String[]{editConfiguration.getSubjectUri()}));
+ urisInScope.put(editConfiguration.getVarNameForPredicate(),
+ Arrays.asList(new String[]{editConfiguration.getPredicateUri()}));
+ editConfiguration.setUrisInScope(urisInScope);
+ //no literals in scope
}
- public void setUrisAndLiteralsOnForm(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
- List urisOnForm = new ArrayList();
- //If an existing person is being used as an author, need to get the person uri
- urisOnForm.add("personUri");
- urisOnForm.add("orgUri");
- editConfiguration.setUrisOnform(urisOnForm);
-
- //for person who is not in system, need to add first name, last name and middle name
- //Also need to store authorship rank and label of author
- List literalsOnForm = list("firstName",
- "middleName",
- "lastName",
- "rank",
- "orgName",
- "label");
- editConfiguration.setLiteralsOnForm(literalsOnForm);
+ private void setUrisAndLiteralsOnForm(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
+ List urisOnForm = new ArrayList();
+ //If an existing person is being used as an author, need to get the person uri
+ urisOnForm.add("personUri");
+ urisOnForm.add("orgUri");
+
+ urisOnForm.add("createPersonInstance");
+ urisOnForm.add("createVCard");
+ editConfiguration.setUrisOnform(urisOnForm);
+
+ //for person who is not in system, need to add first name, last name and middle name
+ //Also need to store authorship rank and label of author
+ List literalsOnForm = list("firstName",
+ "middleName",
+ "lastName",
+ "rank",
+ "orgName",
+ "label");
+ editConfiguration.setLiteralsOnForm(literalsOnForm);
}
/** Set SPARQL Queries and supporting methods. */
private void setSparqlQueries(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
//Sparql queries are all empty for existing values
- //This form is different from the others that it gets multiple authors on the same page
- //and that information will be queried and stored in the additional form specific data
- HashMap map = new HashMap();
- editConfiguration.setSparqlForExistingUris(new HashMap());
- editConfiguration.setSparqlForExistingLiterals(new HashMap());
- editConfiguration.setSparqlForAdditionalUrisInScope(new HashMap());
- editConfiguration.setSparqlForAdditionalLiteralsInScope(new HashMap());
+ //This form is different from the others that it gets multiple authors on the same page
+ //and that information will be queried and stored in the additional form specific data
+ editConfiguration.setSparqlForExistingUris(new HashMap());
+ editConfiguration.setSparqlForExistingLiterals(new HashMap());
+ editConfiguration.setSparqlForAdditionalUrisInScope(new HashMap());
+ editConfiguration.setSparqlForAdditionalLiteralsInScope(new HashMap());
}
/**
- *
- * Set Fields and supporting methods
- */
-
- public void setFields(EditConfigurationVTwo editConfiguration, VitroRequest vreq, String predicateUri) {
- setLabelField(editConfiguration);
- setFirstNameField(editConfiguration);
- setMiddleNameField(editConfiguration);
- setLastNameField(editConfiguration);
- setRankField(editConfiguration);
- setPersonUriField(editConfiguration);
- setOrgUriField(editConfiguration);
- setOrgNameField(editConfiguration);
+ *
+ * Set Fields and supporting methods
+ */
+
+ private void setFields(EditConfigurationVTwo editConfiguration, VitroRequest vreq, String predicateUri) {
+ setLabelField(editConfiguration);
+ setFirstNameField(editConfiguration);
+ setMiddleNameField(editConfiguration);
+ setLastNameField(editConfiguration);
+ setRankField(editConfiguration);
+ setPersonUriField(editConfiguration);
+ setOrgUriField(editConfiguration);
+ setOrgNameField(editConfiguration);
+ setPatternFailFields(editConfiguration);
+ }
+
+ private void setLabelField(EditConfigurationVTwo editConfiguration) {
+ editConfiguration.addField(new FieldVTwo().
+ setName("label").
+ setValidators(list("datatype:" + RDF.dtLangString.getURI())).
+ setRangeDatatypeUri(RDF.dtLangString.getURI())
+ );
}
- private void setLabelField(EditConfigurationVTwo editConfiguration) {
- editConfiguration.addField(new FieldVTwo().
- setName("label").
- setValidators(list("datatype:" + RDF.dtLangString.getURI())).
- setRangeDatatypeUri(RDF.dtLangString.getURI())
- );
- }
-
-
- private void setFirstNameField(EditConfigurationVTwo editConfiguration) {
- editConfiguration.addField(new FieldVTwo().
- setName("firstName").
- setValidators(list("datatype:" + RDF.dtLangString.getURI())).
- setRangeDatatypeUri(RDF.dtLangString.getURI())
- );
- }
-
-
- private void setMiddleNameField(EditConfigurationVTwo editConfiguration) {
- editConfiguration.addField(new FieldVTwo().
- setName("middleName").
- setValidators(list("datatype:" + RDF.dtLangString.getURI())).
- setRangeDatatypeUri(RDF.dtLangString.getURI())
- );
- }
-
- private void setLastNameField(EditConfigurationVTwo editConfiguration) {
- editConfiguration.addField(new FieldVTwo().
- setName("lastName").
- setValidators(list("datatype:" + RDF.dtLangString.getURI())).
- setRangeDatatypeUri(RDF.dtLangString.getURI())
- );
- }
-
- private void setRankField(EditConfigurationVTwo editConfiguration) {
- editConfiguration.addField(new FieldVTwo().
- setName("rank").
- setValidators(list("nonempty")).
- setRangeDatatypeUri(XSD.xint.toString())
- );
- }
-
-
- private void setPersonUriField(EditConfigurationVTwo editConfiguration) {
- editConfiguration.addField(new FieldVTwo().
- setName("personUri")
- //.setObjectClassUri(personClass)
- );
- }
-
- private void setOrgUriField(EditConfigurationVTwo editConfiguration) {
- editConfiguration.addField(new FieldVTwo().
- setName("orgUri")
- //.setObjectClassUri(personClass)
- );
- }
-
- private void setOrgNameField(EditConfigurationVTwo editConfiguration) {
- editConfiguration.addField(new FieldVTwo().
- setName("orgName").
- setValidators(list("datatype:" + RDF.dtLangString.getURI())).
- setRangeDatatypeUri(RDF.dtLangString.getURI())
- );
- }
-
- //Form specific data
- public void addFormSpecificData(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
- HashMap formSpecificData = new HashMap();
- //Get the existing authorships
- formSpecificData.put("existingAuthorInfo", getExistingAuthorships(editConfiguration.getSubjectUri(), vreq));
- formSpecificData.put("newRank", getMaxRank(editConfiguration.getSubjectUri(), vreq) + 1);
- formSpecificData.put("rankPredicate", "http://vivoweb.org/ontology/core#rank");
- editConfiguration.setFormSpecificData(formSpecificData);
- }
-
- private static String AUTHORSHIPS_MODEL = " \n"
- + "PREFIX core: \n"
- + "PREFIX rdfs: \n"
- + "PREFIX foaf: \n"
- + "PREFIX vcard: \n"
- + "CONSTRUCT\n"
- + "{\n"
- + " ?subject core:relatedBy ?authorshipURI .\n"
- + " ?authorshipURI a core:Authorship .\n"
- + " ?authorshipURI core:relates ?authorURI .\n"
- + " ?authorshipURI core:rank ?rank .\n"
- + " ?authorURI a ?type .\n"
- + " ?authorURI rdfs:label ?authorName .\n"
- + " ?authorURI vcard:hasName ?vName .\n"
- + " ?vName vcard:givenName ?firstName .\n"
- + " ?vName vcard:familyName ?lastName .\n"
- + " ?vName core:middleName ?middleName .\n"
- + "}\n"
- + "WHERE\n"
- + "{\n"
- + " {\n"
- + " ?subject core:relatedBy ?authorshipURI .\n"
- + " ?authorshipURI a core:Authorship .\n"
- + " ?authorshipURI core:relates ?authorURI .\n"
- + " ?authorURI a foaf:Agent .\n"
- + " ?authorURI a ?type .\n"
- + " }\n"
- + " UNION\n"
- + " {\n"
- + " ?subject core:relatedBy ?authorshipURI .\n"
- + " ?authorshipURI a core:Authorship .\n"
- + " ?authorshipURI core:relates ?authorURI .\n"
- + " ?authorURI a foaf:Agent .\n"
- + " ?authorURI rdfs:label ?authorName\n"
- + " }\n"
- + " UNION\n"
- + " {\n"
- + " ?subject core:relatedBy ?authorshipURI .\n"
- + " ?authorshipURI a core:Authorship .\n"
- + " ?authorshipURI core:rank ?rank\n"
- + " }\n"
- + " UNION\n"
- + " {\n"
- + " ?subject core:relatedBy ?authorshipURI .\n"
- + " ?authorshipURI a core:Authorship .\n"
- + " ?authorshipURI core:relates ?authorURI .\n"
- + " ?authorURI a vcard:Individual .\n"
- + " ?authorURI a ?type .\n"
- + " ?authorURI vcard:hasName ?vName .\n"
- + " ?vName vcard:givenName ?firstName .\n"
- + " ?vName vcard:familyName ?lastName .\n"
- + " }\n"
- + " UNION\n"
- + " {\n"
- + " ?subject core:relatedBy ?authorshipURI .\n"
- + " ?authorshipURI a core:Authorship .\n"
- + " ?authorshipURI core:relates ?authorURI .\n"
- + " ?authorURI a vcard:Individual .\n"
- + " ?authorURI a ?type .\n"
- + " ?authorURI vcard:hasName ?vName .\n"
- + " ?vName core:middleName ?middleName .\n"
- + " }\n"
- + "}\n"
- ;
+
+ private void setFirstNameField(EditConfigurationVTwo editConfiguration) {
+ editConfiguration.addField(new FieldVTwo().
+ setName("firstName").
+ setValidators(list("datatype:" + RDF.dtLangString.getURI())).
+ setRangeDatatypeUri(RDF.dtLangString.getURI())
+ );
+ }
+
+ private void setPatternFailFields(EditConfigurationVTwo editConfiguration) {
+ editConfiguration.addField(new FieldVTwo().setName("createVCard"));
+ editConfiguration.addField(new FieldVTwo().setName("createPersonInstance"));
+ }
+
+ private void setMiddleNameField(EditConfigurationVTwo editConfiguration) {
+ editConfiguration.addField(new FieldVTwo().
+ setName("middleName").
+ setValidators(list("datatype:" + RDF.dtLangString.getURI())).
+ setRangeDatatypeUri(RDF.dtLangString.getURI())
+ );
+ }
+
+ private void setLastNameField(EditConfigurationVTwo editConfiguration) {
+ editConfiguration.addField(new FieldVTwo().
+ setName("lastName").
+ setValidators(list("datatype:" + RDF.dtLangString.getURI())).
+ setRangeDatatypeUri(RDF.dtLangString.getURI())
+ );
+ }
+
+ private void setRankField(EditConfigurationVTwo editConfiguration) {
+ editConfiguration.addField(new FieldVTwo().
+ setName("rank").
+ setValidators(list("nonempty")).
+ setRangeDatatypeUri(XSD.xint.toString())
+ );
+ }
+
+
+ private void setPersonUriField(EditConfigurationVTwo editConfiguration) {
+ editConfiguration.addField(new FieldVTwo().
+ setName("personUri")
+ //.setObjectClassUri(personClass)
+ );
+ }
+
+ private void setOrgUriField(EditConfigurationVTwo editConfiguration) {
+ editConfiguration.addField(new FieldVTwo().
+ setName("orgUri")
+ //.setObjectClassUri(personClass)
+ );
+ }
+
+ private void setOrgNameField(EditConfigurationVTwo editConfiguration) {
+ editConfiguration.addField(new FieldVTwo().
+ setName("orgName").
+ setValidators(list("datatype:" + RDF.dtLangString.getURI())).
+ setRangeDatatypeUri(RDF.dtLangString.getURI())
+ );
+ }
+
+ //Form specific data
+ public void addFormSpecificData(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
+ HashMap formSpecificData = new HashMap();
+ //Get the existing authorships
+ formSpecificData.put("existingAuthorInfo", getExistingAuthorships(editConfiguration.getSubjectUri(), vreq));
+ formSpecificData.put("newRank", getMaxRank(editConfiguration.getSubjectUri(), vreq) + 1);
+ formSpecificData.put("rankPredicate", "http://vivoweb.org/ontology/core#rank");
+ editConfiguration.setFormSpecificData(formSpecificData);
+ }
+
+ private static String AUTHORSHIPS_MODEL = " \n"
+ + "PREFIX core: \n"
+ + "PREFIX rdfs: \n"
+ + "PREFIX foaf: \n"
+ + "PREFIX vcard: \n"
+ + "CONSTRUCT\n"
+ + "{\n"
+ + " ?subject core:relatedBy ?authorshipURI .\n"
+ + " ?authorshipURI a core:Authorship .\n"
+ + " ?authorshipURI core:relates ?authorURI .\n"
+ + " ?authorshipURI core:rank ?rank .\n"
+ + " ?authorURI a ?type .\n"
+ + " ?authorURI rdfs:label ?authorName .\n"
+ + " ?authorURI vcard:hasName ?vName .\n"
+ + " ?vName vcard:givenName ?firstName .\n"
+ + " ?vName vcard:familyName ?lastName .\n"
+ + " ?vName core:middleName ?middleName .\n"
+ + "}\n"
+ + "WHERE\n"
+ + "{\n"
+ + " {\n"
+ + " ?subject core:relatedBy ?authorshipURI .\n"
+ + " ?authorshipURI a core:Authorship .\n"
+ + " ?authorshipURI core:relates ?authorURI .\n"
+ + " ?authorURI a foaf:Agent .\n"
+ + " ?authorURI a ?type .\n"
+ + " }\n"
+ + " UNION\n"
+ + " {\n"
+ + " ?subject core:relatedBy ?authorshipURI .\n"
+ + " ?authorshipURI a core:Authorship .\n"
+ + " ?authorshipURI core:relates ?authorURI .\n"
+ + " ?authorURI a foaf:Agent .\n"
+ + " ?authorURI rdfs:label ?authorName\n"
+ + " }\n"
+ + " UNION\n"
+ + " {\n"
+ + " ?subject core:relatedBy ?authorshipURI .\n"
+ + " ?authorshipURI a core:Authorship .\n"
+ + " ?authorshipURI core:rank ?rank\n"
+ + " }\n"
+ + " UNION\n"
+ + " {\n"
+ + " ?subject core:relatedBy ?authorshipURI .\n"
+ + " ?authorshipURI a core:Authorship .\n"
+ + " ?authorshipURI core:relates ?authorURI .\n"
+ + " ?authorURI a vcard:Individual .\n"
+ + " ?authorURI a ?type .\n"
+ + " ?authorURI vcard:hasName ?vName .\n"
+ + " ?vName vcard:givenName ?firstName .\n"
+ + " ?vName vcard:familyName ?lastName .\n"
+ + " }\n"
+ + " UNION\n"
+ + " {\n"
+ + " ?subject core:relatedBy ?authorshipURI .\n"
+ + " ?authorshipURI a core:Authorship .\n"
+ + " ?authorshipURI core:relates ?authorURI .\n"
+ + " ?authorURI a vcard:Individual .\n"
+ + " ?authorURI a ?type .\n"
+ + " ?authorURI vcard:hasName ?vName .\n"
+ + " ?vName core:middleName ?middleName .\n"
+ + " }\n"
+ + "}\n";
private static String AUTHORSHIPS_QUERY = " \n"
+ "PREFIX core: \n"
@@ -423,49 +431,49 @@ public void addFormSpecificData(EditConfigurationVTwo editConfiguration, VitroRe
+ " ?authorURI a foaf:Agent . \n"
+ " OPTIONAL { ?authorURI rdfs:label ?authorName } \n"
+ " OPTIONAL { ?authorshipURI core:rank ?rank } \n"
- + "} UNION { \n"
- + " ?subject core:relatedBy ?authorshipURI . \n"
- + " ?authorshipURI a core:Authorship . \n"
- + " ?authorshipURI core:relates ?authorURI . \n"
- + " ?authorURI a vcard:Individual . \n"
- + " ?authorURI vcard:hasName ?vName . \n"
- + " ?vName vcard:givenName ?firstName . \n"
- + " ?vName vcard:familyName ?lastName . \n"
- + " OPTIONAL { ?vName core:middleName ?middleName . } \n"
- + " OPTIONAL { ?authorshipURI core:rank ?rank } \n"
- + " bind ( COALESCE(?firstName, \"\") As ?firstName1) . \n"
- + " bind ( COALESCE(?middleName, \"\") As ?middleName1) . \n"
- + " bind ( COALESCE(?lastName, \"\") As ?lastName1) . \n"
- + " bind (concat(str(?lastName1 + \", \"),str(?middleName1 + \" \"),str(?firstName1)) as ?authorName) . \n"
+ + "} UNION { \n"
+ + " ?subject core:relatedBy ?authorshipURI . \n"
+ + " ?authorshipURI a core:Authorship . \n"
+ + " ?authorshipURI core:relates ?authorURI . \n"
+ + " ?authorURI a vcard:Individual . \n"
+ + " ?authorURI vcard:hasName ?vName . \n"
+ + " ?vName vcard:givenName ?firstName . \n"
+ + " ?vName vcard:familyName ?lastName . \n"
+ + " OPTIONAL { ?vName core:middleName ?middleName . } \n"
+ + " OPTIONAL { ?authorshipURI core:rank ?rank } \n"
+ + " bind ( COALESCE(?firstName, \"\") As ?firstName1) . \n"
+ + " bind ( COALESCE(?middleName, \"\") As ?middleName1) . \n"
+ + " bind ( COALESCE(?lastName, \"\") As ?lastName1) . \n"
+ + " bind (concat(str(str(?lastName1) + \", \"),str(str(?middleName1) + \" \"),str(?firstName1)) as ?authorName) . \n"
+ "} } ORDER BY ?rank";
private List getExistingAuthorships(String subjectUri, VitroRequest vreq) {
- RDFService rdfService = vreq.getRDFService();
-
- List
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
+
${i18n().add_to_person_profile} ${requiredHint}
+
+
+
+
+
+
+
@@ -194,6 +203,12 @@ var i18nStrings = {
helpTextSelect: '${i18n().select_an_existing?js_string}',
helpTextAdd: '${i18n().or_add_new_one?js_string}'
};
+
+$(document).ready(function () {
+ $('input[type=radio].radiotypes').change(function() {
+ $('input[type=radio].radiotypes:checked').not(this).prop('checked', false);
+ });
+});
${stylesheets.add('',
diff --git a/webapp/src/main/webapp/templates/freemarker/edit/forms/addEditorsToInformationResource.ftl b/webapp/src/main/webapp/templates/freemarker/edit/forms/addEditorsToInformationResource.ftl
index 6f5131aee5..2f1e6bfbd8 100644
--- a/webapp/src/main/webapp/templates/freemarker/edit/forms/addEditorsToInformationResource.ftl
+++ b/webapp/src/main/webapp/templates/freemarker/edit/forms/addEditorsToInformationResource.ftl
@@ -18,6 +18,7 @@
<#assign lastNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "lastName") />
<#assign firstNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "firstName") />
<#assign middleNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "middleName") />
+<#assign orgNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "orgName") />
<#--UL class based on size of existing editors-->
<#assign ulClass = ""/>
@@ -101,24 +102,39 @@