Permalink
Please sign in to comment.
Showing
with
944 additions
and 0 deletions.
- +289 −0 .gitignore
- +22 −0 csharp/ncbo.sln
- +64 −0 csharp/ncbo/AnnotateText.cs
- +35 −0 csharp/ncbo/ClassesSearch.cs
- +11 −0 csharp/ncbo/Common/Constants.cs
- +32 −0 csharp/ncbo/Common/Network.cs
- +15 −0 csharp/ncbo/DataTypes/AnnotatedClass.cs
- +19 −0 csharp/ncbo/DataTypes/Annotation.cs
- +27 −0 csharp/ncbo/DataTypes/AnnotationCollection.cs
- +30 −0 csharp/ncbo/DataTypes/AnnotationLinks.cs
- +19 −0 csharp/ncbo/DataTypes/AnnotationResult.cs
- +25 −0 csharp/ncbo/DataTypes/Ontology.cs
- +45 −0 csharp/ncbo/DataTypes/OntologyLink.cs
- +25 −0 csharp/ncbo/DataTypes/Page.cs
- +27 −0 csharp/ncbo/DataTypes/PageCollection.cs
- +15 −0 csharp/ncbo/DataTypes/PageLink.cs
- +39 −0 csharp/ncbo/DataTypes/ResourceContext.cs
- +59 −0 csharp/ncbo/DataTypes/ResourceLinks.cs
- +13 −0 csharp/ncbo/DataTypes/Resources.cs
- +49 −0 csharp/ncbo/GetLabels.cs
- +27 −0 csharp/ncbo/ListOntologies.cs
- +33 −0 csharp/ncbo/Program.cs
- +6 −0 csharp/ncbo/classes_search_terms.txt
- +18 −0 csharp/ncbo/ncbo.csproj
289
.gitignore
| @@ -0,0 +1,22 @@ | ||
| + | ||
| +Microsoft Visual Studio Solution File, Format Version 12.00 | ||
| +# Visual Studio 15 | ||
| +VisualStudioVersion = 15.0.26403.3 | ||
| +MinimumVisualStudioVersion = 10.0.40219.1 | ||
| +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ncbo", "ncbo\ncbo.csproj", "{AC37CC07-66F9-4F08-A5A4-B65316598005}" | ||
| +EndProject | ||
| +Global | ||
| + GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
| + Debug|Any CPU = Debug|Any CPU | ||
| + Release|Any CPU = Release|Any CPU | ||
| + EndGlobalSection | ||
| + GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
| + {AC37CC07-66F9-4F08-A5A4-B65316598005}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| + {AC37CC07-66F9-4F08-A5A4-B65316598005}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| + {AC37CC07-66F9-4F08-A5A4-B65316598005}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| + {AC37CC07-66F9-4F08-A5A4-B65316598005}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| + EndGlobalSection | ||
| + GlobalSection(SolutionProperties) = preSolution | ||
| + HideSolutionNode = FALSE | ||
| + EndGlobalSection | ||
| +EndGlobal |
| @@ -0,0 +1,64 @@ | ||
| +using ncbo.Common; | ||
| +using System; | ||
| +using System.Collections.Generic; | ||
| +using System.Text; | ||
| +using ncbo.DataTypes; | ||
| + | ||
| +namespace ncbo | ||
| +{ | ||
| + public static class AnnotateText | ||
| + { | ||
| + private static void PrintAnnotations(AnnotationResult[] annotationResults) | ||
| + { | ||
| + foreach(AnnotationResult annotationResult in annotationResults) | ||
| + { | ||
| + AnnotationPage annotationPage = | ||
| + Network.GetResponseAs<AnnotationPage>(annotationResult.AnnotatedClass.Link.Self); | ||
| + | ||
| + Console.WriteLine("Class details"); | ||
| + Console.WriteLine("\tID: " + annotationPage.ID); | ||
| + Console.WriteLine("\tPrefLabel: " + annotationPage.PrefLabel); | ||
| + Console.WriteLine("\tOntology: " + annotationPage.Links?.Ontology); | ||
| + | ||
| + Console.WriteLine("Annotation details"); | ||
| + foreach(Annotation annotation in annotationResult.Annotations) | ||
| + { | ||
| + Console.WriteLine("\tFrom: " + annotation.From); | ||
| + Console.WriteLine("\tTo: " + annotation.To); | ||
| + Console.WriteLine("\tMatch type: " + annotation.MatchType); | ||
| + } | ||
| + | ||
| + if(annotationResult.Hierarchy!=null && annotationResult.Hierarchy.Count > 0) | ||
| + { | ||
| + Console.WriteLine("Hierachy Annotations"); | ||
| + foreach (AnnotatedClass annotatedClass in annotationResult.Hierarchy) | ||
| + { | ||
| + AnnotationPage annotationHierarchyPage = | ||
| + Network.GetResponseAs<AnnotationPage>(annotationResult.AnnotatedClass.Link.Self); | ||
| + | ||
| + Console.WriteLine("\tClass details"); | ||
| + Console.WriteLine("\t\tID: " + annotationHierarchyPage.ID); | ||
| + Console.WriteLine("\t\tPrefLabel: " + annotationHierarchyPage.PrefLabel); | ||
| + Console.WriteLine("\t\tOntology: " + annotationHierarchyPage.Links.Ontology); | ||
| + Console.WriteLine("\t\tDistance from originally annotated class: : " + annotatedClass.Distance); | ||
| + } | ||
| + } | ||
| + | ||
| + Console.WriteLine("===="); | ||
| + } | ||
| + } | ||
| + | ||
| + public static void DoIt() | ||
| + { | ||
| + string textToAnnotate = | ||
| + "Melanoma is a malignant tumor of melanocytes which are found " + | ||
| + "predominantly in skin but also in the bowel and the eye."; | ||
| + | ||
| + AnnotationResult[] annotationResults = | ||
| + Network.GetResponseAs<AnnotationResult[]>(Constants.BaseUrl + "/annotator?text=" + textToAnnotate); | ||
| + | ||
| + PrintAnnotations(annotationResults); | ||
| + } | ||
| + } | ||
| +} | ||
| + |
Oops, something went wrong.
0 comments on commit
b84079d