forked from D-Net/dnet-hadoop
apply changes in D-Net/dnet-hadoop#40 (comment)
This commit is contained in:
parent
753d448cc9
commit
7fd8397123
|
@ -1,7 +1,5 @@
|
||||||
/**
|
|
||||||
* Create new Relations between Context Entities and Organizations whose products are associated to the context.
|
|
||||||
* It produces relation such as: organization <-> isRelatedTo <-> context
|
|
||||||
*/
|
|
||||||
package eu.dnetlib.dhp.oa.graph.dump.graph;
|
package eu.dnetlib.dhp.oa.graph.dump.graph;
|
||||||
|
|
||||||
import static eu.dnetlib.dhp.common.SparkSessionSupport.runWithSparkSession;
|
import static eu.dnetlib.dhp.common.SparkSessionSupport.runWithSparkSession;
|
||||||
|
@ -29,6 +27,10 @@ import eu.dnetlib.dhp.schema.dump.oaf.graph.Node;
|
||||||
import eu.dnetlib.dhp.schema.dump.oaf.graph.RelType;
|
import eu.dnetlib.dhp.schema.dump.oaf.graph.RelType;
|
||||||
import eu.dnetlib.dhp.schema.oaf.Relation;
|
import eu.dnetlib.dhp.schema.oaf.Relation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create new Relations between Context Entities and Organizations whose products are associated to the context.
|
||||||
|
* It produces relation such as: organization <-> isRelatedTo <-> context
|
||||||
|
*/
|
||||||
public class SparkOrganizationRelation implements Serializable {
|
public class SparkOrganizationRelation implements Serializable {
|
||||||
private static final Logger log = LoggerFactory.getLogger(SparkOrganizationRelation.class);
|
private static final Logger log = LoggerFactory.getLogger(SparkOrganizationRelation.class);
|
||||||
|
|
||||||
|
@ -98,7 +100,8 @@ public class SparkOrganizationRelation implements Serializable {
|
||||||
.collectAsList()
|
.collectAsList()
|
||||||
.forEach(getMergedRelsConsumer(organizationMap, relList));
|
.forEach(getMergedRelsConsumer(organizationMap, relList));
|
||||||
|
|
||||||
organizationMap.keySet()
|
organizationMap
|
||||||
|
.keySet()
|
||||||
.forEach(
|
.forEach(
|
||||||
oId -> organizationMap
|
oId -> organizationMap
|
||||||
.get(oId)
|
.get(oId)
|
||||||
|
@ -114,7 +117,8 @@ public class SparkOrganizationRelation implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static Consumer<MergedRels> getMergedRelsConsumer(OrganizationMap organizationMap, List<eu.dnetlib.dhp.schema.dump.oaf.graph.Relation> relList) {
|
private static Consumer<MergedRels> getMergedRelsConsumer(OrganizationMap organizationMap,
|
||||||
|
List<eu.dnetlib.dhp.schema.dump.oaf.graph.Relation> relList) {
|
||||||
return mergedRels -> {
|
return mergedRels -> {
|
||||||
String oId = mergedRels.getOrganizationId();
|
String oId = mergedRels.getOrganizationId();
|
||||||
organizationMap
|
organizationMap
|
||||||
|
|
Loading…
Reference in New Issue