source: trunk/grails-app/domain/dbnp/data/Ontology.groovy @ 398

Last change on this file since 398 was 398, checked in by keesvb, 9 years ago

added Ontology/Term? and Subject integration tests

  • Property svn:keywords set to Date Author Rev
File size: 1.1 KB
Line 
1package dbnp.data
2
3/**
4 * This class describes an existing ontology, of which terms can be stored (actually 'cached' would be a better description)
5 * in the (global) Term store.
6 * This information is mapped from the BioPortal NCBO REST service, e.g.: http://rest.bioontology.org/bioportal/ontologies/38802
7 * @see http://www.bioontology.org/wiki/index.php/NCBO_REST_services
8 *
9 * Revision information:
10 * $Rev: 398 $
11 * $Author: keesvb $
12 * $Date: 2010-05-10 14:29:04 +0000 (ma, 10 mei 2010) $
13 */
14class Ontology implements Serializable {
15        String name             // BioPortal: displayLabel
16        String description      // BioPortal: description
17        String url              // BioPortal: homepage
18        String versionNumber    // BioPortal: versionNumber
19        int ncboId              // BioPortal: ontologyId
20        int ncboVersionedId     // BioPortal: id
21
22        /**
23         * Find child terms
24         * @return A set containing all terms that reside under this ontology
25         */
26        Set<Term> giveTerms() {
27                Term.findAllByOntology(this)
28        }
29
30        Object giveTermByName(String name) {
31                giveTerms().find {
32                        it.name == name
33                }
34
35                /* TODO: find out why the following doesn't work (probably more efficient):
36                Term.find {
37                        it.name == name
38                        it.ontology == this
39                }
40                }*/
41        }
42}
Note: See TracBrowser for help on using the repository browser.