updates to allow related concepts to be returned from GEMET as well as display which results are best matches and which are not.

This commit is contained in:
hjkhjk54 2012-03-28 18:13:10 +00:00
parent f0ccf65ddd
commit 05b8ad270a
5 changed files with 28 additions and 8 deletions

View file

@ -3,7 +3,7 @@
.concepts .column {
float:left;
padding-right:3px;
clear:none !important; /*Overriding customFor div's clearing*/
}
.concepts .row {
@ -23,6 +23,20 @@
width:400px;
}
/* For adding an empty element under the best match column*/
.emptyColumn {
width:67px;
height:18px;
background: url("../images/conceptSpacer.png") no-repeat left center;
}
/*For adding the checkmark under the best match column*/
.bestMatchFlag {
width:67px;
height:18px;
background: url("../images/conceptCheckMark.png") no-repeat left center;
}
form#addConceptForm {
display:none;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

View file

@ -256,9 +256,9 @@ var addConceptForm = {
generateIndividualConceptDisplay: function(cuiURI, label, definition, type, definedBy, isBestMatch) {
var htmlAdd = "<li class='concepts'>" +
"<div class='row'>" +
"<span class='column conceptLabel'>" +
"<div class='column conceptLabel'>" +
addConceptForm.generateIndividualCUIInput(cuiURI, label, type, definedBy) +
label + addConceptForm.generateIndividualTypeDisplay(type) + "</span>" +
label + addConceptForm.generateIndividualTypeDisplay(type) + "</div>" +
addConceptForm.generateIndividualDefinitionDisplay(definition) +
addConceptForm.generateBestOrAlternate(isBestMatch) +
"</div>" +
@ -275,15 +275,20 @@ var addConceptForm = {
return "";
},
generateIndividualDefinitionDisplay:function(definition) {
return "<span class='column conceptDefinition'>" + definition + "</span>";
//The definition in some cases may be an empty string, so to prevent the div
//from not appearing, we are replacing with
if(definition == null || definition.length == 0) {
definition = "&nbsp;";
}
return "<div class='column conceptDefinition'>" + definition + "</div>";
},
//adds another div with "best match" next to it if best match
generateBestOrAlternate:function(isBestMatch) {
var content = "&nbsp;";
var className = "emptyColumn";
if(isBestMatch) {
content = "(Best Match)"
className = "bestMatchFlag";
}
return "<span class='column'>" + content + "</span>";
return "<div class='column'><div class='" + className + "'>&nbsp;</div></div>";
},
validateConceptSelection:function(checkedElements) {
var numberElements = checkedElements.length;

View file

@ -35,6 +35,7 @@ import org.xml.sax.SAXException;
import edu.cornell.mannlib.semservices.bo.Concept;
import edu.cornell.mannlib.semservices.service.ExternalConceptService;
import edu.cornell.mannlib.semservices.util.XMLUtils;
import edu.cornell.mannlib.vitro.webapp.web.URLEncoder;
public class GemetService implements ExternalConceptService {
protected final Log logger = LogFactory.getLog(getClass());
@ -187,7 +188,7 @@ public class GemetService implements ExternalConceptService {
protected String getConceptsMatchingKeyword(String keyword) throws Exception {
String result = new String();
String serviceUrl = GemetWS_address + "getConceptsMatchingKeyword" +
"?keyword=" + keyword +
"?keyword=" + URLEncoder.encode(keyword) +
"&search_mode=0" +
"&thesaurus_uri=http://www.eionet.europa.eu/gemet/concept/" +
"&language=en";