diff --git a/productMods/config/listViewConfig-advisorIn.xml b/productMods/config/listViewConfig-advisorIn.xml index 662acc78..30f83e1e 100644 --- a/productMods/config/listViewConfig-advisorIn.xml +++ b/productMods/config/listViewConfig-advisorIn.xml @@ -1,159 +1,183 @@ - - - - - - - - PREFIX foaf: <http://xmlns.com/foaf/0.1/> - PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> - PREFIX bibo: <http://purl.org/ontology/bibo/> - PREFIX core: <http://vivoweb.org/ontology/core#> - PREFIX owl: <http://www.w3.org/2002/07/owl#> - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> - - SELECT DISTINCT ?subclass - ?advisory - ?advisoryLabel - ?localName - ?advisee - ?adviseeLabel - ?degreeLabel - ?degreeAbbr - ?dateTimeStart - ?dateTimeEnd - - WHERE { - ?subject ?property ?advisory - LET ( ?localName := afn:localname(?advisory) ) - OPTIONAL { ?advisory rdfs:label ?advisoryLabel } - OPTIONAL { ?advisory core:advisee ?advisee - OPTIONAL { ?advisee rdfs:label ?adviseeLabel } - } - OPTIONAL { ?advisory core:degreeCandidacy ?degree - OPTIONAL { ?degree rdfs:label ?degreeLabel } - OPTIONAL { ?degree core:abbreviation ?degreeAbbr } - } - - OPTIONAL { ?advisory vitro:mostSpecificType ?subclass . - ?subclass rdfs:subClassOf core:AdvisingRelationship - } - - OPTIONAL { ?advisory core:dateTimeInterval ?dateTimeInterval - OPTIONAL { ?dateTimeInterval core:start ?dateTimeStartValue . - ?dateTimeStartValue core:dateTime ?dateTimeStart - } - } - OPTIONAL { ?advisory core:dateTimeInterval ?dateTimeInterval - OPTIONAL { ?dateTimeInterval core:end ?dateTimeEndValue . - ?dateTimeEndValue core:dateTime ?dateTimeEnd - } - } - - - } ORDER BY ?subclass DESC(?dateTimeEnd) - - - - PREFIX core: <http://vivoweb.org/ontology/core#> - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - CONSTRUCT { - ?subclass rdfs:subClassOf core:AdvisingRelationship - } WHERE { - ?subclass rdfs:subClassOf core:AdvisingRelationship - } - - - - PREFIX core: <http://vivoweb.org/ontology/core#> - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - CONSTRUCT { - ?subject ?property ?advisory . - ?advisory ?advisoryProperty ?advisoryValue . - ?advisory rdfs:label ?advisoryLabel - } WHERE { - { - ?subject ?property ?advisory - } UNION { - ?subject ?property ?advisory . - ?advisory ?advisoryProperty ?advisoryValue - } UNION { - ?subject ?property ?advisory . - ?advisory ?advisoryProperty ?advisoryValue . - ?advisory rdfs:label ?advisoryLabel - } - } - - - - PREFIX bibo: <http://purl.org/ontology/bibo/> - PREFIX core: <http://vivoweb.org/ontology/core#> - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - PREFIX foaf: <http://xmlns.com/foaf/0.1/> - - CONSTRUCT { - ?subject ?property ?advisory . - ?advisory core:advisee ?advisee . - ?advisee rdfs:label ?adviseeLabel . - ?advisory core:degreeCandidacy ?degree . - ?degree rdfs:label ?degreeLabel . - ?degree core:abbreviation ?degreeAbbr - } WHERE { - { - ?subject ?property ?advisory - } UNION { - ?subject ?property ?advisory. - ?advisory core:advisee ?advisee - } UNION { - ?subject ?property ?advisory . - ?advisory core:advisee ?advisee . - ?advisee rdfs:label ?adviseeLabel - } UNION { - ?subject ?property ?advisory . - ?advisory core:degreeCandidacy ?degree - } UNION { - ?subject ?property ?advisory . - ?advisory core:degreeCandidacy ?degree . - ?degree rdfs:label ?degreeLabel - } UNION { - ?subject ?property ?advisory . - ?advisory core:degreeCandidacy ?degree . - ?degree rdfs:label ?degreeLabel . - ?degree core:abbreviation ?degreeAbbr - } - } - - - - PREFIX core: <http://vivoweb.org/ontology/core#> - CONSTRUCT { - ?subject ?property ?award . - ?award core:dateTimeInterval ?dateTimeInterval . - ?dateTimeInterval core:start ?dateTimeStartValue . - ?dateTimeStartValue core:dateTime ?dateTimeStart - } WHERE { - ?subject ?property ?award . - ?award core:dateTimeInterval ?dateTimeInterval . - ?dateTimeInterval core:start ?dateTimeStartValue . - ?dateTimeStartValue core:dateTime ?dateTimeStart - } - - - - PREFIX core: <http://vivoweb.org/ontology/core#> - CONSTRUCT { - ?subject ?property ?award . - ?award core:dateTimeInterval ?dateTimeInterval . - ?dateTimeInterval core:end ?dateTimeEndValue . - ?dateTimeEndValue core:dateTime ?dateTimeEnd - } WHERE { - ?subject ?property ?award . - ?award core:dateTimeInterval ?dateTimeInterval . - ?dateTimeInterval core:end ?dateTimeEndValue . - ?dateTimeEndValue core:dateTime ?dateTimeEnd - } - - - - + + + + + + + + PREFIX foaf: <http://xmlns.com/foaf/0.1/> + PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> + PREFIX bibo: <http://purl.org/ontology/bibo/> + PREFIX core: <http://vivoweb.org/ontology/core#> + PREFIX owl: <http://www.w3.org/2002/07/owl#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> + + SELECT DISTINCT ?subclass + ?advisory + ?advisoryLabel + ?localName + ?advisee + ?adviseeLabel + ?degreeLabel + ?degreeAbbr + ?dateTimeStart + ?dateTimeEnd + + WHERE { + ?subject ?property ?advisory + LET ( ?localName := afn:localname(?advisory) ) + OPTIONAL { ?advisory rdfs:label ?advisoryLabel } + OPTIONAL { ?advisory core:relates ?advisee . + ?advisee a foaf:Person . + OPTIONAL { ?advisee rdfs:label ?adviseeLabel } + } + OPTIONAL { ?advisory core:relates ?degree . + ?degree a core:AcademicDegree . + OPTIONAL { ?degree rdfs:label ?degreeLabel } + OPTIONAL { ?degree core:abbreviation ?degreeAbbr } + } + + OPTIONAL { ?advisory vitro:mostSpecificType ?subclass . + ?subclass rdfs:subClassOf core:AdvisingRelationship + } + + OPTIONAL { ?advisory core:dateTimeInterval ?dateTimeInterval + OPTIONAL { ?dateTimeInterval core:start ?dateTimeStartValue . + ?dateTimeStartValue core:dateTime ?dateTimeStart + } + } + OPTIONAL { ?advisory core:dateTimeInterval ?dateTimeInterval + OPTIONAL { ?dateTimeInterval core:end ?dateTimeEndValue . + ?dateTimeEndValue core:dateTime ?dateTimeEnd + } + } + + FILTER ( ?subject != ?advisee ) + } ORDER BY ?subclass DESC(?dateTimeEnd) + + + + PREFIX core: <http://vivoweb.org/ontology/core#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + CONSTRUCT { + ?subclass rdfs:subClassOf core:AdvisingRelationship + } WHERE { + ?subclass rdfs:subClassOf core:AdvisingRelationship + } + + + + PREFIX core: <http://vivoweb.org/ontology/core#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + CONSTRUCT { + ?subject ?property ?advisory . + ?advisory a core:AdvisingRelationship . + ?advisory ?advisoryProperty ?advisoryValue . + ?advisory rdfs:label ?advisoryLabel + } WHERE { + { + ?subject ?property ?advisory . + ?advisory a core:AdvisingRelationship + } UNION { + ?subject ?property ?advisory . + ?advisory a core:AdvisingRelationship . + ?advisory ?advisoryProperty ?advisoryValue + } UNION { + ?subject ?property ?advisory . + ?advisory a core:AdvisingRelationship . + ?advisory ?advisoryProperty ?advisoryValue . + ?advisory rdfs:label ?advisoryLabel + } + } + + + + PREFIX bibo: <http://purl.org/ontology/bibo/> + PREFIX core: <http://vivoweb.org/ontology/core#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + PREFIX foaf: <http://xmlns.com/foaf/0.1/> + + CONSTRUCT { + ?subject ?property ?advisory . + ?advisory a core:AdvisingRelationship . + ?advisory core:relates ?advisee . + ?advisee a foaf:Person . + ?advisee rdfs:label ?adviseeLabel . + ?advisory core:relates ?degree . + ?degree a core:AcademicDegree . + ?degree rdfs:label ?degreeLabel . + ?degree core:abbreviation ?degreeAbbr + } WHERE { + { + ?subject ?property ?advisory . + ?advisory a core:AdvisingRelationship . + } UNION { + ?subject ?property ?advisory. + ?advisory a core:AdvisingRelationship . + ?advisory core:relates ?advisee . + ?advisee a foaf:Person . + } UNION { + ?subject ?property ?advisory . + ?advisory a core:AdvisingRelationship . + ?advisory core:relates ?advisee . + ?advisee a foaf:Person . + ?advisee rdfs:label ?adviseeLabel + } UNION { + ?subject ?property ?advisory . + ?advisory a core:AdvisingRelationship . + ?advisory core:relates ?degree . + ?degree a core:AcademicDegree . + } UNION { + ?subject ?property ?advisory . + ?advisory a core:AdvisingRelationship . + ?advisory core:relates ?degree . + ?degree a core:AcademicDegree . + ?degree rdfs:label ?degreeLabel + } UNION { + ?subject ?property ?advisory . + ?advisory a core:AdvisingRelationship . + ?advisory core:relates ?degree . + ?degree a core:AcademicDegree . + ?degree rdfs:label ?degreeLabel . + ?degree core:abbreviation ?degreeAbbr + } + } + + + + PREFIX core: <http://vivoweb.org/ontology/core#> + CONSTRUCT { + ?subject ?property ?advisory . + ?advisory a core:AdvisingRelationship . + ?award core:dateTimeInterval ?dateTimeInterval . + ?dateTimeInterval core:start ?dateTimeStartValue . + ?dateTimeStartValue core:dateTime ?dateTimeStart + } WHERE { + ?subject ?property ?advisory . + ?advisory a core:AdvisingRelationship . + ?award core:dateTimeInterval ?dateTimeInterval . + ?dateTimeInterval core:start ?dateTimeStartValue . + ?dateTimeStartValue core:dateTime ?dateTimeStart + } + + + + PREFIX core: <http://vivoweb.org/ontology/core#> + CONSTRUCT { + ?subject ?property ?advisory . + ?advisory a core:AdvisingRelationship . + ?award core:dateTimeInterval ?dateTimeInterval . + ?dateTimeInterval core:end ?dateTimeEndValue . + ?dateTimeEndValue core:dateTime ?dateTimeEnd + } WHERE { + ?subject ?property ?advisory . + ?advisory a core:AdvisingRelationship . + ?award core:dateTimeInterval ?dateTimeInterval . + ?dateTimeInterval core:end ?dateTimeEndValue . + ?dateTimeEndValue core:dateTime ?dateTimeEnd + } + + + + diff --git a/productMods/templates/freemarker/body/partials/individual/propStatement-advisorIn.ftl b/productMods/templates/freemarker/body/partials/individual/propStatement-advisorIn.ftl index 826fc1ab..1813bc2b 100644 --- a/productMods/templates/freemarker/body/partials/individual/propStatement-advisorIn.ftl +++ b/productMods/templates/freemarker/body/partials/individual/propStatement-advisorIn.ftl @@ -29,5 +29,5 @@ - ${linkedIndividual} <@dt.yearIntervalSpan "${statement.dateTimeStart!}" "${statement.dateTimeEnd!}" /> + ${linkedIndividual} <@dt.yearIntervalSpan "${statement.dateTimeStart!}" "${statement.dateTimeEnd!}" /> \ No newline at end of file diff --git a/rdf/display/everytime/PropertyConfig.n3 b/rdf/display/everytime/PropertyConfig.n3 index a467236d..477e5c07 100644 --- a/rdf/display/everytime/PropertyConfig.n3 +++ b/rdf/display/everytime/PropertyConfig.n3 @@ -61,6 +61,7 @@ local:authorInAuthorshipConfig a :ObjectPropertyDisplayConfig ; local:hasServiceProviderRoleContext a :ConfigContext ; :hasConfiguration local:hasServiceProviderRoleConfig ; :configContextFor ; + :qualifiedByDomain ; :qualifiedBy . local:hasServiceProviderRoleConfig a :ObjectPropertyDisplayConfig ; @@ -75,6 +76,7 @@ local:hasServiceProviderRoleConfig a :ObjectPropertyDisplayConfig ; local:hasClinicalRoleContext a :ConfigContext ; :hasConfiguration local:hasClinicalRoleConfig ; :configContextFor ; + :qualifiedByDomain ; :qualifiedBy . local:hasClinicalRoleConfig a :ObjectPropertyDisplayConfig ; @@ -89,6 +91,7 @@ local:hasClinicalRoleConfig a :ObjectPropertyDisplayConfig ; local:hasLeaderRoleContext a :ConfigContext ; :hasConfiguration local:hasLeaderRoleConfig ; :configContextFor ; + :qualifiedByDomain ; :qualifiedBy . local:hasLeaderRoleConfig a :ObjectPropertyDisplayConfig ; @@ -103,6 +106,7 @@ local:hasLeaderRoleConfig a :ObjectPropertyDisplayConfig ; local:hasMemberRoleContext a :ConfigContext ; :hasConfiguration local:hasMemberRoleConfig ; :configContextFor ; + :qualifiedByDomain ; :qualifiedBy . local:hasMemberRoleConfig a :ObjectPropertyDisplayConfig ; @@ -117,6 +121,7 @@ local:hasMemberRoleConfig a :ObjectPropertyDisplayConfig ; local:hasTeacherRoleContext a :ConfigContext ; :hasConfiguration local:hasTeacherRoleConfig ; :configContextFor ; + :qualifiedByDomain ; :qualifiedBy . local:hasTeacherRoleConfig a :ObjectPropertyDisplayConfig ; @@ -131,6 +136,7 @@ local:hasTeacherRoleConfig a :ObjectPropertyDisplayConfig ; local:hasEditorRoleContext a :ConfigContext ; :hasConfiguration local:hasEditorRoleConfig ; :configContextFor ; + :qualifiedByDomain ; :qualifiedBy . local:hasEditorRoleConfig a :ObjectPropertyDisplayConfig ; @@ -145,6 +151,7 @@ local:hasEditorRoleConfig a :ObjectPropertyDisplayConfig ; local:hasReviewerRoleContext a :ConfigContext ; :hasConfiguration local:hasReviewerRoleConfig ; :configContextFor ; + :qualifiedByDomain ; :qualifiedBy . local:hasReviewerRoleConfig a :ObjectPropertyDisplayConfig ; @@ -159,6 +166,7 @@ local:hasReviewerRoleConfig a :ObjectPropertyDisplayConfig ; local:hasOrganizerRoleContext a :ConfigContext ; :hasConfiguration local:hasOrganizerRoleConfig ; :configContextFor ; + :qualifiedByDomain ; :qualifiedBy . local:hasOrganizerRoleConfig a :ObjectPropertyDisplayConfig ; @@ -173,6 +181,7 @@ local:hasOrganizerRoleConfig a :ObjectPropertyDisplayConfig ; local:hasOutreachProviderRoleContext a :ConfigContext ; :hasConfiguration local:hasOutreachProviderRoleConfig ; :configContextFor ; + :qualifiedByDomain ; :qualifiedBy . local:hasOutreachProviderRoleConfig a :ObjectPropertyDisplayConfig ; @@ -187,6 +196,7 @@ local:hasOutreachProviderRoleConfig a :ObjectPropertyDisplayConfig ; local:hasAttendeeRoleContext a :ConfigContext ; :hasConfiguration local:hasAttendeeRoleConfig ; :configContextFor ; + :qualifiedByDomain ; :qualifiedBy . local:hasAttendeeRoleConfig a :ObjectPropertyDisplayConfig ; @@ -201,6 +211,7 @@ local:hasAttendeeRoleConfig a :ObjectPropertyDisplayConfig ; local:hasResearcherRoleContext a :ConfigContext ; :hasConfiguration local:hasResearcherRoleConfig ; :configContextFor ; + :qualifiedByDomain ; :qualifiedBy . local:hasResearcherRoleConfig a :ObjectPropertyDisplayConfig ; @@ -215,6 +226,7 @@ local:hasResearcherRoleConfig a :ObjectPropertyDisplayConfig ; local:hasInvestigatorRoleContext a :ConfigContext ; :hasConfiguration local:hasInvestigatorRoleConfig ; :configContextFor ; + :qualifiedByDomain ; :qualifiedBy . local:hasInvestigatorRoleConfig a :ObjectPropertyDisplayConfig ; @@ -229,6 +241,7 @@ local:hasInvestigatorRoleConfig a :ObjectPropertyDisplayConfig ; local:hasPrincipalInvestigatorRoleContext a :ConfigContext ; :hasConfiguration local:hasPrincipalInvestigatorRoleConfig ; :configContextFor ; + :qualifiedByDomain ; :qualifiedBy . local:hasPrincipalInvestigatorRoleConfig a :ObjectPropertyDisplayConfig ; @@ -243,6 +256,7 @@ local:hasPrincipalInvestigatorRoleConfig a :ObjectPropertyDisplayConfig ; local:hasCo-PrincipalInvestigatorRoleContext a :ConfigContext ; :hasConfiguration local:hasCo-PrincipalInvestigatorRoleConfig ; :configContextFor ; + :qualifiedByDomain ; :qualifiedBy . local:hasCo-PrincipalInvestigatorRoleConfig a :ObjectPropertyDisplayConfig ; @@ -257,6 +271,7 @@ local:hasCo-PrincipalInvestigatorRoleConfig a :ObjectPropertyDisplayConfig ; local:hasPresenterRoleContext a :ConfigContext ; :hasConfiguration local:hasPresenterRoleConfig ; :configContextFor ; + :qualifiedByDomain ; :qualifiedBy . local:hasPresenterRoleConfig a :ObjectPropertyDisplayConfig ; @@ -271,6 +286,7 @@ local:hasPresenterRoleConfig a :ObjectPropertyDisplayConfig ; local:awardOrHonorContext a :ConfigContext ; :hasConfiguration local:awardOrHonorConfig ; :configContextFor ; + :qualifiedByDomain ; :qualifiedBy . local:awardOrHonorConfig a :ObjectPropertyDisplayConfig ; @@ -285,6 +301,7 @@ local:awardOrHonorConfig a :ObjectPropertyDisplayConfig ; local:educationalTrainingContext a :ConfigContext ; :hasConfiguration local:educationalTrainingConfig ; :configContextFor ; + :qualifiedByDomain ; :qualifiedBy . local:educationalTrainingConfig a :ObjectPropertyDisplayConfig ; @@ -296,6 +313,22 @@ local:educationalTrainingConfig a :ObjectPropertyDisplayConfig ; vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.PersonHasEducationalTraining"^^ ; :propertyGroup . +local:advisorRoleContext a :ConfigContext ; + :hasConfiguration local:advisorRoleConfig ; + :configContextFor ; + :qualifiedByDomain ; + :qualifiedBy . + +local:advisorRoleConfig a :ObjectPropertyDisplayConfig ; + :listViewConfigFile "listViewConfig-advisorIn.xml"^^xsd:string ; + :displayName "advisees" ; + vitro:displayRankAnnot 40; + vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ; + vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ; + vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.PersonHasAdvisingRelationshipGenerator"^^ ; + :propertyGroup . + + local:informationResourceInAuthorshipContext a :ConfigContext ; :hasConfiguration local:informationResourceInAuthorshipConfig ; :configContextFor ; @@ -310,3 +343,19 @@ local:informationResourceInAuthorshipConfig a :ObjectPropertyDisplayConfig ; vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ; vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddAuthorsToInformationResourceGenerator"^^ ; :propertyGroup . + +### vcard properties ### +local:mailingAddressContext a :ConfigContext ; + :hasConfiguration local:mailingAddressConfig ; + :configContextFor ; + :qualifiedByDomain ; + :qualifiedBy . + +local:mailingAddressConfig a :ObjectPropertyDisplayConfig ; + :listViewConfigFile "listViewConfig-personHasMailingAddress.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.PersonHasMailingAddressGenerator"^^ ; + :propertyGroup . diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddClinicalRoleToPersonGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddClinicalRoleToPersonGenerator.java index 68bc2fd3..96c73793 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddClinicalRoleToPersonGenerator.java +++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddClinicalRoleToPersonGenerator.java @@ -1,61 +1,61 @@ -/* $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.HashMap; - -import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ConstantFieldOptions; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldOptions; - -public class AddClinicalRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator { - - private static String template = "addClinicalRoleToPerson.ftl"; - - //Should this be overridden - @Override - String getTemplate() { - return template; - } - - @Override - String getRoleType() { - return "http://vivoweb.org/ontology/core#ClinicalRole"; - } - - /** Clinical role involves hard-coded options for the "right side" of the role or activity. */ - @Override - FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception { - return new ConstantFieldOptions( - "", "Select one", - "http://vivoweb.org/ontology/core#Project", "Project", - "http://vivoweb.org/ontology/core#Service", "Service" - ); - } - - //isShowRoleLabelField remains true for this so doesn't need to be overwritten - @Override - boolean isShowRoleLabelField(){ - return true; - } - - - /* - * Use the methods below to change the date/time precision in the - * custom form associated with this generator. When not used, the - * precision will be YEAR. The other precisons are MONTH, DAY, HOUR, - * MINUTE, TIME and NONE. - */ - /* - public String getStartDatePrecision() { - String precision = VitroVocabulary.Precision.MONTH.uri(); - return precision; - } - - public String getEndDatePrecision() { - String precision = VitroVocabulary.Precision.DAY.uri(); - return precision; - } - */ - -} +/* $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.HashMap; + +import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ConstantFieldOptions; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldOptions; + +public class AddClinicalRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator { + + private static String template = "addClinicalRoleToPerson.ftl"; + + //Should this be overridden + @Override + String getTemplate() { + return template; + } + + @Override + String getRoleType() { + return "http://vivoweb.org/ontology/core#ClinicalRole"; + } + + /** Clinical role involves hard-coded options for the "right side" of the role or activity. */ + @Override + FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception { + return new ConstantFieldOptions( + "", "Select one", + "http://vivoweb.org/ontology/core#Project", "Project", + "http://purl.obolibrary.org/obo/ERO_0000005", "Service" + ); + } + + //isShowRoleLabelField remains true for this so doesn't need to be overwritten + @Override + boolean isShowRoleLabelField(){ + return true; + } + + + /* + * Use the methods below to change the date/time precision in the + * custom form associated with this generator. When not used, the + * precision will be YEAR. The other precisons are MONTH, DAY, HOUR, + * MINUTE, TIME and NONE. + */ + /* + public String getStartDatePrecision() { + String precision = VitroVocabulary.Precision.MONTH.uri(); + return precision; + } + + public String getEndDatePrecision() { + String precision = VitroVocabulary.Precision.DAY.uri(); + return precision; + } + */ + +} diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasAdvisingRelationshipGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasAdvisingRelationshipGenerator.java index e7159579..cd5b0092 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasAdvisingRelationshipGenerator.java +++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasAdvisingRelationshipGenerator.java @@ -28,12 +28,8 @@ public class PersonHasAdvisingRelationshipGenerator extends VivoBaseGenerator im final static String subjAreaClass = "http://www.w3.org/2004/02/skos/core#Concept"; final static String degreeClass = vivoCore+"AcademicDegree"; final static String adviseeClass = foaf + "Person"; - final static String advisorInPred = vivoCore + "advisorIn"; - final static String adviseeInPred = vivoCore + "adviseeIn"; - final static String advisorPred = vivoCore + "advisor"; - final static String adviseePred = vivoCore + "advisee" ; - final static String subjAreaPred = vivoCore + "hasSubjectArea" ; - final static String degreePred = vivoCore + "degreeCandidacy" ; + final static String adviseeRoleClass = "http://vivoweb.org/ontology/core#AdviseeRole"; + final static String advisorRoleClass = "http://vivoweb.org/ontology/core#AdvisorRole"; final static String advisingRelToInterval = vivoCore + "dateTimeInterval"; final static String intervalType = vivoCore + "DateTimeInterval"; final static String intervalToStart = vivoCore + "start"; @@ -62,7 +58,7 @@ public class PersonHasAdvisingRelationshipGenerator extends VivoBaseGenerator im conf.setN3Required( Arrays.asList( n3ForNewAdvisingRelationship, advisingRelLabelAssertion, - advisingRelTypeAssertion ) ); + advisingRelTypeAssertion ) ); conf.setN3Optional( Arrays.asList( n3ForNewAdviseeAssertion, n3ForExistingAdviseeAssertion, degreeAssertion, @@ -75,6 +71,8 @@ public class PersonHasAdvisingRelationshipGenerator extends VivoBaseGenerator im conf.addNewResource("advisingRelationship", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("newAdvisee", DEFAULT_NS_FOR_NEW_RESOURCE); + conf.addNewResource("advisorRole", DEFAULT_NS_FOR_NEW_RESOURCE); + conf.addNewResource("adviseeRole", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("newSubjArea", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("intervalNode", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("startNode", DEFAULT_NS_FOR_NEW_RESOURCE); @@ -93,6 +91,8 @@ public class PersonHasAdvisingRelationshipGenerator extends VivoBaseGenerator im conf.addSparqlForExistingLiteral("endField-value", existingEndDateQuery); conf.addSparqlForExistingUris("advisingRelType", advisingRelTypeQuery); + conf.addSparqlForExistingUris("advisorRole", existingAdvisorRoleQuery); + conf.addSparqlForExistingUris("adviseeRole", existingAdviseeRoleQuery); conf.addSparqlForExistingUris("existingSubjArea", subjAreaQuery); conf.addSparqlForExistingUris("existingAdvisee", adviseeQuery); conf.addSparqlForExistingUris("degree", degreeQuery); @@ -193,9 +193,14 @@ public class PersonHasAdvisingRelationshipGenerator extends VivoBaseGenerator im final static String n3ForNewAdvisingRelationship = "@prefix vivo: <" + vivoCore + "> . \n\n" + - "?person <" + advisorInPred + "> ?advisingRelationship . \n" + + "?person ?advisingRelationship . \n" + "?advisingRelationship a <" + advisingRelClass + "> . \n" + - "?advisingRelationship <" + advisorPred + "> ?person . \n" ; + "?advisingRelationship ?person . \n" + + "?advisingRelationship ?advisorRole . \n" + + "?advisorRole a <" + advisorRoleClass + "> . \n" + + "?advisorRole ?advisingRelationship . \n" + + "?person ?advisorRole . \n" + + "?advisorRole ?person . "; final static String advisingRelLabelAssertion = "?advisingRelationship <"+ label + "> ?advisingRelLabel ."; @@ -204,14 +209,24 @@ public class PersonHasAdvisingRelationshipGenerator extends VivoBaseGenerator im "?advisingRelationship a ?advisingRelType ."; final static String n3ForNewAdviseeAssertion = - "?advisingRelationship <" + adviseePred + "> ?newAdvisee . \n" + - "?newAdvisee <" + adviseeInPred + "> ?advisingRelationship . \n" + + "?advisingRelationship ?newAdvisee . \n" + + "?newAdvisee ?advisingRelationship . \n" + "?newAdvisee <" + label + "> ?adviseeLabel . \n" + - "?newAdvisee a <" + adviseeClass + "> . "; + "?newAdvisee a <" + adviseeClass + "> . \n" + + "?newAdvisee ?adviseeRole . \n" + + "?adviseeRole ?newAdvisee . \n" + + "?adviseeRole a <" + adviseeRoleClass + "> . \n" + + "?advisingRelationship ?adviseeRole . \n" + + "?adviseeRole ?advisingRelationship . "; final static String n3ForExistingAdviseeAssertion = - "?advisingRelationship <" + adviseePred + "> ?existingAdvisee . \n" + - "?existingAdvisee <" + adviseeInPred + "> ?advisingRelationship . "; + "?advisingRelationship ?existingAdvisee . \n" + + "?existingAdvisee ?advisingRelationship . \n" + + "?existingAdvisee ?adviseeRole . \n" + + "?adviseeRole ?existingAdvisee . \n" + + "?adviseeRole a <" + adviseeRoleClass + "> . \n" + + "?advisingRelationship ?adviseeRole . \n" + + "?adviseeRole ?advisingRelationship . "; final static String firstNameAssertion = "@prefix foaf: <" + foaf + "> . \n" + @@ -222,19 +237,22 @@ public class PersonHasAdvisingRelationshipGenerator extends VivoBaseGenerator im "?newAdvisee foaf:lastName ?lastName ."; final static String degreeAssertion = - "?advisingRelationship <"+ degreePred +"> ?degree ."; + "?advisingRelationship ?degree . \n" + + "?degree ?advisingRelationship . "; //This is for an existing subject area //Where we only need the existing subject area label final static String n3ForExistingSubjAreaAssertion = - "?advisingRelationship <"+ subjAreaPred +"> ?existingSubjArea ."; + "?advisingRelationship ?existingSubjArea . \n" + + "?existingSubjArea ?advisingRelationship . "; //For new subject area, we include all new information //new subject area should always be a new resource //and the following should only get evaluated //when there is something in the label final static String n3ForNewSubjAreaAssertion = - "?advisingRelationship <"+ subjAreaPred +"> ?newSubjArea . \n" + + "?advisingRelationship ?newSubjArea . \n" + + "?newSubjArea ?advisingRelationship . \n" + "?newSubjArea <"+ label + "> ?subjAreaLabel . \n" + "?newSubjArea a <" + subjAreaClass + "> . "; @@ -264,24 +282,46 @@ public class PersonHasAdvisingRelationshipGenerator extends VivoBaseGenerator im final static String adviseeQuery = "SELECT ?existingAdvisee WHERE { \n" + - " ?advisingRelationship <" + adviseePred + "> ?existingAdvisee . \n" + + " ?advisingRelationship ?existingAdvisee . \n" + + " ?existingAdvisee a <" + adviseeClass + "> . \n" + + " FILTER (?person != ?existingAdvisee) . \n" + + "}"; + + final static String existingAdvisorRoleQuery = + "SELECT ?advisorRole WHERE { \n" + + "?advisingRelationship ?advisorRole . \n" + + "?advisorRole a <" + advisorRoleClass + "> . \n" + + "}"; + + final static String existingAdviseeRoleQuery = + "SELECT ?adviseeRole WHERE { \n" + + " ?advisingRelationship ?adviseeRole . \n" + + " ?adviseeRole a <" + adviseeRoleClass + "> . \n" + "}"; final static String adviseeLabelQuery = "SELECT ?existingAdviseeLabel WHERE { \n" + - " ?advisingRelationship <" + adviseePred + "> ?existingAdvisee . \n" + + " ?advisingRelationship ?existingAdvisee . \n" + + " ?existingAdvisee a <" + adviseeClass + "> . \n" + " ?existingAdvisee <" + label + "> ?existingAdviseeLabel . \n" + + " FILTER (?person != ?existingAdvisee) . \n" + "}"; final static String subjAreaQuery = "SELECT ?existingSubjArea WHERE { \n" + - " ?advisingRelationship <" + subjAreaPred + "> ?existingSubjArea . \n" + + " ?advisingRelationship ?existingSubjArea . \n" + + " ?existingSubjArea a . \n" + + " ?existingSubjArea ?type \n" + + " FILTER (?type != ) . \n" + "}"; final static String subjAreaLabelQuery = "SELECT ?existingSubjAreaLabel WHERE { \n" + - " ?advisingRelationship <" + subjAreaPred + "> ?existingSubjArea . \n" + + " ?advisingRelationship ?existingSubjArea . \n" + + " ?existingSubjArea a . \n" + " ?existingSubjArea <" + label + "> ?existingSubjAreaLabel . \n" + + " ?existingSubjArea ?type \n" + + " FILTER (?type != ) . \n" + "}"; final static String advisingRelLabelQuery = @@ -291,7 +331,10 @@ public class PersonHasAdvisingRelationshipGenerator extends VivoBaseGenerator im final static String degreeQuery = "SELECT ?existingDegree WHERE {\n"+ - " ?advisingRelationship <"+ degreePred +"> ?existingDegree . }"; + " ?advisingRelationship ?existingDegree . \n" + + " ?existingDegree a <" + degreeClass + "> . \n" + + "}"; + final static String existingStartDateQuery = "SELECT ?existingDateStart WHERE { \n" +