Project

General

Profile

« Previous | Next » 

Revision 50516

solr7

View differences:

modules/dnet-openaireplus-mapping-utils/branches/solr7/deploy.info
1
{"type_source": "SVN", "goal": "package -U source:jar", 
2
"url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-openaireplus-mapping-utils/trunk/", "deploy_repository": "dnet45-snapshots", "version": "4", "mail": "sandro.labruzzo@isti.cnr.it,michele.artini@isti.cnr.it, claudio.atzori@isti.cnr.it, alessia.bardi@isti.cnr.it", "deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet45-snapshots", "name": "dnet-openaireplus-mapping-utils"}
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/test/java/eu/dnetlib/openaire/exporter/model/ProjectTest.java
1
package eu.dnetlib.openaire.exporter.model;
2

  
3
import org.junit.Before;
4
import org.junit.Test;
5

  
6
import static org.junit.Assert.assertEquals;
7

  
8
public class ProjectTest {
9

  
10
	Project pMZOS;
11
	Project pFP7;
12

  
13
	@Before
14
	public void setUp() throws Exception {
15
		pMZOS = new Project()
16
				.setFunder("MZOS")
17
				.setJurisdiction("HR")
18
				.setFundingpathid("irb_hr______::MZOS")
19
				.setAcronym("")
20
				.setTitle("Project Title")
21
				.setCode("115-1152437-2500")
22
				.setStartdate("2007-01-01")
23
				.setEnddate("2009-01-01");
24

  
25
		pFP7 = new Project()
26
				.setFunder("EC")
27
				.setJurisdiction("EU")
28
				.setFundingpathid("ec__________::EC::FP7::SP1::NMP")
29
				.setAcronym("REFFIBRE")
30
				.setTitle("Project Title")
31
				.setCode("604187")
32
				.setStartdate("2013-11-01")
33
				.setEnddate("20015-01-01");
34
	}
35

  
36
	@Test
37
	public void testIdNamespaceMZOS(){
38
		String ns = pMZOS.getIdnamespace();
39
		assertEquals("info:eu-repo/grantAgreement/MZOS//115-1152437-2500/HR", ns);
40
	}
41

  
42
	@Test
43
	public void testIdNamespaceFP7(){
44
		String ns = pFP7.getIdnamespace();
45
		assertEquals("info:eu-repo/grantAgreement/EC/FP7/604187/EU", ns);
46
	}
47

  
48

  
49

  
50
}
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/test/java/eu/dnetlib/openaire/exporter/model/ProjectDetailTest.java
1
package eu.dnetlib.openaire.exporter.model;
2

  
3
import java.io.IOException;
4
import java.io.StringReader;
5

  
6
import com.google.common.collect.Lists;
7
import org.apache.commons.io.IOUtils;
8
import org.springframework.core.io.ClassPathResource;
9
import org.springframework.core.io.Resource;
10

  
11
import static org.junit.Assert.assertEquals;
12

  
13
/**
14
 * Created by claudio on 22/09/16.
15
 */
16
public class ProjectDetailTest {
17

  
18
	private Resource projectsCsv = new ClassPathResource("/eu/dnetlib/openaire/exporter/model/projectDetails.csv");
19
	private Resource projectsJson = new ClassPathResource("/eu/dnetlib/openaire/exporter/model/projectDetails.json");
20

  
21
	//@Test
22
	public void testSerialisationCSV() throws IOException {
23
		final String csv = IOUtils.toString(projectsCsv.getInputStream());
24
		doTest(csv, "csv");
25
	}
26

  
27
	//@Test
28
	public void testSerialisationCSV2() throws IOException {
29
		final ProjectDetail p = new ProjectDetail()
30
				.setAcronym("acro")
31
				.setCode("01")
32
				.setOptional1("op1")
33
				.setOptional2("op2")
34
				.setProjectId("project_01")
35
				.setJsonextrainfo("extraInfo")
36
				.setFundingPath(Lists.newArrayList("fundingpath1", "fundingpath2"));
37

  
38
		doTest(p.asCSV(), "csv");
39
	}
40

  
41
	//@Test
42
	public void testSerialisationJSON() throws IOException {
43
		final String json = IOUtils.toString(projectsJson.getInputStream());
44
		doTest(json, "json");
45
	}
46

  
47
	private void doTest(final String data, final String format) throws IOException {
48
		final StringReader reader = new StringReader(data);
49
		for(String line : IOUtils.readLines(reader)) {
50
			System.out.println("line:          " + line);
51
			ProjectDetail p;
52
			String s = "";
53
			switch (format) {
54
			case "csv":
55
				p = ProjectDetail.fromCSV(line);
56
				s = p.asCSV();
57
				break;
58
			case "json":
59
				p = ProjectDetail.fromJson(line);
60
				s = p.asJson();
61
				break;
62
			default: throw new IllegalArgumentException("invalid format: " + format);
63
			}
64
			System.out.println("serialisation: " + s);
65
			assertEquals(s, line);
66
		}
67
	}
68

  
69
}
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/test/java/eu/dnetlib/pace/clustering/BlacklistAwareClusteringCombinerTest.java
1
package eu.dnetlib.pace.clustering;
2

  
3
import org.junit.Before;
4
import org.junit.Test;
5

  
6
import eu.dnetlib.pace.AbstractProtoPaceTest;
7
import eu.dnetlib.pace.config.Config;
8
import eu.dnetlib.pace.config.Type;
9
import eu.dnetlib.pace.model.FieldListImpl;
10
import eu.dnetlib.pace.model.FieldValueImpl;
11
import eu.dnetlib.pace.model.MapDocument;
12

  
13
public class BlacklistAwareClusteringCombinerTest extends AbstractProtoPaceTest {
14

  
15
	private Config config;
16

  
17
	@Before
18
	public void setUp() {
19
		config = getResultFullConf();
20
	}
21

  
22
	@Test
23
	public void testCombine() {
24
		final MapDocument result =
25
				result(config, "A", "Dipping in Cygnus X-2 in a multi-wavelength campaign due to absorption of extended ADC emission", "2013");
26
		final FieldListImpl fl = new FieldListImpl();
27
		fl.add(new FieldValueImpl(Type.String, "desc", "hello world description pipeline"));
28

  
29
		result.getFieldMap().put("desc", fl);
30

  
31
		fl.clear();
32
		fl.add(new FieldValueImpl(Type.String, "title", "lorem ipsum cabalie qwerty"));
33
		final FieldListImpl field = (FieldListImpl) result.getFieldMap().get("title");
34
		field.add(fl);
35

  
36
		System.out.println(BlacklistAwareClusteringCombiner.filterAndCombine(result, config, config.blacklists()));
37
	}
38
}
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/test/java/eu/dnetlib/pace/clustering/ClusteringCombinerTest.java
1
package eu.dnetlib.pace.clustering;
2

  
3
import org.junit.Before;
4
import org.junit.Test;
5

  
6
import eu.dnetlib.pace.AbstractProtoPaceTest;
7
import eu.dnetlib.pace.config.Config;
8
import eu.dnetlib.pace.config.Type;
9
import eu.dnetlib.pace.model.FieldListImpl;
10
import eu.dnetlib.pace.model.FieldValueImpl;
11
import eu.dnetlib.pace.model.MapDocument;
12

  
13
public class ClusteringCombinerTest extends AbstractProtoPaceTest {
14

  
15
	private Config config;
16

  
17
	@Before
18
	public void setUp() {
19
		config = getResultFullConf();
20
	}
21

  
22
	@Test
23
	public void testCombine() {
24
		String title = "Dipping in Cygnus X-2 in a multi-wavelength campaign due to absorption of extended ADC emission";
25
		MapDocument result = result(config, "A", title, "2013");
26

  
27
		FieldListImpl fl = new FieldListImpl();
28
		fl.add(new FieldValueImpl(Type.String, "desc", "lorem ipsum cabalie qwerty"));
29

  
30
		result.getFieldMap().put("desc", fl);
31
		System.out.println(title);
32
		System.out.println(ClusteringCombiner.combine(result, config));
33
	}
34

  
35
}
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/test/java/eu/dnetlib/pace/AbstractProtoPaceTest.java
1
package eu.dnetlib.pace;
2

  
3
import java.io.IOException;
4
import java.io.StringWriter;
5
import java.util.ArrayList;
6
import java.util.LinkedList;
7
import java.util.List;
8
import java.util.stream.Collectors;
9
import java.util.stream.IntStream;
10

  
11
import com.google.common.collect.Lists;
12
import com.google.gson.Gson;
13
import eu.dnetlib.data.mapreduce.util.OafTest;
14
import eu.dnetlib.data.proto.FieldTypeProtos.Author;
15
import eu.dnetlib.data.proto.FieldTypeProtos.Qualifier;
16
import eu.dnetlib.data.proto.FieldTypeProtos.StructuredProperty;
17
import eu.dnetlib.data.proto.FieldTypeProtos.StructuredProperty.Builder;
18
import eu.dnetlib.data.proto.OafProtos.Oaf;
19
import eu.dnetlib.data.proto.OafProtos.OafEntity;
20
import eu.dnetlib.data.proto.OrganizationProtos.Organization;
21
import eu.dnetlib.data.proto.ResultProtos.Result;
22
import eu.dnetlib.pace.config.Config;
23
import eu.dnetlib.pace.config.DedupConfig;
24
import eu.dnetlib.pace.config.Type;
25
import eu.dnetlib.pace.model.Field;
26
import eu.dnetlib.pace.model.FieldValueImpl;
27
import eu.dnetlib.pace.model.MapDocument;
28
import eu.dnetlib.pace.model.ProtoDocumentBuilder;
29
import eu.dnetlib.pace.model.gt.GTAuthor;
30

  
31
import org.apache.commons.io.IOUtils;
32
import org.apache.commons.lang.RandomStringUtils;
33
import org.apache.commons.lang.StringUtils;
34

  
35
public abstract class AbstractProtoPaceTest extends OafTest {
36

  
37
	protected DedupConfig getResultFullConf() {
38
		return DedupConfig.load(readFromClasspath("/eu/dnetlib/pace/result.full.pace.conf"));
39
	}
40

  
41
	protected DedupConfig getResultSimpleConf() {
42
		return DedupConfig.load(readFromClasspath("/eu/dnetlib/pace/result.simple.pace.conf"));
43
	}
44

  
45
	protected DedupConfig getResultConf() {
46
		return DedupConfig.load(readFromClasspath("/eu/dnetlib/pace/result.pace.conf"));
47
	}
48

  
49
	protected DedupConfig getOrganizationSimpleConf() {
50
		return DedupConfig.load(readFromClasspath("/eu/dnetlib/pace/organization.pace.conf"));
51
	}
52

  
53
	protected DedupConfig getResultAuthorsConf() {
54
		return DedupConfig.load(readFromClasspath("/eu/dnetlib/pace/result.authors.pace.conf"));
55
	}
56

  
57
	protected DedupConfig getResultProdConf() {
58
		return DedupConfig.load(readFromClasspath("/eu/dnetlib/pace/result.prod.pace.conf"));
59
	}
60

  
61
	protected MapDocument author(final Config conf, final String id, final Oaf oaf) {
62
		return ProtoDocumentBuilder.newInstance(id, oaf.getEntity(), conf.model());
63
	}
64

  
65
	protected GTAuthor getGTAuthor(final String path) {
66

  
67
		final Gson gson = new Gson();
68

  
69
		final String json = readFromClasspath(path);
70

  
71
		final GTAuthor gta = gson.fromJson(json, GTAuthor.class);
72

  
73
		return gta;
74
	}
75

  
76
	private String readFromClasspath(final String filename) {
77
		final StringWriter sw = new StringWriter();
78
		try {
79
			IOUtils.copy(getClass().getResourceAsStream(filename), sw);
80
			return sw.toString();
81
		} catch (final IOException e) {
82
			throw new RuntimeException("cannot load resource from classpath: " + filename);
83
		}
84
	}
85

  
86
	protected MapDocument result(final Config config, final String id, final String title) {
87
		return result(config, id, title, null, new ArrayList<>(), null);
88
	}
89

  
90
	protected MapDocument result(final Config config, final String id, final String title, final String date) {
91
		return result(config, id, title, date, new ArrayList<>(), null);
92
	}
93

  
94
	protected MapDocument result(final Config config, final String id, final String title, final String date, final List<String> pid) {
95
		return result(config, id, title, date, pid, null);
96
	}
97

  
98
	protected MapDocument result(final Config config, final String id, final String title, final String date, final String pid) {
99
		return result(config, id, title, date, pid, null);
100
	}
101

  
102
	protected MapDocument result(final Config config, final String id, final String title, final String date, final String pid, final List<String> authors) {
103
		return result(config, id, title, date, Lists.newArrayList(pid), authors);
104
	}
105

  
106
	protected MapDocument result(final Config config, final String id, final String title, final String date, final List<String> pid, final List<String> authors) {
107
		final Result.Metadata.Builder metadata = Result.Metadata.newBuilder();
108
		if (!StringUtils.isBlank(title)) {
109
			metadata.addTitle(getStruct(title, getQualifier("main title", "dnet:titles")));
110
			metadata.addTitle(getStruct(RandomStringUtils.randomAlphabetic(10), getQualifier("alternative title", "dnet:titles")));
111
		}
112
		if (!StringUtils.isBlank(date)) {
113
			metadata.setDateofacceptance(sf(date));
114
		}
115

  
116
		final OafEntity.Builder entity = oafEntity(id, eu.dnetlib.data.proto.TypeProtos.Type.result);
117
		final Result.Builder result = Result.newBuilder().setMetadata(metadata);
118

  
119
		if (authors != null) {
120
			result.getMetadataBuilder().addAllAuthor(
121
					IntStream.range(0, authors.size())
122
							.mapToObj(i -> author(authors.get(i), i))
123
							.collect(Collectors.toCollection(LinkedList::new)));
124
		}
125

  
126
		entity.setResult(result);
127

  
128
		if (pid != null) {
129
			for(String p : pid) {
130
				if (!StringUtils.isBlank(p)) {
131
					entity.addPid(sp(p, "doi"));
132
					//entity.addPid(sp(RandomStringUtils.randomAlphabetic(10), "oai"));
133
				}
134
			}
135
		}
136

  
137
		final OafEntity build = entity.build();
138
		return ProtoDocumentBuilder.newInstance(id, build, config.model());
139
	}
140

  
141
	private Author author(final String s, int rank) {
142
		final eu.dnetlib.pace.model.Person p = new eu.dnetlib.pace.model.Person(s, false);
143
		final Author.Builder author = Author.newBuilder();
144
		if (p.isAccurate()) {
145
			author.setName(p.getNormalisedFirstName());
146
			author.setSurname(p.getNormalisedSurname());
147
		}
148
		author.setFullname(p.getNormalisedFullname());
149
		author.setRank(rank);
150

  
151
		return author.build();
152
	}
153

  
154
	private OafEntity.Builder oafEntity(final String id, final eu.dnetlib.data.proto.TypeProtos.Type type) {
155
		final OafEntity.Builder entity = OafEntity.newBuilder().setId(id).setType(type);
156
		return entity;
157
	}
158

  
159
	protected MapDocument organization(final Config config, final String id, final String legalName) {
160
		return organization(config, id, legalName, null);
161
	}
162

  
163
	protected MapDocument organization(final Config config, final String id, final String legalName, final String legalShortName) {
164
		final Organization.Metadata.Builder metadata = Organization.Metadata.newBuilder();
165
		if (legalName != null) {
166
			metadata.setLegalname(sf(legalName));
167
		}
168
		if (legalShortName != null) {
169
			metadata.setLegalshortname(sf(legalShortName));
170
		}
171

  
172
		final OafEntity.Builder entity = oafEntity(id, eu.dnetlib.data.proto.TypeProtos.Type.result);
173
		entity.setOrganization(Organization.newBuilder().setMetadata(metadata));
174

  
175
		return ProtoDocumentBuilder.newInstance(id, entity.build(), config.model());
176
	}
177

  
178
	private StructuredProperty sp(final String pid, final String type) {
179
		final Builder pidSp =
180
				StructuredProperty.newBuilder().setValue(pid)
181
						.setQualifier(Qualifier.newBuilder().setClassid(type).setClassname(type).setSchemeid("dnet:pid_types").setSchemename("dnet:pid_types"));
182
		return pidSp.build();
183
	}
184

  
185
	protected Field title(final String s) {
186
		return new FieldValueImpl(Type.String, "title", s);
187
	}
188

  
189
	protected static StructuredProperty.Builder getStruct(final String value, final Qualifier.Builder qualifier) {
190
		return StructuredProperty.newBuilder().setValue(value).setQualifier(qualifier);
191
	}
192

  
193
	/*
194
	 * protected static StringField.Builder sf(final String s) { return StringField.newBuilder().setValue(s); }
195
	 * 
196
	 * protected static Qualifier.Builder getQualifier(final String classname, final String schemename) { return
197
	 * Qualifier.newBuilder().setClassid(classname).setClassname(classname).setSchemeid(schemename).setSchemename(schemename); }
198
	 */
199

  
200
}
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/test/java/eu/dnetlib/pace/model/ProtoDocumentBuilderTest.java
1
package eu.dnetlib.pace.model;
2

  
3
import com.google.common.collect.Iterables;
4
import com.google.common.collect.Sets;
5
import com.google.common.collect.Sets.SetView;
6
import eu.dnetlib.pace.AbstractProtoPaceTest;
7
import eu.dnetlib.pace.config.Config;
8
import org.junit.Test;
9

  
10
import static org.junit.Assert.assertFalse;
11
import static org.junit.Assert.assertTrue;
12

  
13
public class ProtoDocumentBuilderTest extends AbstractProtoPaceTest {
14

  
15
	@Test
16
	public void test_serialise1() {
17

  
18
		final String id = "12345";
19

  
20
		final Config config = getResultFullConf();
21

  
22
		final MapDocument document = ProtoDocumentBuilder.newInstance(id, getResult(id), config.model());
23

  
24
		assertFalse(document.fieldNames().isEmpty());
25
		assertFalse(Iterables.isEmpty(document.fields()));
26

  
27
		System.out.println("original:\n" + document);
28

  
29
		final String stringDoc = MapDocumentSerializer.toString(document);
30

  
31
		System.out.println("srialization:\n" + stringDoc);
32

  
33
		final MapDocument decoded = MapDocumentSerializer.decode(stringDoc.getBytes());
34

  
35
		final SetView<String> diff = Sets.difference(document.fieldNames(), decoded.fieldNames());
36

  
37
		assertTrue(diff.isEmpty());
38

  
39
		System.out.println("decoded:\n" + decoded);
40
	}
41

  
42
}
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/test/java/eu/dnetlib/pace/model/gt/AuthorTest.java
1
package eu.dnetlib.pace.model.gt;
2

  
3
import static org.junit.Assert.assertTrue;
4

  
5
import java.util.Set;
6

  
7
import org.junit.Test;
8

  
9
import com.google.common.collect.Sets;
10

  
11
import eu.dnetlib.pace.model.gt.Author;
12
import eu.dnetlib.pace.model.gt.Authors;
13

  
14
public class AuthorTest {
15

  
16
	@Test
17
	public void test() {
18
		final Set<Author> s1 = getAuthors(3);
19
		final Set<Author> s2 = getAuthors(3);
20

  
21
		final Set<Author> i = Sets.intersection(s1, s2);
22

  
23
		System.out.println(i);
24

  
25
		assertTrue(i.size() == 3);
26

  
27
	}
28

  
29
	@Test
30
	public void test1() {
31
		final Authors a1 = new Authors(a("1", "Wang, M."));
32
		final Authors a2 = new Authors(a("1", "Wang, M."));
33

  
34
		final Set<Author> i = Sets.intersection(a1, a2);
35

  
36
		assertTrue(i.size() == 1);
37

  
38
	}
39

  
40
	private Set<Author> getAuthors(final int n) {
41
		final Set<Author> s = Sets.newHashSet();
42

  
43
		for (int i = 0; i < n; i++) {
44
			s.add(a(i + "", "name" + i));
45
		}
46
		return s;
47
	}
48

  
49
	private Author a(final String id, final String fullname) {
50
		final Author a = new Author();
51
		a.setId(id);
52
		a.setFullname(fullname);
53
		return a;
54
	}
55

  
56
}
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/test/java/eu/dnetlib/pace/distance/DetectorTest.java
1
package eu.dnetlib.pace.distance;
2

  
3
import java.util.List;
4

  
5
import com.google.common.collect.Lists;
6
import eu.dnetlib.pace.AbstractProtoPaceTest;
7
import eu.dnetlib.pace.config.Config;
8
import eu.dnetlib.pace.distance.eval.ScoreResult;
9
import eu.dnetlib.pace.model.MapDocument;
10
import org.junit.Test;
11

  
12
import static org.junit.Assert.assertTrue;
13

  
14
public class DetectorTest extends AbstractProtoPaceTest {
15

  
16
	@Test
17
	public void testDistanceResultSimple() {
18
		final Config config = getResultSimpleConf();
19

  
20
		final MapDocument resA = result(config, "A", "Recent results from CDF");
21
		final MapDocument resB = result(config, "B", "Recent results from CDF");
22

  
23
		final ScoreResult sr = new PaceDocumentDistance().between(resA, resB, config);
24
		final double d = sr.getScore();
25
		System.out.println(String.format(" d ---> %s", d));
26

  
27
		assertTrue(d == 1.0);
28
	}
29

  
30
	@Test
31
	public void testDistanceResultSimpleMissingDates() {
32
		final Config config = getResultSimpleConf();
33

  
34
		final MapDocument resA = result(config, "A", "Recent results from BES");
35
		final MapDocument resB = result(config, "A", "Recent results from CES");
36

  
37
		final ScoreResult sr = new PaceDocumentDistance().between(resA, resB, config);
38
		final double d = sr.getScore();
39
		System.out.println(String.format(" d ---> %s", d));
40

  
41
		assertTrue(d > 0.97);
42
	}
43

  
44
	@Test
45
	public void testDistanceResultInvalidDate() {
46
		final Config config = getResultConf();
47

  
48
		final MapDocument resA = result(config, "A", "title title title 6BESR", "2013-01-05");
49
		final MapDocument resB = result(config, "B", "title title title 6BESR", "qwerty");
50

  
51
		final ScoreResult sr = new PaceDocumentDistance().between(resA, resB, config);
52
		final double d = sr.getScore();
53
		System.out.println(String.format(" d ---> %s", d));
54

  
55
		assertTrue(d == 1.0);
56
	}
57

  
58
	@Test
59
	public void testDistanceResultMissingOneDate() {
60
		final Config config = getResultConf();
61

  
62
		final MapDocument resA = result(config, "A", "title title title 6BESR", null);
63
		final MapDocument resB = result(config, "B", "title title title 6CLER", "2012-02");
64

  
65
		final ScoreResult sr = new PaceDocumentDistance().between(resA, resB, config);
66
		double d = sr.getScore();
67
		System.out.println(String.format(" d ---> %s", d));
68

  
69
		assertTrue((d > 0.9) && (d < 1.0));
70
	}
71

  
72
	@Test
73
	public void testDistanceResult() {
74
		final Config config = getResultConf();
75

  
76
		final MapDocument resA = result(config, "A", "title title title BES", "");
77
		final MapDocument resB = result(config, "B", "title title title CLEO");
78

  
79
		final ScoreResult sr = new PaceDocumentDistance().between(resA, resB, config);
80
		double d = sr.getScore();
81
		System.out.println(String.format(" d ---> %s", d));
82

  
83
		assertTrue((d > 0.9) && (d < 1.0));
84
	}
85

  
86
	@Test
87
	public void testDistanceResultMissingTwoDate() {
88
		final Config config = getResultConf();
89

  
90
		final MapDocument resA = result(config, "A", "title title title 6BESR");
91
		final MapDocument resB = result(config, "B", "title title title 6CLER");
92

  
93
		final ScoreResult sr = new PaceDocumentDistance().between(resA, resB, config);
94
		double d = sr.getScore();
95
		System.out.println(String.format(" d ---> %s", d));
96

  
97
		assertTrue((d > 0.9) && (d < 1.0));
98
	}
99

  
100
	@Test
101
	public void testDistanceOrganizationIgnoreMissing() {
102

  
103
		final Config config = getOrganizationSimpleConf();
104

  
105
		final MapDocument orgA = organization(config, "A", "CONSIGLIO NAZIONALE DELLE RICERCHE");
106
		final MapDocument orgB = organization(config, "B", "CONSIGLIO NAZIONALE DELLE RICERCHE", "CNR");
107

  
108
		final ScoreResult sr = new PaceDocumentDistance().between(orgA, orgB, config);
109
		final double d = sr.getScore();
110
		System.out.println(String.format(" d ---> %s", d));
111

  
112
		assertTrue(d == 1.0);
113
	}
114

  
115
	@Test
116
	public void testDistanceResultCase1() {
117

  
118
		final Config config = getResultConf();
119

  
120
		final MapDocument resA = result(config, "A", "Search the Standard Model Higgs boson", "2003");
121
		final MapDocument resB = result(config, "B", "Search for the Standard Model Higgs Boson", "2003");
122

  
123
		final ScoreResult sr = new PaceDocumentDistance().between(resA, resB, config);
124
		double d = sr.getScore();
125
		System.out.println(String.format(" d ---> %s", d));
126

  
127
		assertTrue((d > 0.9) && (d < 1.0));
128
	}
129

  
130
	@Test
131
	public void testDistanceResultCaseDoiMatch1() {
132
		final Config config = getResultConf();
133

  
134
		final MapDocument resA = result(config, "A", "Search the Standard Model Higgs boson", "2003", "10.1594/PANGAEA.726855");
135
		final MapDocument resB = result(config, "B", "Search the Standard Model Higgs Boson", "2003", "10.1594/PANGAEA.726855");
136

  
137
		final ScoreResult sr = new PaceDocumentDistance().between(resA, resB, config);
138
		double d = sr.getScore();
139
		System.out.println(String.format(" d ---> %s", d));
140

  
141
		assertTrue("exact DOIs will produce an exact match", d == 1.0);
142
	}
143

  
144
	@Test
145
	public void testDistanceResultCaseDoiMatch2() {
146
		final Config config = getResultConf();
147

  
148
		final MapDocument resA = result(config, "A", "Conference proceedings on X. Appendix", "2003", "10.1594/PANGAEA.726855");
149
		final MapDocument resB = result(config, "B", "Search the Standard Model Higgs Boson", "2005", "10.1594/PANGAEA.726855");
150

  
151
		final ScoreResult sr = new PaceDocumentDistance().between(resA, resB, config);
152
		double d = sr.getScore();
153
		System.out.println(String.format(" d ---> %s", d));
154

  
155
		assertTrue("exact DOIs will produce an exact match, regardless of different titles or publication years", d == 1.0);
156
	}
157

  
158
	@Test
159
	public void testDistanceResultCaseDoiMatch3() {
160
		final Config config = getResultConf();
161

  
162
		final MapDocument resA = result(config, "A", "Conference proceedings on X. Appendix", "2003", "10.1016/j.jmb.2010.12.024");
163
		final MapDocument resB = result(config, "B", "Conference proceedings on X. Appendix", "2003");
164

  
165
		final ScoreResult sr = new PaceDocumentDistance().between(resA, resB, config);
166
		double d = sr.getScore();
167
		System.out.println(String.format(" d ---> %s", d));
168

  
169
		assertTrue("a missing DOI will casue the comparsion to continue with the following conditions", d == 1.0);
170
	}
171

  
172
	@Test
173
	public void testDistanceResultCaseDoiMatch4() {
174
		final Config config = getResultConf();
175

  
176
		final MapDocument resA = result(config, "A", "Conference proceedings on X. Appendix", "2003", "10.1016/j.jmb.2010.12.024");
177
		final MapDocument resB = result(config, "B", "Conference proceedings on X. Appendix", "2005");
178

  
179
		final ScoreResult sr = new PaceDocumentDistance().between(resA, resB, config);
180
		double d = sr.getScore();
181
		System.out.println(String.format(" d ---> %s", d));
182

  
183
		assertTrue("a missing DOI, comparsion continues with the following conditions, different publication years will drop the score to 0", d == 0.0);
184
	}
185

  
186
	@Test
187
	public void testDistanceResultCaseDoiMatch5() {
188

  
189
		final Config config = getResultConf();
190

  
191
		final MapDocument resA = result(config, "A", "Search for the Standard Model Higgs Boson", "2003", "10.1016/j.jmb.2010.12.020");
192
		final MapDocument resB = result(config, "B", "Search the Standard Model Higgs Boson", "2003");
193

  
194
		final ScoreResult sr = new PaceDocumentDistance().between(resA, resB, config);
195
		double d = sr.getScore();
196
		System.out.println(String.format(" d ---> %s", d));
197

  
198
		assertTrue("a missing DOI, comparsion continues with the following conditions", (d > 0.9) && (d < 1.0));
199
	}
200

  
201
	@Test
202
	public void testDistanceResultCaseDoiMatch6() {
203
		final Config config = getResultConf();
204

  
205
		final MapDocument resA = result(config, "A", "Conference proceedings on X. Appendix", "2003", "10.1016/j.jmb.2010.12.024");
206
		final MapDocument resB = result(config, "B", "Conference proceedings on X. Appendix", "2003", "anotherDifferentDOI");
207

  
208
		final ScoreResult sr = new PaceDocumentDistance().between(resA, resB, config);
209
		double d = sr.getScore();
210
		System.out.println(String.format(" d ---> %s", d));
211

  
212
		assertTrue("different DOIs will drop the score to 0, regardless of the other fields", d == 0.0);
213
	}
214

  
215
	@Test
216
	public void testDistanceResultCaseDoiMatch7() {
217
		final Config config = getResultConf();
218

  
219
		final MapDocument resA = result(config, "A", "Adrenal Insufficiency asd asd", "1951", Lists.newArrayList("PMC2037944", "axdsds"));
220
		final MapDocument resB = result(config, "B", "Adrenal Insufficiency", "1951", "PMC2037944");
221

  
222
		final ScoreResult sr = new PaceDocumentDistance().between(resA, resB, config);
223
		double d = sr.getScore();
224
		System.out.println(String.format(" d ---> %s", d));
225

  
226
		assertTrue("different DOIs will drop the score to 0, regardless of the other fields", d > 0.9 & d < 1);
227
	}
228

  
229
	// http://dx.doi.org/10.1594/PANGAEA.726855 doi:10.1594/PANGAEA.726855
230

  
231
	@Test
232
	public void testDistanceResultCaseAuthor1() {
233

  
234
		final Config config = getResultAuthorsConf();
235

  
236
		final List<String> authorsA = Lists.newArrayList("a", "b", "c", "d");
237
		final List<String> authorsB = Lists.newArrayList("a", "b", "c");
238
		final List<String> pid = Lists.newArrayList();
239

  
240
		final MapDocument resA = result(config, "A", "Search the Standard Model Higgs Boson", "2003", pid, authorsA);
241
		final MapDocument resB = result(config, "B", "Search the Standard Model Higgs Boson", "2003", pid, authorsB);
242

  
243
		final ScoreResult sr = new PaceDocumentDistance().between(resA, resB, config);
244
		final double d = sr.getScore();
245
		System.out.println(String.format(" d ---> %s", d));
246

  
247
		assertTrue(d == 0.0);
248
	}
249

  
250
	@Test
251
	public void testDistanceResultCaseAuthor2() {
252

  
253
		final Config config = getResultAuthorsConf();
254

  
255
		final List<String> authorsA = Lists.newArrayList("a", "b", "c");
256
		final List<String> authorsB = Lists.newArrayList("a", "b", "c");
257
		final List<String> pid = Lists.newArrayList();
258

  
259
		final MapDocument resA = result(config, "A", "Search the Standard Model Higgs Boson", "2003", pid, authorsA);
260
		final MapDocument resB = result(config, "B", "Search the Standard Model Higgs Boson", "2003", pid, authorsB);
261

  
262
		final ScoreResult sr = new PaceDocumentDistance().between(resA, resB, config);
263
		final double d = sr.getScore();
264
		System.out.println(String.format(" d ---> %s", d));
265

  
266
		assertTrue(d == 1.0);
267
	}
268

  
269
	@Test
270
	public void testDistanceResultCaseAuthor3() {
271

  
272
		final Config config = getResultAuthorsConf();
273

  
274
		final List<String> authorsA = Lists.newArrayList("Bardi, A.", "Manghi, P.", "Artini, M.");
275
		final List<String> authorsB = Lists.newArrayList("Bardi Alessia", "Manghi Paolo", "Artini Michele");
276
		final List<String> pid = Lists.newArrayList();
277

  
278
		final MapDocument resA = result(config, "A", "Search the Standard Model Higgs Boson", "2003", pid, authorsA);
279
		final MapDocument resB = result(config, "B", "Search the Standard Model Higgs Boson", "2003", pid, authorsB);
280

  
281
		final ScoreResult sr = new PaceDocumentDistance().between(resA, resB, config);
282
		double d = sr.getScore();
283
		System.out.println(String.format(" d ---> %s", d));
284

  
285
		assertTrue((d > 0.9) && (d < 1.0));
286
	}
287

  
288
	@Test
289
	public void testDistanceResultCaseAuthor4() {
290

  
291
		final Config config = getResultAuthorsConf();
292

  
293
		final List<String> authorsA = Lists.newArrayList("Bardi, Alessia", "Manghi, Paolo", "Artini, Michele", "a");
294
		final List<String> authorsB = Lists.newArrayList("Bardi Alessia", "Manghi Paolo", "Artini Michele");
295
		final List<String> pid = Lists.newArrayList();
296

  
297
		final MapDocument resA = result(config, "A", "Search the Standard Model Higgs Boson", "2003", pid, authorsA);
298
		final MapDocument resB = result(config, "B", "Search the Standard Model Higgs Boson", "2003", pid, authorsB);
299

  
300
		final ScoreResult sr = new PaceDocumentDistance().between(resA, resB, config);
301
		final double d = sr.getScore();
302
		System.out.println(String.format(" d ---> %s", d));
303

  
304
		// assertTrue(d.getScore() == 0.0);
305
	}
306

  
307
	@Test
308
	public void testDistanceResultFullConf() {
309

  
310
		final Config config = getResultFullConf();
311

  
312
		final List<String> authorsA = Lists.newArrayList("Nagarajan Pranesh", "Guy Vautier", "Punyanganie de Silva");
313
		final List<String> authorsB = Lists.newArrayList("Pranesh Nagarajan", "Vautier Guy", "de Silva Punyanganie");
314

  
315
		final MapDocument resA =
316
				result(config, "A", "Presentations of perforated colonic pathology in patients with polymyalgia rheumatica: two case reports", "2010",
317
						"10.1186/1752-1947-4-299", authorsA);
318

  
319
		final MapDocument resB =
320
				result(config, "B", "Presentations of perforated colonic pathology in patients with polymyalgia rheumatica: two case reports", "2010",
321
						"10.1186/1752-1947-4-299", authorsB);
322

  
323
		final ScoreResult sr = new PaceDocumentDistance().between(resA, resB, config);
324
		final double d = sr.getScore();
325
		System.out.println(String.format(" d ---> %s", d));
326

  
327
		// assertTrue(d.getScore() == 0.0);
328
	}
329
	
330
}
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/test/java/eu/dnetlib/data/mapreduce/util/OafDecoderTest.java
1
package eu.dnetlib.data.mapreduce.util;
2

  
3
import static org.junit.Assert.assertFalse;
4
import static org.junit.Assert.assertNotNull;
5

  
6
import java.util.List;
7

  
8
import org.junit.Test;
9

  
10
import eu.dnetlib.data.proto.KindProtos.Kind;
11
import eu.dnetlib.miscutils.functional.xml.IndentXmlString;
12

  
13
public class OafDecoderTest {
14

  
15
	@Test
16
	public void testAsXml() {
17

  
18
		final OafDecoder decoder = OafTest.embed(OafTest.getResult("50|id_1"), Kind.entity);
19

  
20
		assertNotNull(decoder);
21

  
22
		assertNotNull(decoder.asXml());
23

  
24
		System.out.println(IndentXmlString.apply(decoder.asXml()));
25

  
26
	}
27

  
28
	@Test
29
	public void testGetFieldValues() {
30
		final OafDecoder decoder = OafTest.embed(OafTest.getResult("50|id_1"), Kind.entity);
31

  
32
		final String path = "result/metadata/title/value";
33
		final List<String> titles = decoder.decodeEntity().getFieldValues(path);
34

  
35
		assertNotNull(titles);
36
		assertFalse(titles.isEmpty());
37
	}
38
}
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/test/java/eu/dnetlib/data/mapreduce/util/OafRowKeyDecoderTest.java
1
package eu.dnetlib.data.mapreduce.util;
2

  
3
import org.junit.Test;
4

  
5
public class OafRowKeyDecoderTest {
6

  
7
	@Test
8
	public void test() {
9

  
10
		String id1 = "50|acnbad______::0a454baf9c61e63d42fb83ab549f8062";
11

  
12
		OafRowKeyDecoder d = OafRowKeyDecoder.decode(id1);
13

  
14
		System.out.println(d.getId());
15
	}
16

  
17
}
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/test/java/eu/dnetlib/data/mapreduce/util/OafRelDecoderTest.java
1
package eu.dnetlib.data.mapreduce.util;
2

  
3
import eu.dnetlib.data.proto.DedupProtos.Dedup.RelName;
4
import eu.dnetlib.data.proto.OafProtos.OafRel;
5
import eu.dnetlib.data.proto.RelTypeProtos.RelType;
6
import eu.dnetlib.data.proto.RelTypeProtos.SubRelType;
7
import org.junit.Before;
8
import org.junit.Test;
9

  
10
import static org.junit.Assert.assertEquals;
11
import static org.junit.Assert.assertNotNull;
12

  
13
public class OafRelDecoderTest {
14

  
15
	private OafRel oafRel;
16

  
17
	@Before
18
	public void setUp() {
19
		oafRel = OafTest.getDedupRel("ID_1", "ID_2", RelType.resultResult, "isMergedIn");
20
	}
21

  
22
	@Test
23
	public void testSetClass() {
24

  
25
		OafRelDecoder d1 = OafRelDecoder.decode(oafRel);
26

  
27
		assertNotNull(d1);
28
		assertEquals("isMergedIn", d1.getRelClass());
29

  
30
		OafRelDecoder d2 = OafRelDecoder.decode(d1.setClassId("isMergedIn").build());
31

  
32
		assertEquals("isMergedIn", d2.getRelClass());
33
		assertEquals("isMergedIn", d2.getRelMetadata().getSemantics().getClassid());
34
		assertEquals("isMergedIn", d2.getRelMetadata().getSemantics().getClassname());
35

  
36
	}
37

  
38
	@Test
39
	public void testGetCF() {
40
		assertEquals("resultResult_dedup_isMergedIn", OafRelDecoder.getCFQ(RelType.resultResult, SubRelType.dedup, RelName.isMergedIn));
41
		assertEquals("resultResult_dedup_isMergedIn", OafRelDecoder.getCFQ(RelType.resultResult, SubRelType.dedup, "isMergedIn"));
42
	}
43

  
44
}
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/test/java/eu/dnetlib/data/transform/xml/OpenTrialsXsltFunctionsTest.java
1
package eu.dnetlib.data.transform.xml;
2

  
3
import java.util.List;
4

  
5
import eu.dnetlib.data.transform.xml.OpenTrialsXsltFunctions.JsonProv;
6
import org.junit.After;
7
import org.junit.Before;
8
import org.junit.Test;
9

  
10
import static org.junit.Assert.assertEquals;
11

  
12

  
13
/**
14
 * OpenTrialsXsltFunctions Tester.
15
 *
16
 */
17
public class OpenTrialsXsltFunctionsTest {
18

  
19
	private String jsonProv = "[{\"url\" : \"http://apps.who.int/trialsearch/Trial3.aspx?trialid=NCT00378508\", \"sourceID\" : \"77eb42c5-0ec7-4e31-963a-5736b66f2d26\", \"sourceName\" : \"ictrp\"},{\"url\" : \"https://www.clinicaltrials.gov/ct2/show/NCT00378508?lup_e=02%2F04%2F2016&lup_s=01%2F01%2F2001&rank=175075&resultsxml=true\", \"sourceID\" : \"b389497c-0833-432b-a09b-930526b7b4d4\", \"sourceName\" : \"nct\"}]";
20
	private String jsonProvWithNull = "[{\"url\" : \"\", \"sourceID\" : \"77eb42c5-0ec7-4e31-963a-5736b66f2d26\", \"sourceName\" : \"ictrp\"},{\"url\" : \"https://www.clinicaltrials.gov/ct2/show/NCT00378508?lup_e=02%2F04%2F2016&lup_s=01%2F01%2F2001&rank=175075&resultsxml=true\", \"sourceID\" : \"b389497c-0833-432b-a09b-930526b7b4d4\", \"sourceName\" : \"nct\"}]";
21
	private String jidentifiers = "{112683,NCT00920439}";
22

  
23

  
24
	private String jsonRecord = "[{\"source_id\" : \"nct\", \"source_url\" : \"https://clinicaltrials.gov/ct2/show/NCT02321059\", \"is_primary\" : true},{\"source_id\" : \"ictrp\", \"source_url\" : \"http://apps.who.int/trialsearch/Trial3.aspx?trialid=NCT02321059\", \"is_primary\" : false}]";
25
	private String jsonRecordNull = "[{\"source_id\" : \"nct\", \"source_url\" : \"https://clinicaltrials.gov/ct2/show/NCT02321059\"},{\"source_id\" : \"ictrp\", \"source_url\" : \"http://apps.who.int/trialsearch/Trial3.aspx?trialid=NCT02321059\", \"is_primary\" : false}]";
26
	private String jsonRecordVoid = "[{\"source_id\" : \"\", \"source_url\" : \"\", \"is_primary\" : \"\"}]";
27
	private String jsonRecondPrimary = "[{\"source_id\" : \"nct\", \"source_url\" : \"https://clinicaltrials.gov/ct2/show/NCT02321059\", \"is_primary\" : false},{\"source_id\" : \"ictrp\", \"source_url\" : \"http://apps.who.int/trialsearch/Trial3.aspx?trialid=NCT02321059\", \"is_primary\" : false}]";
28

  
29
	private String jsonPeopleVoid ="[{\"person_name\" : null, \"person_id\" : null, \"person_role\" : null}]";
30
	private String jsonPeopleOne = "[{\"person_name\" : \"Henk Verheul, M.D., PhD\", \"person_id\" : \"116438e9-f8b1-46e5-a1f8-20f851cab73c\", \"person_role\" : \"principal_investigator\"}]";
31
	private String jsonPeopleMore = "[{\"person_name\" : \"Henk Verheul, M.D., PhD\", \"person_id\" : \"116438e9-f8b1-46e5-a1f8-20f851cab73c\", \"person_role\" : \"principal_investigator\"},{\"person_name\" : \"Miriam Pippolippo Baglioni, PhD\", \"person_id\" : \"fake\", \"person_role\" : \"principal_investigator\"}]";
32

  
33
	private String jsonOrganizationVoid = "[{\"organization_name\" : null, \"organization_id\" : null, \"organization_role\" : null}]";
34
	private String jsonOrganizationOne = "[{\"organization_name\" : \"Södertälje sjukhus AB\", \"organization_id\" : \"15f0d004-b82b-408c-8605-38a57352468d\", \"organization_role\" : \"sponsor\"}]";
35
	private String jsonOrganizationMore = "[{\"organization_name\" : \"Södertälje sjukhus AB\", \"organization_id\" : \"15f0d004-b82b-408c-8605-38a57352468d\", \"organization_role\" : \"sponsor\"},{\"organization_name\" : \"Miriam Baglioni AB\", \"organization_id\" : \"fake\", \"organization_role\" : \"primary_sponsor\"}]";
36

  
37
	private String jsonLocationVoid = "[{\"location_name\" : null}]";
38
	private String jsonLocationOne = "[{\"location_name\" : \"China\"}]";
39
	private String jsonLocationMore = "[{\"location_name\" : \"China\"},{\"location_name\" : \"North Korea\"}]";
40

  
41
	@Before
42
	public void before() throws Exception {
43
	}
44

  
45
	@After
46
	public void after() throws Exception {
47
	}
48

  
49
	/**
50
	 * Method: getProvs(String jsonProvList)
51
	 */
52
	@Test
53
	public void testGetProvs() throws Exception {
54
		List<JsonProv> list = OpenTrialsXsltFunctions.getProvs(jsonProv);
55
		assertEquals(2, list.size());
56
	}
57

  
58
	/**
59
	 * Method: getMainIdentifierURL(String jsonProvList)
60
	 */
61
	@Test
62
	public void testGetMainIdentifierURL() throws Exception {
63
		String url = OpenTrialsXsltFunctions.getMainIdentifierURL(jsonProv);
64
		assertEquals( "http://apps.who.int/trialsearch/Trial3.aspx?trialid=NCT00378508", url );
65
		url = OpenTrialsXsltFunctions.getMainIdentifierURL(jsonProvWithNull);
66
		assertEquals("https://www.clinicaltrials.gov/ct2/show/NCT00378508?lup_e=02%2F04%2F2016&lup_s=01%2F01%2F2001&rank=175075&resultsxml=true", url);
67
	}
68

  
69
	@Test
70
	public void testGetPrimaryRecordUrl(){
71
		String url = OpenTrialsXsltFunctions.getPrimaryRecordUrl(jsonRecord);
72
		assertEquals("https://clinicaltrials.gov/ct2/show/NCT02321059", url);
73
	}
74

  
75
	@Test
76
	public void testGetPrimaryRecordID(){
77
		String id = OpenTrialsXsltFunctions.getPrimaryRecordIdentifier(jsonRecord);
78
		assertEquals("nct", id);
79
	}
80

  
81
	@Test
82
	public void testGetPrimaryRecordUrlNull(){
83
		String url = OpenTrialsXsltFunctions.getPrimaryRecordUrl(jsonRecordNull);
84
		assertEquals("https://clinicaltrials.gov/ct2/show/NCT02321059", url);
85
	}
86

  
87
	@Test
88
	public void testGetPrimaryRecordUrlVoid(){
89
		String url = OpenTrialsXsltFunctions.getPrimaryRecordUrl(jsonRecordVoid);
90
		assertEquals("", url);
91
	}
92

  
93
	@Test
94
	public void testGetPrimaryRecordUrlNoPrimary(){
95
		String url = OpenTrialsXsltFunctions.getPrimaryRecordUrl(jsonRecondPrimary);
96
		assertEquals("https://clinicaltrials.gov/ct2/show/NCT02321059", url);
97
	}
98
	@Test
99
	public void testGetPrimaryRecordIDNoPrimary(){
100
		String id = OpenTrialsXsltFunctions.getPrimaryRecordIdentifier(jsonRecondPrimary);
101
		assertEquals("nct", id);
102
	}
103
	@Test
104
	public void testGetPrincipalInvestigatorsVoid(){
105
		String url = OpenTrialsXsltFunctions.getPrincipalInvestigators(jsonPeopleVoid);
106
		assertEquals("",url);
107
	}
108

  
109

  
110
	@Test
111
	public void testGetPrincipalInvestigatorsOne(){
112
		String url = OpenTrialsXsltFunctions.getPrincipalInvestigators(jsonPeopleOne);
113
		assertEquals("Verheul, Henk", url);
114
	}
115

  
116
	@Test
117
	public void testGetPrincipalInvestigatorsMore(){
118
		String url = OpenTrialsXsltFunctions.getPrincipalInvestigators(jsonPeopleMore);
119
		assertEquals("Verheul, Henk@@Baglioni, Miriam Pippolippo", url);
120
	}
121

  
122

  
123

  
124
	@Test
125
	public void testgGetTrialOrganizationsVoid(){
126
		String url = OpenTrialsXsltFunctions.getTrialOrganizations(jsonOrganizationVoid);
127
		assertEquals("",url);
128
	}
129

  
130

  
131
	@Test
132
	public void testgGetTrialOrganizationsOne(){
133
		String url = OpenTrialsXsltFunctions.getTrialOrganizations(jsonOrganizationOne);
134
		assertEquals("Södertälje sjukhus AB@sponsor", url);
135
	}
136

  
137
	@Test
138
	public void testgGetTrialOrganizationsMore(){
139
		String url = OpenTrialsXsltFunctions.getTrialOrganizations(jsonOrganizationMore);
140
		assertEquals("Södertälje sjukhus AB@sponsor@@Miriam Baglioni AB@sponsor", url);
141
	}
142

  
143
	@Test
144
	public void testgGetTrialLocationsVoid(){
145
		String url = OpenTrialsXsltFunctions.getTrialLocations(jsonLocationVoid);
146
		assertEquals("",url);
147
	}
148

  
149

  
150
	@Test
151
	public void testgGetTrialLocationsOne(){
152
		String url = OpenTrialsXsltFunctions.getTrialLocations(jsonLocationOne);
153
		assertEquals("China", url);
154
	}
155

  
156
	@Test
157
	public void testgGetTrialLocationsMore(){
158
		String url = OpenTrialsXsltFunctions.getTrialLocations(jsonLocationMore);
159
		assertEquals("China@@North Korea", url);
160
	}
161

  
162
	@Test
163
	public void testGetNotPrimaryRecordUrlPrimary(){
164
		String url = OpenTrialsXsltFunctions.getNotPrimaryRecordUrl(jsonRecondPrimary);
165
		assertEquals("http://apps.who.int/trialsearch/Trial3.aspx?trialid=NCT02321059", url);
166
	}
167

  
168
	@Test
169
	public void testGetNotPrimaryRecordUrlVoid(){
170
		String url = OpenTrialsXsltFunctions.getNotPrimaryRecordUrl(jsonRecordVoid);
171
		assertEquals("", url);
172
	}
173

  
174
	@Test
175
	public void testGetNotPrimaryRecordUrl(){
176
		String url = OpenTrialsXsltFunctions.getNotPrimaryRecordUrl(jsonRecord);
177
		assertEquals("http://apps.who.int/trialsearch/Trial3.aspx?trialid=NCT02321059", url);
178
	}
179

  
180

  
181
}
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/test/java/eu/dnetlib/data/transform/xml/FWFXsltFunctionsTest.java
1
package eu.dnetlib.data.transform.xml;
2

  
3
import org.junit.After;
4
import org.junit.Before;
5
import org.junit.Test;
6

  
7
import static org.junit.Assert.assertEquals;
8
import static org.junit.Assert.assertNotNull;
9

  
10
/**
11
 *
12
 * Created by miriam on 04/05/2017.
13
 */
14
public class FWFXsltFunctionsTest {
15
	private String namesurname ="Gerhard SOMMER";
16
	private String noSurname = "Gerhard";
17
	private String noName = "SOMMER";
18
	private String twoNames = "Gerhard Pippo SOMMER";
19
	private String twoSurname = "Gerhard PIPPO SOMMER";
20
	private String nonamesurname = "";
21
	private String organization ="Universität Linz - Institut für Computational Perception; Universität für Musik und darstellende Kunst Graz - Institut 1: Komposition, Musiktheorie, Musikgeschichte und Dirigieren; Universität Mozarteum Salzburg - Institut für Musikalische Rezeptions- und Interpretationsgeschichte; Anton Bruckner Privatuniversität - Institut für Theorie und Geschichte der Musik; Eliette und Herbert von Karajan Institut - Eliette und Herbert von Karajan Institut";
22

  
23
	@Before
24
	public void before() throws Exception {
25
	}
26

  
27
	@After
28
	public void after() throws Exception {
29
	}
30

  
31
	@Test
32
	public void testGetNamesNameNoNameSurname() throws Exception {
33
		String ret = FWFXsltFunctions.getName(nonamesurname,true);
34
		assertEquals("",ret );
35
	}
36

  
37
	@Test
38
	public void testGetNamesSurnameNoNameSurname() throws Exception {
39
		String ret = FWFXsltFunctions.getName(nonamesurname,false);
40
		assertEquals("",ret );
41
	}
42

  
43
	@Test
44
	public void testGetNamesNameTwoSurname() throws Exception {
45
		String ret = FWFXsltFunctions.getName(twoSurname,true);
46
		assertEquals("Gerhard",ret );
47
	}
48

  
49
	@Test
50
	public void testGetNamesSurnameTwoSurname() throws Exception {
51
		String ret = FWFXsltFunctions.getName(twoSurname,false);
52
		assertEquals("PIPPO SOMMER",ret );
53
	}
54

  
55
	@Test
56
	public void testGetNamesNameTwoNames() throws Exception {
57
		String ret = FWFXsltFunctions.getName(twoNames,true);
58
		assertEquals("Gerhard Pippo",ret );
59
	}
60

  
61
	@Test
62
	public void testGetNamesSurnameTwoNames() throws Exception {
63
		String ret = FWFXsltFunctions.getName(twoNames,false);
64
		assertEquals("SOMMER",ret );
65
	}
66

  
67
	/**
68
	 * Method: getProvs(String jsonProvList)
69
	 */
70
	@Test
71
	public void testGetNamesName() throws Exception {
72
		String ret = FWFXsltFunctions.getName(namesurname,true);
73
		assertEquals("Gerhard",ret );
74
	}
75

  
76
	@Test
77
	public void testGetNamesSurname() throws Exception {
78
		String ret = FWFXsltFunctions.getName(namesurname,false);
79
		assertEquals("SOMMER",ret );
80
	}
81

  
82
	@Test
83
	public void testGetNamesNameNoSurname() throws Exception {
84
		String ret = FWFXsltFunctions.getName(noSurname,true);
85
		assertEquals("Gerhard",ret );
86
	}
87

  
88
	@Test
89
	public void testGetNamesSurnameNoSurname() throws Exception {
90
		String ret = FWFXsltFunctions.getName(noSurname,false);
91
		assertEquals("",ret );
92
	}
93

  
94
	@Test
95
	public void testGetNamesNameNoName() throws Exception {
96
		String ret = FWFXsltFunctions.getName(noName,true);
97
		assertEquals("",ret );
98
	}
99

  
100
	@Test
101
	public void testGetNamesSurnameNoName() throws Exception {
102
		String ret = FWFXsltFunctions.getName(noName,false);
103
		assertEquals("SOMMER",ret );
104
	}
105

  
106
	@Test
107
	public void TestGetMd5()throws Exception{
108
		String md5 = FWFXsltFunctions.getMd5(organization);
109
		System.out.println(md5);
110
		assertNotNull(md5);
111
	}
112

  
113
}
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/test/java/eu/dnetlib/data/transform/SolrProtoMapperTest.java
1
package eu.dnetlib.data.transform;
2

  
3
import static org.junit.Assert.assertFalse;
4
import static org.junit.Assert.assertNotNull;
5

  
6
import java.io.IOException;
7
import java.io.StringWriter;
8

  
9
import org.apache.commons.codec.binary.Base64;
10
import org.apache.commons.io.IOUtils;
11
import org.apache.commons.logging.Log;
12
import org.apache.commons.logging.LogFactory;
13
import org.apache.solr.common.SolrInputDocument;
14
import org.apache.solr.common.SolrInputField;
15
import org.dom4j.DocumentException;
16
import org.junit.Before;
17
import org.junit.Test;
18

  
19
import com.google.protobuf.InvalidProtocolBufferException;
20
import com.googlecode.protobuf.format.JsonFormat;
21

  
22
import eu.dnetlib.data.mapreduce.util.OafTest;
23
import eu.dnetlib.data.proto.KindProtos.Kind;
24
import eu.dnetlib.data.proto.OafProtos.Oaf;
25
import eu.dnetlib.data.proto.OafProtos.OafEntity;
26
import eu.dnetlib.functionality.index.solr.feed.InputDocumentFactory;
27

  
28
public class SolrProtoMapperTest {
29

  
30
	private static final Log log = LogFactory.getLog(SolrProtoMapper.class); // NOPMD by marko on 11/24/08 5:02 PM
31
	private String fields;
32

  
33
	@Before
34
	public void setUp() throws IOException {
35
		final StringWriter sw = new StringWriter();
36
		IOUtils.copy(getClass().getResourceAsStream("fields.xml"), sw);
37
		fields = sw.toString();
38
		assertNotNull(fields);
39
		assertFalse(fields.isEmpty());
40

  
41
		log.info(fields);
42
	}
43

  
44
	@Test
45
	public void testProto2SolrDocument() throws DocumentException, InvalidProtocolBufferException {
46
		final SolrProtoMapper mapper = new SolrProtoMapper(fields);
47

  
48
		assertNotNull(mapper);
49

  
50
		final OafEntity.Builder entity = OafTest.getResultBuilder("01");
51
		entity.addChildren(OafTest.getResultBuilder("01_children"));
52

  
53
		final Oaf oaf = OafTest.embed(entity.build(), Kind.entity).getOaf();
54

  
55
		assertNotNull(oaf.getEntity().getChildrenList());
56
		assertFalse(oaf.getEntity().getChildrenList().isEmpty());
57

  
58
		log.info("byte[] size: " + oaf.toByteArray().length);
59

  
60
		log.info("json size:   " + JsonFormat.printToString(oaf).length());
61

  
62
		log.info("base64 size: " + Base64.encodeBase64String(oaf.toByteArray()).length());
63

  
64
		final byte[] decodeBase64 = Base64.decodeBase64(Base64.encodeBase64String(oaf.toByteArray()));
65

  
66
		log.info("decoded: " + JsonFormat.printToString(Oaf.parseFrom(decodeBase64)));
67

  
68
		final SolrInputDocument doc = mapper.map(oaf, InputDocumentFactory.getParsedDateField("2015-02-15"), "asd", "action-set");
69

  
70
		assertNotNull(doc);
71

  
72
		for (final SolrInputField f : doc.values()) {
73
			log.info(f);
74
		}
75
	}
76
}
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/test/resources/eu/dnetlib/openaire/exporter/model/projectDetails.json
1
{"projectId":"corda_______::200130","acronym":"SUPERCOMPETITORS","code":"200130","optional1":"ERC-SG","optional2":"http://erc.europa.eu","jsonextrainfo":"{}","fundingPath":["\u003cfundingtree\u003e\u003cfunder\u003e\u003cid\u003eec__________::EC\u003c/id\u003e\u003cshortname\u003eEC\u003c/shortname\u003e\u003cname\u003eEuropean Commission\u003c/name\u003e\u003cjurisdiction\u003eEU\u003c/jurisdiction\u003e\u003c/funder\u003e\u003cfunding_level_2\u003e\u003cid\u003eec__________::EC::FP7::SP2::ERC\u003c/id\u003e\u003cdescription\u003eERC\u003c/description\u003e\u003cname\u003eERC\u003c/name\u003e\u003cclass\u003eec:program\u003c/class\u003e\u003cparent\u003e\u003cfunding_level_1\u003e\u003cid\u003eec__________::EC::FP7::SP2\u003c/id\u003e\u003cdescription\u003eSP2-Ideas\u003c/description\u003e\u003cname\u003eSP2\u003c/name\u003e\u003cclass\u003eec:specificprogram\u003c/class\u003e\u003cparent\u003e\u003cfunding_level_0\u003e\u003cid\u003eec__________::EC::FP7\u003c/id\u003e\u003cdescription\u003eSEVENTH FRAMEWORK PROGRAMME\u003c/description\u003e\u003cname\u003eFP7\u003c/name\u003e\u003cparent/\u003e\u003cclass\u003eec:frameworkprogram\u003c/class\u003e\u003c/funding_level_0\u003e\u003c/parent\u003e\u003c/funding_level_1\u003e\u003c/parent\u003e\u003c/funding_level_2\u003e\u003c/fundingtree\u003e"]}
2
{"projectId":"corda_______::200141","acronym":"QUESPACE","code":"200141","optional1":"ERC-SG","optional2":"http://erc.europa.eu","jsonextrainfo":"{}","fundingPath":["\u003cfundingtree\u003e\u003cfunder\u003e\u003cid\u003eec__________::EC\u003c/id\u003e\u003cshortname\u003eEC\u003c/shortname\u003e\u003cname\u003eEuropean Commission\u003c/name\u003e\u003cjurisdiction\u003eEU\u003c/jurisdiction\u003e\u003c/funder\u003e\u003cfunding_level_2\u003e\u003cid\u003eec__________::EC::FP7::SP2::ERC\u003c/id\u003e\u003cdescription\u003eERC\u003c/description\u003e\u003cname\u003eERC\u003c/name\u003e\u003cclass\u003eec:program\u003c/class\u003e\u003cparent\u003e\u003cfunding_level_1\u003e\u003cid\u003eec__________::EC::FP7::SP2\u003c/id\u003e\u003cdescription\u003eSP2-Ideas\u003c/description\u003e\u003cname\u003eSP2\u003c/name\u003e\u003cclass\u003eec:specificprogram\u003c/class\u003e\u003cparent\u003e\u003cfunding_level_0\u003e\u003cid\u003eec__________::EC::FP7\u003c/id\u003e\u003cdescription\u003eSEVENTH FRAMEWORK PROGRAMME\u003c/description\u003e\u003cname\u003eFP7\u003c/name\u003e\u003cparent/\u003e\u003cclass\u003eec:frameworkprogram\u003c/class\u003e\u003c/funding_level_0\u003e\u003c/parent\u003e\u003c/funding_level_1\u003e\u003c/parent\u003e\u003c/funding_level_2\u003e\u003c/fundingtree\u003e"]}
3
{"projectId":"corda_______::200165","acronym":"PROTEOMICS OF CHERNO","code":"200165","optional1":"MC-IRG","optional2":"http://cordis.europa.eu/fp7/people.htm","jsonextrainfo":"{}","fundingPath":["\u003cfundingtree\u003e\u003cfunder\u003e\u003cid\u003eec__________::EC\u003c/id\u003e\u003cshortname\u003eEC\u003c/shortname\u003e\u003cname\u003eEuropean Commission\u003c/name\u003e\u003cjurisdiction\u003eEU\u003c/jurisdiction\u003e\u003c/funder\u003e\u003cfunding_level_2\u003e\u003cid\u003eec__________::EC::FP7::SP3::PEOPLE\u003c/id\u003e\u003cdescription\u003eMarie-Curie Actions\u003c/description\u003e\u003cname\u003ePEOPLE\u003c/name\u003e\u003cclass\u003eec:program\u003c/class\u003e\u003cparent\u003e\u003cfunding_level_1\u003e\u003cid\u003eec__________::EC::FP7::SP3\u003c/id\u003e\u003cdescription\u003eSP3-People\u003c/description\u003e\u003cname\u003eSP3\u003c/name\u003e\u003cclass\u003eec:specificprogram\u003c/class\u003e\u003cparent\u003e\u003cfunding_level_0\u003e\u003cid\u003eec__________::EC::FP7\u003c/id\u003e\u003cdescription\u003eSEVENTH FRAMEWORK PROGRAMME\u003c/description\u003e\u003cname\u003eFP7\u003c/name\u003e\u003cparent/\u003e\u003cclass\u003eec:frameworkprogram\u003c/class\u003e\u003c/funding_level_0\u003e\u003c/parent\u003e\u003c/funding_level_1\u003e\u003c/parent\u003e\u003c/funding_level_2\u003e\u003c/fundingtree\u003e"]}
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/test/resources/eu/dnetlib/openaire/exporter/model/projectDetails.csv
1
nih_________::3R01GM073898-02S1,,3R01GM073898-02S1,23188 $,,"{""orgname"":""UNIVERSITY OF CALIFORNIA SAN DIEGO"", ""activity"":""R01"", ""administeringic"":""GM"", ""serialnumber"":""73898"", ""coreprojectnum"":""R01GM073898""}","[""\u003cfundingtree\u003e\n      \u003cfunder\u003e\n         \u003cid\u003enih_________::NIH\u003c/id\u003e\n         \u003cshortname\u003eNIH\u003c/shortname\u003e\n         \u003cname\u003eNational Institutes of Health\u003c/name\u003e\n         \u003cjurisdiction\u003eUS\u003c/jurisdiction\u003e\n      \u003c/funder\u003e\n      \u003cfunding_level_0\u003e\n         \u003cid\u003enih_________::NIH::NATIONAL_INSTITUTE_OF_GENERAL_MEDICAL_SCIENCES\u003c/id\u003e\n         \u003cname\u003eNATIONAL INSTITUTE OF GENERAL MEDICAL SCIENCES\u003c/name\u003e\n         \u003cdescription\u003eNATIONAL INSTITUTE OF GENERAL MEDICAL SCIENCES\u003c/description\u003e\n         \u003cparent/\u003e\n         \u003cclass\u003enih:fundingStream\u003c/class\u003e\n      \u003c/funding_level_0\u003e\n   \u003c/fundingtree\u003e""]"
2
corda_______::100202,RECOMP,100202,JTI-CP-ARTEMIS,http://cordis.europa.eu/fp7/home_en.html,{},"[""\u003cfundingtree\u003e\u003cfunder\u003e\u003cid\u003eec__________::EC\u003c/id\u003e\u003cshortname\u003eEC\u003c/shortname\u003e\u003cname\u003eEuropean Commission\u003c/name\u003e\u003cjurisdiction\u003eEU\u003c/jurisdiction\u003e\u003c/funder\u003e\u003cfunding_level_2\u003e\u003cid\u003eec__________::EC::FP7::SP1::SP1-JTI\u003c/id\u003e\u003cdescription\u003eJoint Technology Initiatives (Annex IV-SP1)\u003c/description\u003e\u003cname\u003eSP1-JTI\u003c/name\u003e\u003cclass\u003eec:program\u003c/class\u003e\u003cparent\u003e\u003cfunding_level_1\u003e\u003cid\u003eec__________::EC::FP7::SP1\u003c/id\u003e\u003cdescription\u003eSP1-Cooperation\u003c/description\u003e\u003cname\u003eSP1\u003c/name\u003e\u003cclass\u003eec:specificprogram\u003c/class\u003e\u003cparent\u003e\u003cfunding_level_0\u003e\u003cid\u003eec__________::EC::FP7\u003c/id\u003e\u003cdescription\u003eSEVENTH FRAMEWORK PROGRAMME\u003c/description\u003e\u003cname\u003eFP7\u003c/name\u003e\u003cparent/\u003e\u003cclass\u003eec:frameworkprogram\u003c/class\u003e\u003c/funding_level_0\u003e\u003c/parent\u003e\u003c/funding_level_1\u003e\u003c/parent\u003e\u003c/funding_level_2\u003e\u003c/fundingtree\u003e""]"
3
corda__h2020::633080,MACC-III,633080,SPACE,SPACE,{},"[""\u003cfundingtree\u003e\u003cfunder\u003e\u003cid\u003eec__________::EC\u003c/id\u003e\u003cshortname\u003eEC\u003c/shortname\u003e\u003cname\u003eEuropean Commission\u003c/name\u003e\u003cjurisdiction\u003eEU\u003c/jurisdiction\u003e\u003c/funder\u003e\u003cfunding_level_1\u003e\u003cid\u003eec__________::EC::H2020::CSA\u003c/id\u003e\u003cdescription\u003eCoordination and support action\u003c/description\u003e\u003cname\u003eCSA\u003c/name\u003e\u003cclass\u003eec:h2020toas\u003c/class\u003e\u003cparent\u003e\u003cfunding_level_0\u003e\u003cid\u003eec__________::EC::H2020\u003c/id\u003e\u003cname\u003eH2020\u003c/name\u003e\u003cdescription\u003eHorizon 2020 Framework Programme\u003c/description\u003e\u003cparent/\u003e\u003cclass\u003eec:h2020fundings\u003c/class\u003e\u003c/funding_level_0\u003e\u003c/parent\u003e\u003c/funding_level_1\u003e\u003c/fundingtree\u003e""]"
4
nsf_________::0000096,,0000096,,,{},"[""\u003cfundingtree\u003e\u003cfunder\u003e\u003cid\u003ensf_________::NSF\u003c/id\u003e\u003cshortname\u003eNSF\u003c/shortname\u003e\u003cname\u003eNational Science Foundation\u003c/name\u003e\u003cjurisdiction\u003eUS\u003c/jurisdiction\u003e\u003c/funder\u003e\u003cfunding_level_1\u003e\u003cid\u003ensf_________::NSF::OD::OD/OIA\u003c/id\u003e\u003cdescription\u003eOffice of Integrative Activities\u003c/description\u003e\u003cname\u003eOffice of Integrative Activities\u003c/name\u003e\u003cparent\u003e\u003cfunding_level_0\u003e\u003cid\u003ensf_________::NSF::OD\u003c/id\u003e\u003cdescription\u003eOffice of the Director\u003c/description\u003e\u003cname\u003eOffice of the Director\u003c/name\u003e\u003cparent/\u003e\u003cclass\u003ensf:fundingStream\u003c/class\u003e\u003c/funding_level_0\u003e\u003c/parent\u003e\u003c/funding_level_1\u003e\u003c/fundingtree\u003e""]"
5
fct_________::100107,PTDC/SAU-ESA/100107/2008,100107,,,{},"[""\u003cfundingtree\u003e\u003cfunder\u003e\u003cid\u003efct_________::FCT\u003c/id\u003e\u003cshortname\u003eFCT\u003c/shortname\u003e\u003cname\u003eFundação para a Ciência e a Tecnologia, I.P.\u003c/name\u003e\u003cjurisdiction\u003ePT\u003c/jurisdiction\u003e\u003c/funder\u003e\u003cfunding_level_0\u003e\u003cid\u003efct_________::FCT::5876-PPCDTI\u003c/id\u003e\u003cdescription\u003e5876-PPCDTI\u003c/description\u003e\u003cname\u003e5876-PPCDTI\u003c/name\u003e\u003cparent/\u003e\u003cclass\u003efct:program\u003c/class\u003e\u003c/funding_level_0\u003e\u003c/fundingtree\u003e""]"
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/test/resources/eu/dnetlib/pace/organization.pace.conf
1
{ 
2
	"wf" : { 
3
        "threshold" : "0.99", 
4
        "run" : "001", 
5
        "entityType" : "organization", 
6
        "orderField" : "title", 
7
        "queueMaxSize" : "2000",
8
        "groupMaxSize" : "10",
9
        "slidingWindowSize" : "200",
10
        "rootBuilder" : [ "organization" ],
11
        "includeChildren" : "true" 
12
    },
13
	"pace" : {		
14
  		"conditions" : [ ],		
15
		"model" : [
16
			{ "name" : "legalname", "algo" : "JaroWinkler", "type" : "String", "weight" : "0.6", "ignoreMissing" : "false", "path" : "organization/metadata/legalname/value" },
17
			{ "name" : "legalshortname", "algo" : "JaroWinkler", "type" : "String", "weight" : "0.4", "ignoreMissing" : "true", "path" : "organization/metadata/legalshortname/value" }
18
		],
19
		"blacklists" : { } 		
20
	}
21
}
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/test/resources/eu/dnetlib/pace/model/gt.author.manghi1.json
1
{"id":"30|dedup_wf_001::e78059705c3885a10440c8021afbdd4a","author":{"frequency":6,"id":"30|od______2294::9897283f935d7c2f4c11cebf65ae3098","fullname":"Manghi, Paolo","firstname":"Paolo","secondnames":"Manghi"},"merged":[{"id":"30|od______2294::9897283f935d7c2f4c11cebf65ae3098","fullname":"Manghi, Paolo","firstname":"Paolo","secondnames":"Manghi"},{"id":"30|doaj10829873::6cff63f7eafbb51fd6a1c268f4f0227f","fullname":"Manghi, Paolo","firstname":"Paolo","secondnames":"Manghi"},{"id":"30|od______2367::9897283f935d7c2f4c11cebf65ae3098","fullname":"Manghi, Paolo","firstname":"Paolo","secondnames":"Manghi"},{"id":"30|doaj10829873::f67c45f3bd4e4e4c4942a373799e0457","fullname":"Manghi, Paolo","firstname":"Paolo","secondnames":"Manghi"},{"id":"30|doaj10829873::39a29e7c15e04cdef8aecaa062b4f000","fullname":"Manghi, Paolo","firstname":"Paolo","secondnames":"Manghi"},{"id":"30|doaj10829873::f9b4de41343d956271d88f93ba68c31d","fullname":"Manghi, Paolo","firstname":"Paolo","secondnames":"Manghi"}],"coAuthors":[{"anchorId":"30|dedup_wf_001::73aac4e0ca21747def81773cdf242152","id":"30|od______2367::069aab4b3defa55d5fb573838e54ed10","fullname":"Werf, Titia","firstname":"Titia","secondnames":"Werf"},{"anchorId":"30|dedup_wf_001::cd493693f2e04159d419cfbea6042944","id":"30|doaj10829873::0acf7cdc45040bd02482b94760af9db5","fullname":"Smith, Tim","firstname":"Tim","secondnames":"Smith"},{"anchorId":"30|dedup_wf_001::4867c41ae4006a89a4e00fa5b2ace526","id":"30|od______2294::717184cb6436add31e3ce0ba86ba2476","fullname":"Katifori, Akrivi","firstname":"Akrivi","secondnames":"Katifori"},{"anchorId":"30|dedup_wf_001::d17df318b8ab8b17ac2b016767e183b4","id":"30|od______2367::d24f772460583eb514d0465f77f15030","fullname":"Rettberg, Najla","firstname":"Najla","secondnames":"Rettberg"},{"anchorId":"30|dedup_wf_001::ce0c9316f1d270fe7c021ac010378189","id":"30|od______2367::ef2914f870d83e32764f2e0db122d0c4","fullname":"Houssos, Nikos","firstname":"Nikos","secondnames":"Houssos"},{"anchorId":"30|dedup_wf_001::ce0c9316f1d270fe7c021ac010378189","id":"30|od______2294::ef2914f870d83e32764f2e0db122d0c4","fullname":"Houssos, Nikos","firstname":"Nikos","secondnames":"Houssos"},{"anchorId":"30|dedup_wf_001::271f098792b54069a4d77b4fee16b354","id":"30|od______2294::217bb36de851aacdeae92250959e5af9","fullname":"Schmidt, Birgit","firstname":"Birgit","secondnames":"Schmidt"},{"anchorId":"30|dedup_wf_001::19651c25c06f8ddbf8fb582efa51bb10","id":"30|od______2367::c48a8036130fc6f9a73348ba3be40041","fullname":"Biagini, Federico","firstname":"Federico","secondnames":"Biagini"},{"anchorId":"30|dedup_wf_001::49e6185992465c4473a19d74aaf0c774","id":"30|od______2367::44afefb40235eadaa9424f735dc569ad","fullname":"Schirrwagen, Jochen","firstname":"Jochen","secondnames":"Schirrwagen"},{"anchorId":"30|dedup_wf_001::21bff9fc229ffae537509689a3eb2bd1","id":"30|doaj10829873::269dbf736b973d298160217072f127bd","fullname":"Candela, Leonardo","firstname":"Leonardo","secondnames":"Candela"},{"anchorId":"30|dedup_wf_001::84b80c9fc38b022ae4e4a5c25ffa7999","id":"30|od______2367::a93eb6a6cbfce5bcdf86cb743f788077","fullname":"Castelli, Donatella","firstname":"Donatella","secondnames":"Castelli"},{"anchorId":"30|dedup_wf_001::731b5090d3f9c6dac58ad770b1a29e13","id":"30|doaj10829873::c6cc48d8aa310a1d2c87f5df7c5576bb","fullname":"Bardi, Alessia","firstname":"Alessia","secondnames":"Bardi"},{"anchorId":"30|dedup_wf_001::5a835806fb58a8199640d0b54de6b70a","id":"30|od______2367::9c743b25e78b06608d4214ba18f92690","fullname":"Bolikowski, Lukasz","firstname":"Lukasz","secondnames":"Bolikowski"},{"anchorId":"30|dedup_wf_001::d71c73319eda487f9b56e860e2c1794f","id":"30|od______2367::c11bdd64efcd19316ef10c1967392565","fullname":"Peters, Dale","firstname":"Dale","secondnames":"Peters"},{"anchorId":"30|dedup_wf_001::2c561a4cbd689f4729324744fb046995","id":"30|doaj10829873::80724b7b737d6c51b3733eaf9da4b605","fullname":"Mikulicic, Marko","firstname":"Marko","secondnames":"Mikulicic"},{"anchorId":"30|dedup_wf_001::cd493693f2e04159d419cfbea6042944","id":"30|od______2367::b340050a287b2601d330547261fe82bc","fullname":"Smith, Tim","firstname":"Tim","secondnames":"Smith"},{"anchorId":"30|dedup_wf_001::49e6185992465c4473a19d74aaf0c774","id":"30|od______2294::44afefb40235eadaa9424f735dc569ad","fullname":"Schirrwagen, Jochen","firstname":"Jochen","secondnames":"Schirrwagen"},{"anchorId":"30|dedup_wf_001::f41b3d7b95be894f9bd7a30b08f50313","id":"30|od______2294::45f6127ede0d24d16a5007ceff0a2d4b","fullname":"Horstmann, Wolfram","firstname":"Wolfram","secondnames":"Horstmann"},{"anchorId":"30|dedup_wf_001::75d72e914bd4d88674bd2a99a01c9f19","id":"30|od______2367::08fc98b1a1e2e2de97e3ecdd1b8174d0","fullname":"Pagano, Pasquale","firstname":"Pasquale","secondnames":"Pagano"},{"anchorId":"30|dedup_wf_001::30530ec3554a58bf9eaa0c497b9c83e5","id":"30|od______2367::c68257b7b29d6c1b372856f371e3ba24","fullname":"Manola, Natalia","firstname":"Natalia","secondnames":"Manola"},{"anchorId":"30|dedup_wf_001::21bff9fc229ffae537509689a3eb2bd1","id":"30|od______2367::8fd116733ee055e8bee96e422b4142ca","fullname":"Candela, Leonardo","firstname":"Leonardo","secondnames":"Candela"},{"anchorId":"30|dedup_wf_001::4867c41ae4006a89a4e00fa5b2ace526","id":"30|od______2367::717184cb6436add31e3ce0ba86ba2476","fullname":"Katifori, Akrivi","firstname":"Akrivi","secondnames":"Katifori"},{"anchorId":"30|dedup_wf_001::2c561a4cbd689f4729324744fb046995","id":"30|od______2367::fe0e336ba013e433486e92b8e30435c1","fullname":"Mikulicic, Marko","firstname":"Marko","secondnames":"Mikulicic"},{"anchorId":"30|dedup_wf_001::21bff9fc229ffae537509689a3eb2bd1","id":"30|od______2294::8fd116733ee055e8bee96e422b4142ca","fullname":"Candela, Leonardo","firstname":"Leonardo","secondnames":"Candela"},{"anchorId":"30|dedup_wf_001::ef5fbc9697bc7bf23f9cedc92f855466","id":"30|od______2367::7aab6e55da61a2f412b9764e3554154a","fullname":"Assante, Massimiliano","firstname":"Massimiliano","secondnames":"Assante"},{"anchorId":"30|dedup_wf_001::49e6185992465c4473a19d74aaf0c774","id":"30|doaj10829873::6bb80887219a5ea64915d84d373e3eb5","fullname":"Schirrwagen, Jochen","firstname":"Jochen","secondnames":"Schirrwagen"},{"anchorId":"30|dedup_wf_001::ca57380f88fb4920d67e024c0af0c715","id":"30|od______2294::2ca703acc4dd66064135c1afc5e976b8","fullname":"Horst, Marek","firstname":"Marek","secondnames":"Horst"},{"anchorId":"30|dedup_wf_001::2317e62318581e89976523d2553977e2","id":"30|od______2367::545b78ed508339ab728beee05f312db1","fullname":"Zoppi, Franco","firstname":"Franco","secondnames":"Zoppi"},{"anchorId":"30|dedup_wf_001::152c124f2f79b57d16500a3b8a63b93c","id":"30|od______2367::ee0556ce5974761280b8be0812a586b3","fullname":"Bolikowski, Å<U+0081>ukasz","firstname":"Å<U+0081>ukasz","secondnames":"Bolikowski"},{"anchorId":"30|dedup_wf_001::84b80c9fc38b022ae4e4a5c25ffa7999","id":"30|doaj10829873::a3c59fe161823ef7fadbd1bb216c34bb","fullname":"Castelli, Donatella","firstname":"Donatella","secondnames":"Castelli"},{"anchorId":"30|dedup_wf_001::731b5090d3f9c6dac58ad770b1a29e13","id":"30|od______2367::3fbd0b3533bd0e6089c1fe68b115f772","fullname":"Bardi, Alessia","firstname":"Alessia","secondnames":"Bardi"},{"anchorId":"30|dedup_wf_001::75d72e914bd4d88674bd2a99a01c9f19","id":"30|doaj10829873::9e7037bbf8b59564442aa12b6b424747","fullname":"Pagano, Pasquale","firstname":"Pasquale","secondnames":"Pagano"},{"anchorId":"30|dedup_wf_001::eacced7c9132e343948bf51698a1c927","id":"30|od______2367::22272e3e38161be671abad3f27c68e36","fullname":"Mikulic, Marko","firstname":"Marko","secondnames":"Mikulic"},{"anchorId":"30|dedup_wf_001::30530ec3554a58bf9eaa0c497b9c83e5","id":"30|od______2294::c68257b7b29d6c1b372856f371e3ba24","fullname":"Manola, Natalia","firstname":"Natalia","secondnames":"Manola"},{"anchorId":"30|dedup_wf_001::f41b3d7b95be894f9bd7a30b08f50313","id":"30|od______2367::45f6127ede0d24d16a5007ceff0a2d4b","fullname":"Horstmann, Wolfram","firstname":"Wolfram","secondnames":"Horstmann"},{"anchorId":"30|dedup_wf_001::ca57380f88fb4920d67e024c0af0c715","id":"30|od______2367::2ca703acc4dd66064135c1afc5e976b8","fullname":"Horst, Marek","firstname":"Marek","secondnames":"Horst"},{"anchorId":"30|dedup_wf_001::7b1fe51141418a62b56f9c3bd5bccaa7","id":"30|od______2367::2638f44b18089930e67bbd5633f9b103","fullname":"Debole, Franca","firstname":"Franca","secondnames":"Debole"},{"anchorId":"30|dedup_wf_001::d17df318b8ab8b17ac2b016767e183b4","id":"30|od______2294::d24f772460583eb514d0465f77f15030","fullname":"Rettberg, Najla","firstname":"Najla","secondnames":"Rettberg"},{"anchorId":"30|dedup_wf_001::75d72e914bd4d88674bd2a99a01c9f19","id":"30|doaj10829873::b3795485a89b87aabeff16b81f2ff24d","fullname":"Pagano, Pasquale","firstname":"Pasquale","secondnames":"Pagano"},{"anchorId":"30|dedup_wf_001::d71c73319eda487f9b56e860e2c1794f","id":"30|od______2294::c11bdd64efcd19316ef10c1967392565","fullname":"Peters, Dale","firstname":"Dale","secondnames":"Peters"},{"anchorId":"30|dedup_wf_001::9bfaee15b25e210ab56dfa6f57c6417e","id":"30|od______2367::81d934153eb100552ef4b398e243dd45","fullname":"La Bruzzo, Sandro","firstname":"Sandro","secondnames":"La Bruzzo"},{"anchorId":"30|dedup_wf_001::5a835806fb58a8199640d0b54de6b70a","id":"30|doaj10829873::2abbf092ab99aaaf0a52969141fc0070","fullname":"Bolikowski, Lukasz","firstname":"Lukasz","secondnames":"Bolikowski"},{"anchorId":"30|dedup_wf_001::cd493693f2e04159d419cfbea6042944","id":"30|od______2294::b340050a287b2601d330547261fe82bc","fullname":"Smith, Tim","firstname":"Tim","secondnames":"Smith"},{"anchorId":"30|dedup_wf_001::2d413333206599ee864738c521dbe5b3","id":"30|od______2367::39c67e010b85a6a79e54e94b2a789221","fullname":"Savino, Pasquale","firstname":"Pasquale","secondnames":"Savino"},{"anchorId":"30|dedup_wf_001::21bff9fc229ffae537509689a3eb2bd1","id":"30|doaj10829873::515b938f185f85e1a91849337310c4b7","fullname":"Candela, Leonardo","firstname":"Leonardo","secondnames":"Candela"},{"anchorId":"30|dedup_wf_001::c4d99fedf82781b5cae2225cf8049426","id":"30|od______2294::e931b1326351ef5b3bb2b89f3fc4244c","fullname":"Kobos, Mateusz","firstname":"Mateusz","secondnames":"Kobos"},{"anchorId":"30|dedup_wf_001::30530ec3554a58bf9eaa0c497b9c83e5","id":"30|doaj10829873::d4df586c008bca6df713f84070d3e1c3","fullname":"Manola, Natalia","firstname":"Natalia","secondnames":"Manola"},{"anchorId":"30|dedup_wf_001::152c124f2f79b57d16500a3b8a63b93c","id":"30|od______2294::029cfdbbd0fcb888f4efbfe1dde81721","fullname":"Bolikowski, Łukasz","firstname":"Łukasz","secondnames":"Bolikowski"},{"anchorId":"30|dedup_wf_001::7b9bd8e96778de90c911e0fcc8821bcc","id":"30|od______2367::c96e9db5145834320c37332ef96802f6","fullname":"Artini, Michele","firstname":"Michele","secondnames":"Artini"},{"anchorId":"30|dedup_wf_001::5a835806fb58a8199640d0b54de6b70a","id":"30|od______2294::9c743b25e78b06608d4214ba18f92690","fullname":"Bolikowski, Lukasz","firstname":"Lukasz","secondnames":"Bolikowski"},{"anchorId":"30|dedup_wf_001::84b80c9fc38b022ae4e4a5c25ffa7999","id":"30|doaj10829873::347ee2414e420e4aec5395146956d8c0","fullname":"Castelli, Donatella","firstname":"Donatella","secondnames":"Castelli"},{"anchorId":"30|dedup_wf_001::5850f94defb717ab4e7be63e6d4d2d12","id":"30|od______2367::de34cde81e9e864703f58d615ea0cf69","fullname":"Siebinga, Sjoerd","firstname":"Sjoerd","secondnames":"Siebinga"},{"anchorId":"30|dedup_wf_001::271f098792b54069a4d77b4fee16b354","id":"30|od______2367::217bb36de851aacdeae92250959e5af9","fullname":"Schmidt, Birgit","firstname":"Birgit","secondnames":"Schmidt"},{"anchorId":"30|dedup_wf_001::ca57ee88d3a6d5e2908b09c5aae07f97","id":"30|od______2367::ddd745ebf411904db3cd353539f6e079","fullname":"Mieldijk, Mario","firstname":"Mario","secondnames":"Mieldijk"},{"anchorId":"30|dedup_wf_001::c4d99fedf82781b5cae2225cf8049426","id":"30|od______2367::e931b1326351ef5b3bb2b89f3fc4244c","fullname":"Kobos, Mateusz","firstname":"Mateusz","secondnames":"Kobos"}],"anchor":true}
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/test/resources/eu/dnetlib/pace/model/gt.author.manghi2.json
1
{"id":"30|dedup_wf_001::9044d2ebdd6112d84e5ff279ae3d0a26","author":{"frequency":2,"id":"30|od______1457::9897283f935d7c2f4c11cebf65ae3098","fullname":"Manghi, Paolo","firstname":"Paolo","secondnames":"Manghi"},"merged":[{"id":"30|od______1457::9897283f935d7c2f4c11cebf65ae3098","fullname":"Manghi, Paolo","firstname":"Paolo","secondnames":"Manghi"},{"score":1.0,"id":"30|od_______307::9897283f935d7c2f4c11cebf65ae3098","fullname":"Manghi, Paolo","firstname":"Paolo","secondnames":"Manghi"}],"coAuthors":[{"anchorId":"30|dedup_wf_001::179d5e120c57d760e8847dedfa7bfb9b","id":"30|od_______307::e0c601b1613eec62abb99e2591168fba","fullname":"Rodrigues, Eloy","firstname":"Eloy","secondnames":"Rodrigues"},{"anchorId":"30|dedup_wf_001::951cb66881f278b74cb366add7f0ce0d","id":"30|od_______307::ef2914f870d83e32764f2e0db122d0c4","fullname":"Houssos, Nikos","firstname":"Nikos","secondnames":"Houssos"},{"anchorId":"30|dedup_wf_001::958d36ee987d35f7d0a4f74a7ad10680","id":"30|od______1457::980daed35d7008f6f4de325f235fde65","fullname":"Príncipe, Pedro","firstname":"Pedro","secondnames":"Príncipe"},{"anchorId":"30|dedup_wf_001::4fe9f7dd4a96f983dcc8f17436238ba6","id":"30|od_______307::ae2f5173f1f1745e8521107ffd9e37ae","fullname":"Dvořák, Jan","firstname":"Jan","secondnames":"Dvořák"},{"anchorId":"30|dedup_wf_001::d09e46b26192d335be7aef7ddcbc9c0c","id":"30|od_______307::56bbbdcfbdda05ec257fabc0c7a596cc","fullname":"Elbæk, Mikael Karstensen","firstname":"Mikael Karstensen","secondnames":"Elbæk"},{"anchorId":"30|dedup_wf_001::d09e46b26192d335be7aef7ddcbc9c0c","id":"30|od______1457::56bbbdcfbdda05ec257fabc0c7a596cc","fullname":"Elbæk, Mikael Karstensen","firstname":"Mikael Karstensen","secondnames":"Elbæk"},{"anchorId":"30|dedup_wf_001::958d36ee987d35f7d0a4f74a7ad10680","id":"30|od_______307::980daed35d7008f6f4de325f235fde65","fullname":"Príncipe, Pedro","firstname":"Pedro","secondnames":"Príncipe"},{"anchorId":"30|dedup_wf_001::29611ace913f53e57c9201010b24434b","id":"30|od______1457::99d2bbd6eb21de2603f2d355875fe7b2","fullname":"Jörg, Brigitte","firstname":"Brigitte","secondnames":"Jörg"},{"anchorId":"30|dedup_wf_001::951cb66881f278b74cb366add7f0ce0d","id":"30|od______1457::ef2914f870d83e32764f2e0db122d0c4","fullname":"Houssos, Nikos","firstname":"Nikos","secondnames":"Houssos"},{"anchorId":"30|dedup_wf_001::29611ace913f53e57c9201010b24434b","id":"30|od_______307::99d2bbd6eb21de2603f2d355875fe7b2","fullname":"Jörg, Brigitte","firstname":"Brigitte","secondnames":"Jörg"},{"anchorId":"30|dedup_wf_001::179d5e120c57d760e8847dedfa7bfb9b","id":"30|od______1457::e0c601b1613eec62abb99e2591168fba","fullname":"Rodrigues, Eloy","firstname":"Eloy","secondnames":"Rodrigues"},{"anchorId":"30|dedup_wf_001::4fe9f7dd4a96f983dcc8f17436238ba6","id":"30|od______1457::ae2f5173f1f1745e8521107ffd9e37ae","fullname":"Dvořák, Jan","firstname":"Jan","secondnames":"Dvořák"}],"anchor":true}
modules/dnet-openaireplus-mapping-utils/branches/solr7/src/test/resources/eu/dnetlib/pace/model/gt.author.manghi1.fo.json
1
{
2
  "id": "30|dedup_wf_001::e78059705c3885a10440c8021afbdd4a",
3
  "author": {
4
    "frequency": 6,
5
    "id": "30|od______2294::9897283f935d7c2f4c11cebf65ae3098",
6
    "fullname": "Manghi, Paolo",
7
    "firstname": "Paolo",
8
    "secondnames": "Manghi"
9
  },
10
  "merged": [
11
    {
12
      "id": "30|od______2294::9897283f935d7c2f4c11cebf65ae3098",
13
      "fullname": "Manghi, Paolo",
14
      "firstname": "Paolo",
15
      "secondnames": "Manghi"
16
    },
17
    {
18
      "id": "30|doaj10829873::6cff63f7eafbb51fd6a1c268f4f0227f",
19
      "fullname": "Manghi, Paolo",
20
      "firstname": "Paolo",
21
      "secondnames": "Manghi"
22
    },
23
    {
24
      "id": "30|od______2367::9897283f935d7c2f4c11cebf65ae3098",
25
      "fullname": "Manghi, Paolo",
26
      "firstname": "Paolo",
27
      "secondnames": "Manghi"
28
    },
29
    {
30
      "id": "30|doaj10829873::f67c45f3bd4e4e4c4942a373799e0457",
31
      "fullname": "Manghi, Paolo",
32
      "firstname": "Paolo",
33
      "secondnames": "Manghi"
34
    },
35
    {
36
      "id": "30|doaj10829873::39a29e7c15e04cdef8aecaa062b4f000",
37
      "fullname": "Manghi, Paolo",
38
      "firstname": "Paolo",
39
      "secondnames": "Manghi"
40
    },
41
    {
42
      "id": "30|doaj10829873::f9b4de41343d956271d88f93ba68c31d",
43
      "fullname": "Manghi, Paolo",
44
      "firstname": "Paolo",
45
      "secondnames": "Manghi"
46
    }
47
  ],
48
  "coAuthors": [
49
    {
50
      "anchorId": "30|dedup_wf_001::179d5e120c57d760e8847dedfa7bfb9b",
51
      "id": "30|od_______307::e0c601b1613eec62abb99e2591168fba",
52
      "fullname": "Rodrigues, Eloy",
53
      "firstname": "Eloy",
54
      "secondnames": "Rodrigues"
55
    },
56
    {
57
      "anchorId": "30|dedup_wf_001::73aac4e0ca21747def81773cdf242152",
58
      "id": "30|od______2367::069aab4b3defa55d5fb573838e54ed10",
59
      "fullname": "Werf, Titia",
60
      "firstname": "Titia",
61
      "secondnames": "Werf"
62
    },
63
    {
64
      "anchorId": "30|dedup_wf_001::cd493693f2e04159d419cfbea6042944",
65
      "id": "30|doaj10829873::0acf7cdc45040bd02482b94760af9db5",
66
      "fullname": "Smith, Tim",
67
      "firstname": "Tim",
68
      "secondnames": "Smith"
69
    },
70
    {
71
      "anchorId": "30|dedup_wf_001::4867c41ae4006a89a4e00fa5b2ace526",
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff