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

@ -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"+
"}";