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] get tree of a given class via REST interface

Jennifer Leigh Vendetti vendetti at stanford.edu
Mon Mar 14 15:10:46 PDT 2016


Hello Lorenz,

The /ontologies/:ontology/classes/:cls/tree call returns the tree structure for the given :cls object.  In other words, you’ll get a path to the root from the :cls object you designate (as well as sibling classes in the structure).

In your examples below, you used the “Physical object” (ID: http://purl.bioontology.org/ontology/SNOMEDCT/260787004) and “Clinical finding” (ID: http://purl.bioontology.org/ontology/SNOMEDCT/404684003) classes.  Both of these classes are top-level classes in the SNOMEDCT hierarchy.  So, there isn’t any tree structure to return here, other than the sibling classes at the root of the ontology, i.e. for Physical object the structure is:

|-- Body structure
|-- Clinical finding
|-- Environment or geographical location
|-- Event
|-- Observable entity
|-- Organism
|-- Pharmaceutical / biologic product
|-- Physical force
|-- Physical object
|-- etc…

If your example had used a class further down the hierarchy such as “Industrial transport vehicle” (ID: http://purl.bioontology.org/ontology/SNOMEDCT/705447007), e.g.:

http://data.bioontology.org/ontologies/SNOMEDCT/classes/http%3A%2F%2Fpurl.bioontology.org%2Fontology%2FSNOMEDCT%2F705447007/tree<http://data.bioontology.org/ontologies/SNOMEDCT/classes/http://purl.bioontology.org/ontology/SNOMEDCT/705447007/tree>

… the results contain the tree structure for this class, i.e., the path to root and sibling classes:

|-- Physical object
    |-- Floor mat
    |-- Device
    |-- Instrument of aggression
    |-- Vehicle
        |-- Nontraffic vehicle
        |-- Mobile medical facility
        |-- Industrial transport vehicle
        |-- Transport vehicle
        |-- Pedestrian conveyance
    |-- Printed material
    |-- etc…
|-- etc…

Best,
Jennifer



On Mar 11, 2016, at 3:56 AM, Lorenz buehmann <buehmann at informatik.uni-leipzig.de<mailto:buehmann at informatik.uni-leipzig.de>> wrote:

Hello Jennifer,

thank you, that's quite helpful. I will try the inclusion of properties via REST parameters.

But can you clarify the meaning of

/ontologies/:ontology/classes/:cls/tree

For me it seems like it returns the root classes of the ontology, but then I'm wondering why :cls is sued as parameter.


Kind regards,
Lorenz

On 10.03.2016 22:38, Jennifer Leigh Vendetti wrote:
Hello Lorenz,


On Mar 9, 2016, at 2:15 AM, Lorenz B. <<mailto:buehmann at informatik.uni-leipzig.de>buehmann at informatik.uni-leipzig.de<mailto:buehmann at informatik.uni-leipzig.de>> wrote:

Hello,

I'm wondering whether it's possible to get children of a given class via the REST interface.


Yes, you can either get direct children, or all children.


Direct Children

Uses this format:

/ontologies/:ontology/classes/:cls/children

Using your class as an example:

http://data.bioontology.org/ontologies/SNOMEDCT/classes/http%3A%2F%2Fpurl.bioontology.org%2Fontology%2FSNOMEDCT%2F260787004/children<http://data.bioontology.org/ontologies/SNOMEDCT/classes/http://purl.bioontology.org/ontology/SNOMEDCT/260787004/children>


All Children

Uses this format:

/ontologies/:ontology/classes/:cls/descendants

Using your class as an example:

http://data.bioontology.org/ontologies/SNOMEDCT/classes/http%3A%2F%2Fpurl.bioontology.org%2Fontology%2FSNOMEDCT%2F260787004/descendants<http://data.bioontology.org/ontologies/SNOMEDCT/classes/http://purl.bioontology.org/ontology/SNOMEDCT/260787004/descendants>




I know that there is one request

/ontologies/:ontology/classes/:cls/tree

but it looks like it always returns the root classes only, and not the subclasses of the given class. see for example both links below:

"http://data.bioontology.org/ontologies/SNOMEDCT/classes/http%3A%2F%2Fpurl.bioontology.org%2Fontology%2FSNOMEDCT%2F260787004/tree"<http://data.bioontology.org/ontologies/SNOMEDCT/classes/http%3A%2F%2Fpurl.bioontology.org%2Fontology%2FSNOMEDCT%2F260787004/tree>

http://data.bioontology.org/ontologies/SNOMEDCT/classes/http%3A%2F%2Fpurl.bioontology.org%2Fontology%2FSNOMEDCT%2F404684003/tree

For me this looks like a bug because otherwise there would be no need to have this for each class, but only for the ontology itself. Moreover, the
"children" property is always an empty array here.

Indeed I could use as REST request

/ontologies/:ontology/classes/:cls/children

but this does not return information like "hasChildren" which is quite useful when building the class tree, like it's done in the public BioPortal UI.



If you want to get information about whether a class has children, or the child count, you can use the “include” parameter, e.g.:

http://data.bioontology.org/ontologies/SNOMEDCT/classes/http%3A%2F%2Fpurl.bioontology.org%2Fontology%2FSNOMEDCT%2F260787004?include=hasChildren,childrenCount<http://data.bioontology.org/ontologies/SNOMEDCT/classes/http://purl.bioontology.org/ontology/SNOMEDCT/260787004?include=hasChildren,childrenCount>

Hope that helps.

Best,
Jennifer






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/bioontology-support/attachments/20160314/07d24d0b/attachment.html>


More information about the bioontology-support mailing list