rel_project_validation #69
|
@ -75,6 +75,8 @@ public abstract class AbstractMdRecordToOafMapper {
|
||||||
protected static final Qualifier MAG_PID_TYPE = qualifier(
|
protected static final Qualifier MAG_PID_TYPE = qualifier(
|
||||||
"MAGIdentifier", "Microsoft Academic Graph Identifier", DNET_PID_TYPES, DNET_PID_TYPES);
|
"MAGIdentifier", "Microsoft Academic Graph Identifier", DNET_PID_TYPES, DNET_PID_TYPES);
|
||||||
|
|
||||||
|
protected static final String DEFAULT_TRUST_FOR_VALIDATED_RELS = "0.999";
|
||||||
|
|
||||||
protected static final Map<String, String> nsContext = new HashMap<>();
|
protected static final Map<String, String> nsContext = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -244,25 +246,54 @@ public abstract class AbstractMdRecordToOafMapper {
|
||||||
|
|
||||||
final String originalId = ((Node) o).getText();
|
final String originalId = ((Node) o).getText();
|
||||||
|
|
||||||
|
final String validationdDate = ((Node) o).valueOf("@validationDate");
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(originalId)) {
|
if (StringUtils.isNotBlank(originalId)) {
|
||||||
final String projectId = createOpenaireId(40, originalId, true);
|
final String projectId = createOpenaireId(40, originalId, true);
|
||||||
|
|
||||||
res
|
res
|
||||||
.add(
|
.add(
|
||||||
getRelation(
|
getRelationWithValidationDate(
|
||||||
docId, projectId, RESULT_PROJECT, OUTCOME, IS_PRODUCED_BY, collectedFrom, info,
|
docId, projectId, RESULT_PROJECT, OUTCOME, IS_PRODUCED_BY, collectedFrom, info,
|
||||||
lastUpdateTimestamp));
|
lastUpdateTimestamp, validationdDate));
|
||||||
res
|
res
|
||||||
.add(
|
.add(
|
||||||
getRelation(
|
getRelationWithValidationDate(
|
||||||
projectId, docId, RESULT_PROJECT, OUTCOME, PRODUCES, collectedFrom, info,
|
projectId, docId, RESULT_PROJECT, OUTCOME, PRODUCES, collectedFrom, info,
|
||||||
lastUpdateTimestamp));
|
lastUpdateTimestamp, validationdDate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Relation getRelationWithValidationDate(final String source,
|
||||||
|
final String target,
|
||||||
|
final String relType,
|
||||||
|
final String subRelType,
|
||||||
|
final String relClass,
|
||||||
|
final KeyValue collectedFrom,
|
||||||
|
final DataInfo info,
|
||||||
|
final long lastUpdateTimestamp,
|
||||||
|
final String validationDate) {
|
||||||
|
|
||||||
|
final Relation r = getRelation(
|
||||||
|
source, target, relType, subRelType, relClass, collectedFrom, info, lastUpdateTimestamp);
|
||||||
|
r.setValidated(StringUtils.isNotBlank(validationDate));
|
||||||
|
r.setValidationDate(StringUtils.isNotBlank(validationDate) ? validationDate : null);
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(validationDate)) {
|
||||||
|
r.setValidated(true);
|
||||||
|
r.setValidationDate(validationDate);
|
||||||
|
r.getDataInfo().setTrust(DEFAULT_TRUST_FOR_VALIDATED_RELS);
|
||||||
|
} else {
|
||||||
|
r.setValidated(false);
|
||||||
|
r.setValidationDate(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
protected Relation getRelation(final String source,
|
protected Relation getRelation(final String source,
|
||||||
final String target,
|
final String target,
|
||||||
final String relType,
|
final String relType,
|
||||||
|
|
|
@ -141,7 +141,10 @@ public class MappersTest {
|
||||||
assertTrue(StringUtils.isNotBlank(r2.getRelClass()));
|
assertTrue(StringUtils.isNotBlank(r2.getRelClass()));
|
||||||
assertTrue(StringUtils.isNotBlank(r1.getRelType()));
|
assertTrue(StringUtils.isNotBlank(r1.getRelType()));
|
||||||
assertTrue(StringUtils.isNotBlank(r2.getRelType()));
|
assertTrue(StringUtils.isNotBlank(r2.getRelType()));
|
||||||
|
assertTrue(r1.getValidated());
|
||||||
|
assertTrue(r2.getValidated());
|
||||||
|
assertEquals(r1.getValidationDate(), "2020-01-01");
|
||||||
|
assertEquals(r2.getValidationDate(), "2020-01-01");
|
||||||
// System.out.println(new ObjectMapper().writeValueAsString(p));
|
// System.out.println(new ObjectMapper().writeValueAsString(p));
|
||||||
// System.out.println(new ObjectMapper().writeValueAsString(r1));
|
// System.out.println(new ObjectMapper().writeValueAsString(r1));
|
||||||
// System.out.println(new ObjectMapper().writeValueAsString(r2));
|
// System.out.println(new ObjectMapper().writeValueAsString(r2));
|
||||||
|
@ -246,6 +249,10 @@ public class MappersTest {
|
||||||
assertTrue(StringUtils.isNotBlank(r2.getRelClass()));
|
assertTrue(StringUtils.isNotBlank(r2.getRelClass()));
|
||||||
assertTrue(StringUtils.isNotBlank(r1.getRelType()));
|
assertTrue(StringUtils.isNotBlank(r1.getRelType()));
|
||||||
assertTrue(StringUtils.isNotBlank(r2.getRelType()));
|
assertTrue(StringUtils.isNotBlank(r2.getRelType()));
|
||||||
|
assertTrue(r1.getValidated());
|
||||||
|
assertTrue(r2.getValidated());
|
||||||
|
assertEquals(r1.getValidationDate(), "2020-01-01");
|
||||||
|
assertEquals(r2.getValidationDate(), "2020-01-01");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
<!--<dr:CobjCategory type="publication">0001</dr:CobjCategory>-->
|
<!--<dr:CobjCategory type="publication">0001</dr:CobjCategory>-->
|
||||||
<dr:CobjCategory>0001</dr:CobjCategory>
|
<dr:CobjCategory>0001</dr:CobjCategory>
|
||||||
<oaf:dateAccepted>2017-01-01</oaf:dateAccepted>
|
<oaf:dateAccepted>2017-01-01</oaf:dateAccepted>
|
||||||
<oaf:projectid>corda_______::226852</oaf:projectid>
|
<oaf:projectid validationDate="2020-01-01">corda_______::226852</oaf:projectid>
|
||||||
<oaf:accessrights>OPEN</oaf:accessrights>
|
<oaf:accessrights>OPEN</oaf:accessrights>
|
||||||
<oaf:hostedBy id="openaire____::issn226852" name="One Ecosystem"/>
|
<oaf:hostedBy id="openaire____::issn226852" name="One Ecosystem"/>
|
||||||
<oaf:collectedFrom
|
<oaf:collectedFrom
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
<oaf:language>und</oaf:language>
|
<oaf:language>und</oaf:language>
|
||||||
<oaf:concept id="https://zenodo.org/communities/epfl"/>
|
<oaf:concept id="https://zenodo.org/communities/epfl"/>
|
||||||
<oaf:hostedBy id="re3data_____::r3d100010468" name="Zenodo"/>
|
<oaf:hostedBy id="re3data_____::r3d100010468" name="Zenodo"/>
|
||||||
<oaf:projectid>corda_______::226852</oaf:projectid>
|
<oaf:projectid validationDate="2020-01-01">corda_______::226852</oaf:projectid>
|
||||||
<oaf:collectedFrom id="re3data_____::r3d100010468" name="Zenodo"/>
|
<oaf:collectedFrom id="re3data_____::r3d100010468" name="Zenodo"/>
|
||||||
<oaf:refereed>0001</oaf:refereed>s
|
<oaf:refereed>0001</oaf:refereed>s
|
||||||
</metadata>
|
</metadata>
|
||||||
|
|
Loading…
Reference in New Issue