updates for adding concepts, including urls for agrovoc and umls services and updating person has educational training to add the inverse property from organization to educational training
This commit is contained in:
parent
c240321458
commit
49ff104d3a
7 changed files with 39 additions and 33 deletions
|
@ -206,7 +206,7 @@ var addConceptForm = {
|
|||
var htmlAdd = "<li class='concepts'>" +
|
||||
"<div class='row'>" +
|
||||
"<span class='column conceptLabel'>" +
|
||||
addConceptForm.generateIndividualCUIInput(cuiURI, label, definition, type, definedBy) +
|
||||
addConceptForm.generateIndividualCUIInput(cuiURI, label, type, definedBy) +
|
||||
label + addConceptForm.generateIndividualTypeDisplay(type) + "</span>" +
|
||||
addConceptForm.generateIndividualDefinitionDisplay(definition) +
|
||||
"</div>" +
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
<#assign existingConcepts = editConfiguration.pageData.existingConcepts/>
|
||||
<#assign userDefinedConceptUrl = editConfiguration.pageData.userDefinedConceptUrl/>
|
||||
<#assign sources = editConfiguration.pageData.searchServices/>
|
||||
|
||||
<#--If edit submission exists, then retrieve validation errors if they exist-->
|
||||
<#if editSubmission?has_content && editSubmission.submissionExists = true && editSubmission.validationErrors?has_content>
|
||||
|
@ -10,10 +11,6 @@
|
|||
</#if>
|
||||
|
||||
|
||||
<#--This is set for testing purposes - will be retrieved dynamically from the generator later-->
|
||||
<#assign sources = [{"uri":"http://link.informatics.stonybrook.edu/umls/", "label":"UMLS"}, {"uri":"http://www.fao.org/webservices/Agrovoc", "label":"Agrovoc"}]/>
|
||||
<#assign selectedSource = "UMLS" />
|
||||
|
||||
<h2>Manage Concepts</h2>
|
||||
|
||||
|
||||
|
@ -81,9 +78,9 @@
|
|||
</div>
|
||||
<form id="addConceptForm" class="customForm" action="${submitUrl}">
|
||||
|
||||
<#list sources as source>
|
||||
<input type="radio" id="source" name="source" value="${source.uri}" role="radio" <#if selectedSource = source.uri>checked</#if> />
|
||||
<label class="inline" for="${source.label}"> ${source.label}</label>
|
||||
<#list sources?keys as sourceUri>
|
||||
<input type="radio" id="source" name="source" value="${sourceUri}" role="radio" />
|
||||
<label class="inline" for="${sources[sourceUri]}"> ${sources[sourceUri]}</label>
|
||||
<br />
|
||||
</#list>
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ public class AgrovocService implements ExternalConceptService {
|
|||
//XMLUtils.serializeNode(node); System.out.println();
|
||||
|
||||
Concept concept = new Concept();
|
||||
concept.setDefinedBy("Agrovoc");
|
||||
concept.setDefinedBy("http://aims.fao.org/aos/agrovoc/agrovocScheme");
|
||||
concept.setConceptId(termcode);
|
||||
|
||||
NamedNodeMap attrs = node.getAttributes();
|
||||
|
|
|
@ -82,7 +82,7 @@ public class UMLSService implements ExternalConceptService {
|
|||
JSONObject o = bestMatchArray.getJSONObject(i);
|
||||
//System.out.println(o.toString());
|
||||
Concept concept = new Concept();
|
||||
concept.setDefinedBy("UMLS");
|
||||
concept.setDefinedBy("http://link.informatics.stonybrook.edu/umls");
|
||||
concept.setBestMatch("true");
|
||||
String cui = getJsonValue(o, "CUI");
|
||||
bestMatchIdList.add(cui);
|
||||
|
|
|
@ -54,6 +54,7 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
|||
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.ConceptSearchService.ConceptSearchServiceUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.generators.EditModeUtils;
|
||||
/**
|
||||
|
@ -306,19 +307,12 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
|||
//Form specific data
|
||||
public void addFormSpecificData(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
|
||||
HashMap<String, Object> formSpecificData = new HashMap<String, Object>();
|
||||
//Existing concepts should probably be a hash map or a hash map of classes
|
||||
//with URI of concept node to label and information about existing URI
|
||||
//This would be a sparql query and would need to be run here?
|
||||
//-------------------->For test purposes
|
||||
List<AssociatedConceptInfo> testInfo = new ArrayList<AssociatedConceptInfo>();
|
||||
testInfo.add(new AssociatedConceptInfo("testLabel", "testURI", "testVocabURI", "testVocabLabel", null));
|
||||
testInfo.add(new AssociatedConceptInfo("user defined label", "testUserURI", null, null, "http://www.w3.org/2004/02/skos/core#Concept"));
|
||||
|
||||
//Adding concepts
|
||||
testInfo.addAll(getExistingConcepts(vreq));
|
||||
formSpecificData.put("existingConcepts", testInfo);
|
||||
//These are the concepts that already exist currently
|
||||
formSpecificData.put("existingConcepts", getExistingConcepts(vreq));
|
||||
//Return url for adding user defined concept
|
||||
formSpecificData.put("userDefinedConceptUrl", getUserDefinedConceptUrl(vreq));
|
||||
//Add URIs and labels for different services
|
||||
formSpecificData.put("searchServices", ConceptSearchServiceUtils.getVocabSources());
|
||||
editConfiguration.setFormSpecificData(formSpecificData);
|
||||
}
|
||||
|
||||
|
@ -342,17 +336,17 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
|||
//TODO: Check if sorted correctly
|
||||
sortConceptIndividuals(concepts);
|
||||
|
||||
return getAssociatedConceptInfo(concepts);
|
||||
return getAssociatedConceptInfo(concepts, vreq);
|
||||
}
|
||||
|
||||
|
||||
private void sortConceptIndividuals(List<Individual> authorships) {
|
||||
private void sortConceptIndividuals(List<Individual> concepts) {
|
||||
DataPropertyComparator comp = new DataPropertyComparator(RDFS.label.getURI());
|
||||
Collections.sort(authorships, comp);
|
||||
Collections.sort(concepts, comp);
|
||||
}
|
||||
|
||||
private List<AssociatedConceptInfo> getAssociatedConceptInfo(
|
||||
List<Individual> concepts) {
|
||||
List<Individual> concepts, VitroRequest vreq) {
|
||||
List<AssociatedConceptInfo> info = new ArrayList<AssociatedConceptInfo>();
|
||||
for ( Individual conceptIndividual : concepts ) {
|
||||
boolean isSKOSConcept = false;
|
||||
|
@ -376,8 +370,9 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
|||
String vocabLabel = null;
|
||||
if(vocabList != null && vocabList.size() > 0) {
|
||||
vocabSource = vocabList.get(0).getObjectURI();
|
||||
//vocab label? Right now set as same to vocab source until we get the correct input
|
||||
vocabLabel = vocabSource;
|
||||
Individual sourceIndividual = EditConfigurationUtils.getIndividual(vreq, vocabSource);
|
||||
//Assuming name will get label
|
||||
vocabLabel = sourceIndividual.getName();
|
||||
}
|
||||
info.add(new AssociatedConceptInfo(conceptLabel, conceptUri, vocabSource, vocabLabel, null));
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
|
|||
conf.setN3Optional(Arrays.asList(
|
||||
n3ForEdTrainingToOrg, majorFieldAssertion, degreeAssertion,
|
||||
deptAssertion, infoAssertion,
|
||||
n3ForStart, n3ForEnd ));
|
||||
n3ForStart, n3ForEnd, n3ForOrgToEdTraining ));
|
||||
|
||||
conf.addNewResource("edTraining", DEFAULT_NS_FOR_NEW_RESOURCE);
|
||||
conf.addNewResource("org",DEFAULT_NS_FOR_NEW_RESOURCE);
|
||||
|
@ -119,6 +119,8 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
|
|||
conf.addSparqlForExistingUris("endNode", existingEndNodeQuery);
|
||||
conf.addSparqlForExistingUris("startField-precision", existingStartPrecisionQuery);
|
||||
conf.addSparqlForExistingUris("endField-precision", existingEndPrecisionQuery);
|
||||
//Add sparql to include inverse property as well
|
||||
conf.addSparqlForAdditionalUrisInScope("inverseTrainingAtOrg", inverseTrainingAtOrgQuery);
|
||||
|
||||
conf.addField( new FieldVTwo().
|
||||
setName("degree").
|
||||
|
@ -228,7 +230,9 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
|
|||
final static String n3ForEdTrainingToOrg =
|
||||
"?edTraining <"+ trainingAtOrg +"> ?org .";
|
||||
|
||||
|
||||
//The inverse of the above
|
||||
final static String n3ForOrgToEdTraining =
|
||||
"?org ?inverseTrainingAtOrg ?edTraining .";
|
||||
/* Queries for editing an existing educational training entry */
|
||||
|
||||
final static String orgQuery =
|
||||
|
@ -318,6 +322,13 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
|
|||
"?endNode <"+ type +"> <"+ dateTimeValueType +"> .\n"+
|
||||
"?endNode <"+ dateTimePrecision +"> ?existingEndPrecision . }";
|
||||
|
||||
//Query for inverse property
|
||||
final static String inverseTrainingAtOrgQuery =
|
||||
"PREFIX owl: <http://www.w3.org/2002/07/owl#>"
|
||||
+ " SELECT ?inverseTrainingAtOrg "
|
||||
+ " WHERE { ?inverseTrainingAtOrg owl:inverseOf <"+ trainingAtOrg +"> . } ";
|
||||
|
||||
|
||||
//Adding form specific data such as edit mode
|
||||
public void addFormSpecificData(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
|
||||
HashMap<String, Object> formSpecificData = new HashMap<String, Object>();
|
||||
|
@ -331,4 +342,6 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
|
|||
return EditModeUtils.getEditMode(vreq, predicates);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -19,8 +19,9 @@ import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
|||
public class ConceptSearchServiceUtils {
|
||||
private static final Log log = LogFactory.getLog(ConceptSearchServiceUtils.class);
|
||||
//Get the appropriate search service class
|
||||
private static final String UMLSVocabSource = "http://link.informatics.stonybrook.edu/umls/";
|
||||
private static final String AgrovocVocabSource = "http://www.fao.org/webservices/Agrovoc";
|
||||
//TODO: Change this so retrieved from the system instead using a query
|
||||
private static final String UMLSVocabSource = "http://link.informatics.stonybrook.edu/umls";
|
||||
private static final String AgrovocVocabSource = "http://aims.fao.org/aos/agrovoc/agrovocScheme";
|
||||
//Get the class that corresponds to the appropriate search
|
||||
public static String getConceptSearchServiceClassName(String searchServiceName) {
|
||||
HashMap<String, String> map = getMapping();
|
||||
|
@ -44,8 +45,8 @@ public class ConceptSearchServiceUtils {
|
|||
//Get the hashmap mapping service name to Service class
|
||||
private static HashMap<String, String> getMapping() {
|
||||
HashMap<String, String> map = new HashMap<String, String>();
|
||||
map.put("http://link.informatics.stonybrook.edu/umls/", "edu.cornell.mannlib.semservices.service.impl.UMLSService");
|
||||
map.put("http://www.fao.org/webservices/Agrovoc", "edu.cornell.mannlib.semservices.service.impl.AgrovocService");
|
||||
map.put(UMLSVocabSource, "edu.cornell.mannlib.semservices.service.impl.UMLSService");
|
||||
map.put(AgrovocVocabSource, "edu.cornell.mannlib.semservices.service.impl.AgrovocService");
|
||||
|
||||
return map;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue