Ignore:
Timestamp:
Apr 19, 2010, 3:45:35 PM (9 years ago)
Author:
keesvb
Message:

added ontology/term properties, getting code to work from clean build: removed Protocol and EventDescription? controllers, cleaned up Protocol code from ImporterService?, commented out EventDescription? code in WizardController?

File:
1 edited

Legend:

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

    r306 r350  
    77 * The Term object should point to an existing term in an online ontology, therefore instances of this class can also
    88 * be seen as a cache of elements of the external ontology.
     9 * BioPortal example: Mus musculus: http://rest.bioontology.org/bioportal/concepts/38802/NCBITaxon:10090
    910 *
    1011 * Revision information:
     
    1516class Term implements Serializable {
    1617        static searchable = true
    17         String name
    18         Ontology ontology
    19         String accession
     18
     19        String name             // BioPortal: label (preferred name)
     20        Ontology ontology       // Parent ontology
     21        String accession        // BioPortal: fullId
    2022
    2123        static constraints = {
     24                accession(unique: 'ontology')
    2225        }
    2326
     
    2629        }
    2730
    28 
    29         /*
    30          * Very scary behaviour... commenting this code out. Refactor
    31          * your code that relies on this by using something like
    32          * Term.findByName( string ) instead...
    33          *
    34          * Jeroen 20100323
    35          *
    36 
    37         // Covenenice method for delivering Terms.
    38         // if the term is already defined, use it.
    39         // otherwise, create it and return it.
    40         // should be removed when ontologies work.
    41         static getTerm( string ) {
    42             def term = Term.find("from Term as t where t.name = '${string}'")
    43             if( term==null ) { term = new Term()
    44                     term.name=string
    45                     term.ontology = Ontology.find('from Ontology as o')
    46                     term.accession = ''
    47                     if( !term.save(flush:true) )  {
    48                             term.errors.each{ println it }
    49                     }
    50             }
    51             return term
    52         }
    53 
    54          *
    55          */
    5631}
Note: See TracChangeset for help on using the changeset viewer.