fixing Gemet null type and LCSC null concepts
This commit is contained in:
parent
2983cf69b0
commit
47c7e3746f
3 changed files with 21 additions and 7 deletions
|
@ -13,5 +13,6 @@
|
|||
## Can extend this to define what the constructor arguments should be if required, and then N3EditUtils.java should be modified
|
||||
## to know it can pull out parameters based on what is defined in the display model
|
||||
|
||||
## <java:edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.TestModelChangePreprocessor>
|
||||
## a <java:edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.ModelChangePreprocessor> .
|
||||
# Testing to see if this will be read in BECAUSE this has changed and should be read in
|
||||
# <java:edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.TestModelChangePreprocessor>
|
||||
# a <java:edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.ModelChangePreprocessor> .
|
|
@ -98,6 +98,7 @@ public class GemetService implements ExternalConceptService {
|
|||
concept.setUri(uri);
|
||||
concept.setConceptId(stripConceptId(uri));
|
||||
concept.setSchemeURI(schemeURI);
|
||||
concept.setType("");
|
||||
if (json.has("preferredLabel")) {
|
||||
JSONObject preferredLabelObj = json
|
||||
.getJSONObject("preferredLabel");
|
||||
|
|
|
@ -146,6 +146,7 @@ public class LCSHService implements ExternalConceptService {
|
|||
}
|
||||
log.debug("-" + uri + "-");
|
||||
String conceptUriString = getSKOSURI(uri);
|
||||
String baseConceptURI = getConceptURI(uri);
|
||||
URI conceptURI = null;
|
||||
try {
|
||||
conceptURI = new URI(conceptUriString);
|
||||
|
@ -159,12 +160,14 @@ public class LCSHService implements ExternalConceptService {
|
|||
log.debug("Number of skos concepts " + skosConcepts.size());
|
||||
|
||||
for (SKOSConcept skosConcept : skosConcepts) {
|
||||
|
||||
//Close matches are also being returned in list of skos concepts and
|
||||
//we are interested in getting the main concept we requested only
|
||||
if(skosConcept.getURI().toString().equals(baseConceptURI)) {
|
||||
Concept c = this.createConcept(sdf, bestMatch, skosConcept, dataset);
|
||||
if(c != null) {
|
||||
conceptList.add(c);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
i++;
|
||||
|
||||
|
@ -401,6 +404,15 @@ public class LCSHService implements ExternalConceptService {
|
|||
return hostUri + skosURI;
|
||||
}
|
||||
|
||||
//Given the URI from the xml, get just the base URI
|
||||
private String getConceptURI(String uri) {
|
||||
String skosURI = uri;
|
||||
if (uri.endsWith(".xml")) {
|
||||
skosURI = uri.substring(0, uri.length() - 4);
|
||||
}
|
||||
return hostUri + skosURI;
|
||||
}
|
||||
|
||||
public List<String> getConceptURISFromJSON(String results) {
|
||||
List<String> uris = new ArrayList<String>();
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue