Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[bioontology-support] [BioPortal] Feedback from marwa811

Michael Dorf mdorf at stanford.edu
Mon Aug 31 22:09:06 PDT 2020


Thank you for sharing this, Marwa, that’s a very useful code snippet!  I'm CCing this to the support list in case someone on it searches for a solution to a similar issue.

Michael


On Aug 31, 2020, at 4:42 PM, Marwa Hussein <marwa.abdelrehem at fci.au.edu.eg<mailto:marwa.abdelrehem at fci.au.edu.eg>> wrote:

Thanks Micheal your reply was very useful to me I managed to get the categories with just very simple lines of code
    JsonNode categories = jsonToNode(get(ontology.get("links").get("categories").asText()));
        ArrayList<String> categoryList = new ArrayList<String>();
          for (JsonNode category : categories) {
         if (!category.get("acronym").isNull()) {
         categoryList.add(category.get("acronym").asText() +"\n");
         }
          }
Regards,
Marwa
________________________________
From: Michael Dorf <mdorf at stanford.edu<mailto:mdorf at stanford.edu>>
Sent: Monday, August 31, 2020 11:39 PM
To: support at bioontology.org<mailto:support at bioontology.org> <support at bioontology.org<mailto:support at bioontology.org>>
Cc: Marwa Hussein <marwa.abdelrehem at fci.au.edu.eg<mailto:marwa.abdelrehem at fci.au.edu.eg>>
Subject: Re: [bioontology-support] [BioPortal] Feedback from marwa811

Hi Marwa,

Thank you for contacting us. I don’t have a working Java environment setup to test my recommendation (we are a Ruby/Rails shop), but since you are already have a working code that retrieves the ontologies, you only need to add a parameter “display=…” for the REST service to bring in the list of categories (domains) for each ontology. Your code should look like this:


// Follow the ontologies link by looking for the media type in the list of links
String link = resources.get("links").findValue("ontologies").asText();
link += "?display=acronym,name,summaryOnly,flat,ontologyType,hasDomain";

Then, as you iterate over the ontologies, you should be able to do something like this:


for (JsonNode ontology : ontologies) {
    ontNames.add(ontology.get("name").asText() + "\n" + ontology.get("@id").asText() + "\n\n");
    ArrayList<String> categories = (new ObjectMapper()).convertValue(ontology.get("hasDomain"), ArrayList.class);

I don’t know if this exact code works as written, but you should be able to tweak it to a working version.

Hope this helps.

Michael



On Aug 30, 2020, at 5:23 PM, support at bioontology.org<mailto:support at bioontology.org> wrote:

Name: marwa811
Email: marwa.abdelrehem at fci.au.edu.eg<mailto:marwa.abdelrehem at fci.au.edu.eg>
Location: https%3A%2F%2Fbioportal.bioontology.org<http://2fbioportal.bioontology.org/>%2Fhelp

Feedback:
Hi,
I am using your API for retrieving data about Bioportal ontologies. https://github.com/ncbo/ncbo_rest_sample_code/blob/master/java/src/ListOntologies.java
This example is efficient and simple and outputs a list of the ontologies' names and ids. I also need to output the categories (Domains) for each ontology. Could you guide me (with code snippet) on how to make this?
Regards,
Marwa

_______________________________________________
bioontology-support mailing list
bioontology-support at lists.stanford.edu<mailto:bioontology-support at lists.stanford.edu>
https://mailman.stanford.edu/mailman/listinfo/bioontology-support

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/bioontology-support/attachments/20200901/6dcb6778/attachment-0001.html>


More information about the bioontology-support mailing list