NIHVIVO-3186 fully functional?

This commit is contained in:
j2blake 2011-11-22 16:52:18 +00:00
parent e6e37662d1
commit 58b8176a39
2 changed files with 37 additions and 20 deletions

View file

@ -25,6 +25,7 @@
<#assign positionTitleValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "positionTitle") /> <#assign positionTitleValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "positionTitle") />
<#assign positionTypeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "positionType") /> <#assign positionTypeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "positionType") />
<#assign personValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "person") />
<#assign personLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "personLabel") /> <#assign personLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "personLabel") />
<#if editSubmission?has_content && editSubmission.submissionExists = true && editSubmission.validationErrors?has_content> <#if editSubmission?has_content && editSubmission.submissionExists = true && editSubmission.validationErrors?has_content>
@ -94,7 +95,12 @@
<p> <p>
<label for="relatedIndLabel">Person</label> <label for="relatedIndLabel">Person</label>
<input class="acSelector" size="50" type="text" id="relatedIndLabel" name="personLabel" value="${personLabelValue}" /> <#if editMode == "edit">
<input class="acSelector" size="50" type="text" id="relatedIndLabel" name="personLabel" value="${personLabelValue}" disabled="disabled" >
<input class="acLabelReceiver" type="hidden" id="existingPersonLabel" name="personLabel" value="${personLabelValue}" />
<#else>
<input class="acSelector" size="50" type="text" id="relatedIndLabel" name="personLabel" value="${personLabelValue}" >
</#if>
</p> </p>
<div class="acSelection"> <div class="acSelection">
@ -103,8 +109,7 @@
<span class="acSelectionInfo"></span> <span class="acSelectionInfo"></span>
<a href="/vivo/individual?uri=" class="verifyMatch">(Verify this match)</a> <a href="/vivo/individual?uri=" class="verifyMatch">(Verify this match)</a>
</p> </p>
<input class="acUriReceiver" type="hidden" id="personUri" name="personLabel" value="" /> <input class="acUriReceiver" type="hidden" id="personUri" name="person" value="${personValue}" />
<input class="acLabelReceiver" type="hidden" id="existingPersonLabel" name="existingPersonLabel" value="${personLabelValue}" />
</div> </div>
<br /> <br />

View file

@ -20,13 +20,10 @@ public class OrganizationHasPositionHistoryGenerator extends VivoBaseGenerator
private final static String NS_VIVO_CORE = "http://vivoweb.org/ontology/core#"; private final static String NS_VIVO_CORE = "http://vivoweb.org/ontology/core#";
private final static String URI_RDFS_LABEL = RDFS.label.getURI();
private static final String URI_PRECISION_NONE = Precision.NONE.uri(); private static final String URI_PRECISION_NONE = Precision.NONE.uri();
private static final String URI_PRECISION_YEAR = Precision.YEAR.uri(); private static final String URI_PRECISION_YEAR = Precision.YEAR.uri();
private final static String URI_POSITION_CLASS = vivoCore("Position"); private final static String URI_POSITION_CLASS = vivoCore("Position");
private final static String URI_POSITION_FOR_PERSON = vivoCore("positionForPerson");
private final static String URI_INTERVAL_FOR_POSITION = vivoCore("dateTimeInterval"); private final static String URI_INTERVAL_FOR_POSITION = vivoCore("dateTimeInterval");
private final static String URI_DATE_TIME_INTERVAL_CLASS = vivoCore("DateTimeInterval"); private final static String URI_DATE_TIME_INTERVAL_CLASS = vivoCore("DateTimeInterval");
private final static String URI_DATE_TIME_VALUE_CLASS = vivoCore("DateTimeValue"); private final static String URI_DATE_TIME_VALUE_CLASS = vivoCore("DateTimeValue");
@ -40,23 +37,33 @@ public class OrganizationHasPositionHistoryGenerator extends VivoBaseGenerator
return NS_VIVO_CORE + localName; return NS_VIVO_CORE + localName;
} }
private static final String QUERY_EXISTING_POSITION_TITLE = "SELECT ?existingPositionTitle WHERE { \n" private static final String QUERY_EXISTING_POSITION_TITLE = ""
+ "?position <" + URI_RDFS_LABEL + "> ?existingPositionTitle . }"; + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
+ "SELECT ?existingPositionTitle WHERE { \n"
+ " ?position rdfs:label ?existingPositionTitle . }";
private static final String QUERY_EXISTING_POSITION_TYPE = "SELECT ?existingPositionType WHERE { \n" private static final String QUERY_EXISTING_POSITION_TYPE = ""
+ "SELECT ?existingPositionType WHERE { \n"
+ " ?position a ?existingPositionType . }"; + " ?position a ?existingPositionType . }";
private static final String QUERY_EXISTING_PERSON_LABEL = String.format( private static final String QUERY_EXISTING_PERSON = ""
"SELECT ?existingPersonLabel WHERE { \n" + "PREFIX core: <http://vivoweb.org/ontology/core#> \n"
+ " ?position <%1$s> ?existingPerson . \n" + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
+ " ?existingPerson <%2$s> ?existingPersonLabel . }", + "SELECT ?existingPerson WHERE { \n"
URI_POSITION_FOR_PERSON, URI_RDFS_LABEL); + " ?position core:positionForPerson ?existingPerson .}";
private static final String QUERY_EXISTING_INTERVAL_NODE = String.format( private static final String QUERY_EXISTING_PERSON_LABEL = ""
"SELECT ?existingIntervalNode WHERE { \n" + "PREFIX core: <http://vivoweb.org/ontology/core#> \n"
+ " ?position <%1$s> ?existingIntervalNode . \n" + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
+ " ?existingIntervalNode a <%2$s> . }", + "SELECT ?existingPersonLabel WHERE { \n"
URI_INTERVAL_FOR_POSITION, URI_DATE_TIME_INTERVAL_CLASS); + " ?position core:positionForPerson ?existingPerson . \n"
+ " ?existingPerson rdfs:label ?existingPersonLabel . }";
private static final String QUERY_EXISTING_INTERVAL_NODE = ""
+ "PREFIX core: <http://vivoweb.org/ontology/core#> \n"
+ "SELECT ?existingIntervalNode WHERE { \n"
+ " ?position core:dateTimeInterval ?existingIntervalNode . \n"
+ " ?existingIntervalNode a core:DateTimeInterval . }";
private static final String QUERY_EXISTING_START_NODE = String.format( private static final String QUERY_EXISTING_START_NODE = String.format(
"SELECT ?existingStartNode WHERE { \n" "SELECT ?existingStartNode WHERE { \n"
@ -180,9 +187,10 @@ public class OrganizationHasPositionHistoryGenerator extends VivoBaseGenerator
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);
conf.setUrisOnform(Arrays.asList("position", "positionType")); conf.setUrisOnform(Arrays.asList("person", "position", "positionType"));
conf.addSparqlForExistingUris("positionType", conf.addSparqlForExistingUris("positionType",
QUERY_EXISTING_POSITION_TYPE); QUERY_EXISTING_POSITION_TYPE);
conf.addSparqlForExistingUris("person", QUERY_EXISTING_PERSON);
conf.addSparqlForExistingUris("intervalNode", conf.addSparqlForExistingUris("intervalNode",
QUERY_EXISTING_INTERVAL_NODE); QUERY_EXISTING_INTERVAL_NODE);
@ -215,6 +223,10 @@ public class OrganizationHasPositionHistoryGenerator extends VivoBaseGenerator
.setRangeDatatypeUri(XSD.xstring.toString()) .setRangeDatatypeUri(XSD.xstring.toString())
.setValidators(list("nonempty"))); .setValidators(list("nonempty")));
conf.addField(new FieldVTwo().setName("person")
.setOptionsType(FieldVTwo.OptionsType.INDIVIDUALS_VIA_VCLASS)
.setObjectClassUri(personClass));
conf.addField(new FieldVTwo().setName("personLabel") conf.addField(new FieldVTwo().setName("personLabel")
.setRangeDatatypeUri(XSD.xstring.toString()) .setRangeDatatypeUri(XSD.xstring.toString())
.setValidators(list("nonempty"))); .setValidators(list("nonempty")));