Changeset 398


Ignore:
Timestamp:
May 10, 2010, 4:29:04 PM (7 years ago)
Author:
keesvb
Message:

added Ontology/Term? and Subject integration tests

Location:
trunk
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/domain/dbnp/data/Ontology.groovy

    r359 r398  
    1919        int ncboId              // BioPortal: ontologyId
    2020        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        }
    2142}
  • trunk/grails-app/domain/dbnp/data/Term.groovy

    r359 r398  
    1818
    1919        String name             // BioPortal: label (preferred name)
    20         Ontology ontology       // Parent ontology
     20        Ontology ontology       // Parent ontology. To enable the unique constraints, we describe the Ontology-Term relation here
    2121        String accession        // BioPortal: conceptId
    2222
    2323        static constraints = {
    24                 accession(unique: 'ontology')
     24                accession(unique: 'ontology')   // Accession should be unique within an ontology
     25                name(unique: 'ontology')        // Preferred name should be unique within an ontology
    2526        }
    2627
Note: See TracChangeset for help on using the changeset viewer.