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
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.


On Aug 31, 2020, at 4:42 PM, Marwa Hussein <marwa.abdelrehem at<mailto:marwa.abdelrehem at>> 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");
From: Michael Dorf <mdorf at<mailto:mdorf at>>
Sent: Monday, August 31, 2020 11:39 PM
To: support at<mailto:support at> <support at<mailto:support at>>
Cc: Marwa Hussein <marwa.abdelrehem at<mailto:marwa.abdelrehem at>>
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.


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

Name: marwa811
Email: marwa.abdelrehem at<mailto:marwa.abdelrehem at>

I am using your API for retrieving data about Bioportal ontologies.
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?

bioontology-support mailing list
bioontology-support at<mailto:bioontology-support at>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the bioontology-support mailing list