<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Hello Lorenz,
<div class=""><br class="">
</div>
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On Mar 9, 2016, at 2:15 AM, Lorenz B. <<a href="mailto:buehmann@informatik.uni-leipzig.de" class="">buehmann@informatik.uni-leipzig.de</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div smarttemplateinserted="true" bgcolor="#FFFFFF" text="#000000" class="">
<div id="smartTemplate4-template" class="">Hello,<br class="">
<br class="">
I'm wondering whether it's possible to get children of a given class via the REST interface.
</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div><br class="">
</div>
<div>Yes, you can either get direct children, or all children.</div>
<div><br class="">
</div>
<div><br class="">
</div>
<div><b class="">Direct Children</b></div>
<div><br class="">
</div>
<div>Uses this format:</div>
<div><br class="">
</div>
<div>/ontologies/:ontology/classes/:cls/children</div>
<div><br class="">
</div>
<div>Using your class as an example:</div>
<div><br class="">
</div>
<div><a href="http://data.bioontology.org/ontologies/SNOMEDCT/classes/http://purl.bioontology.org/ontology/SNOMEDCT/260787004/children" class="">http://data.bioontology.org/ontologies/SNOMEDCT/classes/http%3A%2F%2Fpurl.bioontology.org%2Fontology%2FSNOMEDCT%2F260787004/children</a></div>
<div><br class="">
</div>
<div><b class=""><br class="">
</b></div>
<div><b class="">All Children</b></div>
<div><br class="">
</div>
<div>Uses this format:</div>
<div><br class="">
</div>
<div>/ontologies/:ontology/classes/:cls/descendants</div>
<div><br class="">
</div>
<div>Using your class as an example:</div>
<div><br class="">
</div>
<div><a href="http://data.bioontology.org/ontologies/SNOMEDCT/classes/http://purl.bioontology.org/ontology/SNOMEDCT/260787004/descendants" class="">http://data.bioontology.org/ontologies/SNOMEDCT/classes/http%3A%2F%2Fpurl.bioontology.org%2Fontology%2FSNOMEDCT%2F260787004/descendants</a></div>
<div><br class="">
</div>
<div><br class="">
</div>
<div><br class="">
</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div smarttemplateinserted="true" bgcolor="#FFFFFF" text="#000000" class="">
<div id="smartTemplate4-template" class="">I know that there is one request<br class="">
<br class="">
/ontologies/:ontology/classes/:cls/tree<br class="">
<br class="">
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:<br class="">
<br class="">
<a href="http://data.bioontology.org/ontologies/SNOMEDCT/classes/http%3A%2F%2Fpurl.bioontology.org%2Fontology%2FSNOMEDCT%2F260787004/tree" style="font-family: monospace; font-size: 14.3px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">"http://data.bioontology.org/ontologies/SNOMEDCT/classes/http%3A%2F%2Fpurl.bioontology.org%2Fontology%2FSNOMEDCT%2F260787004/tree"</a><br class="">
<br class="">
<a class="moz-txt-link-freetext" href="http://data.bioontology.org/ontologies/SNOMEDCT/classes/http%3A%2F%2Fpurl.bioontology.org%2Fontology%2FSNOMEDCT%2F404684003/tree">http://data.bioontology.org/ontologies/SNOMEDCT/classes/http%3A%2F%2Fpurl.bioontology.org%2Fontology%2FSNOMEDCT%2F404684003/tree</a><br class="">
<br class="">
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
<br class="">
"children" property is always an empty array here.<br class="">
<br class="">
Indeed I could use as REST request <br class="">
<br class="">
/ontologies/:ontology/classes/:cls/children<br class="">
<br class="">
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.<br class="">
</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div><br class="">
</div>
<div><br class="">
</div>
<div>If you want to get information about whether a class has children, or the child count, you can use the “include” parameter, e.g.:</div>
<div><br class="">
</div>
<div><a href="http://data.bioontology.org/ontologies/SNOMEDCT/classes/http://purl.bioontology.org/ontology/SNOMEDCT/260787004?include=hasChildren,childrenCount" class="">http://data.bioontology.org/ontologies/SNOMEDCT/classes/http%3A%2F%2Fpurl.bioontology.org%2Fontology%2FSNOMEDCT%2F260787004?include=hasChildren,childrenCount</a></div>
<div><br class="">
</div>
<div>Hope that helps.</div>
<div><br class="">
</div>
<div>Best,</div>
<div>Jennifer</div>
<div><br class="">
</div>
<div><br class="">
</div>
<div><br class="">
</div>
<div><br class="">
</div>
</div>
</div>
</body>
</html>