Merge pull request 'removed the inverse of the Citing relation' (#292) from citeOnly into beta
Reviewed-on: #292
This commit is contained in:
commit
021321ae06
|
@ -114,10 +114,10 @@ public class CreateActionSetSparkJob implements Serializable {
|
||||||
|
|
||||||
if (!citing.equals(cited)) {
|
if (!citing.equals(cited)) {
|
||||||
relationList
|
relationList
|
||||||
.addAll(
|
.add(
|
||||||
getRelations(
|
getRelation(
|
||||||
citing,
|
citing,
|
||||||
cited));
|
cited, ModelConstants.CITES));
|
||||||
|
|
||||||
if (duplicate && value.getCiting().endsWith(".refs")) {
|
if (duplicate && value.getCiting().endsWith(".refs")) {
|
||||||
citing = ID_PREFIX + IdentifierFactory
|
citing = ID_PREFIX + IdentifierFactory
|
||||||
|
@ -125,7 +125,7 @@ public class CreateActionSetSparkJob implements Serializable {
|
||||||
CleaningFunctions
|
CleaningFunctions
|
||||||
.normalizePidValue(
|
.normalizePidValue(
|
||||||
"doi", value.getCiting().substring(0, value.getCiting().indexOf(".refs"))));
|
"doi", value.getCiting().substring(0, value.getCiting().indexOf(".refs"))));
|
||||||
relationList.addAll(getRelations(citing, cited));
|
relationList.add(getRelation(citing, cited, ModelConstants.CITES));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class CreateOpenCitationsASTest {
|
||||||
.map(value -> OBJECT_MAPPER.readValue(value._2().toString(), AtomicAction.class))
|
.map(value -> OBJECT_MAPPER.readValue(value._2().toString(), AtomicAction.class))
|
||||||
.map(aa -> ((Relation) aa.getPayload()));
|
.map(aa -> ((Relation) aa.getPayload()));
|
||||||
|
|
||||||
assertEquals(62, tmp.count());
|
assertEquals(31, tmp.count());
|
||||||
|
|
||||||
// tmp.foreach(r -> System.out.println(OBJECT_MAPPER.writeValueAsString(r)));
|
// tmp.foreach(r -> System.out.println(OBJECT_MAPPER.writeValueAsString(r)));
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ public class CreateOpenCitationsASTest {
|
||||||
.map(value -> OBJECT_MAPPER.readValue(value._2().toString(), AtomicAction.class))
|
.map(value -> OBJECT_MAPPER.readValue(value._2().toString(), AtomicAction.class))
|
||||||
.map(aa -> ((Relation) aa.getPayload()));
|
.map(aa -> ((Relation) aa.getPayload()));
|
||||||
|
|
||||||
assertEquals(46, tmp.count());
|
assertEquals(23, tmp.count());
|
||||||
|
|
||||||
// tmp.foreach(r -> System.out.println(OBJECT_MAPPER.writeValueAsString(r)));
|
// tmp.foreach(r -> System.out.println(OBJECT_MAPPER.writeValueAsString(r)));
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ public class CreateOpenCitationsASTest {
|
||||||
assertEquals("resultResult", r.getRelType());
|
assertEquals("resultResult", r.getRelType());
|
||||||
});
|
});
|
||||||
assertEquals(23, tmp.filter(r -> r.getRelClass().equals("Cites")).count());
|
assertEquals(23, tmp.filter(r -> r.getRelClass().equals("Cites")).count());
|
||||||
assertEquals(23, tmp.filter(r -> r.getRelClass().equals("IsCitedBy")).count());
|
assertEquals(0, tmp.filter(r -> r.getRelClass().equals("IsCitedBy")).count());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,15 +318,15 @@ public class CreateOpenCitationsASTest {
|
||||||
|
|
||||||
JavaRDD<Relation> check = tmp.filter(r -> r.getSource().equals(doi1) || r.getTarget().equals(doi1));
|
JavaRDD<Relation> check = tmp.filter(r -> r.getSource().equals(doi1) || r.getTarget().equals(doi1));
|
||||||
|
|
||||||
assertEquals(10, check.count());
|
assertEquals(5, check.count());
|
||||||
|
|
||||||
check.foreach(r -> {
|
// check.foreach(r -> {
|
||||||
if (r.getSource().equals(doi2) || r.getSource().equals(doi3) || r.getSource().equals(doi4) ||
|
// if (r.getSource().equals(doi2) || r.getSource().equals(doi3) || r.getSource().equals(doi4) ||
|
||||||
r.getSource().equals(doi5) || r.getSource().equals(doi6)) {
|
// r.getSource().equals(doi5) || r.getSource().equals(doi6)) {
|
||||||
assertEquals(ModelConstants.IS_CITED_BY, r.getRelClass());
|
// assertEquals(ModelConstants.IS_CITED_BY, r.getRelClass());
|
||||||
assertEquals(doi1, r.getTarget());
|
// assertEquals(doi1, r.getTarget());
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
assertEquals(5, check.filter(r -> r.getSource().equals(doi1)).count());
|
assertEquals(5, check.filter(r -> r.getSource().equals(doi1)).count());
|
||||||
check.filter(r -> r.getSource().equals(doi1)).foreach(r -> assertEquals(ModelConstants.CITES, r.getRelClass()));
|
check.filter(r -> r.getSource().equals(doi1)).foreach(r -> assertEquals(ModelConstants.CITES, r.getRelClass()));
|
||||||
|
|
Loading…
Reference in New Issue