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

Create Independent Context

The following example shows how to create an independent context and add some elements to it.

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

    using Incipit.LogosLink.ContextEngine;

    //create context.
    var cx = new Context("Test Context", "MyUserName");

    //add a new theme.
    var th = cx.AddNewTheme("Immigration");

    //add a couple of positions to the theme.
    var poGood = th.AddNewPosition("Open borders are good for the economy.");
    var poCrime = th.AddNewPosition("Open borders increase crime rates.");

    //add two agents to the theme, and make one a sub-agent of the other.
    var agNeighbours = th.AddNewAgent("Neighbours");
    var agImmigrants = th.AddNewAgent("Immigrants");
    agImmigrants.ParentAgent = agNeighbours;

    //add some adherences.
    agNeighbours.AddNewAdherence(poCrime, AdherenceDegree.ModerateSupport);
    agImmigrants.AddNewAdherence(poGood, AdherenceDegree.StrongSupport);
    agImmigrants.AddNewAdherence(poCrime, AdherenceDegree.StrongOpposition);

In line 4, we create a new context named "Test Context".

In line 7, we add a theme to the context, named "Immigration".

In lines 10-11, we add two positions to the "Immigration" theme, each one with a different statement.

In lines 14-15, we add two agents to the "Immigration" theme, one for the neighbours and a second one for the immigrants. Then, in line 16, we make the "Immigrants" agent a sub-agent of "Neighbours".

Finally, in lines 19-21, we add some adherences of agents to positions, of different degrees.


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