Revision 53101
Added by Michele Artini over 5 years ago
GridUtils.java | ||
---|---|---|
93 | 93 |
org.getLinks().stream().findFirst().orElse(""), |
94 | 94 |
country, |
95 | 95 |
e.getKey().equals(mainOpenaireId) ? org.getAcronyms() : new ArrayList<>(), |
96 |
orgNames, collectedFrom)) |
|
96 |
orgNames.keySet(), |
|
97 |
collectedFrom)) |
|
97 | 98 |
.flatMap(l -> l.stream()) |
98 | 99 |
.collect(Collectors.toList()); |
99 |
|
|
100 | 100 |
} |
101 | 101 |
|
102 | 102 |
private static List<Oaf> toProtos(final String openaireId, |
... | ... | |
106 | 106 |
final String url, |
107 | 107 |
final Qualifier country, |
108 | 108 |
final List<String> acronyms, |
109 |
final Map<String, String> orgRels,
|
|
109 |
final Set<String> orgRels,
|
|
110 | 110 |
final KeyValue collectedFrom) { |
111 | 111 |
|
112 | 112 |
final OafEntity.Builder entity = OafEntity.newBuilder() |
... | ... | |
128 | 128 |
.addAllAlternativeNames(acronyms.stream().map(a -> StringField.newBuilder().setValue(a).build()).collect(Collectors.toList())) |
129 | 129 |
.setCountry(country))); |
130 | 130 |
|
131 |
final List<Oaf> oafs = orgRels.entrySet().stream() |
|
132 |
.filter(e -> !e.getKey().equals(openaireId)) |
|
133 |
.map(e -> Oaf.newBuilder() |
|
131 |
// Relations |
|
132 |
final List<Oaf> oafs = orgRels.stream() |
|
133 |
.filter(id -> !id.equals(openaireId)) |
|
134 |
.map(id -> Oaf.newBuilder() |
|
134 | 135 |
.setKind(Kind.relation) |
135 | 136 |
.setLastupdatetimestamp(DateUtils.now()) |
136 | 137 |
.setRel(OafRel.newBuilder() |
137 | 138 |
.setSource(openaireId) |
138 |
.setTarget(e.getKey())
|
|
139 |
.setTarget(id)
|
|
139 | 140 |
.setRelType(RelType.organizationOrganization) |
140 | 141 |
.setSubRelType(SubRelType.dedupSimilarity) |
141 | 142 |
.setRelClass("isSimilarTo") |
... | ... | |
143 | 144 |
.build()) |
144 | 145 |
.collect(Collectors.toList()); |
145 | 146 |
|
147 |
// Entity |
|
146 | 148 |
oafs.add(Oaf.newBuilder() |
147 | 149 |
.setKind(Kind.entity) |
148 | 150 |
.setLastupdatetimestamp(DateUtils.now()) |
Also available in: Unified diff