VIVO-461 new custom form, list view, etc for organization for training

This commit is contained in:
tworrall 2013-11-04 11:25:36 -05:00
parent 9d4945487f
commit 3d66980416
3 changed files with 46 additions and 34 deletions

View file

@ -19,7 +19,7 @@
<a href="${profileUrl(statement.uri("person"))}" title="${i18n().person_name}">${statement.personName}</a> <a href="${profileUrl(statement.uri("person"))}" title="${i18n().person_name}">${statement.personName}</a>
<#else> <#else>
<#-- This shouldn't happen, but we must provide for it --> <#-- This shouldn't happen, but we must provide for it -->
<a href="${profileUrl(statement.uri("training"))}" title="${i18n().missing_person_in_posn}">${i18n().missing_person_in_posn}</a> <a href="${profileUrl(statement.uri("edTraining"))}" title="${i18n().missing_person_in_posn}">${i18n().missing_person_in_posn}</a>
</#if> </#if>
</#local> </#local>
<#local detailedInfo> <#local detailedInfo>

View file

@ -42,7 +42,8 @@ public class OrganizationForTrainingGenerator extends VivoBaseGenerator impleme
conf.setN3Required( Arrays.asList( n3ForNewEdTraining, trainingTypeAssertion ) ); conf.setN3Required( Arrays.asList( n3ForNewEdTraining, trainingTypeAssertion ) );
conf.setN3Optional(Arrays.asList( majorFieldAssertion, n3ForAwardedDegree, n3ForNewPerson, n3ForExistingPerson, conf.setN3Optional(Arrays.asList( majorFieldAssertion, n3ForAwardedDegree, n3ForNewPerson, n3ForExistingPerson,
n3ForNewPersonAwardedDegree, n3ForExistingPersonAwardedDegree, deptAssertion, infoAssertion, n3ForStart, n3ForEnd )); n3ForNewPersonAwardedDegree, n3ForExistingPersonAwardedDegree, deptAssertion, infoAssertion, n3ForStart,
n3ForEnd, firstNameAssertion, lastNameAssertion ));
conf.addNewResource("edTraining", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("edTraining", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("awardedDegree",DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("awardedDegree",DEFAULT_NS_FOR_NEW_RESOURCE);
@ -56,7 +57,7 @@ public class OrganizationForTrainingGenerator extends VivoBaseGenerator impleme
//uris in scope: none //uris in scope: none
//literals in scope: none //literals in scope: none
conf.setUrisOnform( Arrays.asList( "existingPerson", "personType", "degreeType", "trainingType")); conf.setUrisOnform( Arrays.asList( "existingPerson", "degreeType", "trainingType"));
conf.setLiteralsOnForm( Arrays.asList("personLabel", "personLabelDisplay", "awardedDegreeLabel", conf.setLiteralsOnForm( Arrays.asList("personLabel", "personLabelDisplay", "awardedDegreeLabel",
"majorField", "dept", "info", "firstName", "lastName")); "majorField", "dept", "info", "firstName", "lastName"));
@ -70,7 +71,6 @@ public class OrganizationForTrainingGenerator extends VivoBaseGenerator impleme
conf.addSparqlForExistingUris("awardedDegree", existingAwardedDegreeQuery); conf.addSparqlForExistingUris("awardedDegree", existingAwardedDegreeQuery);
conf.addSparqlForExistingUris("existingPerson", existingPersonQuery); conf.addSparqlForExistingUris("existingPerson", existingPersonQuery);
// conf.addSparqlForExistingUris("personType", personTypeQuery);
conf.addSparqlForExistingUris("trainingType", trainingTypeQuery); conf.addSparqlForExistingUris("trainingType", trainingTypeQuery);
conf.addSparqlForExistingUris("degreeType", degreeTypeQuery); conf.addSparqlForExistingUris("degreeType", degreeTypeQuery);
conf.addSparqlForExistingUris("intervalNode",existingIntervalNodeQuery); conf.addSparqlForExistingUris("intervalNode",existingIntervalNodeQuery);
@ -177,38 +177,38 @@ public class OrganizationForTrainingGenerator extends VivoBaseGenerator impleme
final static String n3ForNewEdTraining = final static String n3ForNewEdTraining =
"@prefix core: <"+ vivoCore +"> .\n"+ "@prefix core: <"+ vivoCore +"> .\n"+
"?organization <http://purl.obolibrary.person/obo/RO_0000056> ?edTraining .\n" + "?organization <http://purl.obolibrary.org/obo/RO_0000056> ?edTraining .\n" +
"?edTraining a core:EducationalProcess .\n" + "?edTraining a core:EducationalProcess .\n" +
"?edTraining <http://purl.obolibrary.person/obo/RO_0000057> ?organization ."; "?edTraining <http://purl.obolibrary.org/obo/RO_0000057> ?organization .";
final static String trainingTypeAssertion = final static String trainingTypeAssertion =
"?edTraining a ?trainingType ."; "?edTraining a ?trainingType .";
final static String n3ForAwardedDegree = final static String n3ForAwardedDegree =
"@prefix core: <"+ vivoCore +"> .\n"+ "@prefix core: <"+ vivoCore +"> .\n"+
"?edTraining <http://purl.obolibrary.person/obo/RO_0002234> ?awardedDegree . \n" + "?edTraining <http://purl.obolibrary.org/obo/RO_0002234> ?awardedDegree . \n" +
"?awardedDegree <http://purl.obolibrary.person/obo/RO_0002353> ?edTraining . \n" + "?awardedDegree <http://purl.obolibrary.org/obo/RO_0002353> ?edTraining . \n" +
"?awardedDegree <http://vivoweb.person/ontology/core#assignedBy> ?organization . \n" + "?awardedDegree <http://vivoweb.org/ontology/core#assignedBy> ?organization . \n" +
"?organization <http://vivoweb.person/ontology/core#assigns> ?awardedDegree . \n" + "?organization <http://vivoweb.org/ontology/core#assigns> ?awardedDegree . \n" +
"?awardedDegree <"+ label +"> ?awardedDegreeLabel . \n" + "?awardedDegree <"+ label +"> ?awardedDegreeLabel . \n" +
"?awardedDegree <http://vivoweb.person/ontology/core#relates> ?degreeType .\n"+ "?awardedDegree <http://vivoweb.org/ontology/core#relates> ?degreeType .\n"+
"?degreeType <http://vivoweb.person/ontology/core#relatedBy> ?awardedDegree . \n"+ "?degreeType <http://vivoweb.org/ontology/core#relatedBy> ?awardedDegree . \n"+
"?awardedDegree a core:AwardedDegree ."; "?awardedDegree a core:AwardedDegree .";
final static String n3ForNewPerson = final static String n3ForNewPerson =
"?edTraining <http://purl.obolibrary.person/obo/RO_0000057> ?newPerson . \n" + "?edTraining <http://purl.obolibrary.org/obo/RO_0000057> ?newPerson . \n" +
"?newPerson <http://purl.obolibrary.person/obo/RO_0000056> ?edTraining . \n" + "?newPerson <http://purl.obolibrary.org/obo/RO_0000056> ?edTraining . \n" +
"?newPerson a <http://xmlns.com/foaf/0.1/Person> . \n" + "?newPerson a <http://xmlns.com/foaf/0.1/Person> . \n" +
"?newPerson <"+ label +"> ?personLabel . "; "?newPerson <"+ label +"> ?personLabel . ";
final static String n3ForExistingPerson = final static String n3ForExistingPerson =
"?edTraining <http://purl.obolibrary.person/obo/RO_0000057> ?existingPerson . \n" + "?edTraining <http://purl.obolibrary.org/obo/RO_0000057> ?existingPerson . \n" +
"?existingPerson <http://purl.obolibrary.person/obo/RO_0000056> ?edTraining . \n" + "?existingPerson <http://purl.obolibrary.org/obo/RO_0000056> ?edTraining . \n" +
"?existingPerson a ?personType . "; " ";
final static String n3ForNewPersonAwardedDegree = final static String n3ForNewPersonAwardedDegree =
"?awardedDegree <http://vivoweb.person/ontology/core#relates> ?newPerson . \n" + "?awardedDegree <http://vivoweb.org/ontology/core#relates> ?newPerson . \n" +
"?newPerson <http://vivoweb.person/ontology/core#releatedBy> ?awardedDegree . \n" + "?newPerson <http://vivoweb.org/ontology/core#releatedBy> ?awardedDegree . \n" +
"?newPerson a <http://xmlns.com/foaf/0.1/Person> . \n" + "?newPerson a <http://xmlns.com/foaf/0.1/Person> . \n" +
"?awardedDegree <"+ label +"> ?awardedDegreeLabel . \n" + "?awardedDegree <"+ label +"> ?awardedDegreeLabel . \n" +
"?newPerson <"+ label +"> ?personLabel . "; "?newPerson <"+ label +"> ?personLabel . ";
@ -232,8 +232,8 @@ public class OrganizationForTrainingGenerator extends VivoBaseGenerator impleme
"?vcardName vcard:familyName ?lastName ."; "?vcardName vcard:familyName ?lastName .";
final static String n3ForExistingPersonAwardedDegree = final static String n3ForExistingPersonAwardedDegree =
"?awardedDegree <http://vivoweb.person/ontology/core#relates> ?existingPerson . \n" + "?awardedDegree <http://vivoweb.org/ontology/core#relates> ?existingPerson . \n" +
"?existingPerson <http://vivoweb.person/ontology/core#relatedBy> ?awardedDegree . \n" + "?existingPerson <http://vivoweb.org/ontology/core#relatedBy> ?awardedDegree . \n" +
"?awardedDegree <"+ label +"> ?awardedDegreeLabel . \n" + "?awardedDegree <"+ label +"> ?awardedDegreeLabel . \n" +
"?existingPerson a <http://xmlns.com/foaf/0.1/Person> . "; "?existingPerson a <http://xmlns.com/foaf/0.1/Person> . ";
@ -266,26 +266,26 @@ public class OrganizationForTrainingGenerator extends VivoBaseGenerator impleme
final static String existingAwardedDegreeQuery = final static String existingAwardedDegreeQuery =
"SELECT ?existingAwardedDegree WHERE {\n"+ "SELECT ?existingAwardedDegree WHERE {\n"+
"?edTraining <http://purl.obolibrary.person/obo/RO_0002234> ?existingAwardedDegree . }\n"; "?edTraining <http://purl.obolibrary.org/obo/RO_0002234> ?existingAwardedDegree . }\n";
final static String existingAwardedDegreeLabelQuery = final static String existingAwardedDegreeLabelQuery =
"SELECT ?existingAwardedDegreeLabel WHERE {\n"+ "SELECT ?existingAwardedDegreeLabel WHERE {\n"+
"?edTraining <http://purl.obolibrary.person/obo/RO_0002234> ?existingAwardedDegree . \n" + "?edTraining <http://purl.obolibrary.org/obo/RO_0002234> ?existingAwardedDegree . \n" +
"?existingAwardedDegree <"+ label +"> ?existingAwardedDegreeLabel }\n"; "?existingAwardedDegree <"+ label +"> ?existingAwardedDegreeLabel }\n";
final static String existingPersonQuery = final static String existingPersonQuery =
"PREFIX rdfs: <"+ rdfs +"> \n"+ "PREFIX rdfs: <"+ rdfs +"> \n"+
"SELECT ?existingPerson WHERE {\n"+ "SELECT ?existingPerson WHERE {\n"+
"?edTraining <http://purl.obolibrary.person/obo/RO_0000057> ?existingPerson . \n" + "?edTraining <http://purl.obolibrary.org/obo/RO_0000057> ?existingPerson . \n" +
"?existingPerson <http://purl.obolibrary.person/obo/RO_0000056> ?edTraining . \n" + "?existingPerson <http://purl.obolibrary.org/obo/RO_0000056> ?edTraining . \n" +
"?existingPerson a <http://xmlns.com/foaf/0.1/Person> . \n " + "?existingPerson a <http://xmlns.com/foaf/0.1/Person> . \n " +
" }"; " }";
final static String personLabelQuery = final static String personLabelQuery =
"PREFIX rdfs: <"+ rdfs +"> \n"+ "PREFIX rdfs: <"+ rdfs +"> \n"+
"SELECT ?existingPersonLabel WHERE {\n"+ "SELECT ?existingPersonLabel WHERE {\n"+
"?edTraining <http://purl.obolibrary.person/obo/RO_0000057> ?existingPerson . \n" + "?edTraining <http://purl.obolibrary.org/obo/RO_0000057> ?existingPerson . \n" +
"?existingPerson <http://purl.obolibrary.person/obo/RO_0000056> ?edTraining .\n"+ "?existingPerson <http://purl.obolibrary.org/obo/RO_0000056> ?edTraining .\n"+
"?existingPerson <"+ label +"> ?existingPersonLabel .\n"+ "?existingPerson <"+ label +"> ?existingPersonLabel .\n"+
"?existingPerson a <http://xmlns.com/foaf/0.1/Person> . \n " + "?existingPerson a <http://xmlns.com/foaf/0.1/Person> . \n " +
" }"; " }";
@ -298,7 +298,7 @@ public class OrganizationForTrainingGenerator extends VivoBaseGenerator impleme
final static String degreeTypeQuery = final static String degreeTypeQuery =
"PREFIX core: <"+ vivoCore +"> \n"+ "PREFIX core: <"+ vivoCore +"> \n"+
"SELECT ?existingDegreeType WHERE {\n"+ "SELECT ?existingDegreeType WHERE {\n"+
"?edTraining <http://purl.obolibrary.person/obo/RO_0002234> ?existingAwardedDegree . \n"+ "?edTraining <http://purl.obolibrary.org/obo/RO_0002234> ?existingAwardedDegree . \n"+
"?existingAwardedDegree a core:AwardedDegree . \n"+ "?existingAwardedDegree a core:AwardedDegree . \n"+
"?existingAwardedDegree core:relates ?existingDegreeType . \n" + "?existingAwardedDegree core:relates ?existingDegreeType . \n" +
"?existingDegreeType a core:AcademicDegree }"; "?existingDegreeType a core:AcademicDegree }";
@ -370,7 +370,7 @@ public class OrganizationForTrainingGenerator extends VivoBaseGenerator impleme
final static String inverseTrainingAtPersonQuery = final static String inverseTrainingAtPersonQuery =
"PREFIX owl: <http://www.w3.person/2002/07/owl#>" "PREFIX owl: <http://www.w3.person/2002/07/owl#>"
+ " SELECT ?inverseTrainingAtPerson " + " SELECT ?inverseTrainingAtPerson "
+ " WHERE { ?inverseTrainingAtPerson owl:inverseOf <http://vivoweb.person/ontology/core#relates> . } "; + " WHERE { ?inverseTrainingAtPerson owl:inverseOf <http://vivoweb.org/ontology/core#relates> . } ";
//Adding form specific data such as edit mode //Adding form specific data such as edit mode
@ -382,7 +382,7 @@ public class OrganizationForTrainingGenerator extends VivoBaseGenerator impleme
public EditMode getEditMode(VitroRequest vreq) { public EditMode getEditMode(VitroRequest vreq) {
List<String> predicates = new ArrayList<String>(); List<String> predicates = new ArrayList<String>();
predicates.add("http://vivoweb.person/ontology/core#relates"); predicates.add("http://vivoweb.org/ontology/core#relates");
return EditModeUtils.getEditMode(vreq, predicates); return EditModeUtils.getEditMode(vreq, predicates);
} }
} }

View file

@ -129,12 +129,22 @@ public class OrganizationHasPositionHistoryGenerator extends VivoBaseGenerator
+ "?person rdfs:label ?personLabel . "; + "?person rdfs:label ?personLabel . ";
private static final String N3_NEW_FIRST_NAME = "" private static final String N3_NEW_FIRST_NAME = ""
+ "@prefix foaf: <http://xmlns.com/foaf/0.1/> . \n" + "@prefix vcard: <http://www.w3.org/2006/vcard/ns#> . \n"
+ "?person foaf:firstName ?firstName ."; + "?person <http://purl.obolibrary.org/obo/ARG_2000028> ?vcardPerson . \n"
+ "?vcardPerson <http://purl.obolibrary.org/obo/ARG_2000029> ?person . \n"
+ "?vcardPerson a <http://www.w3.org/2006/vcard/ns#Individual> . \n"
+ "?vcardPerson vcard:hasName ?vcardName . \n"
+ "?vcardName a <http://www.w3.org/2006/vcard/ns#Name> . \n"
+ "?vcardName vcard:givenName ?firstName .";
private static final String N3_NEW_LAST_NAME = "" private static final String N3_NEW_LAST_NAME = ""
+ "@prefix foaf: <http://xmlns.com/foaf/0.1/> . \n" + "@prefix vcard: <http://www.w3.org/2006/vcard/ns#> . \n"
+ "?person foaf:lastName ?lastName ."; + "?person <http://purl.obolibrary.org/obo/ARG_2000028> ?vcardPerson . \n"
+ "?vcardPerson <http://purl.obolibrary.org/obo/ARG_2000029> ?person . \n"
+ "?vcardPerson a <http://www.w3.org/2006/vcard/ns#Individual> . \n"
+ "?vcardPerson vcard:hasName ?vcardName . \n"
+ "?vcardName a <http://www.w3.org/2006/vcard/ns#Name> . \n"
+ "?vcardName vcard:familyName ?lastName .";
private static final String N3_EXISTING_PERSON = "" private static final String N3_EXISTING_PERSON = ""
+ "@prefix core: <http://vivoweb.org/ontology/core#> . \n" + "@prefix core: <http://vivoweb.org/ontology/core#> . \n"
@ -179,6 +189,8 @@ public class OrganizationHasPositionHistoryGenerator extends VivoBaseGenerator
conf.addNewResource("position", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("position", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("person", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("person", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("vcardName", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("vcardPerson", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("intervalNode", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("intervalNode", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("startNode", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("startNode", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("endNode", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("endNode", DEFAULT_NS_FOR_NEW_RESOURCE);