sascha@1015: sascha@1015: sascha@1015: sascha@1018: sascha@1018: User specific part sascha@1018: ------------------ sascha@1018: sascha@1018: sascha@1021: sascha@1021: sascha@1021: SELECT id as user_id FROM users WHERE gid = CAST(${user-id} AS uuid) sascha@1021: sascha@1021: sascha@1021: SELECT id AS collection_id FROM collections WHERE user_id = ${user_id} sascha@1021: sascha@1021: sascha@1021: SELECT a.id AS a_id, a.state AS a_state, a.gid as a_gid FROM sascha@1021: collection_items ci JOIN artifacts a ON ci.artifact_id = a.id sascha@1021: WHERE collection_id = ${collection_id} AND a.state = ${current-state-id} AND a.gid <> CAST(${artifact-id} AS uuid) sascha@1021: AND EXISTS (SELECT id FROM artifact_data WHERE artifact_id = a.id AND k = 'river' AND v = ${river}) sascha@1021: sascha@1021: --- TODO: We only need the 'master' artifacts! --- sascha@1021: sascha@1021: sascha@1021: sascha@1021: sascha@1021: SELECT id AS out_id FROM outs WHERE artifact_id = ${a_id} AND name = 'longitudinal_section' sascha@1021: sascha@1021: sascha@1021: SELECT name AS facet_name, num as facet_num, description AS facet_description sascha@1021: FROM facets WHERE out_id = ${out_id} ORDER BY num ASC, name DESC sascha@1021: sascha@1021: sascha@1021: sascha@1021: sascha@1021: sascha@1021: sascha@1021: sascha@1021: sascha@1021: sascha@1021: sascha@1021: sascha@1021: sascha@1021: sascha@1021: sascha@1021: sascha@1021: sascha@1021: sascha@1021: sascha@1021: sascha@1021: sascha@1021: sascha@1018: sascha@1015: sascha@1015: