/** * This class extracts the set of most suitable mediating ontologies for a given set of concept * labels from ontology 1 and ontology 2 * * @param representative_labels_onto1 * @param representative_labels_onto2 */ public MediatingOntologyExtractor(Set<String> representative_labels) { bioportal = new RESTBioPortalAccess(); if (bioportal.isActive()) { // TODO To speed up process // This could be commented since we already ignore those ontologies giving errors or not // contributing to the composed mappings bad_ontologies.add("OPE"); // gives an error // bad_ontologies.add("SNOMEDCT"); //not available bad_ontologies.add("NIFSTD"); // error when downloading it bad_ontologies.add("RADLEX"); // interesting concepts only in individuals // bad_ontologies.add("FMA"); //the download is a zip file and gives an error bad_ontologies.add("SOPHARM"); // error downloading bad_ontologies.add( "EP"); // Basically it only contaisn terms from the Imported FMA, but is is imported from // outside bioPortal (error downloading) bad_ontologies.add("GO-PLUS"); // Error accessing metadata this.representative_labels = representative_labels; extractMediatingOntologies(); // if (Parameters.print_output_always) printMediatingOntologies(); } else { System.out.println("BioPotal is not accessible. No mediating ontology has been extracted."); } }
public OWLOntology downloadBioPortalOntology(String ontoAcronym, int attempts) { return bioportal.downLoadOntology(ontoAcronym, attempts); }
private void extractSuitableOntologiesForLabel(String label) { try { acronyms.clear(); int size_synset; // TODO We do not require exact correspondence? // If no exact we may get many crap and more than one page... time may is affected // dramatically JsonNode jsonConcepts = bioportal.getConcepts4Label(label, true); // If an ontology appears several times for a concept for (JsonNode concept : jsonConcepts) { // TODO Something has change din BioPortal and no synonyms are given for UBERON // if (concept.has(bioportal.SYNONYM)) { String acronym = bioportal.getOntologyAcronym( concept.get(bioportal.LINKS).get(bioportal.ONTOLOGY).asText()); // Consider only one positive hit per label // For example EHDA has 39 positive hits for only one label!! // Also ignore ontologies that produce an error. E.g. have a wrong OWL format if (acronyms.contains(acronym) || bad_ontologies.contains(acronym)) continue; acronyms.add(acronym); size_synset = 0; if (concept.has(bioportal.SYNONYM)) size_synset = concept.get(bioportal.SYNONYM).size(); // System.out.println("\t"+acronym); // Already in list if (candiateMOs.containsKey(acronym)) { candiateMOs.get(acronym).increasePositiveHits(); candiateMOs.get(acronym).increaseNumberOfProvidedSynonyms(size_synset); } else { // We call bioportal about metrics BioPortalOntologyInfo onto_bio = bioportal.getMetricInfo4Onto(acronym); /// if (onto_bio.getClasses()<=MAX_SIZE_ONTOLOGY){ candiateMOs.put(acronym, new CandidateMediatingOntology(onto_bio, size_synset)); // } } // } } } catch (JsonProcessingException e) { // TODO Auto-generated catch block System.out.println( "Error performing the BioPortal call for: " + label + ". Mediating ontology search."); } catch (IOException e) { // TODO Auto-generated catch block System.out.println( "Error performing the BioPortal call for: " + label + ". Mediating ontology search."); } }