Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/Ontology.NET/ExtensionMethods.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace Ontology.NET.OBO


open Ontology.NET


[<AutoOpen>]
module Extensions =

type OboOntology with

/// <summary>
/// Returns the corresponding Ontology from the OboOntology, with the term IDs as node keys, the terms as CvTerms as node data and the relations as edges.
/// </summary>
/// <remarks>If a relation points to a term that is not present in the given OboOntology, initializes them as new CvTerms but with name and ref = "&lt;missing&gt;".</remarks>
member this.ToOntology() =
Ontology.fromOboOntology this

/// <summary>
/// Returns the corresponding Ontology from the given OboOntology, with the term IDs as node keys, the terms as CvTerms as node data and the relations as edges.
/// </summary>
/// <param name="oboOnto">The OboOntology that serves as the basis for the respective Ontology.</param>
/// <remarks>If a relation points to a term that is not present in the given OboOntology, initializes them as new CvTerms but with name and ref = "&lt;missing&gt;".</remarks>
static member toOntology (oboOnto : OboOntology) =
oboOnto.ToOntology()
3 changes: 1 addition & 2 deletions src/Ontology.NET/Ontology.NET.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@
<Compile Include="OBO\OboProvider.fs" />
<Compile Include="OntologyRelation.fs" />
<Compile Include="Ontology.fs" />
<Compile Include="ExtensionMethods.fs" />
</ItemGroup>

<ItemGroup />

<PropertyGroup>
<Authors>Heinrich Lukas Weil, Oliver Maus, F# open source contributors</Authors>
<Description>A library to work with ontologies and ontology-related file formats.</Description>
Expand Down
2 changes: 2 additions & 0 deletions src/Ontology.NET/Ontology.fs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type Ontology() =
/// <summary>
/// Takes a given OboOntology and returns the corresponding Ontology, with the term IDs as node keys, the terms as CvTerms as node data and the relations as edges.
/// </summary>
/// <param name="oboOnto">The OboOntology that serves as the basis for the respective Ontology.</param>
/// <remarks>If a relation points to a term that is not present in the given OboOntology, initializes them as new CvTerms but with name and ref = "&lt;missing&gt;".</remarks>
static member fromOboOntology (oboOnto : OboOntology) =

Expand Down Expand Up @@ -1325,6 +1326,7 @@ type Ontology() =
/// <summary>
/// Returns the given Ontology as a collection of Triplets.
/// </summary>
/// <param name="onto">The Ontology that serves as the informational basis for the Triplet collection.</param>
/// <returns>A collection of Triplets in the form of SourceTerm * Relation * TargetTerm.</returns>
static member toTriplets (onto : Ontology) =
onto.ToTriplets()
Loading