VIVO-112: more updates for educational training and a change for organizationHasPositionHistory

This commit is contained in:
tworrall 2013-09-10 11:33:20 -04:00
parent c367ce4fd6
commit fbf2c4b651
6 changed files with 97 additions and 63 deletions

View file

@ -26,7 +26,13 @@
?trainingType rdfs:subClassOf core:EducationalProcess .
?trainingType rdfs:label ?typeName
}
OPTIONAL { ?edTraining core:relates ?org .
OPTIONAL { ?edTraining <http://purl.obolibrary.org/obo/RO_0002234> ?awardedDegree .
?awardedDegree core:relates ?degree .
?degree a core:AcademicDegree
OPTIONAL { ?degree rdfs:label ?degreeName }
OPTIONAL { ?degree core:abbreviation ?degreeAbbr }
}
OPTIONAL { ?awardedDegree core:assignedBy ?org .
?org rdfs:label ?orgName
<collated>
OPTIONAL { ?org vitro:mostSpecificType ?subclass .
@ -34,12 +40,6 @@
}
</collated>
}
OPTIONAL { ?edTraining &lt;http://purl.obolibrary.org/obo/RO_0002234&gt; ?awardedDegree .
?awardedDegree core:relates ?degree .
?degree a core:AcademicDegree
OPTIONAL { ?degree rdfs:label ?degreeName }
OPTIONAL { ?degree core:abbreviation ?degreeAbbr }
}
OPTIONAL { ?edTraining core:majorField ?majorField }
OPTIONAL { ?edTraining core:departmentOrSchool ?deptOrSchool }
OPTIONAL { ?edTraining core:supplementalInformation ?info }
@ -74,9 +74,9 @@
?subject ?property ?edTraining .
?edTraining a core:EducationalProcess .
?edTraining ?edTrainingProp ?edTrainingValue .
?edTraining core:relates ?org .
?org rdfs:label ?orgName .
?edTraining &lt;http://purl.obolibrary.org/obo/RO_0002234&gt; ?awardedDegree .
?awardedDegree core:assignedBy ?org .
?org rdfs:label ?orgName .
?awardedDegree core:relates ?degree .
?edTraining core:dateTimeInterval ?dateTimeInterval
} WHERE {
@ -92,14 +92,15 @@
UNION {
?subject ?property ?edTraining .
?edTraining a core:EducationalProcess .
?edTraining core:relates ?org .
?org rdfs:label ?orgName
}
?edTraining &lt;http://purl.obolibrary.org/obo/RO_0002234&gt; ?awardedDegree .
}
UNION {
?subject ?property ?edTraining .
?edTraining a core:EducationalProcess .
?edTraining &lt;http://purl.obolibrary.org/obo/RO_0002234&gt; ?awardedDegree .
}
?awardedDegree core:assignedBy ?org .
?org rdfs:label ?orgName
}
UNION {
?subject ?property ?edTraining .
?edTraining a core:EducationalProcess .

View file

@ -31,7 +31,7 @@
LET (?activityName := afn:localname(?activity))
OPTIONAL { ?activity rdfs:label ?activityLabel }
}
OPTIONAL { ?role &lt;http://vivoweb.org/ontology/core#relatedBy&gt; ?activity
OPTIONAL { ?role &lt;http://vivoweb.org/ontology/core#relates&gt; ?activity
LET (?activityName := afn:localname(?activity))
OPTIONAL { ?activity rdfs:label ?activityLabel }
}
@ -49,7 +49,7 @@
?dateTimeEndValueRole core:dateTime ?dateTimeEndRole
}
}
OPTIONAL { ?role &lt;http://vivoweb.org/ontology/core#relatedBy&gt; ?grant .
OPTIONAL { ?role &lt;http://vivoweb.org/ontology/core#relates&gt; ?grant .
?grant core:dateTimeInterval ?dateTimeIntervalGrant
OPTIONAL { ?dateTimeIntervalGrant core:start ?dateTimeStartValueGrant .
?dateTimeStartValueGrant core:dateTime ?dateTimeStartGrant
@ -77,7 +77,7 @@
{
?subject ?property ?role .
?role a ?objectType .
?role &lt;http://vivoweb.org/ontology/core#relatedBy&gt; ?activity
?role &lt;http://vivoweb.org/ontology/core#relates&gt; ?activity
} UNION
{
?subject ?property ?role .
@ -96,18 +96,18 @@
CONSTRUCT {
?subject ?property ?role .
?role a ?objectType .
?role &lt;http://vivoweb.org/ontology/core#relatedBy&gt; ?activity .
?role &lt;http://vivoweb.org/ontology/core#relates&gt; ?activity .
?activity rdfs:label ?activityLabel
} WHERE {
{
?subject ?property ?role .
?role a ?objectType .
?role &lt;http://vivoweb.org/ontology/core#relatedBy&gt; ?activity
?role &lt;http://vivoweb.org/ontology/core#relates&gt; ?activity
} UNION
{
?subject ?property ?role .
?role a ?objectType .
?role &lt;http://vivoweb.org/ontology/core#relatedBy&gt; ?activity .
?role &lt;http://vivoweb.org/ontology/core#relates&gt; ?activity .
?activity rdfs:label ?activityLabel
}
}
@ -135,7 +135,7 @@
} UNION {
?subject ?property ?role .
?role a ?objectType .
?role &lt;http://vivoweb.org/ontology/core#relatedBy&gt; ?activity .
?role &lt;http://vivoweb.org/ontology/core#relates&gt; ?activity .
?activity rdfs:label ?activityName
} UNION {
?subject ?property ?role .
@ -145,23 +145,23 @@
} UNION {
?subject ?property ?role .
?role a ?objectType .
?role &lt;http://vivoweb.org/ontology/core#relatedBy&gt; ?activity .
?role &lt;http://vivoweb.org/ontology/core#relates&gt; ?activity .
?activity core:grantAwardedBy ?awardedBy
} UNION {
?subject ?property ?role .
?role a ?objectType .
?role &lt;http://vivoweb.org/ontology/core#relatedBy&gt; ?activity .
?role &lt;http://vivoweb.org/ontology/core#relates&gt; ?activity .
?activity core:grantAwardedBy ?awardedBy .
?awardedBy rdfs:label ?awardedByLabel
} UNION {
?subject ?property ?role .
?role a ?objectType .
?role &lt;http://vivoweb.org/ontology/core#relatedBy&gt; ?activity .
?role &lt;http://vivoweb.org/ontology/core#relates&gt; ?activity .
?activity core:administeredBy ?adminedBy
} UNION {
?subject ?property ?role .
?role a ?objectType .
?role &lt;http://vivoweb.org/ontology/core#relatedBy&gt; ?activity .
?role &lt;http://vivoweb.org/ontology/core#relates&gt; ?activity .
?activity core:administeredBy ?adminedBy .
?adminedBy rdfs:label ?adminedByLabel
}
@ -206,14 +206,14 @@
CONSTRUCT {
?subject ?property ?role .
?role a ?objectType .
?role &lt;http://vivoweb.org/ontology/core#relatedBy&gt; ?grant .
?role &lt;http://vivoweb.org/ontology/core#relates&gt; ?grant .
?grant core:dateTimeInterval ?dateTimeIntervalGrant .
?dateTimeIntervalGrant core:start ?dateTimeStartValueGrant .
?dateTimeStartValueGrant core:dateTime ?dateTimeStartGrant
} WHERE {
?subject ?property ?role .
?role a ?objectType .
?role &lt;http://vivoweb.org/ontology/core#relatedBy&gt; ?grant .
?role &lt;http://vivoweb.org/ontology/core#relates&gt; ?grant .
?grant core:dateTimeInterval ?dateTimeIntervalGrant .
?dateTimeIntervalGrant core:start ?dateTimeStartValueGrant .
?dateTimeStartValueGrant core:dateTime ?dateTimeStartGrant
@ -225,14 +225,14 @@
CONSTRUCT {
?subject ?property ?role .
?role a ?objectType .
?role &lt;http://vivoweb.org/ontology/core#relatedBy&gt; ?grant .
?role &lt;http://vivoweb.org/ontology/core#relates&gt; ?grant .
?grant core:dateTimeInterval ?dateTimeIntervalGrant .
?dateTimeIntervalGrant core:end ?dateTimeEndValueGrant .
?dateTimeEndValueGrant core:dateTime ?dateTimeEndGrant
} WHERE {
?subject ?property ?role .
?role a ?objectType .
?role &lt;http://vivoweb.org/ontology/core#relatedBy&gt; ?grant .
?role &lt;http://vivoweb.org/ontology/core#relates&gt; ?grant .
?grant core:dateTimeInterval ?dateTimeIntervalGrant .
?dateTimeIntervalGrant core:end ?dateTimeEndValueGrant .
?dateTimeEndValueGrant core:dateTime ?dateTimeEndGrant

View file

@ -9,6 +9,7 @@
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;
PREFIX afn: &lt;http://jena.hpl.hp.com/ARQ/function#&gt;
PREFIX vitro: &lt;http://vitro.mannlib.cornell.edu/ns/vitro/0.7#&gt;
PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt;
SELECT DISTINCT <collated> ?subclass </collated>
?position
@ -19,6 +20,7 @@
WHERE {
?subject ?property ?position
OPTIONAL { ?position core:relates ?person .
?person a foaf:Person .
?person rdfs:label ?personName
}
<collated>
@ -51,29 +53,38 @@
PREFIX vitro: &lt;http://vitro.mannlib.cornell.edu/ns/vitro/0.7#&gt;
CONSTRUCT {
?subject ?property ?position .
?position a core:Position .
?position vitro:mostSpecificType ?subclass
} WHERE {
?subject ?property ?position .
?position a core:Position .
?position vitro:mostSpecificType ?subclass
}
</query-construct>
<query-construct>
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt;
CONSTRUCT {
?subject ?property ?position .
?position a core:Position .
?position ?positionProperty ?positionValue .
?position core:relates ?person .
?person a foaf:Person .
?person rdfs:label ?personName
} WHERE {
{
?subject ?property ?position
?subject ?property ?position .
?position a core:Position .
} UNION {
?subject ?property ?position .
?position a core:Position .
?position ?positionProperty ?positionValue
} UNION {
?subject ?property ?position .
?position core:positionForPerson ?person .
?position core:relates ?person .
?person a foaf:Person .
?person rdfs:label ?personName
}
}
@ -83,11 +94,13 @@
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;
CONSTRUCT {
?subject ?property ?position .
?position a core:Position .
?position core:dateTimeInterval ?dateTimeInterval .
?dateTimeInterval core:start ?dateTimeStartValue .
?dateTimeStartValue core:dateTime ?dateTimeStart
} WHERE {
?subject ?property ?position .
?subject ?property ?position .
?position a core:Position .
?position core:dateTimeInterval ?dateTimeInterval .
?dateTimeInterval core:start ?dateTimeStartValue .
?dateTimeStartValue core:dateTime ?dateTimeStart
@ -98,11 +111,13 @@
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;
CONSTRUCT {
?subject ?property ?position .
?position a core:Position .
?position core:dateTimeInterval ?dateTimeInterval .
?dateTimeInterval core:end ?dateTimeEndValue .
?dateTimeEndValue core:dateTime ?dateTimeEnd
} WHERE {
?subject ?property ?position .
?position a core:Position .
?position core:dateTimeInterval ?dateTimeInterval .
?dateTimeInterval core:end ?dateTimeEndValue .
?dateTimeEndValue core:dateTime ?dateTimeEnd

View file

@ -44,7 +44,7 @@ Set this flag on the input acUriReceiver where you would like this behavior to o
<#assign submissionErrors = editSubmission.validationErrors/>
</#if>
<#if editMode == "edit">
<#if editMode == "edit" || editMode == "repair">
<#assign titleVerb="${i18n().edit_capitalized}">
<#assign submitButtonText="${i18n().save_changes}">
<#assign disabledVal="disabled">
@ -164,7 +164,7 @@ Set this flag on the input acUriReceiver where you would like this behavior to o
<option value="${key}" <#if degreeValue = key>selected</#if>>${degreeOpts[key]}</option>
</#list>
</select>
<#if editMode == "edit">
<#if editMode == "edit" || editMode == "repair">
<input type="hidden" id="newAwardedDegreeLabel" name="awardedDegreeLabel" value=""/>
<input type="hidden" id="awardedDegreeLabel" name="existingAwardedDegreeLabel" value="${existingADLabelValue!}"/>
<#else>

View file

@ -43,13 +43,13 @@ public class OrganizationHasPositionHistoryGenerator extends VivoBaseGenerator
+ "PREFIX core: <http://vivoweb.org/ontology/core#> \n"
+ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
+ "SELECT ?existingPerson WHERE { \n"
+ " ?position core:positionForPerson ?existingPerson .}";
+ " ?position core:relates ?existingPerson .}";
private static final String QUERY_EXISTING_PERSON_LABEL = ""
+ "PREFIX core: <http://vivoweb.org/ontology/core#> \n"
+ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
+ "SELECT ?existingPersonLabel WHERE { \n"
+ " ?position core:positionForPerson ?existingPerson . \n"
+ " ?position core:relates ?existingPerson . \n"
+ " ?existingPerson rdfs:label ?existingPersonLabel . }";
private static final String QUERY_EXISTING_INTERVAL_NODE = ""
@ -113,18 +113,18 @@ public class OrganizationHasPositionHistoryGenerator extends VivoBaseGenerator
private static final String N3_NEW_POSITION = ""
+ "@prefix core: <http://vivoweb.org/ontology/core#> . \n"
+ "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . \n"
+ "?organization core:organizationForPosition ?position . \n"
+ "?organization core:relatedBy ?position . \n"
+ "?position a core:Position . \n"
+ "?position a ?positionType . \n"
+ "?position rdfs:label ?positionTitle . \n"
+ "?position core:positionInOrganization ?organization . ";
+ "?position core:relates ?organization . ";
private static final String N3_NEW_PERSON = ""
+ "@prefix core: <http://vivoweb.org/ontology/core#> . \n"
+ "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . \n"
+ "@prefix foaf: <http://xmlns.com/foaf/0.1/> . \n"
+ "?position core:positionForPerson ?person . \n"
+ "?person core:personInPosition ?position . \n"
+ "?position core:relates ?person . \n"
+ "?person core:relatedBy ?position . \n"
+ "?person a foaf:Person . \n"
+ "?person rdfs:label ?personLabel . ";
@ -138,8 +138,8 @@ public class OrganizationHasPositionHistoryGenerator extends VivoBaseGenerator
private static final String N3_EXISTING_PERSON = ""
+ "@prefix core: <http://vivoweb.org/ontology/core#> . \n"
+ "?position core:positionForPerson ?existingPerson . \n"
+ "?existingPerson core:personInPosition ?position . \n";
+ "?position core:relates ?existingPerson . \n"
+ "?existingPerson core:relatedBy ?position . \n";
private static final String N3_NEW_START_NODE = ""
+ "@prefix core: <http://vivoweb.org/ontology/core#> . \n"

View file

@ -90,8 +90,8 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
conf.setN3Required( Arrays.asList( n3ForNewEdTraining, trainingTypeAssertion ) );
conf.setN3Optional(Arrays.asList(
n3ForNewOrg, n3ForExistingOrg, n3ForNewAwardedDegree,
majorFieldAssertion,
n3ForNewOrgExistingAwardedDegree, n3ForExistingOrgExistingAwardedDegree, n3ForNewAwardedDegreeNewOrg,
majorFieldAssertion, n3ForNewAwardedDegreeExistingOrg,
//existingDegreeTypeAssertion,
existingAwardedDegreeLabel, deptAssertion, infoAssertion, n3ForStart, n3ForEnd ));
@ -229,15 +229,30 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
final static String trainingTypeAssertion =
"?edTraining a ?trainingType .";
final static String n3ForNewAwardedDegree =
final static String n3ForNewAwardedDegreeNewOrg =
"@prefix core: <"+ vivoCore +"> .\n"+
"?edTraining <http://purl.obolibrary.org/obo/RO_0002234> ?newAwardedDegree . \n" +
"?newAwardedDegree <http://purl.obolibrary.org/obo/RO_0002353> ?edTraining . \n" +
"?newAwardedDegree <http://vivoweb.org/ontology/core#relates> ?person . \n" +
"?person <http://vivoweb.org/ontology/core#relatedBy> ?newAwardedDegree . \n" +
"?newAwardedDegree <"+ label +"> ?awardedDegreeLabel . \n" +
"?newOrg <http://vivoweb.org/ontology/core#assigns> ?newAwardedDegree . \n" +
"?newAwardedDegree <http://vivoweb.org/ontology/core#assignedBy> ?newOrg . \n" +
"?newOrg <http://vivoweb.org/ontology/core#assigns> ?newAwardedDegree . \n" +
"?newOrg a ?orgType . \n" +
"?newOrg <"+ label +"> ?orgLabel . \n" +
"?newAwardedDegree <http://vivoweb.org/ontology/core#relates> ?degreeType .\n"+
"?degreeType <http://vivoweb.org/ontology/core#relatedBy> ?newAwardedDegree . \n"+
"?newAwardedDegree a core:AwardedDegree .";
final static String n3ForNewAwardedDegreeExistingOrg =
"@prefix core: <"+ vivoCore +"> .\n"+
"?edTraining <http://purl.obolibrary.org/obo/RO_0002234> ?newAwardedDegree . \n" +
"?newAwardedDegree <http://purl.obolibrary.org/obo/RO_0002353> ?edTraining . \n" +
"?newAwardedDegree <http://vivoweb.org/ontology/core#relates> ?person . \n" +
"?person <http://vivoweb.org/ontology/core#relatedBy> ?newAwardedDegree . \n" +
"?newAwardedDegree <"+ label +"> ?awardedDegreeLabel . \n" +
"?existingOrg <http://vivoweb.org/ontology/core#assigns> ?newAwardedDegree . \n" +
"?newAwardedDegree <http://vivoweb.org/ontology/core#assignedBy> ?existingOrg . \n" +
"?newAwardedDegree <http://vivoweb.org/ontology/core#relates> ?degreeType .\n"+
"?degreeType <http://vivoweb.org/ontology/core#relatedBy> ?newAwardedDegree . \n"+
"?newAwardedDegree a core:AwardedDegree .";
@ -249,15 +264,15 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
"?degreeType <http://vivoweb.org/ontology/core#relatedBy> ?existingAwardedDegree . \n"+
"?existingAwardedDegree <"+ label +"> ?existingAwardedDegreeLabel . " ;
final static String n3ForNewOrg =
"?edTraining <http://vivoweb.org/ontology/core#relates> ?newOrg . \n" +
"?newOrg <http://vivoweb.org/ontology/core#relatedBy> ?edTraining . \n" +
final static String n3ForNewOrgExistingAwardedDegree =
"?existingAwardedDegree <http://vivoweb.org/ontology/core#assignedBy> ?newOrg . \n" +
"?newOrg <http://vivoweb.org/ontology/core#assigns> ?existingAwardedDegree . \n" +
"?newOrg <"+ label +"> ?orgLabel . \n" +
"?newOrg a ?orgType .";
final static String n3ForExistingOrg =
"?edTraining <http://vivoweb.org/ontology/core#relates> ?existingOrg . \n" +
"?existingOrg <http://vivoweb.org/ontology/core#relatedBy> ?edTraining . \n" +
final static String n3ForExistingOrgExistingAwardedDegree =
"?existingAwardedDegree <http://vivoweb.org/ontology/core#assignedBy> ?existingOrg . \n" +
"?existingOrg <http://vivoweb.org/ontology/core#assigns> ?existingAwardedDegree . \n" +
"?existingOrg a ?orgType . ";
final static String majorFieldAssertion =
@ -287,16 +302,6 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
/* Queries for editing an existing educational training entry */
final static String existingOrgQuery =
"SELECT ?existingOrg WHERE {\n"+
"?edTraining <http://vivoweb.org/ontology/core#relates> ?existingOrg . }\n";
final static String orgLabelQuery =
"SELECT ?existingOrgLabel WHERE {\n"+
"?edTraining <http://vivoweb.org/ontology/core#relates> ?existingOrg .\n"+
"?existingOrg <"+ label +"> ?existingOrgLabel .\n"+
"}";
final static String existingAwardedDegreeQuery =
"SELECT ?existingAwardedDegree WHERE {\n"+
"?edTraining <http://purl.obolibrary.org/obo/RO_0002234> ?existingAwardedDegree . }\n";
@ -306,12 +311,25 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
"?edTraining <http://purl.obolibrary.org/obo/RO_0002234> ?existingAwardedDegree . \n" +
"?existingAwardedDegree <"+ label +"> ?existingAwardedDegreeLabel }\n";
final static String existingOrgQuery =
"SELECT ?existingOrg WHERE {\n"+
"?edTraining <http://purl.obolibrary.org/obo/RO_0002234> ?existingAwardedDegree . \n" +
"?existingAwardedDegree <http://vivoweb.org/ontology/core#assignedBy> ?existingOrg . }\n";
final static String orgLabelQuery =
"SELECT ?existingOrgLabel WHERE {\n"+
"?edTraining <http://purl.obolibrary.org/obo/RO_0002234> ?existingAwardedDegree . \n" +
"?existingAwardedDegree <http://vivoweb.org/ontology/core#assignedBy> ?existingOrg .\n"+
"?existingOrg <"+ label +"> ?existingOrgLabel .\n"+
"}";
/* Limit type to subclasses of foaf:Organization. Otherwise, sometimes owl:Thing or another
type is returned and we don't get a match to the select element options. */
final static String orgTypeQuery =
"PREFIX rdfs: <"+ rdfs +"> \n"+
"SELECT ?existingOrgType WHERE {\n"+
"?edTraining <http://vivoweb.org/ontology/core#relates> ?existingOrg .\n"+
"?edTraining <http://purl.obolibrary.org/obo/RO_0002234> ?existingAwardedDegree . \n" +
"?existingAwardedDegree <http://vivoweb.org/ontology/core#assignedBy> ?existingOrg .\n"+
"?existingOrg a ?existingOrgType .\n"+
"?existingOrgType rdfs:subClassOf <"+ orgClass +"> .\n"+
"}";