1
SELECT cvterm.cvterm_id AS trait_component_id,
2
(((((cvterm.name)::text || '|'::text) || (db.name)::text) || ':'::text) || (dbxref.accession)::text) AS trait_component_name
3
FROM ((((((cv
4
JOIN cvprop ON (((cv.cv_id = cvprop.cv_id) AND (cvprop.type_id IN ( SELECT cvterm_1.cvterm_id
5
FROM cvterm cvterm_1
6
WHERE ((cvterm_1.name)::text = ANY ('{object_ontology,attribute_ontology,method_ontology,unit_ontology,time_ontology}'::text[])))))))
7
JOIN cvterm ON ((cvprop.cv_id = cvterm.cv_id)))
8
JOIN dbxref USING (dbxref_id))
9
JOIN db ON ((dbxref.db_id = db.db_id)))
10
LEFT JOIN cvterm_relationship is_subject ON ((cvterm.cvterm_id = is_subject.subject_id)))
11
LEFT JOIN cvterm_relationship is_object ON ((cvterm.cvterm_id = is_object.object_id)))
12
WHERE ((is_object.object_id IS NULL) AND (is_subject.subject_id IS NOT NULL))
13
GROUP BY (((((cvterm.name)::text || '|'::text) || (db.name)::text) || ':'::text) || (dbxref.accession)::text), cvterm.cvterm_id
14
ORDER BY (((((cvterm.name)::text || '|'::text) || (db.name)::text) || ':'::text) || (dbxref.accession)::text), cvterm.cvterm_id;