Project

General

Profile

« Previous | Next » 

Revision 48991

depending on protobuf specific version, getting rid of person entities, updated solrj version

View differences:

OafTest.java
14 14
import eu.dnetlib.data.proto.OafProtos.OafRel;
15 15
import eu.dnetlib.data.proto.OrganizationOrganizationProtos.OrganizationOrganization;
16 16
import eu.dnetlib.data.proto.OrganizationProtos.Organization;
17
import eu.dnetlib.data.proto.PersonProtos.Person;
18
import eu.dnetlib.data.proto.PersonResultProtos.PersonResult;
19
import eu.dnetlib.data.proto.PersonResultProtos.PersonResult.Authorship;
20 17
import eu.dnetlib.data.proto.ProjectOrganizationProtos.ProjectOrganization;
21 18
import eu.dnetlib.data.proto.ProjectOrganizationProtos.ProjectOrganization.Participation;
22
import eu.dnetlib.data.proto.ProjectPersonProtos.ProjectPerson;
23
import eu.dnetlib.data.proto.ProjectPersonProtos.ProjectPerson.ContactPerson;
24 19
import eu.dnetlib.data.proto.ProjectProtos.Project;
25 20
import eu.dnetlib.data.proto.RelMetadataProtos.RelMetadata;
26 21
import eu.dnetlib.data.proto.RelTypeProtos.RelType;
......
131 126

  
132 127
	public static OafRel getDedupRel(final String source, final String target, final RelType relType, final String relClass) {
133 128
		return OafRel.newBuilder().setSource(source).setTarget(target).setRelType(relType).setSubRelType(SubRelType.dedup).setRelClass(relClass)
134
				.setChild(false).setCachedTarget(getResult(target)).build();
135
	}
136

  
137
	public static OafRel getPersonResult(final String source, final String target, final String ranking, final String relClass) {
138
		return OafRel
139
				.newBuilder()
140
				.setSource(source)
141
				.setTarget(target)
142
				.setRelType(RelType.personResult)
143
				.setSubRelType(SubRelType.authorship)
144
				.setRelClass(relClass)
145
				.setChild(false)
146
				.setPersonResult(
147
						PersonResult.newBuilder().setAuthorship(
148
								Authorship.newBuilder().setRanking(ranking).setRelMetadata(relMetadata(relClass, "dnet:personResult_relations"))))
149
				.setCachedTarget(getPerson()).build();
150
	}
151

  
152
	public static OafEntity getPerson() {
153
		return OafEntity
154
				.newBuilder()
155
				.setType(Type.person)
156
				.setId("WOS:000277866500014_A._Shirazi-Adl")
157
				.setPerson(
158
						Person.newBuilder().setMetadata(
159
								Person.Metadata.newBuilder().addSecondnames(sf("Shirazi-Adl")).setFullname(sf("A. Shirazi-Adl"))
160
										.setEmail(sf("name.surname@gmail.com")).setPhone(sf("12345")).setNationality(getQualifier("EN", "dnet:countries"))))
129
				.setChild(false).setCachedTarget(getResult(target))
130
				.setResultResult(ResultResult.newBuilder().setDedup(Dedup.newBuilder().setRelMetadata(RelMetadata.getDefaultInstance())))
161 131
				.build();
162 132
	}
163 133

  
......
238 208
		return oafRel.build();
239 209
	}
240 210

  
241
	public static OafRel getProjectPerson(final String sourceId, final String targetId, final String relClass) {
242
		return OafRel
243
				.newBuilder()
244
				.setSource(sourceId)
245
				.setTarget(targetId)
246
				.setRelType(RelType.projectPerson)
247
				.setSubRelType(SubRelType.contactPerson)
248
				.setRelClass(relClass)
249
				.setChild(true)
250
				.setProjectPerson(
251
						ProjectPerson.newBuilder().setContactPerson(
252
								ContactPerson.newBuilder().setRelMetadata(relMetadata(relClass, "dnet:project_result_relations"))))
253
				.setCachedTarget(getPerson()).build();
254
	}
255

  
256 211
	public static OafRel getSimilarityRel(final String sourceId, final String targetId, final OafEntity result, final String relClass) {
257 212
		return OafRel
258 213
				.newBuilder()

Also available in: Unified diff