Changeset 552 for trunk/test


Ignore:
Timestamp:
Jun 10, 2010, 1:36:02 AM (14 years ago)
Author:
keesvb
Message:

added BioPortal? Ontology add function via Ontocat, added test for that

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/integration/gscf/OntologyTests.groovy

    r496 r552  
    103103        /**
    104104         * Ontocat test for debug purposes: show all properties of a certain ontology
     105        * Make this method private in order to run it
    105106         */
    106107        private void testOntocatBioPortalDebug() {
     
    111112                uk.ac.ebi.ontocat.Ontology o = os.getOntology("1005")
    112113                StringBuilder sb = new StringBuilder();
     114                // This is of course a very scary way to getting more information on 'o', but it seems to be the only way to reach codingScheme
    113115                def bean = os.getOntologyBean()
    114116                String codingScheme = bean.codingScheme
     
    120122                }
    121123                sb.append "Bean:\t" + bean.dump()
     124                sb.append("Coding scheme: ")
    122125                sb.append(bean.properties['codingScheme'])
    123126                sb.append("\t");
     
    167170
    168171                // Iterate over all ontologies in OLS
    169                 os.getOntologies().each {
    170 
    171                         // Get bean and extract versionedId
    172                         def bean = os.ontologyBean
    173                         def matcher = bean.codingScheme =~ "/(\\d{5})/"
    174                         assert matcher
    175                         assert matcher.size() == 1
    176                         assert matcher[0].size() == 2
    177                         def versionedId = matcher[0][1]
     172                os.getOntologies().each { o ->
    178173
    179174                        // Instantiate ontology
     
    181176                            name: o.label,
    182177                            description: o.description,
    183                             url: bean.properties['homepage'],
     178                            url: o.properties['homepage'],
    184179                            //url: 'http://bioportal.bioontology.org/ontologies/' + versionedId,
    185180                            versionNumber: o.versionNumber,
    186181                            ncboId: o.ontologyAccession,
    187                             ncboVersionedId: versionedId
     182                            ncboVersionedId: o.id
    188183                        );
    189184
     
    194189                        //println ontology.dump()
    195190                }
     191
     192        }
     193
     194        public void testAddBioPortalOntology() {
     195                def ontology = dbnp.data.Ontology.getBioPortalOntology("1005")                 
     196                // Validate and save ontology
     197                if (!ontology.validate()) { ontology.errors.each { println it} }
     198                assert ontology.validate()
     199                assert ontology.save(flush: true)
     200                assert Ontology.findByNcboId(1005).name.equals(ontology.name)
    196201        }
    197202}
Note: See TracChangeset for help on using the changeset viewer.