Changeset 350 for trunk/grails-app/domain
- Timestamp:
- Apr 19, 2010, 3:45:35 PM (13 years ago)
- Location:
- trunk/grails-app/domain/dbnp/data
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/domain/dbnp/data/Ontology.groovy
r299 r350 4 4 * This class describes an existing ontology, of which terms can be stored (actually 'cached' would be a better description) 5 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 6 8 * 7 9 * Revision information: … … 11 13 */ 12 14 class Ontology implements Serializable { 13 String name 14 String shortName 15 String url 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 16 21 } -
trunk/grails-app/domain/dbnp/data/Term.groovy
r306 r350 7 7 * The Term object should point to an existing term in an online ontology, therefore instances of this class can also 8 8 * 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 9 10 * 10 11 * Revision information: … … 15 16 class Term implements Serializable { 16 17 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 20 22 21 23 static constraints = { 24 accession(unique: 'ontology') 22 25 } 23 26 … … 26 29 } 27 30 28 29 /*30 * Very scary behaviour... commenting this code out. Refactor31 * your code that relies on this by using something like32 * Term.findByName( string ) instead...33 *34 * Jeroen 2010032335 *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=string45 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 term52 }53 54 *55 */56 31 }
Note: See TracChangeset
for help on using the changeset viewer.