-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathall_subject_links.sql
32 lines (31 loc) · 1.16 KB
/
all_subject_links.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
SELECT CONCAT('/subjects/', subject.id) as subject_uri
, subject.title as subject
, subject.created_by
, subject.create_time
, resource.title as title
, CONCAT('/repositories/', resource.repo_id, '/resources/', resource.id) as uri
FROM subject_rlshp sr
JOIN subject on sr.subject_id = subject.id
JOIN resource on sr.resource_id = resource.id
UNION ALL
SELECT CONCAT('/subjects/', subject.id) as subject_uri
, subject.title as subject
, subject.created_by
, subject.create_time
, ao.title as title
, CONCAT('/repositories/', ao.repo_id, '/archival_objects/', ao.id) as uri
FROM subject_rlshp sr
JOIN subject on sr.subject_id = subject.id
JOIN archival_object ao on sr.archival_object_id = ao.id
UNION ALL
SELECT CONCAT('/subjects/', subject.id) as subject_uri
, subject.title as subject
, subject.created_by
, subject.create_time
, accession.title as title
, CONCAT('/repositories/', accession.repo_id, '/accessions/', accession.id) as uri
FROM subject_rlshp sr
JOIN subject on sr.subject_id = subject.id
JOIN accession on sr.accession_id = accession.id
ORDER BY subject
#Do something to get all the terms?? Maybe another API thing? Or can I use the one that I already did?