Skip to content
Snippets Groups Projects
Commit 99b90f2b authored by Stefan E. Funk's avatar Stefan E. Funk
Browse files

Merge branch '3-test-openaire-responses' into 'develop'

Resolve "Test OpenAIRE responses"

Closes #3

See merge request dariah-de/dariah-de-oai-pmh-services!80
parents 9c47c668 601ef948
No related branches found
No related tags found
No related merge requests found
Pipeline #342195 passed
Showing
with 505 additions and 361 deletions
...@@ -19,7 +19,7 @@ import info.textgrid.middleware.oaipmh.ResumptionTokenType; ...@@ -19,7 +19,7 @@ import info.textgrid.middleware.oaipmh.ResumptionTokenType;
/** /**
* @author Stefan E. Funk, SUB Göttingen * @author Stefan E. Funk, SUB Göttingen
* @version 2022-09-07 * @version 2023-01-03
* @since 2014-02-20 * @since 2014-02-20
*/ */
public abstract class IdentifierListDelivererAbstract implements IdentifierListDelivererInterface { public abstract class IdentifierListDelivererAbstract implements IdentifierListDelivererInterface {
...@@ -154,7 +154,7 @@ public abstract class IdentifierListDelivererAbstract implements IdentifierListD ...@@ -154,7 +154,7 @@ public abstract class IdentifierListDelivererAbstract implements IdentifierListD
JSONObject json = new JSONObject(hit.getSourceAsMap()); JSONObject json = new JSONObject(hit.getSourceAsMap());
// Get modifiedDate field and convert datestamp. // Get modifiedDate field and convert datestamp.
this.datestamp = OaipmhUtilities.fieldLoader(json, this.dateOfObjectCreation); this.datestamp = OaipmhUtilities.firstEnrtryFieldLoader(json, this.dateOfObjectCreation);
try { try {
this.datestamp = OaipmhUtilities.convertDateFormat(this.datestamp).toXMLFormat(); this.datestamp = OaipmhUtilities.convertDateFormat(this.datestamp).toXMLFormat();
} catch (ParseException e) { } catch (ParseException e) {
...@@ -166,7 +166,7 @@ public abstract class IdentifierListDelivererAbstract implements IdentifierListD ...@@ -166,7 +166,7 @@ public abstract class IdentifierListDelivererAbstract implements IdentifierListD
} }
// Get identifier field. // Get identifier field.
String identifier = OaipmhUtilities.fieldLoader(json, this.identifierField); String identifier = OaipmhUtilities.firstEnrtryFieldLoader(json, this.identifierField);
lit = setListIdentifierHeader(this.datestamp, identifier, lit, set); lit = setListIdentifierHeader(this.datestamp, identifier, lit, set);
} }
} }
......
...@@ -22,7 +22,7 @@ import info.textgrid.middleware.oaipmh.ResumptionTokenType; ...@@ -22,7 +22,7 @@ import info.textgrid.middleware.oaipmh.ResumptionTokenType;
/** /**
* @author Max Brodhun, SUB Göttingen * @author Max Brodhun, SUB Göttingen
* @author Stefan E. Funk, SUB Göttingen * @author Stefan E. Funk, SUB Göttingen
* @version 2022-09-23 * @version 2023-01-03
*/ */
public class IdentifierListDelivererIdiom extends IdentifierListDelivererAbstract { public class IdentifierListDelivererIdiom extends IdentifierListDelivererAbstract {
...@@ -73,6 +73,7 @@ public class IdentifierListDelivererIdiom extends IdentifierListDelivererAbstrac ...@@ -73,6 +73,7 @@ public class IdentifierListDelivererIdiom extends IdentifierListDelivererAbstrac
BoolQueryBuilder both = QueryBuilders.boolQuery().should(artefactQuery).should(conedakorQuery); BoolQueryBuilder both = QueryBuilders.boolQuery().should(artefactQuery).should(conedakorQuery);
// TODO bla???
BoolQueryBuilder bla = BoolQueryBuilder bla =
QueryBuilders.boolQuery().must(rangeQuery).must(projectQuery.filter(both)); QueryBuilders.boolQuery().must(rangeQuery).must(projectQuery.filter(both));
recordFilterForClassicMayan = bla; recordFilterForClassicMayan = bla;
...@@ -121,10 +122,11 @@ public class IdentifierListDelivererIdiom extends IdentifierListDelivererAbstrac ...@@ -121,10 +122,11 @@ public class IdentifierListDelivererIdiom extends IdentifierListDelivererAbstrac
for (SearchHit hit : scrollResp.getHits().getHits()) { for (SearchHit hit : scrollResp.getHits().getHits()) {
i++; i++;
String textgridURI = String textgridURI = OaipmhUtilities
OaipmhUtilities.fieldLoader(new JSONObject(hit.getSourceAsMap()), OaipmhTGConstants.URI); .firstEnrtryFieldLoader(new JSONObject(hit.getSourceAsMap()), OaipmhTGConstants.URI);
String createdDate = OaipmhUtilities.oaiDatestampAsString( String createdDate =
OaipmhUtilities.fieldLoader(new JSONObject(hit.getSourceAsMap()), OaipmhTGConstants.CREATED)); OaipmhUtilities.oaiDatestampAsString(OaipmhUtilities.firstEnrtryFieldLoader(
new JSONObject(hit.getSourceAsMap()), OaipmhTGConstants.CREATED));
identifierList.getHeader().add(OaipmhUtilities.computeResponseHeader(createdDate, identifierList.getHeader().add(OaipmhUtilities.computeResponseHeader(createdDate,
OaipmhUtilities.getTextGridBaseURI(textgridURI), "")); OaipmhUtilities.getTextGridBaseURI(textgridURI), ""));
......
...@@ -390,90 +390,113 @@ public class OaipmhUtilities { ...@@ -390,90 +390,113 @@ public class OaipmhUtilities {
/** /**
* <p> * <p>
* Loads the field with MORE params from an array! * Loops over all fields and collects field contents.
* </p> * </p>
* *
* @param resultFromGetRequestInES * @param resultFromGetRequestInES
* @param fields * @param fields
* @return Returns MORE params as a list! * @return Returns a list with all field entries.
*/ */
public static List<String> fieldLoader(JSONObject resultFromGetRequestInES, String[] fields) { public static List<String> loopListFieldLoader(final JSONObject resultFromGetRequestInES,
final String[] fields) {
log.fine("JSON: " + (resultFromGetRequestInES == null ? "NULL" : resultFromGetRequestInES)); List<String> result = new ArrayList<String>();
log.fine("FIELDS: " + fields);
List<String> fieldResults = new ArrayList<String>();
int count = 0; for (String f : fields) {
for (String field : fields) { result.addAll(listFieldLoader(resultFromGetRequestInES, f));
String[] fieldPathForESIndex = field.split(ES_DIVIDER_REGEXP);
log.fine("field[" + count++ + "]: " + field);
JSONObject singlePath = resultFromGetRequestInES;
try {
for (int i = 0; i < fieldPathForESIndex.length; i++) {
if (i < fieldPathForESIndex.length - 1) {
singlePath = singlePath.getJSONObject(fieldPathForESIndex[i]);
} else if (fieldPathForESIndex.length == 1) {
JSONObject resultiDingsda =
resultFromGetRequestInES.getJSONObject(fieldPathForESIndex[i]);
fieldResults.add(resultiDingsda.toString());
} else {
String res = singlePath.get(fieldPathForESIndex[i]).toString();
if (res.startsWith("[")) {
JSONArray array = new JSONArray(res);
for (int j = 0; j < array.length(); j++) {
String find = array.getString(j).toString();
fieldResults.add(find);
}
} else {
fieldResults.add(singlePath.get(fieldPathForESIndex[i]).toString());
}
}
}
} catch (JSONException e) {
log.fine("IGNORING JSON ERROR: " + e.getMessage());
}
} }
log.fine("field results: " + fieldResults); return result;
return fieldResults;
} }
/** /**
* <p> * <p>
* Loads the field with ONE param! * Loads the field with one param.
* </p> * </p>
* *
* @param resultFromGetRequestInES * @param resultFromGetRequestInES
* @param field * @param field
* @return Returns only ONE String! * @return Returns one or more params as a list.
*/ */
public static String fieldLoader(JSONObject resultFromGetRequestInES, String field) { public static List<String> listFieldLoader(final JSONObject resultFromGetRequestInES,
final String field) {
String fieldResults = ""; List<String> fieldResults = new ArrayList<String>();
log.fine("JSON: " + (resultFromGetRequestInES == null ? "NULL" : resultFromGetRequestInES));
log.fine("FIELD: " + field);
// Check if field has got "." in it, such as
// "edition.source.bibliographicCitation.placeOfPublication".
String[] fieldPathForESIndex = field.split(ES_DIVIDER_REGEXP); String[] fieldPathForESIndex = field.split(ES_DIVIDER_REGEXP);
JSONObject singlePath = resultFromGetRequestInES; JSONObject singlePath = resultFromGetRequestInES;
try { try {
// Loop the splitted field components, such as "edition", "source", etcpp.
for (int i = 0; i < fieldPathForESIndex.length; i++) { for (int i = 0; i < fieldPathForESIndex.length; i++) {
String fieldComponent = fieldPathForESIndex[i];
log.fine("i=" + i);
log.fine("fieldPathLength=" + fieldPathForESIndex.length);
// Case 1: Reduce JSON object.
if (i < fieldPathForESIndex.length - 1) { if (i < fieldPathForESIndex.length - 1) {
log.fine(
"case 1: " + i + "<" + (fieldPathForESIndex.length - 1) + " : reduce singlePath");
singlePath = singlePath.getJSONObject(fieldPathForESIndex[i]); singlePath = singlePath.getJSONObject(fieldPathForESIndex[i]);
} else if (fieldPathForESIndex.length == 1) { }
fieldResults = resultFromGetRequestInES.get(fieldPathForESIndex[i]).toString(); // Case 2: We have one field component.
} else { else if (fieldPathForESIndex.length == 1) {
fieldResults = singlePath.get(fieldPathForESIndex[i]).toString();
log.fine("case 2: we have only one field component in field " + field);
// Add content from JSON, Array or String.
fieldResults.addAll(getFieldContent(singlePath, fieldComponent));
}
// Case 3: We have got more field components.
else {
log.fine("case 3: we have " + fieldPathForESIndex.length + " components in " + field);
// Add content from JSON, Array or String.
fieldResults.addAll(getFieldContent(singlePath, fieldComponent));
} }
} }
} catch (JSONException e) { } catch (JSONException e) {
log.fine("IGNORING JSON ERROR: " + e.getMessage()); log.fine("IGNORING JSON ERROR: " + e.getMessage());
} }
log.fine("field results: " + fieldResults);
return fieldResults; return fieldResults;
} }
/**
* <p>
* Loads the field with the first param from. Please use for single value fields only.
* </p>
*
* @param resultFromGetRequestInES
* @param field
* @return Returns only the first String from the result list, or "" if list is empty.
*/
public static String firstEnrtryFieldLoader(JSONObject resultFromGetRequestInES, String field) {
String result = "";
List<String> list = listFieldLoader(resultFromGetRequestInES, field);
if (!list.isEmpty()) {
result = list.get(0);
}
return result;
}
/** /**
* @param theESClient The ES client to use. * @param theESClient The ES client to use.
* @param idInElasticSearchIndex The ID to get the ES record from. * @param idInElasticSearchIndex The ID to get the ES record from.
...@@ -494,7 +517,12 @@ public class OaipmhUtilities { ...@@ -494,7 +517,12 @@ public class OaipmhUtilities {
log.fine("esclient/index: " + (theESClient != null ? theESClient : "null") + "/" log.fine("esclient/index: " + (theESClient != null ? theESClient : "null") + "/"
+ (theESClient != null ? theESClient.getEsIndex() : "null")); + (theESClient != null ? theESClient.getEsIndex() : "null"));
// Building the getRequest against the elastic search index // Check for ES client.
if (theESClient == null) {
throw new IOException("elasticsearch client is NULL!");
}
// Building the getRequest against the elastic search index.
GetRequest getRequest = GetRequest getRequest =
new GetRequest(theESClient.getEsIndex(), theESClient.getEsType(), idInElasticSearchIndex) new GetRequest(theESClient.getEsIndex(), theESClient.getEsType(), idInElasticSearchIndex)
.fetchSourceContext(fetchSourceContext); .fetchSourceContext(fetchSourceContext);
...@@ -707,6 +735,54 @@ public class OaipmhUtilities { ...@@ -707,6 +735,54 @@ public class OaipmhUtilities {
return result.trim(); return result.trim();
} }
// **
// PRIVATE METHODS
// **
/**
* <p>
* Get List of Strings from JSON object, Array or String!
* </p>
*
* @param singlePath
* @param fieldComponent
* @return
*/
private static List<String> getFieldContent(JSONObject singlePath, String fieldComponent) {
List<String> result = new ArrayList<String>();
// Examine JSONArray, take String if not applicable.
try {
JSONArray singlePathArray = singlePath.getJSONArray(fieldComponent);
log.fine("get json array: " + singlePathArray.toString(2));
for (int j = 0; j < singlePathArray.length(); j++) {
result.add(singlePathArray.getString(j));
}
} catch (JSONException e) {
Object noArray = singlePath.get(fieldComponent);
if (noArray instanceof String) {
log.fine("get string: " + noArray);
result.add(singlePath.getString(fieldComponent));
} else if (noArray instanceof Integer) {
log.fine("get int: " + noArray);
result.add(String.valueOf(singlePath.getInt(fieldComponent)));
} else {
log.fine("no string & no int: " + noArray);
}
}
return result;
}
// ** // **
// GETTERS & SETTERS // GETTERS & SETTERS
// ** // **
......
...@@ -14,7 +14,7 @@ import info.textgrid.middleware.oaipmh.RecordType; ...@@ -14,7 +14,7 @@ import info.textgrid.middleware.oaipmh.RecordType;
/** /**
* @author Maximilian Brodhun, SUB Göttingen * @author Maximilian Brodhun, SUB Göttingen
* @author Stefan E. Funk, SUB Göttingen * @author Stefan E. Funk, SUB Göttingen
* @version 2022-09-07 * @version 2023-01-03
* @since 2014-02-17 * @since 2014-02-17
*/ */
@Component @Component
...@@ -30,10 +30,8 @@ public class RecordDelivererDC extends RecordDelivererAbstract { ...@@ -30,10 +30,8 @@ public class RecordDelivererDC extends RecordDelivererAbstract {
super(textgrid, dariah); super(textgrid, dariah);
} }
/* /**
* (non-Javadoc) *
*
* @see info.textgrid.middleware.RecordDelivererInterface#getRecordById(java.lang.String)
*/ */
@Override @Override
public GetRecordType getRecordById(String id) public GetRecordType getRecordById(String id)
...@@ -73,14 +71,14 @@ public class RecordDelivererDC extends RecordDelivererAbstract { ...@@ -73,14 +71,14 @@ public class RecordDelivererDC extends RecordDelivererAbstract {
if (this.dariah == true) { if (this.dariah == true) {
dublinCoreBuilder = putContentIntoDCFieldListsDH(esResultObject); dublinCoreBuilder = putContentIntoDCFieldListsDH(esResultObject);
JSONObject json = new JSONObject(esResultObject.getSourceAsMap()); JSONObject json = new JSONObject(esResultObject.getSourceAsMap());
identifier = OaipmhUtilities.fieldLoader(json, this.identifierField); identifier = OaipmhUtilities.firstEnrtryFieldLoader(json, this.identifierField);
String dateOfCreation = "NO_DATE_SET!"; String dateOfCreation = "NO_DATE_SET!";
if (OaipmhUtilities.fieldLoader(json, this.dateOfObjectCreation) != null) { if (OaipmhUtilities.firstEnrtryFieldLoader(json, this.dateOfObjectCreation) != null) {
try { try {
dateOfCreation = OaipmhUtilities dateOfCreation = OaipmhUtilities
.convertDateFormat( .convertDateFormat(OaipmhUtilities
OaipmhUtilities.fieldLoader(json, this.dateOfObjectCreation).toString()) .firstEnrtryFieldLoader(json, this.dateOfObjectCreation).toString())
.toXMLFormat(); .toXMLFormat();
} catch (ParseException e) { } catch (ParseException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
...@@ -91,7 +89,7 @@ public class RecordDelivererDC extends RecordDelivererAbstract { ...@@ -91,7 +89,7 @@ public class RecordDelivererDC extends RecordDelivererAbstract {
} }
} }
String setSpec = OaipmhUtilities.fieldLoader(json, this.specField); String setSpec = OaipmhUtilities.firstEnrtryFieldLoader(json, this.specField);
String setSpecValue = String setSpecValue =
OaipmhUtilities.getSetSpec(setSpec, this.specFieldPrefix, identifier); OaipmhUtilities.getSetSpec(setSpec, this.specFieldPrefix, identifier);
...@@ -238,46 +236,36 @@ public class RecordDelivererDC extends RecordDelivererAbstract { ...@@ -238,46 +236,36 @@ public class RecordDelivererDC extends RecordDelivererAbstract {
DublinCoreBuilder result = new DublinCoreBuilder(); DublinCoreBuilder result = new DublinCoreBuilder();
// Set DublinCore lists with content from elastic search results due to configuration. // Set DublinCore lists with content from elastic search results due to configuration.
result.setContributor(OaipmhUtilities result.setContributor(OaipmhUtilities.loopListFieldLoader(
.fieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()), this.contributorList)); new JSONObject(responseWorkValues.getSourceAsMap()), this.contributorList));
result.setCoverage( result.setCoverage(OaipmhUtilities.loopListFieldLoader(
OaipmhUtilities.fieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()), new JSONObject(responseWorkValues.getSourceAsMap()), this.coverageList));
this.coverageList)); result.setCreator(OaipmhUtilities.loopListFieldLoader(
result new JSONObject(responseWorkValues.getSourceAsMap()), this.creatorList));
.setCreator(OaipmhUtilities.fieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()), result.setDate(OaipmhUtilities
this.creatorList)); .loopListFieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()), this.dateList));
result.setDate(OaipmhUtilities.fieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()), result.setDescription(OaipmhUtilities.loopListFieldLoader(
this.dateList)); new JSONObject(responseWorkValues.getSourceAsMap()), this.descriptionList));
result.setDescription( result.setFormat(OaipmhUtilities
OaipmhUtilities.fieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()), .loopListFieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()), this.formatList));
this.descriptionList)); result.setIdentifier(OaipmhUtilities.loopListFieldLoader(
result new JSONObject(responseWorkValues.getSourceAsMap()), this.identifierList));
.setFormat(OaipmhUtilities.fieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()), result.setLanguage(OaipmhUtilities.loopListFieldLoader(
this.formatList)); new JSONObject(responseWorkValues.getSourceAsMap()), this.languageList));
result.setIdentifier( result.setPublisher(OaipmhUtilities.loopListFieldLoader(
OaipmhUtilities.fieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()), new JSONObject(responseWorkValues.getSourceAsMap()), this.publisherList));
this.identifierList)); result.setRelation(OaipmhUtilities.loopListFieldLoader(
result.setLanguage( new JSONObject(responseWorkValues.getSourceAsMap()), this.relationList));
OaipmhUtilities.fieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()), result.setRights(OaipmhUtilities
this.languageList)); .loopListFieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()), this.rightsList));
result.setPublisher( result.setSource(OaipmhUtilities
OaipmhUtilities.fieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()), .loopListFieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()), this.sourceList));
this.publisherList)); result.setSubject(OaipmhUtilities.loopListFieldLoader(
result.setRelation( new JSONObject(responseWorkValues.getSourceAsMap()), this.subjectList));
OaipmhUtilities.fieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()),
this.relationList));
result
.setRights(OaipmhUtilities.fieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()),
this.rightsList));
result
.setSource(OaipmhUtilities.fieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()),
this.sourceList));
result.setSubject(OaipmhUtilities
.fieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()), this.subjectList));
result.setTitle(OaipmhUtilities result.setTitle(OaipmhUtilities
.fieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()), this.titleList)); .loopListFieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()), this.titleList));
result.setType(OaipmhUtilities.fieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()), result.setType(OaipmhUtilities
this.typeList)); .loopListFieldLoader(new JSONObject(responseWorkValues.getSourceAsMap()), this.typeList));
return result; return result;
} }
......
...@@ -24,7 +24,7 @@ import info.textgrid.middleware.oaipmh.RecordType; ...@@ -24,7 +24,7 @@ import info.textgrid.middleware.oaipmh.RecordType;
/** /**
* @author Maximilian Brodhun, SUB Göttingen * @author Maximilian Brodhun, SUB Göttingen
* @author Stefan E. Funk, SUB Göttingen * @author Stefan E. Funk, SUB Göttingen
* @version 2022-10-06 * @version 2023-01-03
* @since 2019-03-12 * @since 2019-03-12
*/ */
@Component @Component
...@@ -218,7 +218,7 @@ public class RecordDelivererIdiom extends RecordDelivererAbstract { ...@@ -218,7 +218,7 @@ public class RecordDelivererIdiom extends RecordDelivererAbstract {
json = new JSONObject(OaipmhUtilities.getRcordByIDFromElasticSearch(this.oaiEsClient, changedId, json = new JSONObject(OaipmhUtilities.getRcordByIDFromElasticSearch(this.oaiEsClient, changedId,
searchField, Strings.EMPTY_ARRAY).getSource()); searchField, Strings.EMPTY_ARRAY).getSource());
result = OaipmhUtilities.fieldLoader(json, theSearchField); result = OaipmhUtilities.firstEnrtryFieldLoader(json, theSearchField);
return result; return result;
} }
......
...@@ -191,7 +191,7 @@ public class RecordListDelivererDC extends RecordListDelivererAbstract { ...@@ -191,7 +191,7 @@ public class RecordListDelivererDC extends RecordListDelivererAbstract {
if (hit != null && hit.getFields() != null) { if (hit != null && hit.getFields() != null) {
JSONObject json = new JSONObject(hit.getSourceAsMap()); JSONObject json = new JSONObject(hit.getSourceAsMap());
this.modifiedValue = OaipmhUtilities.fieldLoader(json, this.modifiedField); this.modifiedValue = OaipmhUtilities.firstEnrtryFieldLoader(json, this.modifiedField);
// ** // **
// TEXTGRID SEARCH // TEXTGRID SEARCH
...@@ -240,7 +240,7 @@ public class RecordListDelivererDC extends RecordListDelivererAbstract { ...@@ -240,7 +240,7 @@ public class RecordListDelivererDC extends RecordListDelivererAbstract {
else if (this.dariah) { else if (this.dariah) {
// Get identifier and setSpec field, add setSpec prefix if not already set. // Get identifier and setSpec field, add setSpec prefix if not already set.
String identifier = OaipmhUtilities.fieldLoader(json, this.identifierField); String identifier = OaipmhUtilities.firstEnrtryFieldLoader(json, this.identifierField);
String setSpec = OaipmhUtilities.getSetSpec(set, this.specFieldPrefix, identifier); String setSpec = OaipmhUtilities.getSetSpec(set, this.specFieldPrefix, identifier);
try { try {
...@@ -415,8 +415,8 @@ public class RecordListDelivererDC extends RecordListDelivererAbstract { ...@@ -415,8 +415,8 @@ public class RecordListDelivererDC extends RecordListDelivererAbstract {
result.setDescription( result.setDescription(
DublinCoreFieldLoader.fillListFromTGWorkValues(responseWorkValues, this.descriptionList)); DublinCoreFieldLoader.fillListFromTGWorkValues(responseWorkValues, this.descriptionList));
result.setFormat(DublinCoreFieldLoader.fillList(hit, this.formatList)); result.setFormat(DublinCoreFieldLoader.fillList(hit, this.formatList));
result.setIdentifier( result.setIdentifier(OaipmhUtilities.loopListFieldLoader(new JSONObject(hit.getSourceAsMap()),
OaipmhUtilities.fieldLoader(new JSONObject(hit.getSourceAsMap()), this.identifierList)); this.identifierList));
result.setLanguage(DublinCoreFieldLoader.fillList(hit, this.languageList)); result.setLanguage(DublinCoreFieldLoader.fillList(hit, this.languageList));
result.setPublisher(DublinCoreFieldLoader.fillList(hit, this.publisherList)); result.setPublisher(DublinCoreFieldLoader.fillList(hit, this.publisherList));
result.setRelation(DublinCoreFieldLoader.fillList(hit, this.relationList)); result.setRelation(DublinCoreFieldLoader.fillList(hit, this.relationList));
...@@ -443,36 +443,36 @@ public class RecordListDelivererDC extends RecordListDelivererAbstract { ...@@ -443,36 +443,36 @@ public class RecordListDelivererDC extends RecordListDelivererAbstract {
DublinCoreBuilder result = new DublinCoreBuilder(); DublinCoreBuilder result = new DublinCoreBuilder();
result.setContributor( result.setContributor(OaipmhUtilities.loopListFieldLoader(new JSONObject(hit.getSourceAsMap()),
OaipmhUtilities.fieldLoader(new JSONObject(hit.getSourceAsMap()), this.contributorList)); this.contributorList));
result.setCoverage( result.setCoverage(OaipmhUtilities.loopListFieldLoader(new JSONObject(hit.getSourceAsMap()),
OaipmhUtilities.fieldLoader(new JSONObject(hit.getSourceAsMap()), this.coverageList)); this.coverageList));
result.setCreator( result.setCreator(OaipmhUtilities.loopListFieldLoader(new JSONObject(hit.getSourceAsMap()),
OaipmhUtilities.fieldLoader(new JSONObject(hit.getSourceAsMap()), this.creatorList)); this.creatorList));
result result.setDate(
.setDate(OaipmhUtilities.fieldLoader(new JSONObject(hit.getSourceAsMap()), this.dateList)); OaipmhUtilities.loopListFieldLoader(new JSONObject(hit.getSourceAsMap()), this.dateList));
result.setDescription( result.setDescription(OaipmhUtilities.loopListFieldLoader(new JSONObject(hit.getSourceAsMap()),
OaipmhUtilities.fieldLoader(new JSONObject(hit.getSourceAsMap()), this.descriptionList)); this.descriptionList));
result.setFormat( result.setFormat(
OaipmhUtilities.fieldLoader(new JSONObject(hit.getSourceAsMap()), this.formatList)); OaipmhUtilities.loopListFieldLoader(new JSONObject(hit.getSourceAsMap()), this.formatList));
result.setIdentifier( result.setIdentifier(OaipmhUtilities.loopListFieldLoader(new JSONObject(hit.getSourceAsMap()),
OaipmhUtilities.fieldLoader(new JSONObject(hit.getSourceAsMap()), this.identifierList)); this.identifierList));
result.setLanguage( result.setLanguage(OaipmhUtilities.loopListFieldLoader(new JSONObject(hit.getSourceAsMap()),
OaipmhUtilities.fieldLoader(new JSONObject(hit.getSourceAsMap()), this.languageList)); this.languageList));
result.setPublisher( result.setPublisher(OaipmhUtilities.loopListFieldLoader(new JSONObject(hit.getSourceAsMap()),
OaipmhUtilities.fieldLoader(new JSONObject(hit.getSourceAsMap()), this.publisherList)); this.publisherList));
result.setRelation( result.setRelation(OaipmhUtilities.loopListFieldLoader(new JSONObject(hit.getSourceAsMap()),
OaipmhUtilities.fieldLoader(new JSONObject(hit.getSourceAsMap()), this.relationList)); this.relationList));
result.setRights( result.setRights(
OaipmhUtilities.fieldLoader(new JSONObject(hit.getSourceAsMap()), this.rightsList)); OaipmhUtilities.loopListFieldLoader(new JSONObject(hit.getSourceAsMap()), this.rightsList));
result.setSource( result.setSource(
OaipmhUtilities.fieldLoader(new JSONObject(hit.getSourceAsMap()), this.sourceList)); OaipmhUtilities.loopListFieldLoader(new JSONObject(hit.getSourceAsMap()), this.sourceList));
result.setSubject( result.setSubject(OaipmhUtilities.loopListFieldLoader(new JSONObject(hit.getSourceAsMap()),
OaipmhUtilities.fieldLoader(new JSONObject(hit.getSourceAsMap()), this.subjectList)); this.subjectList));
result.setTitle( result.setTitle(
OaipmhUtilities.fieldLoader(new JSONObject(hit.getSourceAsMap()), this.titleList)); OaipmhUtilities.loopListFieldLoader(new JSONObject(hit.getSourceAsMap()), this.titleList));
result result.setType(
.setType(OaipmhUtilities.fieldLoader(new JSONObject(hit.getSourceAsMap()), this.typeList)); OaipmhUtilities.loopListFieldLoader(new JSONObject(hit.getSourceAsMap()), this.typeList));
return result; return result;
} }
......
...@@ -124,8 +124,8 @@ public class RecordListDelivererIdiom extends RecordListDelivererAbstract { ...@@ -124,8 +124,8 @@ public class RecordListDelivererIdiom extends RecordListDelivererAbstract {
log.fine("hit no." + i + ": id=" + hit.getId()); log.fine("hit no." + i + ": id=" + hit.getId());
String textgridURI = String textgridURI = OaipmhUtilities
OaipmhUtilities.fieldLoader(new JSONObject(hit.getSourceAsMap()), "textgridUri"); .firstEnrtryFieldLoader(new JSONObject(hit.getSourceAsMap()), "textgridUri");
log.fine("textgrid uri: " + textgridURI); log.fine("textgrid uri: " + textgridURI);
......
...@@ -63,7 +63,6 @@ public class TestTGOaipmhLocally { ...@@ -63,7 +63,6 @@ public class TestTGOaipmhLocally {
private static IdentifierListDelivererIdiom identifierListIDIOM = private static IdentifierListDelivererIdiom identifierListIDIOM =
new IdentifierListDelivererIdiom(true, false); new IdentifierListDelivererIdiom(true, false);
private static SetListDeliverer setListTextGrid; private static SetListDeliverer setListTextGrid;
private static IdiomImages idiomImages;
// ** // **
// CLASS // CLASS
...@@ -148,9 +147,9 @@ public class TestTGOaipmhLocally { ...@@ -148,9 +147,9 @@ public class TestTGOaipmhLocally {
// System.out.println(json); // System.out.println(json);
DublinCoreBuilder result = new DublinCoreBuilder(); DublinCoreBuilder result = new DublinCoreBuilder();
List<String> identifier = new ArrayList<String>(); List<String> identifier = new ArrayList<String>();
String[] fieldsForIdentifier = {"descriptiveMetadata.dc:identifier"}; System.out.println(
System.out.println(OaipmhUtilities.fieldLoader(json, OaipmhConstants.TEST_DARIAH_IDENTIFIER)); OaipmhUtilities.firstEnrtryFieldLoader(json, OaipmhConstants.TEST_DARIAH_IDENTIFIER));
identifier = OaipmhUtilities.fieldLoader(json, fieldsForIdentifier); identifier = OaipmhUtilities.listFieldLoader(json, "descriptiveMetadata.dc:identifier");
for (String id : identifier) { for (String id : identifier) {
System.out.println(id); System.out.println(id);
} }
...@@ -198,9 +197,9 @@ public class TestTGOaipmhLocally { ...@@ -198,9 +197,9 @@ public class TestTGOaipmhLocally {
JSONObject json = new JSONObject(jsonAsString); JSONObject json = new JSONObject(jsonAsString);
DublinCoreBuilder result = new DublinCoreBuilder(); DublinCoreBuilder result = new DublinCoreBuilder();
List<String> identifier = new ArrayList<String>(); List<String> identifier = new ArrayList<String>();
String[] fieldsForIdentifier = {"descriptiveMetadata.dc:identifier"}; System.out.println(
System.out.println(OaipmhUtilities.fieldLoader(json, OaipmhConstants.TEST_DARIAH_IDENTIFIER)); OaipmhUtilities.firstEnrtryFieldLoader(json, OaipmhConstants.TEST_DARIAH_IDENTIFIER));
identifier = OaipmhUtilities.fieldLoader(json, fieldsForIdentifier); identifier = OaipmhUtilities.listFieldLoader(json, "descriptiveMetadata.dc:identifier");
for (String id : identifier) { for (String id : identifier) {
System.out.println(id); System.out.println(id);
} }
......
############################################################################### ##################################
## OAI-PMH Configuration File ## ## OAI-PMH Configuration File ##
############################################################################### ##################################
RS_ENDPOINT = https://repository.de.dariah.eu/1.0/oaipmh RS_ENDPOINT = https://repository.de.dariah.eu/1.0/oaipmh
...@@ -47,10 +47,14 @@ fields = administrativeMetadata.dcterms:creator, administrativeMetadata.datacite ...@@ -47,10 +47,14 @@ fields = administrativeMetadata.dcterms:creator, administrativeMetadata.datacite
workFields = descriptiveMetadata.dc:title workFields = descriptiveMetadata.dc:title
###################### ######################
## OpenAireRecords ### ## OpenAireRecords ##
###################### ######################
oar.identifierField = administrativeMetadata.datacite:identifier oar.identifierField = administrativeMetadata.datacite:identifier
oar.sizeField = administrativeMetadata.dcterms:extent
oar.relationToWorkObject =
oar.handle = administrativeMetadata.dcterms:identifier
oar.titleFields = descriptiveMetadata.dc:title oar.titleFields = descriptiveMetadata.dc:title
oar.dateFields = administrativeMetadata.dcterms:created, administrativeMetadata.dcterms:modified oar.dateFields = administrativeMetadata.dcterms:created, administrativeMetadata.dcterms:modified
oar.contributorFields = administrativeMetadata.dcterms:creator, descriptiveMetadata.dc:contributor oar.contributorFields = administrativeMetadata.dcterms:creator, descriptiveMetadata.dc:contributor
...@@ -61,12 +65,9 @@ oar.formatFields = administrativeMetadata.dcterms:format ...@@ -61,12 +65,9 @@ oar.formatFields = administrativeMetadata.dcterms:format
oar.rightsFields = descriptiveMetadata.dc:rights oar.rightsFields = descriptiveMetadata.dc:rights
oar.descriptionFields = descriptiveMetadata.dc:description oar.descriptionFields = descriptiveMetadata.dc:description
oar.relatedIdentifierFields = descriptiveMetadata.dc:relation oar.relatedIdentifierFields = descriptiveMetadata.dc:relation
oar.relationToWorkObject =
oar.geoLocationFields = descriptiveMetadata.dc:coverage oar.geoLocationFields = descriptiveMetadata.dc:coverage
oar.handle = administrativeMetadata.dcterms:identifier
oar.versionFields = oar.versionFields =
oar.subjectFields = descriptiveMetadata.dc:subject oar.subjectFields = descriptiveMetadata.dc:subject
oar.sizeField = administrativeMetadata.dcterms:extent
########################## ##########################
## Dublin Core Fields ## ## Dublin Core Fields ##
...@@ -105,15 +106,15 @@ identifierField = administrativeMetadata.dcterms:identifier ...@@ -105,15 +106,15 @@ identifierField = administrativeMetadata.dcterms:identifier
modifiedField = administrativeMetadata.dcterms:modified modifiedField = administrativeMetadata.dcterms:modified
searchResponseSize = 100 searchResponseSize = 100
####################### #####################
### More Settings ### ## More Settings ##
####################### #####################
specField = administrativeMetadata.dcterms:relation specField = administrativeMetadata.dcterms:relation
specFieldPrefix = hdl: specFieldPrefix = hdl:
######################################## ######################################
### IDIOM Metadata Format Settings ### ## IDIOM Metadata Format Settings ##
######################################## ######################################
idiomResponseSize = 30 idiomResponseSize = 30
############################################################################### ##################################
## OAI-PMH Configuration File ## ## OAI-PMH Configuration File ##
############################################################################### ##################################
RS_ENDPOINT = https://dev.textgridlab.org/1.0/tgoaipmh RS_ENDPOINT = https://dev.textgridlab.org/1.0/tgoaipmh
...@@ -47,13 +47,17 @@ fields = extent, work.subject, revision, edition.source.bibliographicCitation, e ...@@ -47,13 +47,17 @@ fields = extent, work.subject, revision, edition.source.bibliographicCitation, e
workFields = created, work.abstract, relations.isDerivedFrom, textgridUri, work.genre, title, work.type, work.spatial.value, work.temporal.spatial, work.agent.value, work.subject.id.value workFields = created, work.abstract, relations.isDerivedFrom, textgridUri, work.genre, title, work.type, work.spatial.value, work.temporal.spatial, work.agent.value, work.subject.id.value
###################### ######################
## OpenAireRecords ### ## OpenAireRecords ##
###################### ######################
oar.identifierField = pid.value oar.identifierField = pid.value
oar.titleFields = title, edition.source.bibliographicCitation.editionTitle oar.sizeField = extent
oar.dateFields = created, issued, lastModified oar.relationToWorkObject = edition.isEditionOf
oar.contributorFields = dataContributor, project oar.handle = pid.value
oar.titleFields = title
oar.dateFields = created,issued,lastModified
oar.contributorFields = dataContributor
oar.creatorFields = TODO oar.creatorFields = TODO
oar.languageFields = edition.language oar.languageFields = edition.language
oar.alternateIdentifierFields = textgridUri oar.alternateIdentifierFields = textgridUri
...@@ -61,12 +65,9 @@ oar.formatFields = format ...@@ -61,12 +65,9 @@ oar.formatFields = format
oar.rightsFields = edition.license oar.rightsFields = edition.license
oar.descriptionFields = work.abstract oar.descriptionFields = work.abstract
oar.relatedIdentifierFields = edition.isEditionOf oar.relatedIdentifierFields = edition.isEditionOf
oar.relationToWorkObject = edition.isEditionOf
oar.geoLocationFields = edition.source.bibliographicCitation.placeOfPublication oar.geoLocationFields = edition.source.bibliographicCitation.placeOfPublication
oar.handle = pid.value
oar.versionFields = revision oar.versionFields = revision
oar.subjectFields = work.subject oar.subjectFields = work.subject
oar.sizeField = extent
########################## ##########################
## Dublin Core Fields ## ## Dublin Core Fields ##
...@@ -105,16 +106,16 @@ identifierField = textgridUri ...@@ -105,16 +106,16 @@ identifierField = textgridUri
modifiedField = lastModified modifiedField = lastModified
searchResponseSize = 100 searchResponseSize = 100
####################### #####################
### More Settings ### ## More Settings ##
####################### #####################
specField = project.id specField = project.id
specFieldPrefix = project: specFieldPrefix = project:
######################################## ######################################
### IDIOM Metadata Format Settings ### ## IDIOM Metadata Format Settings ##
######################################## ######################################
idiomResponseSize = 30 idiomResponseSize = 30
# NONPUBLIC index only TextGrid IDIOM queries! # NONPUBLIC index only TextGrid IDIOM queries!
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment