Skip to content

Commit

Permalink
Merge pull request #434 from EBISPOT/issue-428
Browse files Browse the repository at this point in the history
issue-428: handle reified deprecation reason
  • Loading branch information
serjoshua authored Jul 24, 2023
2 parents 709974a + 8b24435 commit bb74b49
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 22 deletions.
14 changes: 6 additions & 8 deletions frontend/src/model/Entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@ export default abstract class Entity extends Thing {
return this.properties["http://www.ebi.ac.uk/efo/obsoleted_in_version"];
}

getDeprecationReason(): string {
return asArray(
getDeprecationReason(): Reified<any>[] {
return Reified.fromJson<any>(
this.properties["http://purl.obolibrary.org/obo/IAO_0000231"]
)
.concat(
asArray(
this.properties["http://www.ebi.ac.uk/efo/reason_for_obsolescence"]
)
).concat(
Reified.fromJson<any>(
this.properties["http://www.ebi.ac.uk/efo/reason_for_obsolescence"]
)
.join(", ");
);
}

getDeprecationReplacement(): string {
Expand Down
45 changes: 31 additions & 14 deletions frontend/src/pages/ontologies/entities/EntityPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import LanguagePicker from "../../../components/LanguagePicker";
import LoadingOverlay from "../../../components/LoadingOverlay";
import SearchBox from "../../../components/SearchBox";
import LinkedEntities from "../../../model/LinkedEntities";
import Reified from "../../../model/Reified";
import {
getClassInstances,
getEntityWithType,
Expand All @@ -36,6 +37,7 @@ import IndividualDifferentFromSection from "./entityPageSections/IndividualDiffe
import IndividualPropertyAssertionsSection from "./entityPageSections/IndividualPropertyAssertionsSection";
import IndividualSameAsSection from "./entityPageSections/IndividualSameAsSection";
import IndividualTypesSection from "./entityPageSections/IndividualTypesSection";
import MetadataTooltip from "./entityPageSections/MetadataTooltip";
import PropertyChainSection from "./entityPageSections/PropertyChainSection";
import PropertyCharacteristicsSection from "./entityPageSections/PropertyCharacteristicsSection";
import PropertyInverseOfSection from "./entityPageSections/PropertyInverseOfSection";
Expand Down Expand Up @@ -246,20 +248,35 @@ export default function EntityPage({
</i>
</div>
)}
{entity.getDeprecationReason() && (
<div>
Reason:&thinsp;
<i>
{addLinksToText(
entity.getDeprecationReason(),
linkedEntities,
ontologyId,
entity,
entityType
)}
</i>
</div>
)}
{entity.getDeprecationReason() &&
entity.getDeprecationReason().length > 0 && (
<div>
Reason:&thinsp;
<i>
{entity
.getDeprecationReason()
.map((reason: Reified<any>) => {
return (
<span key={reason.value.toString()}>
{addLinksToText(
reason.value,
linkedEntities,
ontologyId,
entity,
entityType
)}
{reason.hasMetadata() ? (
<MetadataTooltip
metadata={reason.getMetadata()}
linkedEntities={linkedEntities}
/>
) : null}
</span>
);
})}
</i>
</div>
)}
</Banner>
)}
<div className="bg-gradient-to-r to-white rounded-lg p-8 mb-4 text-neutral-black from-neutral-light">
Expand Down

0 comments on commit bb74b49

Please sign in to comment.