forked from D-Net/dnet-hadoop
Merge pull request 'Map oaf:eoscifguidelines from mdstore to the graph' (#256) from eoscifguidelines-from-mdstores into beta
Reviewed-on: D-Net/dnet-hadoop#256
This commit is contained in:
commit
24f99d7310
|
@ -366,6 +366,7 @@ public abstract class AbstractMdRecordToOafMapper {
|
||||||
|
|
||||||
r.setInstance(instances);
|
r.setInstance(instances);
|
||||||
r.setBestaccessright(OafMapperUtils.createBestAccessRights(instances));
|
r.setBestaccessright(OafMapperUtils.createBestAccessRights(instances));
|
||||||
|
r.setEoscifguidelines(prepareEOSCIfGuidelines(doc, info));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract List<StructuredProperty> prepareResultPids(Document doc, DataInfo info);
|
protected abstract List<StructuredProperty> prepareResultPids(Document doc, DataInfo info);
|
||||||
|
@ -384,6 +385,25 @@ public abstract class AbstractMdRecordToOafMapper {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<EoscIfGuidelines> prepareEOSCIfGuidelines(Document doc, DataInfo info) {
|
||||||
|
final Set<EoscIfGuidelines> set = Sets.newHashSet();
|
||||||
|
for (final Object o : doc.selectNodes("//oaf:eoscifguidelines")) {
|
||||||
|
final String code = ((Node) o).valueOf("@code");
|
||||||
|
final String label = ((Node) o).valueOf("@label");
|
||||||
|
final String url = ((Node) o).valueOf("@url");
|
||||||
|
final String semrel = ((Node) o).valueOf("@semanticrelation");
|
||||||
|
if (StringUtils.isNotBlank(code)) {
|
||||||
|
final EoscIfGuidelines eig = new EoscIfGuidelines();
|
||||||
|
eig.setCode(code);
|
||||||
|
eig.setLabel(label);
|
||||||
|
eig.setUrl(url);
|
||||||
|
eig.setSemanticRelation(semrel);
|
||||||
|
set.add(eig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Lists.newArrayList(set);
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract Qualifier prepareResourceType(Document doc, DataInfo info);
|
protected abstract Qualifier prepareResourceType(Document doc, DataInfo info);
|
||||||
|
|
||||||
protected abstract List<Instance> prepareInstances(
|
protected abstract List<Instance> prepareInstances(
|
||||||
|
|
|
@ -947,6 +947,11 @@ class MappersTest {
|
||||||
Instance inst = p.getInstance().get(0);
|
Instance inst = p.getInstance().get(0);
|
||||||
assertEquals("https://w3id.org/ro-id/0ab171a7-45c5-4194-82d4-850955504bca", inst.getPid().get(0).getValue());
|
assertEquals("https://w3id.org/ro-id/0ab171a7-45c5-4194-82d4-850955504bca", inst.getPid().get(0).getValue());
|
||||||
assertEquals("https://w3id.org/ro-id/0ab171a7-45c5-4194-82d4-850955504bca", inst.getUrl().get(0));
|
assertEquals("https://w3id.org/ro-id/0ab171a7-45c5-4194-82d4-850955504bca", inst.getUrl().get(0));
|
||||||
|
assertEquals(1, p.getEoscifguidelines().size());
|
||||||
|
assertEquals("EOSC::RO-crate", p.getEoscifguidelines().get(0).getCode());
|
||||||
|
assertEquals("EOSC::RO-crate", p.getEoscifguidelines().get(0).getLabel());
|
||||||
|
assertEquals("", p.getEoscifguidelines().get(0).getUrl());
|
||||||
|
assertEquals("compliesWith", p.getEoscifguidelines().get(0).getSemanticRelation());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,6 @@
|
||||||
</sizes>
|
</sizes>
|
||||||
<subjects xmlns="http://datacite.org/schema/kernel-4">
|
<subjects xmlns="http://datacite.org/schema/kernel-4">
|
||||||
<subject>Ecology</subject>
|
<subject>Ecology</subject>
|
||||||
<subject>EOSC::RO-crate</subject>
|
|
||||||
</subjects>
|
</subjects>
|
||||||
</datacite:resource>
|
</datacite:resource>
|
||||||
<oaf:identifier identifierType="w3id">https://w3id.org/ro-id/0ab171a7-45c5-4194-82d4-850955504bca</oaf:identifier>
|
<oaf:identifier identifierType="w3id">https://w3id.org/ro-id/0ab171a7-45c5-4194-82d4-850955504bca</oaf:identifier>
|
||||||
|
@ -75,5 +74,9 @@
|
||||||
<oaf:language/>
|
<oaf:language/>
|
||||||
<oaf:hostedBy name="ROHub" id="fairsharing_::4119"/>
|
<oaf:hostedBy name="ROHub" id="fairsharing_::4119"/>
|
||||||
<oaf:collectedFrom name="ROHub" id="fairsharing_::4119"/>
|
<oaf:collectedFrom name="ROHub" id="fairsharing_::4119"/>
|
||||||
|
<oaf:eoscifguidelines code="EOSC::RO-crate"
|
||||||
|
label="EOSC::RO-crate"
|
||||||
|
url=""
|
||||||
|
semanticrelation="compliesWith"/>
|
||||||
</metadata>
|
</metadata>
|
||||||
</record>
|
</record>
|
Loading…
Reference in New Issue