Skip to content

Commit 4fde334

Browse files
authored
Merge pull request #1387 from NCEAS/dev-2.11
Dev 2.11 second merge
2 parents b614e74 + d0898d3 commit 4fde334

File tree

7 files changed

+61
-19
lines changed

7 files changed

+61
-19
lines changed

build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@
342342
<property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
343343
<property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
344344
<property name="eml2_1_1-schema-tag" value="RELEASE_EML_2_1_1" />
345-
<property name="eml2_2_0-schema-tag" value="BRANCH_EML_2_2" />
345+
<property name="eml2_2_0-schema-tag" value="RELEASE_EML_2_2_0" />
346346
<!--<property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_0_7" />-->
347347

348348

lib/metacat.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,5 +774,5 @@ solr.collectionName=collection1
774774
#solr.systeminfo.urlappendix=/admin/system
775775
#Solr-home for the http solr server is used to store some files. It can be not really solr home.
776776
#solr.homeDir=/var/metacat/solr-home
777-
solr.query.appned.include.archived.name=archived
778-
solr.query.append.incldue.archived.value=-archived:*fake
777+
solr.query.append.includeArchived.name=archived
778+
solr.query.append.includeArchived.value=-archived:*fake

metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/ApplicationController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ private void initializeSharedConfiguration() {
163163
}
164164

165165
}
166-
queryIncludeArchivedParaName = Settings.getConfiguration().getString("solr.query.appned.include.archived.name");
167-
queryIncludeArchivedParaValue = Settings.getConfiguration().getString("solr.query.append.incldue.archived.value");
166+
queryIncludeArchivedParaName = Settings.getConfiguration().getString("solr.query.append.includeArchived.name");
167+
queryIncludeArchivedParaValue = Settings.getConfiguration().getString("solr.query.append.includeArchived.value");
168168
}
169169

170170
/**
@@ -326,7 +326,7 @@ public void run() {
326326
*/
327327
public static String getIncludeArchivedQueryParaName() {
328328
if(queryIncludeArchivedParaName == null) {
329-
queryIncludeArchivedParaName = Settings.getConfiguration().getString("solr.query.appned.include.archived.name");
329+
queryIncludeArchivedParaName = Settings.getConfiguration().getString("solr.query.append.includeArchived.name");
330330
}
331331
return queryIncludeArchivedParaName;
332332
}
@@ -337,7 +337,7 @@ public static String getIncludeArchivedQueryParaName() {
337337
*/
338338
public static String getIncludeArchivedQueryParaValue() {
339339
if(queryIncludeArchivedParaValue == null) {
340-
queryIncludeArchivedParaValue = Settings.getConfiguration().getString("solr.query.append.incldue.archived.value");
340+
queryIncludeArchivedParaValue = Settings.getConfiguration().getString("solr.query.append.includeArchived.value");
341341
}
342342
return queryIncludeArchivedParaValue;
343343
}

metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/annotation/EmlAnnotationSubprocessor.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,15 @@
2525
import org.dataone.cn.indexer.XmlDocumentUtility;
2626
import org.springframework.beans.factory.annotation.Autowired;
2727
import org.w3c.dom.Document;
28+
2829
/**
29-
* A subprocessor that extracts semantic annotations from EML records and
30-
* materializes the superclass hierarchy for all extracted concepts using a
31-
* pre-defined set of ontologies. It is very similar to a
32-
* BaseXPathDocumentSubprocessor but a bit different in that it post-processes
33-
* results from the usual ISolrDoc.getFields() instead of mergingn them asi-s.
30+
* Extracts semantic annotations from EML records and materializes the
31+
* superclass hierarchy for all extracted concepts using a pre-defined set of
32+
* ontologies. It is very similar to a BaseXPathDocumentSubprocessor but a bit
33+
* different in that it post-processes results from the usual
34+
* ISolrDoc.getFields() instead of mergingn them asi-s.
3435
*
35-
* User: Mecum
36-
* Date: 2019/02/05
37-
* Time: 4:57 PM
36+
* User: Mecum Date: 2019/02/05 Time: 4:57 PM
3837
*
3938
*/
4039
public class EmlAnnotationSubprocessor implements IDocumentSubprocessor {
@@ -131,7 +130,7 @@ public Map<String, SolrDoc> processDocument(String identifier, Map<String, SolrD
131130
/**
132131
* Merge updates with existing solr documents
133132
*
134-
* @param indexDocument
133+
* @param indexDocument The index document to merge processed fields with
135134
* @return
136135
* @throws IOException
137136
* @throws EncoderException

metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/annotation/OntologyModelService.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ private void init() {
8080
}
8181
}
8282

83+
/**
84+
* Perform expansion on a given term URI.
85+
*
86+
* @param uri The URI to expand
87+
* @return A Map of String (field) <-> Set<String> expanded concepts
88+
*/
8389
protected Map<String, Set<String>> expandConcepts(String uri) {
8490
log.debug("expandConcepts " + uri);
8591
Map<String, Set<String>> conceptFields = new HashMap<String, Set<String>>();
@@ -168,6 +174,11 @@ public void setAltEntryList(Map<String, String> entryList) {
168174
altEntryList = entryList;
169175
}
170176

177+
/**
178+
* Tell the OntologyModelService where to find ontologies by adding alternative
179+
* entries to the OntDocumentManager with imports disabled. Processing of
180+
* imports is a security risk so this is disabled explicitly.
181+
*/
171182
public void loadAltEntries() {
172183
log.debug("OntologyModelService - Loading altEntries of size " + altEntryList.size());
173184

src/edu/ucsb/nceas/metacat/dataone/MNodeService.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2127,9 +2127,11 @@ public Identifier publish(Session session, Identifier originalIdentifier) throws
21272127
ObjectFormatIdentifier objFormatId = originalSystemMetadata.getFormatId();
21282128
String formatId = objFormatId.getValue();
21292129
//For all EML formats
2130-
if(formatId.indexOf("eml") == 0){
2131-
logMetacat.debug("~~~~~~~~~~~~~~~~~~~~~~MNodeService.publish - the object "+originalIdentifier.getValue()+" with format id "+formatId+" is an eml document.");
2130+
if(formatId.contains("ecoinformatics.org/eml")){
2131+
logMetacat.debug("~~~~~~~~~~~~~~~~~~~~~~MNodeService.publish - the object " + originalIdentifier.getValue() + " with format id " + formatId + " is an eml document.");
21322132
isEML = true;
2133+
} else {
2134+
logMetacat.debug("MNodeService.publish - the object " + originalIdentifier.getValue() + " with format id " + formatId + " is NOT an eml document.");
21332135
}
21342136
InputStream originalObject = this.get(session, originalIdentifier);
21352137

test/edu/ucsb/nceas/metacat/dataone/RegisterDOITest.java

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,11 @@ public void testPublishDOI() {
344344
// now publish it
345345
Identifier publishedIdentifier = MNodeService.getInstance(request).publish(session, pid);
346346

347+
//check if the package id was updated
348+
InputStream emlObj = MNodeService.getInstance(request).get(session, publishedIdentifier);
349+
String emlStr = IOUtils.toString(emlObj, "UTF-8");
350+
assertTrue(emlStr.contains("packageId=\"" + publishedIdentifier.getValue() + "\""));
351+
347352
// check for the metadata explicitly, using ezid service
348353
EZIDService ezid = new EZIDService(ezidServiceBaseUrl);
349354
ezid.login(ezidUsername, ezidPassword);
@@ -894,10 +899,35 @@ public void testPublishEML220() throws Exception {
894899
} while (metadata == null && count < 20);
895900
assertNotNull(metadata);
896901
String result = metadata.get(DOIService.DATACITE);
897-
System.out.println("result is\n"+result);
898902
assertTrue(result.contains("EML Annotation Example"));
899903
assertTrue(result.contains("0000-0002-1209-5122"));
900904
assertTrue(result.contains("It can include multiple paragraphs"));
901905
content.close();
906+
907+
//check if the package id was updated
908+
InputStream emlObj = MNodeService.getInstance(request).get(session, publishedIdentifier);
909+
String emlStr = IOUtils.toString(emlObj, "UTF-8");
910+
assertTrue(emlStr.contains("packageId=\"" + publishedIdentifier.getValue() + "\""));
911+
912+
//check the query
913+
String query = "q=id:"+guid.getValue();
914+
InputStream stream = MNodeService.getInstance(request).query(session, "solr", query);
915+
String resultStr = IOUtils.toString(stream, "UTF-8");
916+
do {
917+
try {
918+
if(resultStr.contains("funding")) {
919+
break;
920+
}
921+
} catch (Exception e) {
922+
Thread.sleep(2000);
923+
}
924+
count++;
925+
} while (metadata == null && count < 20);
926+
assertTrue(resultStr.contains("<arr name=\"funding\">"));
927+
assertTrue(resultStr.contains("<str>Funding is from a grant from the National Science Foundation.</str>"));
928+
assertTrue(resultStr.contains("<arr name=\"funderName\">"));
929+
assertTrue(resultStr.contains("<str>National Science Foundation</str>"));
930+
assertTrue(resultStr.contains("<arr name=\"sem_annotation\"><str>http://purl.dataone.org/odo/ECSO_00000512</str>"));
931+
assertTrue(resultStr.contains("<str>http://purl.dataone.org/odo/ECSO_00000512</str>"));
902932
}
903933
}

0 commit comments

Comments
 (0)