LogosLink Programmer's Guide · LogosLink Programmer's Interface version 2.0.1

Carry Out Centrality Analytics on an Ontology

The following example shows how to run centrality analytics on an ontology.

To execute this code, you will need a reference to the OntologyEngine package.

    using Incipit.LogosLink.OntologyEngine;
    using Incipit.LogosLink.OntologyEngine.Analytics.Centrality;

    //load an ontology from a file.
    var onp = new OntologyPersister("MyUserName");
    var on = onp.LoadOntology("C:\\Temp\\Test Models\\Test Ontology.llo").Ontology;

    //prepare and run a centrality analyser.
    var ana = new CentralityAnalyser(on);
    ana.Run();

    //print out overall centralities.
    foreach (var kvp in ana.EntityCentralities)
    {
        Console.WriteLine($"{kvp.Key.ElementKind}: {kvp.Key.SimpleText}; Overall centrality: {kvp.Value.OverallCentrality:P2}");
    }

In lines 5-6, we load an ontology from a file.

In lines 9-10, we create a centrality analyser for the ontology just loaded, and run it.

In lines 13-16, we iterate the entity centrality results from the analyser. For each element, we print out the kind and simple text for the entity, followed by its overall centrality.


Contents distributed under a Creative Commons Attribution 4.0 International License · About · Terms of Use · Contact Us · last updated on 21/04/2025 16:01