forked from D-Net/dnet-hadoop
Merge branch 'beta' into clean_subjects
This commit is contained in:
commit
a78028dabc
|
@ -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 */
|
||||
|
|
|
@ -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())));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
{
|
||||
"eoscifguidelines": [
|
||||
{
|
||||
"code" : "EOSC::Jupyter Notebook",
|
||||
"label" : "EOSC::Jupyter Notebook",
|
||||
"url" : "",
|
||||
"semanticRelation" : "compliesWith"
|
||||
}
|
||||
],
|
||||
"measures": [
|
||||
{
|
||||
"id": "influence",
|
||||
|
|
Loading…
Reference in New Issue