Changeset 350


Ignore:
Timestamp:
Apr 19, 2010, 3:45:35 PM (14 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?

Location:
trunk/grails-app
Files:
5 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/studycapturing/WizardController.groovy

    r349 r350  
    241241                                //params.classification = Term.findByName(params.classification)
    242242
     243                                /* TODO: rewrite to Event template
     244
    243245                                // fetch protocol by name (as posted by the form)
    244246                                params.protocol = Protocol.findByName(params.protocol)
     
    246248                                // transform checkbox form value to boolean
    247249                                params.isSamplingEvent = (params.containsKey('isSamplingEvent'))
     250
    248251
    249252                                // instantiate EventDescription with parameters
     
    262265                                        error()
    263266                                }
     267
     268                                */
    264269                        }.to "eventDescriptions"
    265270                        on("delete") {
    266271                                def delete = params.get('do') as int;
    267272
     273                                /* TODO: rewrite to Event template
     274                               
    268275                                // handle form data
    269276                                if (!this.handleEventDescriptions(flow, flash, params)) {
     
    285292                                        flow.eventDescriptions.remove(delete)
    286293                                }
     294
     295                                */
    287296                        }.to "eventDescriptions"
    288297                        on("previous") {
  • trunk/grails-app/domain/dbnp/data/Ontology.groovy

    r299 r350  
    44 * This class describes an existing ontology, of which terms can be stored (actually 'cached' would be a better description)
    55 * 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
    68 *
    79 * Revision information:
     
    1113 */
    1214class 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
    1621}
  • 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}
  • trunk/grails-app/services/dbnp/importer/ImporterService.groovy

    r334 r350  
    1919import org.apache.poi.poifs.filesystem.POIFSFileSystem
    2020import org.apache.poi.ss.usermodel.DataFormatter
    21 import org.apache.poi.hssf.usermodel.HSSFDateUtil
     21
    2222import dbnp.studycapturing.TemplateFieldType
    2323import dbnp.studycapturing.Template
     
    2525import dbnp.studycapturing.Subject
    2626import dbnp.studycapturing.Event
    27 import dbnp.studycapturing.Protocol
     27
    2828import dbnp.studycapturing.Sample
    2929
    30 import dbnp.data.Ontology
    3130import dbnp.data.Term
    3231
     
    223222                                    persistEntity(entity)
    224223                                    break
    225                     case Protocol:  print "Persisting Protocol `" + entity.name + "`: "
    226                                     persistEntity(entity)
    227                                     break
    228224                    case Sample  :  print "Persisting Sample `" + entity.name +"`: "
    229225                                    persistEntity(entity)
     
    264260        def subject = new Subject(name:"New subject", species:Term.findByName("Homo sapiens"), template:template)
    265261        def event = new Event(eventdescription:"New event", template:template)
    266         def protocol = new Protocol(name:"New protocol", template:template)
    267262        def sample = new Sample(name:"New sample", template:template)
    268263
     
    283278                                    if (mc.identifier) { event.eventdescription = value; break }
    284279                                    event.setFieldValue(mc.property.name, value)
    285                                     break
    286                 case Protocol   :   (record.any {it.getClass()==mc.entity}) ? 0 : record.add(protocol)
    287                                     if (mc.identifier) { protocol.name = value; break }
    288                                     protocol.setFieldValue(mc.property.name, value)
    289280                                    break
    290281                case Sample     :   (record.any {it.getClass()==mc.entity}) ? record.add(sample) : 0
Note: See TracChangeset for help on using the changeset viewer.