Skip to content

Commit

Permalink
ignore free text entries when registering cvoc term
Browse files Browse the repository at this point in the history
  • Loading branch information
qqmyers committed Apr 20, 2023
1 parent 391404f commit bd7cdb4
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,25 @@ public void registerExternalTerm(JsonObject cvocEntry, String term) {
logger.fine("Ingoring blank term");
return;
}
boolean isExternal = false;
JsonObject vocabs = cvocEntry.getJsonObject("vocabs");
for (String key: vocabs.keySet()) {
JsonObject vocab = vocabs.getJsonObject(key);
if (vocab.containsKey("uriSpace")) {
if (term.startsWith(vocab.getString("uriSpace"))) {
isExternal = true;
break;
}
}
}
if (!isExternal) {
logger.fine("Ignoring free text entry: " + term);
return;
}
logger.fine("Registering term: " + term);
try {
URI uri = new URI(term);
//Assure the term is in URI form - should be if the uriSpace entry was correct
new URI(term);
ExternalVocabularyValue evv = null;
try {
evv = em.createQuery("select object(o) from ExternalVocabularyValue as o where o.uri=:uri",
Expand Down

0 comments on commit bd7cdb4

Please sign in to comment.