diff --git a/productMods/config/listViewConfig-advisorIn.xml b/productMods/config/listViewConfig-advisorIn.xml index e2cf9500..71f60a20 100644 --- a/productMods/config/listViewConfig-advisorIn.xml +++ b/productMods/config/listViewConfig-advisorIn.xml @@ -4,16 +4,16 @@ - - 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 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 + SELECT DISTINCT ?subclass ?advisorRole ?advisingRel ?advisingRelLabel @@ -28,73 +28,88 @@ WHERE { ?subject ?property ?advisorRole . ?advisorRole core:relatedBy ?advisingRel . - ?subject core:relatedBy ?advisingRel . LET ( ?localName := afn:localname(?advisingRel) ) - OPTIONAL { ?advisingRel rdfs:label ?advisingRelLabel } + OPTIONAL { ?advisingRel rdfs:label ?advisingRelLabel } OPTIONAL { ?advisingRel core:relates ?advisee . - ?advisee a foaf:Person . + ?advisee a foaf:Person . + ?advisee <http://purl.obolibrary.org/obo/RO_0000053> ?adviseeRole . + ?adviseeRole a core:AdviseeRole . OPTIONAL { ?advisee rdfs:label ?adviseeLabel } } OPTIONAL { ?advisingRel core:degreeCandidacy ?degree . - ?degree rdfs:label ?degreeLabel . + OPTIONAL { ?degree rdfs:label ?degreeLabel } OPTIONAL { ?degree core:abbreviation ?degreeAbbr } } OPTIONAL { ?advisingRel vitro:mostSpecificType ?subclass . - ?subclass rdfs:subClassOf core:AdvisingRelationship + ?subclass rdfs:subClassOf core:AdvisingRelationship } - - OPTIONAL { ?advisingRel core:dateTimeInterval ?dateTimeInterval + + OPTIONAL { ?advisingRel core:dateTimeInterval ?dateTimeInterval OPTIONAL { ?dateTimeInterval core:start ?dateTimeStartValue . - ?dateTimeStartValue core:dateTime ?dateTimeStart + ?dateTimeStartValue core:dateTime ?dateTimeStart } - } - OPTIONAL { ?advisingRel core:dateTimeInterval ?dateTimeInterval + } + OPTIONAL { ?advisingRel core:dateTimeInterval ?dateTimeInterval OPTIONAL { ?dateTimeInterval core:end ?dateTimeEndValue . ?dateTimeEndValue core:dateTime ?dateTimeEnd } - } + } - } ORDER BY ?subclass DESC(?dateTimeEnd) + } ORDER BY ?subclass DESC(?dateTimeEnd) PREFIX core: <http://vivoweb.org/ontology/core#> - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> CONSTRUCT { - ?subclass rdfs:subClassOf core:AdvisingRelationship + ?advisingRel vitro:mostSpecificType ?subclass . + ?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 ?advisorRole . ?advisorRole core:relatedBy ?advisingRel . + ?advisingRel a core:AdvisingRelationship . + ?advisingRel vitro:mostSpecificType ?subclass . + ?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 ?advisorRole . + ?advisorRole a core:AdvisorRole . + ?advisorRole core:relatedBy ?advisingRel . + ?advisingRel a core:AdvisingRelationship . + ?advisingRel ?advisingRelProperty ?advisingRelValue . ?advisingRel rdfs:label ?advisingRelLabel . } WHERE { { ?subject ?property ?advisorRole . ?advisorRole a core:AdvisorRole . ?advisorRole core:relatedBy ?advisingRel . - ?advisingRel a core:AdvisingRelationship + ?advisingRel a core:AdvisingRelationship + } UNION { + ?subject ?property ?advisorRole . + ?advisorRole a core:AdvisorRole . + ?advisorRole core:relatedBy ?advisingRel . + ?advisingRel a core:AdvisingRelationship . } UNION { ?subject ?property ?advisorRole . ?advisorRole a core:AdvisorRole . ?advisorRole core:relatedBy ?advisingRel . ?advisingRel a core:AdvisingRelationship . ?advisingRel rdfs:label ?advisingRelLabel - } + } } 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 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 { @@ -104,20 +119,30 @@ ?advisingRel a core:AdvisingRelationship . ?advisingRel core:relates ?advisee . ?advisee a foaf:Person . + ?advisee rdfs:label ?adviseeLabel . ?advisee <http://purl.obolibrary.org/obo/RO_0000053> ?adviseeRole . ?adviseeRole a core:AdviseeRole . - ?advisee rdfs:label ?adviseeLabel . ?advisingRel core:degreeCandidacy ?degree . + ?degree a core:AcademicDegree . ?degree rdfs:label ?degreeLabel . ?degree core:abbreviation ?degreeAbbr - } WHERE { + } WHERE { { ?subject ?property ?advisorRole . ?advisorRole a core:AdvisorRole . ?advisorRole core:relatedBy ?advisingRel . ?advisingRel a core:AdvisingRelationship . } UNION { - ?subject ?property ?advisorRole . + ?subject ?property ?advisorRole . + ?advisorRole a core:AdvisorRole . + ?advisorRole core:relatedBy ?advisingRel . + ?advisingRel a core:AdvisingRelationship . + ?advisingRel core:relates ?advisee . + ?advisee a foaf:Person . + ?advisee <http://purl.obolibrary.org/obo/RO_0000053> ?adviseeRole . + ?adviseeRole a core:AdviseeRole + } UNION { + ?subject ?property ?advisorRole . ?advisorRole a core:AdvisorRole . ?advisorRole core:relatedBy ?advisingRel . ?advisingRel a core:AdvisingRelationship . @@ -132,6 +157,7 @@ ?advisorRole core:relatedBy ?advisingRel . ?advisingRel a core:AdvisingRelationship . ?advisingRel core:degreeCandidacy ?degree . + ?degree a core:AcademicDegree . ?degree rdfs:label ?degreeLabel . } UNION { ?subject ?property ?advisorRole . @@ -139,54 +165,53 @@ ?advisorRole core:relatedBy ?advisingRel . ?advisingRel a core:AdvisingRelationship . ?advisingRel core:degreeCandidacy ?degree . + ?degree a core:AcademicDegree . ?degree core:abbreviation ?degreeAbbr } - } + } - PREFIX core: <http://vivoweb.org/ontology/core#> - CONSTRUCT { - ?subject ?property ?advisorRole . - ?advisorRole core:relatedBy ?advisingRel . - ?subject core:relatedBy ?advisingRel . - ?advisingRel a core:AdvisingRelationship . - ?advisingRel core:dateTimeInterval ?dateTimeInterval . - ?dateTimeInterval core:start ?dateTimeStartValue . - ?dateTimeStartValue core:dateTime ?dateTimeStart - } WHERE { + PREFIX core: <http://vivoweb.org/ontology/core#> + CONSTRUCT { ?subject ?property ?advisorRole . ?advisorRole a core:AdvisorRole . - ?subject core:relatedBy ?advisingRel . ?advisorRole core:relatedBy ?advisingRel . ?advisingRel a core:AdvisingRelationship . ?advisingRel core:dateTimeInterval ?dateTimeInterval . ?dateTimeInterval core:start ?dateTimeStartValue . - ?dateTimeStartValue core:dateTime ?dateTimeStart - } - - - - PREFIX core: <http://vivoweb.org/ontology/core#> - CONSTRUCT { - ?subject ?property ?advisorRole . - ?advisorRole core:relatedBy ?advisingRel . - ?subject core:relatedBy ?advisingRel . - ?advisingRel a core:AdvisingRelationship . - ?advisingRel core:dateTimeInterval ?dateTimeInterval . - ?dateTimeInterval core:end ?dateTimeEndValue . - ?dateTimeEndValue core:dateTime ?dateTimeEnd + ?dateTimeStartValue core:dateTime ?dateTimeStart } WHERE { ?subject ?property ?advisorRole . ?advisorRole a core:AdvisorRole . - ?subject core:relatedBy ?advisingRel . + ?advisorRole core:relatedBy ?advisingRel . + ?advisingRel a core:AdvisingRelationship . + ?advisingRel core:dateTimeInterval ?dateTimeInterval . + ?dateTimeInterval core:start ?dateTimeStartValue . + ?dateTimeStartValue core:dateTime ?dateTimeStart + } + + + + PREFIX core: <http://vivoweb.org/ontology/core#> + CONSTRUCT { + ?subject ?property ?advisorRole . + ?advisorRole a core:AdvisorRole . ?advisorRole core:relatedBy ?advisingRel . ?advisingRel a core:AdvisingRelationship . ?advisingRel core:dateTimeInterval ?dateTimeInterval . ?dateTimeInterval core:end ?dateTimeEndValue . - ?dateTimeEndValue core:dateTime ?dateTimeEnd - } - + ?dateTimeEndValue core:dateTime ?dateTimeEnd + } WHERE { + ?subject ?property ?advisorRole . + ?advisorRole a core:AdvisorRole . + ?advisorRole core:relatedBy ?advisingRel . + ?advisingRel a core:AdvisingRelationship . + ?advisingRel core:dateTimeInterval ?dateTimeInterval . + ?dateTimeInterval core:end ?dateTimeEndValue . + ?dateTimeEndValue core:dateTime ?dateTimeEnd + } + diff --git a/productMods/templates/freemarker/edit/forms/js/advisorRelationshipUtils.js b/productMods/templates/freemarker/edit/forms/js/advisorRelationshipUtils.js index efa89fe4..ab991c22 100644 --- a/productMods/templates/freemarker/edit/forms/js/advisorRelationshipUtils.js +++ b/productMods/templates/freemarker/edit/forms/js/advisorRelationshipUtils.js @@ -25,6 +25,7 @@ var advisorRelUtils = { this.form = $('#personHasAdvisingRelationship'); this.adRelshiplabel = $('#advisingRelLabel'); this.advisee = $('#advisee'); + this.fauxLabel = $('#maskLabelBuilding'); this.subjArea = $('#SubjectArea'); this.firstName = $('#firstName'); this.lastName = $('#lastName'); @@ -56,6 +57,7 @@ var advisorRelUtils = { this.form.submit(function() { advisorRelUtils.resolveAdviseeNames(); advisorRelUtils.buildAdvisingRelLabel(); + }); }, @@ -75,9 +77,16 @@ var advisorRelUtils = { lastName = this.advisee.val(); name = lastName; + if (firstName) { name += ', ' + firstName; } + + // we don't want the user to see the label getting built, so hide the acSelector + // field and display a bogus field that just has the last name in it. + this.fauxLabel.val(lastName); + this.advisee.hide(); + this.fauxLabel.show(); this.advisee.val(name); this.lastName.val(lastName); } diff --git a/productMods/templates/freemarker/edit/forms/personHasAdvisorRelationship.ftl b/productMods/templates/freemarker/edit/forms/personHasAdvisorRelationship.ftl index e1e3d332..71dc39ac 100644 --- a/productMods/templates/freemarker/edit/forms/personHasAdvisorRelationship.ftl +++ b/productMods/templates/freemarker/edit/forms/personHasAdvisorRelationship.ftl @@ -124,6 +124,7 @@ Set this flag on the input acUriReceiver where you would like this behavior to o

+
diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasAdvisorRelationshipGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasAdvisorRelationshipGenerator.java index 285bd7b6..68d02e4e 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasAdvisorRelationshipGenerator.java +++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasAdvisorRelationshipGenerator.java @@ -93,7 +93,7 @@ public class PersonHasAdvisorRelationshipGenerator extends VivoBaseGenerator imp conf.addSparqlForExistingLiteral("endField-value", existingEndDateQuery); conf.addSparqlForExistingUris("advisingRelType", advisingRelTypeQuery); - conf.addSparqlForExistingUris("advisorRole", existingAdvisorRoleQuery); + conf.addSparqlForExistingUris("advisingRelationship", existingAdvisingRelQuery); conf.addSparqlForExistingUris("adviseeRole", existingAdviseeRoleQuery); conf.addSparqlForExistingUris("existingSubjArea", subjAreaQuery); conf.addSparqlForExistingUris("existingAdvisee", adviseeQuery); @@ -286,41 +286,63 @@ public class PersonHasAdvisorRelationshipGenerator extends VivoBaseGenerator imp /* Queries for editing an existing entry */ + final static String existingAdvisingRelQuery = + "SELECT ?advisingRelationship WHERE { \n" + + " ?advisorRole ?advisingRelationship . \n" + + " ?advisingRelationship ?advisorRole . \n" + + "}"; + final static String advisingRelTypeQuery = "PREFIX vitro: <" + VitroVocabulary.vitroURI + "> \n" + "SELECT ?advisingRelType WHERE { \n" + - " ?advisingRelationship vitro:mostSpecificType ?advisingRelType . \n" + + " ?advisorRole ?advisingRelationship . \n" + + " ?advisingRelationship ?advisorRole . \n" + + " ?advisingRelationship vitro:mostSpecificType ?advisingRelType . \n" + + "}"; + + final static String advisingRelLabelQuery = + "SELECT ?existingAdvisingRelLabel WHERE { \n" + + " ?advisorRole ?advisingRelationship . \n" + + " ?advisingRelationship ?advisorRole . \n" + + " ?advisingRelationship <" + label + "> ?existingAdvisingRelLabel . \n" + "}"; final static String adviseeQuery = "SELECT ?existingAdvisee WHERE { \n" + + " ?advisorRole ?advisingRelationship . \n" + + " ?advisingRelationship ?advisorRole . \n" + " ?advisingRelationship ?existingAdvisee . \n" + + " ?existingAdvisee ?advisingRelationship . \n" + " ?existingAdvisee a <" + adviseeClass + "> . \n" + - " FILTER (?person != ?existingAdvisee) . \n" + - "}"; - - final static String existingAdvisorRoleQuery = - "SELECT ?existingAdvisorRole WHERE { \n" + - "?advisingRelationship ?existingAdvisorRole . \n" + - "?existingAdvisorRole a <" + advisorRoleClass + "> . \n" + - "}"; - - final static String existingAdviseeRoleQuery = - "SELECT ?existingAdviseeRole WHERE { \n" + - " ?advisingRelationship ?existingAdviseeRole . \n" + - " ?existingAdviseeRole a <" + adviseeRoleClass + "> . \n" + + " ?existingAdvisee ?existingAdviseeRole . \n" + + " ?existingAdviseeRole a <" + adviseeRoleClass + "> . \n" + "}"; final static String adviseeLabelQuery = "SELECT ?existingAdviseeLabel WHERE { \n" + + " ?advisorRole ?advisingRelationship . \n" + + " ?advisingRelationship ?advisorRole . \n" + " ?advisingRelationship ?existingAdvisee . \n" + + " ?existingAdvisee ?advisingRelationship . \n" + " ?existingAdvisee a <" + adviseeClass + "> . \n" + " ?existingAdvisee <" + label + "> ?existingAdviseeLabel . \n" + - " FILTER (?person != ?existingAdvisee) . \n" + + " ?existingAdvisee ?existingAdviseeRole . \n" + + " ?existingAdviseeRole a <" + adviseeRoleClass + "> . \n" + + "}"; + + final static String existingAdviseeRoleQuery = + "SELECT ?existingAdviseeRole WHERE { \n" + + " ?advisorRole ?advisingRelationship . \n" + + " ?advisingRelationship ?advisorRole . \n" + + " ?advisingRelationship ?existingAdviseeRole . \n" + + " ?existingAdviseeRole ?advisingRelationship . \n" + + " ?existingAdviseeRole a <" + adviseeRoleClass + "> . \n" + "}"; final static String subjAreaQuery = "SELECT ?existingSubjArea WHERE { \n" + + " ?advisorRole ?advisingRelationship . \n" + + " ?advisingRelationship ?advisorRole . \n" + " ?advisingRelationship ?existingSubjArea . \n" + " ?existingSubjArea a . \n" + " ?existingSubjArea ?type \n" + @@ -328,25 +350,26 @@ public class PersonHasAdvisorRelationshipGenerator extends VivoBaseGenerator imp final static String subjAreaLabelQuery = "SELECT ?existingSubjAreaLabel WHERE { \n" + + " ?advisorRole ?advisingRelationship . \n" + + " ?advisingRelationship ?advisorRole . \n" + " ?advisingRelationship ?existingSubjArea . \n" + " ?existingSubjArea a . \n" + " ?existingSubjArea <" + label + "> ?existingSubjAreaLabel . \n" + " ?existingSubjArea ?type \n" + "}"; - final static String advisingRelLabelQuery = - "SELECT ?existingAdvisingRelLabel WHERE { \n" + - " ?advisingRelationship <" + label + "> ?existingAdvisingRelLabel . \n" + - "}"; - final static String degreeQuery = "SELECT ?existingDegree WHERE {\n"+ + " ?advisorRole ?advisingRelationship . \n" + + " ?advisingRelationship ?advisorRole . \n" + " ?advisingRelationship ?existingDegree . \n" + " ?existingDegree a <" + degreeClass + "> . \n" + "}"; final static String existingStartDateQuery = "SELECT ?existingDateStart WHERE { \n" + + " ?advisorRole ?advisingRelationship . \n" + + " ?advisingRelationship ?advisorRole . \n" + " ?advisingRelationship <" + advisingRelToInterval + "> ?intervalNode . \n" + " ?intervalNode a <" + intervalType + "> . \n" + " ?intervalNode <" + intervalToStart + "> ?startNode . \n" + @@ -355,6 +378,8 @@ public class PersonHasAdvisorRelationshipGenerator extends VivoBaseGenerator imp final static String existingEndDateQuery = "SELECT ?existingEndDate WHERE { \n" + + " ?advisorRole ?advisingRelationship . \n" + + " ?advisingRelationship ?advisorRole . \n" + " ?advisingRelationship <" + advisingRelToInterval + "> ?intervalNode . \n" + " ?intervalNode a <" + intervalType + "> . \n " + " ?intervalNode <" + intervalToEnd + "> ?endNode . \n" + @@ -363,11 +388,15 @@ public class PersonHasAdvisorRelationshipGenerator extends VivoBaseGenerator imp final static String existingIntervalNodeQuery = "SELECT ?existingIntervalNode WHERE { \n" + + " ?advisorRole ?advisingRelationship . \n" + + " ?advisingRelationship ?advisorRole . \n" + " ?advisingRelationship <" + advisingRelToInterval + "> ?existingIntervalNode . \n" + " ?existingIntervalNode a <" + intervalType + "> . }"; final static String existingStartNodeQuery = "SELECT ?existingStartNode WHERE { \n" + + " ?advisorRole ?advisingRelationship . \n" + + " ?advisingRelationship ?advisorRole . \n" + " ?advisingRelationship <" + advisingRelToInterval + "> ?intervalNode . \n" + " ?intervalNode a <" + intervalType + "> . \n" + " ?intervalNode <" + intervalToStart + "> ?existingStartNode . \n" + @@ -375,6 +404,8 @@ public class PersonHasAdvisorRelationshipGenerator extends VivoBaseGenerator imp final static String existingEndNodeQuery = "SELECT ?existingEndNode WHERE { \n" + + " ?advisorRole ?advisingRelationship . \n" + + " ?advisingRelationship ?advisorRole . \n" + " ?advisingRelationship <" + advisingRelToInterval + "> ?intervalNode . \n" + " ?intervalNode a <" + intervalType + "> . \n" + " ?intervalNode <" + intervalToEnd + "> ?existingEndNode . \n" + @@ -382,6 +413,8 @@ public class PersonHasAdvisorRelationshipGenerator extends VivoBaseGenerator imp final static String existingStartPrecisionQuery = "SELECT ?existingStartPrecision WHERE { \n" + + " ?advisorRole ?advisingRelationship . \n" + + " ?advisingRelationship ?advisorRole . \n" + " ?advisingRelationship <" + advisingRelToInterval + "> ?intervalNode . \n" + " ?intervalNode a <" + intervalType + "> . \n" + " ?intervalNode <" + intervalToStart + "> ?startNode . \n" + @@ -390,6 +423,8 @@ public class PersonHasAdvisorRelationshipGenerator extends VivoBaseGenerator imp final static String existingEndPrecisionQuery = "SELECT ?existingEndPrecision WHERE { \n" + + " ?advisorRole ?advisingRelationship . \n" + + " ?advisingRelationship ?advisorRole . \n" + " ?advisingRelationship <" + advisingRelToInterval + "> ?intervalNode . \n" + " ?intervalNode a <" + intervalType + "> . \n" + " ?intervalNode <" + intervalToEnd + "> ?endNode . \n" +