modification of the queries for openorgs: they now consider also pending orgs

This commit is contained in:
miconis 2021-04-20 12:06:56 +02:00
parent e06c7f32f6
commit cadd0a5de8
2 changed files with 13 additions and 8 deletions

View File

@ -35,7 +35,7 @@ FROM organizations o
LEFT OUTER JOIN organizations od ON (d.oa_original_id = od.id) LEFT OUTER JOIN organizations od ON (d.oa_original_id = od.id)
LEFT OUTER JOIN other_ids idup ON (od.id = idup.id) LEFT OUTER JOIN other_ids idup ON (od.id = idup.id)
WHERE WHERE
o.status = 'approved' o.status = 'approved' OR o.status = 'suggested'
GROUP BY GROUP BY
o.id, o.id,
o.name, o.name,

View File

@ -1,7 +1,7 @@
-- relations approved by the user -- relations approved by the user
SELECT SELECT
local_id AS id1, d.local_id AS id1,
oa_original_id AS id2, d.oa_original_id AS id2,
'openaire____::openorgs' AS collectedfromid, 'openaire____::openorgs' AS collectedfromid,
'OpenOrgs Database' AS collectedfromname, 'OpenOrgs Database' AS collectedfromname,
false AS inferred, false AS inferred,
@ -9,7 +9,9 @@ SELECT
0.99 AS trust, 0.99 AS trust,
'' AS inferenceprovenance, '' AS inferenceprovenance,
'isSimilarTo' AS relclass 'isSimilarTo' AS relclass
FROM oa_duplicates WHERE reltype = 'is_similar' FROM oa_duplicates d
LEFT OUTER JOIN organizations o ON (d.local_id=o.id)
WHERE d.reltype = 'is_similar' AND o.status = 'approved'
UNION ALL UNION ALL
@ -26,13 +28,14 @@ SELECT
'isSimilarTo' AS relclass 'isSimilarTo' AS relclass
FROM other_names n FROM other_names n
LEFT OUTER JOIN organizations o ON (n.id = o.id) LEFT OUTER JOIN organizations o ON (n.id = o.id)
WHERE o.status = 'approved'
UNION ALL UNION ALL
-- diff relations approved by the user -- diff relations approved by the user
SELECT SELECT
local_id AS id1, d.local_id AS id1,
oa_original_id AS id2, d.oa_original_id AS id2,
'openaire____::openorgs' AS collectedfromid, 'openaire____::openorgs' AS collectedfromid,
'OpenOrgs Database' AS collectedfromname, 'OpenOrgs Database' AS collectedfromname,
false AS inferred, false AS inferred,
@ -40,4 +43,6 @@ SELECT
0.99 AS trust, 0.99 AS trust,
'' AS inferenceprovenance, '' AS inferenceprovenance,
'isDifferentFrom' AS relclass 'isDifferentFrom' AS relclass
FROM oa_duplicates WHERE reltype = 'is_different'; FROM oa_duplicates d
LEFT OUTER JOIN organizations o ON (d.local_id=o.id)
WHERE d.reltype = 'is_different' AND o.status = 'approved';