authority.tracing_links (view)
|
This is a database view, not a base table. It has no triggers, indexes, or FK constraints of its own. Querying this view may be more efficient than joining the underlying tables directly. |
Columns
| Column | Type | Nullable | Notes |
|---|---|---|---|
record |
|
Yes |
|
main_id |
|
Yes |
|
main_tag |
|
Yes |
|
main_value |
|
Yes |
|
relationship |
|
Yes |
|
use_restriction |
|
Yes |
|
deprecation |
|
Yes |
|
display_restriction |
|
Yes |
|
link_id |
|
Yes |
|
link_tag |
|
Yes |
|
link_value |
|
Yes |
|
normalized_main_value |
|
Yes |
View Definition
SELECT main.record,
main.id AS main_id,
main.tag AS main_tag,
oils_xpath_string(('//*[@tag="'::text || main.tag::text) || '"]/*[local-name()="subfield"]'::text, are.marc) AS main_value,
substr(link.value, 1, 1) AS relationship,
substr(link.value, 2, 1) AS use_restriction,
substr(link.value, 3, 1) AS deprecation,
substr(link.value, 4, 1) AS display_restriction,
link.id AS link_id,
link.tag AS link_tag,
oils_xpath_string(('//*[@tag="'::text || link.tag::text) || '"]/*[local-name()="subfield"]'::text, are.marc) AS link_value,
are.heading AS normalized_main_value
FROM authority.full_rec main
JOIN authority.record_entry are ON main.record = are.id
JOIN authority.control_set_authority_field main_entry ON main_entry.tag = main.tag AND main_entry.main_entry IS NULL AND main.subfield = 'a'::text
JOIN authority.control_set_authority_field sub_entry ON main_entry.id = sub_entry.main_entry
JOIN authority.full_rec link ON link.record = main.record AND link.tag = sub_entry.tag AND link.subfield = 'w'::text;