Merge branch 'beta' into clean_subjects

This commit is contained in:
Claudio Atzori 2022-08-08 12:34:33 +02:00
commit a78028dabc
4 changed files with 34 additions and 0 deletions

View File

@ -214,6 +214,17 @@ public class XmlRecordFactory implements Serializable {
metadata.addAll(measuresAsXml(r.getMeasures()));
}
if (r.getEoscifguidelines() != null) {
metadata
.addAll(
r
.getEoscifguidelines()
.stream()
.filter(Objects::nonNull)
.map(e -> XmlSerializationUtils.mapEoscIf(e))
.collect(Collectors.toList()));
}
if (r.getContext() != null) {
contexts.addAll(r.getContext().stream().map(c -> c.getId()).collect(Collectors.toList()));
/* FIXME: Workaround for CLARIN mining issue: #3670#note-29 */

View File

@ -7,6 +7,8 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.util.List;
import com.google.common.collect.Lists;
import eu.dnetlib.dhp.schema.oaf.*;
import scala.Tuple2;
@ -161,4 +163,15 @@ public class XmlSerializationUtils {
sb.append("/>");
return sb.toString();
}
public static String mapEoscIf(EoscIfGuidelines e) {
return asXmlElement(
"eoscifguidelines", Lists
.newArrayList(
new Tuple2<>("code", e.getCode()),
new Tuple2<>("label", e.getLabel()),
new Tuple2<>("url", e.getUrl()),
new Tuple2<>("semanticrelation", e.getSemanticRelation())));
}
}

View File

@ -87,6 +87,8 @@ public class XmlRecordFactoryTest {
assertEquals(
"C", doc.valueOf("//*[local-name() = 'result']/measure[./@id = 'popularity']/@class"));
assertEquals("EOSC::Jupyter Notebook", doc.valueOf("//*[local-name() = 'result']/eoscifguidelines/@code"));
}
@Test

View File

@ -1,4 +1,12 @@
{
"eoscifguidelines": [
{
"code" : "EOSC::Jupyter Notebook",
"label" : "EOSC::Jupyter Notebook",
"url" : "",
"semanticRelation" : "compliesWith"
}
],
"measures": [
{
"id": "influence",