/// <summary> /// Provides concept and complete ancestry for concepts identified in the set. /// </summary> /// <returns>Identified concepts and ancestry.</returns> /// <param name="ids">Concept Ids.</param> /// <exception cref="ArgumentNullException"/> /// <exception cref="DbException"/> /// <exception cref="LeafRPCException"/> public async Task <IEnumerable <Concept> > GetAncestryAsync(HashSet <Guid> ids) { Ensure.NotNull(ids, nameof(ids)); log.LogInformation("Getting parent concepts. Ids:{Ids}", ids); try { return(await reader.GetWithParentsAsync(ids)); } catch (DbException de) { log.LogError("Failed to get rooted concepts of children ids. ID:{Ids} Error:{Error}", ids, de.Message); de.MapThrow(); throw; } }
public async Task <ActionResult <ConceptParentsDTO> > Parents( [FromQuery] HashSet <Guid> idents, [FromServices] IConceptTreeReader conceptReader) { try { var concepts = await conceptReader.GetWithParentsAsync(idents); var dto = new ConceptParentsDTO { Concepts = concepts.Select(c => new ConceptDTO(c)) }; return(Ok(dto)); } catch (Exception ex) { log.LogError("Could not retrieve parents of Concepts:{Ids}. Error:{Error}", idents, ex.ToString()); return(StatusCode(StatusCodes.Status500InternalServerError)); } }