Project

General

Profile

« Previous | Next » 

Revision 57829

View differences:

modules/dnet-orgs-database-application/trunk/src/main/java/eu/dnetlib/organizations/repository/OpenaireSimRelRepository.java
1
package eu.dnetlib.organizations.repository;
2

  
3
import java.util.List;
4

  
5
import org.springframework.data.jpa.repository.JpaRepository;
6
import org.springframework.stereotype.Repository;
7

  
8
import eu.dnetlib.organizations.model.OpenaireSimRel;
9
import eu.dnetlib.organizations.model.OpenaireSimRelPK;
10

  
11
@Repository
12
public interface OpenaireSimRelRepository extends JpaRepository<OpenaireSimRel, OpenaireSimRelPK> {
13

  
14
	List<OpenaireSimRel> findByLocalId(String localId);
15
}
modules/dnet-orgs-database-application/trunk/src/main/java/eu/dnetlib/organizations/model/OpenaireSimRelPK.java
1
package eu.dnetlib.organizations.model;
2

  
3
import java.io.Serializable;
4
import java.util.Objects;
5

  
6
public class OpenaireSimRelPK implements Serializable {
7

  
8
	/**
9
	 *
10
	 */
11
	private static final long serialVersionUID = 2546257975404466712L;
12

  
13
	private String localId;
14
	private String oaOriginalId;
15

  
16
	public String getLocalId() {
17
		return localId;
18
	}
19

  
20
	public void setLocalId(final String localId) {
21
		this.localId = localId;
22
	}
23

  
24
	public String getOaOriginalId() {
25
		return oaOriginalId;
26
	}
27

  
28
	public void setOaOriginalId(final String oaOriginalId) {
29
		this.oaOriginalId = oaOriginalId;
30
	};
31

  
32
	@Override
33
	public int hashCode() {
34
		return Objects.hash(localId, oaOriginalId);
35
	}
36

  
37
	@Override
38
	public boolean equals(final Object obj) {
39
		if (this == obj) { return true; }
40
		if (obj == null) { return false; }
41
		if (!(obj instanceof OpenaireSimRelPK)) { return false; }
42
		final OpenaireSimRelPK other = (OpenaireSimRelPK) obj;
43
		return Objects.equals(localId, other.localId) && Objects.equals(oaOriginalId, other.oaOriginalId);
44
	}
45

  
46
	@Override
47
	public String toString() {
48
		return String.format("OpenaireSimRelPK [localId=%s, oaOriginalId=%s]", localId, oaOriginalId);
49
	}
50

  
51
}
modules/dnet-orgs-database-application/trunk/src/main/java/eu/dnetlib/organizations/model/OpenaireSimRel.java
1
package eu.dnetlib.organizations.model;
2

  
3
import java.io.Serializable;
4

  
5
import javax.persistence.Column;
6
import javax.persistence.Entity;
7
import javax.persistence.Id;
8
import javax.persistence.IdClass;
9
import javax.persistence.Table;
10

  
11
@Entity
12
@Table(name = "openaire_simrels")
13
@IdClass(OpenaireSimRelPK.class)
14
public class OpenaireSimRel implements Serializable {
15

  
16
	/**
17
	 *
18
	 */
19
	private static final long serialVersionUID = -5656204073481770618L;
20

  
21
	@Id
22
	@Column(name = "local_id")
23
	private String localId;
24

  
25
	@Id
26
	@Column(name = "oa_original_id")
27
	private String oaOriginalId;
28

  
29
	@Column(name = "oa_name")
30
	private String oaName;
31

  
32
	@Column(name = "oa_acronym")
33
	private String oaAcronym;
34

  
35
	@Column(name = "oa_country")
36
	private String oaCountry;
37

  
38
	@Column(name = "oa_url")
39
	private String oaUrl;
40

  
41
	@Column(name = "oa_collectedfrom")
42
	private String oaCollectedFrom;
43

  
44
	@Column(name = "reltype")
45
	private String relType;
46

  
47
	public String getLocalId() {
48
		return localId;
49
	}
50

  
51
	public void setLocalId(final String localId) {
52
		this.localId = localId;
53
	}
54

  
55
	public String getOaOriginalId() {
56
		return oaOriginalId;
57
	}
58

  
59
	public void setOaOriginalId(final String oaOriginalId) {
60
		this.oaOriginalId = oaOriginalId;
61
	}
62

  
63
	public String getOaName() {
64
		return oaName;
65
	}
66

  
67
	public void setOaName(final String oaName) {
68
		this.oaName = oaName;
69
	}
70

  
71
	public String getOaAcronym() {
72
		return oaAcronym;
73
	}
74

  
75
	public void setOaAcronym(final String oaAcronym) {
76
		this.oaAcronym = oaAcronym;
77
	}
78

  
79
	public String getOaCountry() {
80
		return oaCountry;
81
	}
82

  
83
	public void setOaCountry(final String oaCountry) {
84
		this.oaCountry = oaCountry;
85
	}
86

  
87
	public String getOaUrl() {
88
		return oaUrl;
89
	}
90

  
91
	public void setOaUrl(final String oaUrl) {
92
		this.oaUrl = oaUrl;
93
	}
94

  
95
	public String getOaCollectedFrom() {
96
		return oaCollectedFrom;
97
	}
98

  
99
	public void setOaCollectedFrom(final String oaCollectedFrom) {
100
		this.oaCollectedFrom = oaCollectedFrom;
101
	}
102

  
103
	public String getRelType() {
104
		return relType;
105
	}
106

  
107
	public void setRelType(final String relType) {
108
		this.relType = relType;
109
	}
110

  
111
}
modules/dnet-orgs-database-application/trunk/src/main/java/eu/dnetlib/organizations/repository/OpenaireConflictRepository.java
1
package eu.dnetlib.organizations.repository;
2

  
3
import java.util.List;
4

  
5
import org.springframework.data.jpa.repository.JpaRepository;
6
import org.springframework.data.jpa.repository.Query;
7
import org.springframework.stereotype.Repository;
8

  
9
import eu.dnetlib.organizations.model.OpenaireConflict;
10
import eu.dnetlib.organizations.model.OpenaireConflictPK;
11
import eu.dnetlib.organizations.model.utils.OrganizationConflict;
12

  
13
@Repository
14
public interface OpenaireConflictRepository extends JpaRepository<OpenaireConflict, OpenaireConflictPK> {
15

  
16
	@Query(value = "select o.id, o.name, o.type, o.city, o.country from oa_conflicts c left outer join organizations o on (c.id2 = o.id) where o.id is not null and c.id1 = ?", nativeQuery = true)
17
	List<OrganizationConflict> getConflictsForId(String id);
18

  
19
}
modules/dnet-orgs-database-application/trunk/src/main/java/eu/dnetlib/organizations/repository/OpenaireDuplicateRepository.java
1
package eu.dnetlib.organizations.repository;
2

  
3
import java.util.List;
4

  
5
import org.springframework.data.jpa.repository.JpaRepository;
6
import org.springframework.stereotype.Repository;
7

  
8
import eu.dnetlib.organizations.model.OpenaireDuplicate;
9
import eu.dnetlib.organizations.model.OpenaireDuplicatePK;
10

  
11
@Repository
12
public interface OpenaireDuplicateRepository extends JpaRepository<OpenaireDuplicate, OpenaireDuplicatePK> {
13

  
14
	List<OpenaireDuplicate> findByLocalId(String localId);
15
}
modules/dnet-orgs-database-application/trunk/src/main/java/eu/dnetlib/organizations/model/OpenaireConflictPK.java
1
package eu.dnetlib.organizations.model;
2

  
3
import java.io.Serializable;
4
import java.util.Objects;
5

  
6
public class OpenaireConflictPK implements Serializable {
7

  
8
	/**
9
	 *
10
	 */
11
	private static final long serialVersionUID = 6752695921988906962L;
12

  
13
	private String id1;
14

  
15
	private String id2;
16

  
17
	public String getId1() {
18
		return id1;
19
	}
20

  
21
	public void setId1(final String id1) {
22
		this.id1 = id1;
23
	}
24

  
25
	public String getId2() {
26
		return id2;
27
	}
28

  
29
	public void setId2(final String id2) {
30
		this.id2 = id2;
31
	}
32

  
33
	@Override
34
	public int hashCode() {
35
		return Objects.hash(id1, id2);
36
	}
37

  
38
	@Override
39
	public boolean equals(final Object obj) {
40
		if (this == obj) { return true; }
41
		if (obj == null) { return false; }
42
		if (!(obj instanceof OpenaireConflictPK)) { return false; }
43
		final OpenaireConflictPK other = (OpenaireConflictPK) obj;
44
		return Objects.equals(id1, other.id1) && Objects.equals(id2, other.id2);
45
	}
46

  
47
	@Override
48
	public String toString() {
49
		return String.format("OpenaireConflictPK [id1=%s, id2=%s]", id1, id2);
50
	}
51

  
52
}
modules/dnet-orgs-database-application/trunk/src/main/java/eu/dnetlib/organizations/model/utils/DedupEvents.java
3 3
import java.util.ArrayList;
4 4
import java.util.List;
5 5

  
6
import eu.dnetlib.organizations.model.OpenaireSimRel;
6
import eu.dnetlib.organizations.model.OpenaireDuplicate;
7 7

  
8 8
public class DedupEvents {
9 9

  
10
	private List<OpenaireSimRel> duplicates = new ArrayList<>();
11
	private List<OpenaireSimRel> conflicts = new ArrayList<>();
10
	private final List<OpenaireDuplicate> duplicates = new ArrayList<>();
11
	private final List<OrganizationConflict> conflicts = new ArrayList<>();
12 12

  
13
	public List<OpenaireSimRel> getDuplicates() {
13
	public List<OpenaireDuplicate> getDuplicates() {
14 14
		return duplicates;
15 15
	}
16 16

  
17
	public void setDuplicates(final List<OpenaireSimRel> duplicates) {
18
		this.duplicates = duplicates;
19
	}
20

  
21
	public List<OpenaireSimRel> getConflicts() {
17
	public List<OrganizationConflict> getConflicts() {
22 18
		return conflicts;
23 19
	}
24 20

  
25
	public void setConflicts(final List<OpenaireSimRel> conflicts) {
26
		this.conflicts = conflicts;
27
	}
28

  
29 21
}
modules/dnet-orgs-database-application/trunk/src/main/java/eu/dnetlib/organizations/model/utils/OrganizationConflict.java
1
package eu.dnetlib.organizations.model.utils;
2

  
3
public interface OrganizationConflict {
4

  
5
	String getId();
6

  
7
	String getName();
8

  
9
	String getType();
10

  
11
	String getCity();
12

  
13
	String getCountry();
14

  
15
}
modules/dnet-orgs-database-application/trunk/src/main/java/eu/dnetlib/organizations/model/OpenaireConflict.java
1
package eu.dnetlib.organizations.model;
2

  
3
import java.io.Serializable;
4

  
5
import javax.persistence.Column;
6
import javax.persistence.Entity;
7
import javax.persistence.Id;
8
import javax.persistence.IdClass;
9
import javax.persistence.Table;
10

  
11
@Entity
12
@Table(name = "oa_conflicts")
13
@IdClass(OpenaireConflictPK.class)
14
public class OpenaireConflict implements Serializable {
15

  
16
	/**
17
	 *
18
	 */
19
	private static final long serialVersionUID = -5143344657695218270L;
20

  
21
	@Id
22
	@Column(name = "id1")
23
	private String id1;
24

  
25
	@Id
26
	@Column(name = "id2")
27
	private String id2;
28

  
29
	@Column(name = "reltype")
30
	private String relType;
31

  
32
	public String getId1() {
33
		return id1;
34
	}
35

  
36
	public void setId1(final String id1) {
37
		this.id1 = id1;
38
	}
39

  
40
	public String getId2() {
41
		return id2;
42
	}
43

  
44
	public void setId2(final String id2) {
45
		this.id2 = id2;
46
	}
47

  
48
	public String getRelType() {
49
		return relType;
50
	}
51

  
52
	public void setRelType(final String relType) {
53
		this.relType = relType;
54
	}
55

  
56
}
modules/dnet-orgs-database-application/trunk/src/main/java/eu/dnetlib/organizations/model/OpenaireDuplicatePK.java
1
package eu.dnetlib.organizations.model;
2

  
3
import java.io.Serializable;
4
import java.util.Objects;
5

  
6
public class OpenaireDuplicatePK implements Serializable {
7

  
8
	/**
9
	 *
10
	 */
11
	private static final long serialVersionUID = 2546257975404466712L;
12

  
13
	private String localId;
14
	private String oaOriginalId;
15

  
16
	public String getLocalId() {
17
		return localId;
18
	}
19

  
20
	public void setLocalId(final String localId) {
21
		this.localId = localId;
22
	}
23

  
24
	public String getOaOriginalId() {
25
		return oaOriginalId;
26
	}
27

  
28
	public void setOaOriginalId(final String oaOriginalId) {
29
		this.oaOriginalId = oaOriginalId;
30
	};
31

  
32
	@Override
33
	public int hashCode() {
34
		return Objects.hash(localId, oaOriginalId);
35
	}
36

  
37
	@Override
38
	public boolean equals(final Object obj) {
39
		if (this == obj) { return true; }
40
		if (obj == null) { return false; }
41
		if (!(obj instanceof OpenaireDuplicatePK)) { return false; }
42
		final OpenaireDuplicatePK other = (OpenaireDuplicatePK) obj;
43
		return Objects.equals(localId, other.localId) && Objects.equals(oaOriginalId, other.oaOriginalId);
44
	}
45

  
46
	@Override
47
	public String toString() {
48
		return String.format("OpenaireDuplicatePK [localId=%s, oaOriginalId=%s]", localId, oaOriginalId);
49
	}
50

  
51
}
modules/dnet-orgs-database-application/trunk/src/main/java/eu/dnetlib/organizations/model/OpenaireDuplicate.java
1
package eu.dnetlib.organizations.model;
2

  
3
import java.io.Serializable;
4

  
5
import javax.persistence.Column;
6
import javax.persistence.Entity;
7
import javax.persistence.Id;
8
import javax.persistence.IdClass;
9
import javax.persistence.Table;
10

  
11
@Entity
12
@Table(name = "oa_duplicates")
13
@IdClass(OpenaireDuplicatePK.class)
14
public class OpenaireDuplicate implements Serializable {
15

  
16
	/**
17
	 *
18
	 */
19
	private static final long serialVersionUID = -5656204073481770618L;
20

  
21
	@Id
22
	@Column(name = "local_id")
23
	private String localId;
24

  
25
	@Id
26
	@Column(name = "oa_original_id")
27
	private String oaOriginalId;
28

  
29
	@Column(name = "oa_name")
30
	private String oaName;
31

  
32
	@Column(name = "oa_acronym")
33
	private String oaAcronym;
34

  
35
	@Column(name = "oa_country")
36
	private String oaCountry;
37

  
38
	@Column(name = "oa_url")
39
	private String oaUrl;
40

  
41
	@Column(name = "oa_collectedfrom")
42
	private String oaCollectedFrom;
43

  
44
	@Column(name = "reltype")
45
	private String relType;
46

  
47
	public String getLocalId() {
48
		return localId;
49
	}
50

  
51
	public void setLocalId(final String localId) {
52
		this.localId = localId;
53
	}
54

  
55
	public String getOaOriginalId() {
56
		return oaOriginalId;
57
	}
58

  
59
	public void setOaOriginalId(final String oaOriginalId) {
60
		this.oaOriginalId = oaOriginalId;
61
	}
62

  
63
	public String getOaName() {
64
		return oaName;
65
	}
66

  
67
	public void setOaName(final String oaName) {
68
		this.oaName = oaName;
69
	}
70

  
71
	public String getOaAcronym() {
72
		return oaAcronym;
73
	}
74

  
75
	public void setOaAcronym(final String oaAcronym) {
76
		this.oaAcronym = oaAcronym;
77
	}
78

  
79
	public String getOaCountry() {
80
		return oaCountry;
81
	}
82

  
83
	public void setOaCountry(final String oaCountry) {
84
		this.oaCountry = oaCountry;
85
	}
86

  
87
	public String getOaUrl() {
88
		return oaUrl;
89
	}
90

  
91
	public void setOaUrl(final String oaUrl) {
92
		this.oaUrl = oaUrl;
93
	}
94

  
95
	public String getOaCollectedFrom() {
96
		return oaCollectedFrom;
97
	}
98

  
99
	public void setOaCollectedFrom(final String oaCollectedFrom) {
100
		this.oaCollectedFrom = oaCollectedFrom;
101
	}
102

  
103
	public String getRelType() {
104
		return relType;
105
	}
106

  
107
	public void setRelType(final String relType) {
108
		this.relType = relType;
109
	}
110

  
111
}
modules/dnet-orgs-database-application/trunk/src/main/java/eu/dnetlib/organizations/controller/OrganizationController.java
23 23
import org.springframework.web.bind.annotation.RequestParam;
24 24
import org.springframework.web.bind.annotation.RestController;
25 25

  
26
import eu.dnetlib.organizations.model.OpenaireSimRel;
26
import eu.dnetlib.organizations.model.OpenaireDuplicate;
27 27
import eu.dnetlib.organizations.model.utils.BrowseEntry;
28 28
import eu.dnetlib.organizations.model.utils.DedupEvents;
29 29
import eu.dnetlib.organizations.model.view.ConflictView;
30 30
import eu.dnetlib.organizations.model.view.OrganizationInfoView;
31 31
import eu.dnetlib.organizations.model.view.OrganizationSimpleView;
32 32
import eu.dnetlib.organizations.model.view.OrganizationView;
33
import eu.dnetlib.organizations.repository.OpenaireSimRelRepository;
33
import eu.dnetlib.organizations.repository.OpenaireConflictRepository;
34
import eu.dnetlib.organizations.repository.OpenaireDuplicateRepository;
34 35
import eu.dnetlib.organizations.repository.OrganizationRepository;
35 36
import eu.dnetlib.organizations.repository.UserCountryRepository;
36 37
import eu.dnetlib.organizations.repository.readonly.ConflictViewRepository;
......
39 40
import eu.dnetlib.organizations.repository.readonly.OrganizationViewRepository;
40 41
import eu.dnetlib.organizations.repository.readonly.SuggestionInfoViewByCountryRepository;
41 42
import eu.dnetlib.organizations.utils.DatabaseUtils;
42
import eu.dnetlib.organizations.utils.OpenOrgsConstants;
43 43

  
44 44
@RestController
45 45
@RequestMapping("/api/organizations")
......
54 54
	@Autowired
55 55
	private OrganizationSimpleViewRepository organizationSimpleViewRepository;
56 56
	@Autowired
57
	private OpenaireSimRelRepository openaireSimRelRepository;
57
	private OpenaireDuplicateRepository openaireDuplicateRepository;
58 58
	@Autowired
59
	private OpenaireConflictRepository openaireConflictRepository;
60
	@Autowired
59 61
	private ConflictViewRepository conflictViewRepository;
60 62
	@Autowired
61 63
	private SuggestionInfoViewByCountryRepository suggestionInfoViewByCountryRepository;
......
117 119
	public DedupEvents dedupEvents(@RequestParam final String id, final Authentication authentication) {
118 120
		if (UserInfo.isSuperAdmin(authentication) || userCountryRepository.verifyAuthorizationForId(id, authentication.getName())) {
119 121
			final DedupEvents res = new DedupEvents();
120

  
121
			for (final OpenaireSimRel r : openaireSimRelRepository.findByLocalId(id)) {
122
				if (r.getOaOriginalId().startsWith(OpenOrgsConstants.OPENORGS_PREFIX)) {
123
					res.getConflicts().add(r);
124
				} else {
125
					res.getDuplicates().add(r);
126
				}
127
			}
122
			res.getDuplicates().addAll(openaireDuplicateRepository.findByLocalId(id));
123
			res.getConflicts().addAll(openaireConflictRepository.getConflictsForId(id));
128 124
			return res;
129 125
		} else {
130 126
			throw new RuntimeException("User not authorized");
......
188 184
	}
189 185

  
190 186
	@RequestMapping(value = "/duplicates", method = RequestMethod.POST)
191
	public List<OpenaireSimRel> duplicates(@RequestBody final List<OpenaireSimRel> simrels, final Authentication authentication) {
187
	public List<OpenaireDuplicate> duplicates(@RequestBody final List<OpenaireDuplicate> simrels, final Authentication authentication) {
192 188

  
193 189
		final boolean b = UserInfo.isSuperAdmin(authentication)
194 190
				|| simrels.stream()
195
						.map(OpenaireSimRel::getLocalId)
191
						.map(OpenaireDuplicate::getLocalId)
196 192
						.distinct()
197 193
						.allMatch(id -> userCountryRepository.verifyAuthorizationForId(id, authentication.getName()));
198 194

  
199 195
		if (b) {
200
			return openaireSimRelRepository.saveAll(simrels);
196
			return openaireDuplicateRepository.saveAll(simrels);
201 197
		} else {
202 198
			throw new RuntimeException("User not authorized");
203 199
		}
modules/dnet-orgs-database-application/trunk/src/main/resources/sql/importNewRels.sql
10 10

  
11 11
COPY tmp_simrels(local_id, oa_original_id, oa_name, oa_acronym, oa_country, oa_url, oa_collectedfrom) FROM '/Users/michele/Develop/dnet45/dnet-orgs-database-application/src/main/resources/tmp_data/rels.part-r-00000.tsv' DELIMITER E'\t';;
12 12

  
13
DELETE FROM openaire_simrels WHERE reltype = 'suggested';
13
DELETE FROM oa_duplicates WHERE reltype = 'suggested';
14
DELETE FROM oa_conflicts  WHERE reltype = 'suggested';
14 15

  
15
INSERT INTO openaire_simrels (local_id, oa_original_id, oa_name, oa_acronym, oa_country, oa_url, oa_collectedfrom)
16
INSERT INTO oa_duplicates (local_id, oa_original_id, oa_name, oa_acronym, oa_country, oa_url, oa_collectedfrom)
16 17
SELECT local_id, oa_original_id, oa_name, oa_acronym, oa_country, oa_url, oa_collectedfrom
17 18
FROM tmp_simrels
19
WHERE oa_original_id NOT LIKE 'openorgs____::%'
18 20
ON CONFLICT DO NOTHING;
19 21

  
22
INSERT INTO oa_conflicts (id1, id2)
23
SELECT local_id, oa_original_id
24
FROM tmp_simrels
25
WHERE oa_original_id LIKE 'openorgs____::%'
26
ON CONFLICT DO NOTHING;
modules/dnet-orgs-database-application/trunk/src/main/resources/sql/schema.sql
10 10
DROP TABLE IF EXISTS acronyms;
11 11
DROP TABLE IF EXISTS relationships;
12 12
DROP TABLE IF EXISTS urls;
13
DROP TABLE IF EXISTS openaire_simrels;
13
DROP TABLE IF EXISTS oa_duplicates;
14
DROP TABLE IF EXISTS oa_conflicts;
14 15
DROP TABLE IF EXISTS organizations;
15 16
DROP TABLE IF EXISTS org_types;
16 17

  
......
121 122
);
122 123
CREATE INDEX urls_id_idx ON urls(id);
123 124

  
124
CREATE TABLE openaire_simrels (
125
CREATE TABLE oa_duplicates (
125 126
	local_id         text REFERENCES organizations(id) ON UPDATE CASCADE,
126 127
	oa_original_id   text NOT NULL,
127 128
	oa_name          text NOT NULL,
......
132 133
	reltype          text NOT NULL DEFAULT 'suggested',
133 134
	PRIMARY KEY (local_id, oa_original_id)
134 135
);
135
CREATE INDEX openaire_simrels_local_id_idx ON openaire_simrels(local_id);
136
CREATE INDEX oa_duplicates_local_id_idx ON oa_duplicates(local_id);
136 137

  
138

  
139
CREATE TABLE oa_conflicts (
140
	id1     text REFERENCES organizations(id) ON UPDATE CASCADE,
141
	id2     text REFERENCES organizations(id) ON UPDATE CASCADE,
142
	reltype text NOT NULL DEFAULT 'suggested',
143
	PRIMARY KEY (id1, id2)
144
);
145
CREATE INDEX oa_conflicts_id1_idx ON oa_conflicts(id1);
146
CREATE INDEX oa_conflicts_id2_idx ON oa_conflicts(id2);
147

  
137 148
CREATE VIEW organizations_view AS SELECT
138 149
    org.id,
139 150
    org.name,
......
171 182
	org.creation_date,
172 183
	org.modified_by,
173 184
	org.modification_date,
174
	count(DISTINCT e.oa_original_id) as n_duplicates,
175
	count(DISTINCT c.oa_original_id) as n_conflicts
185
	count(DISTINCT d.oa_original_id) as n_duplicates,
186
	count(DISTINCT c.id2) as n_conflicts
176 187
FROM organizations org
177
	LEFT OUTER JOIN openaire_simrels e ON (org.id = e.local_id AND e.oa_original_id NOT LIKE 'openorgs____::%' AND e.reltype = 'suggested')
178
	LEFT OUTER JOIN openaire_simrels c ON (org.id = c.local_id AND c.oa_original_id     LIKE 'openorgs____::%' AND c.reltype = 'suggested')
188
	LEFT OUTER JOIN oa_duplicates d ON (org.id = d.local_id AND d.reltype = 'suggested')
189
	LEFT OUTER JOIN oa_conflicts  c ON (org.id = c.id1 AND c.reltype = 'suggested')
179 190
GROUP BY org.id;
180 191
	
181 192
CREATE VIEW organizations_simple_view AS SELECT
......
225 236
	o2.city    AS city_2,
226 237
	o2.country AS country_2
227 238
FROM
228
	openaire_simrels s
229
	LEFT OUTER JOIN organizations o1 ON (s.local_id = o1.id)
230
    LEFT OUTER JOIN organizations o2 ON (s.oa_original_id = o2.id)
239
	oa_conflicts c
240
	LEFT OUTER JOIN organizations o1 ON (c.id1 = o1.id)
241
    LEFT OUTER JOIN organizations o2 ON (c.id2 = o2.id)
231 242
WHERE
232
	s.oa_original_id LIKE 'openorgs____::%' AND o1.id IS NOT NULL AND O2.id IS NOT NULL;
243
	o1.id IS NOT NULL AND O2.id IS NOT NULL;
233 244
	
234 245

  
235 246

  
modules/dnet-orgs-database-application/trunk/src/main/resources/static/resources/html/part/org_form_dedup_events.html
11 11
				<tr class="d-flex">
12 12
					<th class="col-4 pl-3" style="border-top: none;">Related organization</th>
13 13
					<th class="col-1 text-center" style="border-top: none;">Acronym</th>
14
					<th class="col-1 text-center" style="border-top: none;">Country</th>
15
					<th class="col-4" style="border-top: none;">Source</th>
14
					<th class="col-2 text-center" style="border-top: none;">Country</th>
15
					<th class="col-3" style="border-top: none;">Source</th>
16 16
					<th class="col-2" style="border-top: none;"></th>
17 17
				</tr>
18 18
			</thead>
......
23 23
						<span class="small" ng-if="sr.oaUrl" ><br /><b>URL: </b><a href="{{sr.oaUrl}}" target="_blank">{{sr.oaUrl}}</a></span>
24 24
					</td>
25 25
					<td class="col-1 text-center small">{{sr.oaAcronym}}</td>
26
					<td class="col-1 text-center small"><img ng-src="resources/images/flags/{{sr.oaCountry}}.gif" /> {{sr.oaCountry}}</td>
27
					<td class="col-4 small">
26
					<td class="col-2 text-center small"><img ng-src="resources/images/flags/{{sr.oaCountry}}.gif" /> {{sr.oaCountry}}</td>
27
					<td class="col-3 small">
28 28
						<b>Collected from:</b> {{sr.oaCollectedFrom}}<br />
29 29
						<b>Original Id:</b> <span class="text-monospace">{{sr.oaOriginalId}}</span>
30 30
					</td>
......
62 62
				<thead>
63 63
					<tr class="d-flex">
64 64
						<th class="col-4 pl-3" style="border-top: none;">Related organization</th>
65
						<th class="col-1 text-center" style="border-top: none;">Acronym</th>
66
						<th class="col-1 text-center" style="border-top: none;">Country</th>
67
						<th class="col-4" style="border-top: none;">Original ID</th>
65
						<th class="col-1 text-center" style="border-top: none;">Type</th>
66
						<th class="col-2 text-center" style="border-top: none;">Place</th>
67
						<th class="col-3" style="border-top: none;">Original ID</th>
68 68
						<th class="col-2" style="border-top: none;"></th>
69 69
					</tr>
70 70
				</thead>
71 71
				<tbody>
72 72
					<tr class="d-flex" ng-repeat="sr in events.conflicts">
73 73
						<td class="col-4 pl-3">
74
							{{sr.oaName}}
75
							<span class="small" ng-if="sr.oaUrl" ><br /><b>URL: </b><a href="{{sr.oaUrl}}" target="_blank">{{sr.oaUrl}}</a></span>
74
							{{sr.name}}
76 75
						</td>
77
						<td class="col-1 text-center small">{{sr.oaAcronym}}</td>
78
						<td class="col-1 text-center small"><img ng-src="resources/images/flags/{{sr.oaCountry}}.gif" /> {{sr.oaCountry}}</td>
79
						<td class="col-4 small">
80
							<a href="#!/edit/0/{{sr.oaOriginalId}}"><span class="text-monospace">{{sr.oaOriginalId}}</span></a>
76
						<td class="col-1 text-center small">{{sr.type}}</td>
77
						<td class="col-2 text-center small"><img ng-src="resources/images/flags/{{sr.country}}.gif" /> {{sr.city}}, {{sr.country}}</td>
78
						<td class="col-3 small">
79
							<a href="#!/edit/0/{{sr.id}}"><span class="text-monospace">{{sr.id}}</span></a>
81 80
						</td>
82 81
						<td class="col-2 text-right">
83 82
							<div class="btn-group btn-group-toggle btn-group-sm" data-toggle="buttons">

Also available in: Unified diff