updates to associated concept and user defined concept generators, related preprocessors, css, and javascript file
This commit is contained in:
parent
c3d1d16d9b
commit
b54b8c566d
8 changed files with 645 additions and 107 deletions
|
@ -41,6 +41,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
|||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.AddAssociatedConceptsPreprocessor;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.RoleToActivityPredicatePreprocessor;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||
|
@ -147,20 +148,20 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
|||
return "@prefix core: <http://vivoweb.org/ontology/core#> .";
|
||||
}
|
||||
|
||||
//TODO: Check if single string or multiple strings - check rdfslabel form etc. for prefix
|
||||
//processing
|
||||
//The only string always required is that linking the subject to the concept node
|
||||
//Since the concept node from an external vocabulary may already be in the system
|
||||
//The label and is defined by may already be defined and don't require re-saving
|
||||
private List<String> generateN3Required(VitroRequest vreq) {
|
||||
return list(
|
||||
getPrefixesString() + "\n" +
|
||||
"?subject ?predicate ?conceptNode .\n" +
|
||||
"?conceptNode <" + RDFS.label.getURI() + "> ?conceptLabel .\n" +
|
||||
"?conceptNode <" + RDFS.isDefinedBy.getURI() + "> ?vocabURI ."
|
||||
"?subject ?predicate ?conceptNode .\n"
|
||||
);
|
||||
}
|
||||
|
||||
//Don't think there's any n3 optional here
|
||||
private List<String> generateN3Optional() {
|
||||
return list(
|
||||
return list("?conceptNode <" + RDFS.label.getURI() + "> ?conceptLabel .\n" +
|
||||
"?conceptNode <" + RDFS.isDefinedBy.getURI() + "> ?conceptSource ."
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -220,8 +221,8 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
|||
List<String> urisOnForm = new ArrayList<String>();
|
||||
List<String> literalsOnForm = new ArrayList<String>();
|
||||
//The URI of the node that defines the concept
|
||||
urisOnForm.add("conceptURI");
|
||||
urisOnForm.add("vocabURI");
|
||||
urisOnForm.add("conceptNode");
|
||||
urisOnForm.add("conceptSource");
|
||||
//Also need to add the label of the concept
|
||||
literalsOnForm.add("conceptLabel");
|
||||
editConfiguration.setLiteralsOnForm(literalsOnForm);
|
||||
|
@ -236,53 +237,11 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
|||
private void setSparqlQueries(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
|
||||
//Sparql queries defining retrieval of literals etc.
|
||||
editConfiguration.setSparqlForAdditionalLiteralsInScope(new HashMap<String, String>());
|
||||
|
||||
Map<String, String> urisInScope = new HashMap<String, String>();
|
||||
editConfiguration.setSparqlForAdditionalUrisInScope(urisInScope);
|
||||
|
||||
editConfiguration.setSparqlForExistingLiterals(generateSparqlForExistingLiterals(vreq));
|
||||
editConfiguration.setSparqlForExistingUris(generateSparqlForExistingUris(vreq));
|
||||
editConfiguration.setSparqlForAdditionalUrisInScope(new HashMap<String, String>());
|
||||
editConfiguration.setSparqlForExistingLiterals(new HashMap<String, String>());
|
||||
editConfiguration.setSparqlForExistingUris(new HashMap<String, String>());
|
||||
}
|
||||
|
||||
|
||||
//Get page uri for object
|
||||
private HashMap<String, String> generateSparqlForExistingUris(VitroRequest vreq) {
|
||||
HashMap<String, String> map = new HashMap<String, String>();
|
||||
//Existing uris here might include is defined by
|
||||
//map.put("vocabURI", getExistingVocabURIQuery());
|
||||
return map;
|
||||
}
|
||||
|
||||
private String getExistingVocabURIQuery() {
|
||||
String query = "SELECT ?existingVocabURI \n " +
|
||||
"WHERE { \n" +
|
||||
"?conceptNode <" + RDFS.isDefinedBy.getURI() + "> ?existingVocabURI ."
|
||||
+ "}";
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private HashMap<String, String> generateSparqlForExistingLiterals(VitroRequest vreq) {
|
||||
HashMap<String, String> map = new HashMap<String, String>();
|
||||
//Queries for existing concept label
|
||||
//Vocab uri label is something that can be retrieved
|
||||
map.put("conceptLabel", getConceptLabelQuery());
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private String getConceptLabelQuery() {
|
||||
String query = "SELECT ?existingConceptLabel \n " +
|
||||
"WHERE { \n" +
|
||||
"?conceptNode <" + RDFS.label.getURI() + "> ?existingConceptLabel ."
|
||||
+ "}";
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -300,7 +259,7 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
|||
VitroRequest vreq) {
|
||||
editConfiguration.addField(new FieldVTwo().
|
||||
setName("conceptNode").
|
||||
setValidators(new ArrayList<String>()).
|
||||
setValidators(list("nonempty")).
|
||||
setOptionsType("UNDEFINED"));
|
||||
|
||||
}
|
||||
|
@ -310,9 +269,7 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
|||
private void setVocabURIField(EditConfigurationVTwo editConfiguration,
|
||||
VitroRequest vreq) {
|
||||
editConfiguration.addField(new FieldVTwo().
|
||||
setName("vocabURI").
|
||||
setValidators(new ArrayList<String>()).
|
||||
setOptionsType("UNDEFINED"));
|
||||
setName("conceptSource"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -321,27 +278,19 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
|||
VitroRequest vreq) {
|
||||
editConfiguration.addField(new FieldVTwo().
|
||||
setName("conceptLabel").
|
||||
setValidators(new ArrayList<String>()).
|
||||
setOptionsType("UNDEFINED").
|
||||
setRangeDatatypeUri(XSD.xstring.toString())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Add preprocessor
|
||||
|
||||
private void addPreprocessors(EditConfigurationVTwo editConfiguration, WebappDaoFactory wadf) {
|
||||
//Will be a completely different type of preprocessor
|
||||
/*
|
||||
//An Edit submission preprocessor for enabling addition of multiple terms for a single search
|
||||
|
||||
editConfiguration.addEditSubmissionPreprocessor(
|
||||
new RoleToActivityPredicatePreprocessor(editConfiguration, wadf));
|
||||
*/
|
||||
new AddAssociatedConceptsPreprocessor(editConfiguration));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -351,9 +300,10 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
|||
//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
|
||||
//-------------------->For test purposes
|
||||
List<AssociatedConceptInfo> testInfo = new ArrayList<AssociatedConceptInfo>();
|
||||
testInfo.add(new AssociatedConceptInfo("testLabel", "testURI", "testVocabURI", "testVocabLabel"));
|
||||
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"));
|
||||
formSpecificData.put("existingConcepts", testInfo);
|
||||
//Return url for adding user defined concept
|
||||
formSpecificData.put("userDefinedConceptUrl", getUserDefinedConceptUrl(vreq));
|
||||
|
@ -376,11 +326,13 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
|||
private String conceptURI;
|
||||
private String vocabURI;
|
||||
private String vocabLabel;
|
||||
public AssociatedConceptInfo(String inputLabel, String inputURI, String inputVocabURI, String inputVocabLabel) {
|
||||
private String type; //In case of SKOS concept, will have skos concept type
|
||||
public AssociatedConceptInfo(String inputLabel, String inputURI, String inputVocabURI, String inputVocabLabel, String inputType) {
|
||||
this.conceptLabel = inputLabel;
|
||||
this.conceptURI = inputURI;
|
||||
this.vocabURI = inputVocabURI;
|
||||
this.vocabLabel = inputVocabLabel;
|
||||
this.type = inputType;
|
||||
}
|
||||
|
||||
//Getters
|
||||
|
@ -400,6 +352,10 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
|||
return vocabLabel;
|
||||
}
|
||||
|
||||
public String getType(){
|
||||
return type;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -292,16 +292,17 @@ public class AddUserDefinedConceptGenerator extends VivoBaseGenerator implement
|
|||
public void addFormSpecificData(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
|
||||
HashMap<String, Object> formSpecificData = new HashMap<String, Object>();
|
||||
formSpecificData.put("sparqlForAcFilter", getSparqlForAcFilter(vreq));
|
||||
formSpecificData.put("conceptType", SKOSConceptType);
|
||||
editConfiguration.setFormSpecificData(formSpecificData);
|
||||
}
|
||||
|
||||
|
||||
public String getSparqlForAcFilter(VitroRequest vreq) {
|
||||
String subject = EditConfigurationUtils.getSubjectUri(vreq);
|
||||
|
||||
String predicate = EditConfigurationUtils.getPredicateUri(vreq);
|
||||
String query = "PREFIX core:<" + vivoCore + "> " +
|
||||
"SELECT ?conceptNode WHERE { " +
|
||||
"<" + subject + "> ?predicate ?conceptNode ." +
|
||||
"<" + subject + "> <" + predicate + "> ?conceptNode ." +
|
||||
"?conceptNode <" + VitroVocabulary.RDF_TYPE + "> <" + SKOSConceptType + "> . }";
|
||||
return query;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,305 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Literal;
|
||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||
import com.hp.hpl.jena.vocabulary.XSD;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.BaseEditSubmissionPreprocessorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.MultiValueEditSubmission;
|
||||
|
||||
public class AddAssociatedConceptsPreprocessor extends
|
||||
BaseEditSubmissionPreprocessorVTwo {
|
||||
|
||||
protected static final Log log = LogFactory
|
||||
.getLog(AddAssociatedConceptsPreprocessor.class.getName());
|
||||
|
||||
// Field names/variables names for n3 - these will have numbers added as
|
||||
// suffix if more than one term
|
||||
private static String conceptNodeBase = "conceptNode";
|
||||
private static String sourceBase = "conceptSource";
|
||||
private static String labelBase = "conceptLabel";
|
||||
//Also storing submission
|
||||
private static MultiValueEditSubmission submission = null;
|
||||
|
||||
// String datatype
|
||||
|
||||
// Will be editing the edit configuration as well as edit submission here
|
||||
|
||||
public AddAssociatedConceptsPreprocessor(EditConfigurationVTwo editConfig) {
|
||||
super(editConfig);
|
||||
}
|
||||
|
||||
public void preprocess(MultiValueEditSubmission inputSubmission) {
|
||||
submission = inputSubmission;
|
||||
// Get the input elements for concept node and concept label as well
|
||||
// as vocab uri (which is based on thge
|
||||
// For query parameters, check whether CUI
|
||||
String conceptNodeValues = getConceptNodeValues();
|
||||
|
||||
if (conceptNodeValues != null) {
|
||||
String[] conceptNodes = convertDelimitedStringToArray(conceptNodeValues);
|
||||
int numberConcepts = conceptNodes.length;
|
||||
if (numberConcepts > 1) {
|
||||
processConceptNodes(numberConcepts);
|
||||
}
|
||||
|
||||
} else {
|
||||
log.error("No concept nodes were added from the service");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void processConceptNodes(int numberConcepts) {
|
||||
//There are no "new" resources b/c the concept nodes are URIs from external vocabularies
|
||||
// Add N3Required
|
||||
addN3Required(numberConcepts);
|
||||
// Add URIs on Form and Add Literals On Form
|
||||
addLiteralsAndUrisOnForm(numberConcepts);
|
||||
// Add fields
|
||||
addFields(numberConcepts);
|
||||
//Add input values to submission
|
||||
addInputsToSubmission(numberConcepts);
|
||||
|
||||
}
|
||||
|
||||
//This is where the actual values will be submitted as if they were separate input fields
|
||||
//Each field name will correspond to the names of the fileds/uris on form/literals on form
|
||||
//generated here
|
||||
|
||||
private void addInputsToSubmission(int numberConcepts) {
|
||||
//This will essentially manufacture a set of query parameters
|
||||
//And will add the appropriate fields to the multivalue submission
|
||||
addConceptNodeInputs(numberConcepts);
|
||||
addConceptSourceInputs(numberConcepts);
|
||||
addConceptLabelInputs(numberConcepts);
|
||||
|
||||
}
|
||||
|
||||
private void addConceptNodeInputs(int numberConcepts) {
|
||||
//Get the current value
|
||||
String conceptNodeValues = getConceptNodeValues();
|
||||
String[] conceptNodes = convertDelimitedStringToArray(conceptNodeValues);
|
||||
if(conceptNodes != null && conceptNodes.length == numberConcepts) {
|
||||
int i;
|
||||
for(i = 1; i <= numberConcepts; i++) {
|
||||
int suffix = i;
|
||||
String conceptInputName = conceptNodeBase + suffix;
|
||||
String[] nodeValues = new String[1];
|
||||
nodeValues[0] = conceptNodes[i];
|
||||
//Add value for uri to form
|
||||
submission.addUriToForm(editConfiguration, conceptInputName, nodeValues);
|
||||
}
|
||||
} else if(conceptNodes != null && conceptNodes.length != numberConcepts){
|
||||
log.error("Number of concept nodes did not match the number of concepts to be added");
|
||||
} else{
|
||||
log.error("Concept nodes returned were null");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addConceptSourceInputs(int numberConcepts) {
|
||||
String conceptSourceValues = getConceptSourceValues();
|
||||
String[] conceptSources = convertDelimitedStringToArray(conceptSourceValues);
|
||||
if(conceptSources != null && conceptSources.length == numberConcepts) {
|
||||
int i;
|
||||
for(i = 1; i <= numberConcepts; i++) {
|
||||
int suffix = i;
|
||||
String conceptInputName = sourceBase + suffix;
|
||||
String[] sourceValues = new String[1];
|
||||
sourceValues[0] = conceptSources[i];
|
||||
//Add value for uri to form
|
||||
submission.addUriToForm(editConfiguration, conceptInputName, sourceValues);
|
||||
}
|
||||
} else if(conceptSources != null && conceptSources.length != numberConcepts){
|
||||
log.error("Number of concept nodes did not match the number of concepts to be added");
|
||||
} else{
|
||||
log.error("Concept nodes returned were null");
|
||||
}
|
||||
}
|
||||
|
||||
private void addConceptLabelInputs(int numberConcepts) {
|
||||
String conceptLabelValues = getConceptLabelValues();
|
||||
String[] labels = convertDelimitedStringToArray(conceptLabelValues);
|
||||
if(labels != null && labels.length == numberConcepts) {
|
||||
int i;
|
||||
for(i = 1; i <= numberConcepts; i++) {
|
||||
int suffix = i;
|
||||
String labelInputName = labelBase + suffix;
|
||||
String[] labelValues = new String[1];
|
||||
labelValues[0] = labels[i];
|
||||
//TODO: Check if there are no funky typed information also stored
|
||||
//At this point the field should already have been added to edit configuration
|
||||
FieldVTwo labelField = editConfiguration.getField(labelInputName);
|
||||
if(labelField != null) {
|
||||
submission.addLiteralToForm(editConfiguration, labelField, labelInputName, labelValues);
|
||||
} else {
|
||||
log.error("Corresponding field for " + labelInputName + " was not added to edit configuration");
|
||||
}
|
||||
|
||||
}
|
||||
} else if(labels != null && labels.length != numberConcepts){
|
||||
log.error("Number of concept labels did not match the number of concepts to be added");
|
||||
} else{
|
||||
log.error("Concept labels returned were null");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void addFields(int numberConcepts) {
|
||||
//Clear out all fields in edit configuration first
|
||||
editConfiguration.setFields(new HashMap<String, FieldVTwo>());
|
||||
int index;
|
||||
// First one already included in generator so add additional ones here
|
||||
for (index = 1; index <= numberConcepts; index++) {
|
||||
int suffix = index + 1;
|
||||
String conceptNode = conceptNodeBase + suffix;
|
||||
String label = labelBase + suffix;
|
||||
String source = sourceBase + suffix;
|
||||
|
||||
addConceptNodeField(conceptNode);
|
||||
addLabelField(label);
|
||||
addSourceField(source);
|
||||
}
|
||||
}
|
||||
|
||||
private void addConceptNodeField(String conceptNode) {
|
||||
List<String> validators = new ArrayList<String>();
|
||||
validators.add("nonempty");
|
||||
editConfiguration.addField(new FieldVTwo().
|
||||
setName(conceptNode).
|
||||
setValidators(validators));
|
||||
}
|
||||
|
||||
private void addLabelField(String label) {
|
||||
editConfiguration.addField(new FieldVTwo().
|
||||
setName(label).
|
||||
setRangeDatatypeUri(XSD.xstring.toString())
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
private void addSourceField(String source) {
|
||||
editConfiguration.addField(new FieldVTwo().
|
||||
setName(source));
|
||||
|
||||
}
|
||||
|
||||
//original literals on form: label, uris on form: conceptNode and conceptSource
|
||||
//This will overwrite the original values in the edit configuration
|
||||
private void addLiteralsAndUrisOnForm(int numberTerms) {
|
||||
List<String> urisOnForm = new ArrayList<String>();
|
||||
List<String> literalsOnForm = new ArrayList<String>();
|
||||
|
||||
int index;
|
||||
|
||||
// First one already included so add new ones here
|
||||
for (index = 1; index <= numberTerms; index++) {
|
||||
int suffix = index;
|
||||
String conceptNode = conceptNodeBase + suffix;
|
||||
String label = labelBase + suffix;
|
||||
String source = sourceBase + suffix;
|
||||
urisOnForm.add(conceptNode);
|
||||
urisOnForm.add(source);
|
||||
literalsOnForm.add(label);
|
||||
}
|
||||
editConfiguration.setUrisOnform(urisOnForm);
|
||||
editConfiguration.setLiteralsOnForm(literalsOnForm);
|
||||
}
|
||||
|
||||
// N3 being reproduced
|
||||
/*
|
||||
* ?subject ?predicate ?conceptNode .
|
||||
*/
|
||||
//This will overwrite the original with the set of new n3 required
|
||||
private void addN3Required(int numberConcepts) {
|
||||
// List<String> n3Required = editConfig.getN3Required();
|
||||
List<String> n3Required = new ArrayList<String>();
|
||||
int index;
|
||||
String nodeBase = "?" + conceptNodeBase;
|
||||
String labelVar = "?" + labelBase;
|
||||
String sourceVar = "?" + sourceBase;
|
||||
String prefixStr = "@prefix core: <http://vivoweb.org/ontology/core#> .";
|
||||
// First one already included so add new ones here
|
||||
for (index = 1; index <= numberConcepts; index++) {
|
||||
int suffix = index;
|
||||
String node = nodeBase + suffix;
|
||||
String n3String = prefixStr;
|
||||
n3String += "?subject ?predicate " + node + " . ";
|
||||
n3Required.add(n3String);
|
||||
}
|
||||
editConfiguration.setN3Required(n3Required);
|
||||
}
|
||||
//Add n3 optional
|
||||
|
||||
private void addN3Optional(int numberConcepts) {
|
||||
List<String> n3Optional = new ArrayList<String>();
|
||||
int index;
|
||||
String nodeBase = "?" + conceptNodeBase;
|
||||
String labelVar = "?" + labelBase;
|
||||
String sourceVar = "?" + sourceBase;
|
||||
String prefixStr = "@prefix core: <http://vivoweb.org/ontology/core#> .";
|
||||
// First one already included so add new ones here
|
||||
for (index = 1; index <= numberConcepts; index++) {
|
||||
int suffix = index;
|
||||
String node = nodeBase + suffix;
|
||||
String label = labelVar + suffix;
|
||||
String source = sourceVar + suffix;
|
||||
String n3String = prefixStr;
|
||||
n3String += node + " <" + RDFS.label.getURI() + "> " + label + " .\n" +
|
||||
node + " <" + RDFS.isDefinedBy.getURI() + "> " + source + " .";
|
||||
n3Optional.add(n3String);
|
||||
}
|
||||
//Already have n3 required so need to add to that
|
||||
|
||||
editConfiguration.setN3Optional(n3Optional);
|
||||
}
|
||||
|
||||
private String[] convertDelimitedStringToArray(String inputString) {
|
||||
String[] inputArray = new String[1];
|
||||
if (inputString.indexOf(",") != -1) {
|
||||
inputArray = inputString.split(",");
|
||||
} else {
|
||||
inputArray[0] = inputString;
|
||||
}
|
||||
return inputArray;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private String getConceptNodeValues() {
|
||||
Map<String, List<String>> urisFromForm = submission.getUrisFromForm();
|
||||
List<String> conceptNodes = urisFromForm.get("conceptNode");
|
||||
return (String) getFirstElement(conceptNodes);
|
||||
}
|
||||
|
||||
private String getConceptSourceValues() {
|
||||
Map<String, List<String>> urisFromForm = submission.getUrisFromForm();
|
||||
return (String) getFirstElement(urisFromForm.get("conceptSource"));
|
||||
}
|
||||
|
||||
private String getConceptLabelValues() {
|
||||
Map<String, List<Literal>> literalsFromForm = submission.getLiteralsFromForm();
|
||||
Map<String, List<String>> transformed = EditConfigurationUtils.transformLiteralMap(literalsFromForm);
|
||||
return (String) getFirstElement(transformed.get("conceptLabel"));
|
||||
|
||||
}
|
||||
|
||||
private Object getFirstElement(List inputList) {
|
||||
if(inputList == null || inputList.size() == 0)
|
||||
return null;
|
||||
return inputList.get(0);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue