Class BDIContextMapper

java.lang.Object
com.tnsai.context.integration.BDIContextMapper

public class BDIContextMapper extends Object
Maps BDI (Belief-Desire-Intention) model to Context Graph components.

This mapper bridges the gap between TnsAI's BDI architecture and the Foundation Capital Context Graphs model, enabling:

  • Beliefs to be captured as decision inputs
  • Desires to be mapped to decision goals
  • Intentions to be traced as committed actions

Usage Example


 BDIContextMapper mapper = new BDIContextMapper();

 // Map beliefs to decision input
 DecisionInput input = mapper.mapBeliefsToInput(agent.getBeliefs());

 // Derive goal from desires
 String goal = mapper.mapDesiresToGoal(agent.getDesires());

 // Create reasoning from BDI state
 DecisionReasoning reasoning = mapper.createReasoning(
     beliefs, desires, selectedIntention
 );
 
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a mapper with default confidence threshold (0.7).
    BDIContextMapper(double confidenceThreshold)
    Creates a mapper with custom confidence threshold.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.tnsai.context.decision.DecisionPolicy
    createPolicyFromBeliefs(List<com.tnsai.models.agent.Belief> beliefs)
    Creates decision policy from beliefs about rules.
    com.tnsai.context.decision.DecisionReasoning
    createReasoning(List<com.tnsai.models.agent.Belief> beliefs, List<com.tnsai.models.agent.Desire> desires, com.tnsai.models.agent.Intention intention)
    Creates decision reasoning from BDI state.
    com.tnsai.context.decision.DecisionReasoning
    createReasoningFromIntention(com.tnsai.models.agent.Intention intention)
    Creates simple reasoning from intention only.
    com.tnsai.context.decision.DecisionTrigger
    createTriggerFromBeliefChange(com.tnsai.models.agent.Belief oldBelief, com.tnsai.models.agent.Belief newBelief)
    Creates a decision trigger from belief change.
    com.tnsai.context.decision.DecisionTrigger
    createTriggerFromIntention(com.tnsai.models.agent.Intention intention, String source)
    Creates a decision trigger from intention activation.
    double
    Gets the confidence threshold used by this mapper.
    com.tnsai.context.decision.DecisionInput
    mapBeliefsToInput(List<com.tnsai.models.agent.Belief> beliefs)
    Maps beliefs to decision input.
    com.tnsai.context.decision.DecisionInput
    mapBeliefsToInput(List<com.tnsai.models.agent.Belief> beliefs, String query)
    Maps beliefs to decision input with a query.
    mapDesiresToGoal(List<com.tnsai.models.agent.Desire> desires)
    Maps desires to a goal description.
    mapDesireToGoal(com.tnsai.models.agent.Desire desire)
    Maps a single desire to a goal.
    mapIntentionToAction(com.tnsai.models.agent.Intention intention)
    Maps an intention to an action name.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BDIContextMapper

      public BDIContextMapper()
      Creates a mapper with default confidence threshold (0.7).
    • BDIContextMapper

      public BDIContextMapper(double confidenceThreshold)
      Creates a mapper with custom confidence threshold.
      Parameters:
      confidenceThreshold - minimum confidence for high-confidence beliefs
  • Method Details

    • mapBeliefsToInput

      public com.tnsai.context.decision.DecisionInput mapBeliefsToInput(List<com.tnsai.models.agent.Belief> beliefs)
      Maps beliefs to decision input.

      Converts the agent's beliefs into a structured decision input that captures what the agent knows when making a decision.

      Parameters:
      beliefs - agent's current beliefs
      Returns:
      decision input containing the beliefs
    • mapBeliefsToInput

      public com.tnsai.context.decision.DecisionInput mapBeliefsToInput(List<com.tnsai.models.agent.Belief> beliefs, String query)
      Maps beliefs to decision input with a query.
      Parameters:
      beliefs - agent's current beliefs
      query - the decision query
      Returns:
      decision input containing beliefs and query
    • mapDesiresToGoal

      public String mapDesiresToGoal(List<com.tnsai.models.agent.Desire> desires)
      Maps desires to a goal description.

      Derives a goal string from the agent's desires, prioritizing by priority level (CRITICAL > HIGH > MEDIUM > LOW).

      Parameters:
      desires - agent's current desires
      Returns:
      goal description string
    • mapDesireToGoal

      public String mapDesireToGoal(com.tnsai.models.agent.Desire desire)
      Maps a single desire to a goal.
      Parameters:
      desire - the desire to map
      Returns:
      goal description
    • createReasoning

      public com.tnsai.context.decision.DecisionReasoning createReasoning(List<com.tnsai.models.agent.Belief> beliefs, List<com.tnsai.models.agent.Desire> desires, com.tnsai.models.agent.Intention intention)
      Creates decision reasoning from BDI state.

      Constructs a reasoning trace that explains how the agent arrived at a decision based on its beliefs, desires, and selected intention.

      Parameters:
      beliefs - agent's beliefs at decision time
      desires - agent's desires at decision time
      intention - the selected intention (committed task)
      Returns:
      decision reasoning with BDI-based explanation
    • createReasoningFromIntention

      public com.tnsai.context.decision.DecisionReasoning createReasoningFromIntention(com.tnsai.models.agent.Intention intention)
      Creates simple reasoning from intention only.
      Parameters:
      intention - the selected intention
      Returns:
      decision reasoning
    • mapIntentionToAction

      public String mapIntentionToAction(com.tnsai.models.agent.Intention intention)
      Maps an intention to an action name.
      Parameters:
      intention - the intention to map
      Returns:
      action name derived from intention
    • createTriggerFromIntention

      public com.tnsai.context.decision.DecisionTrigger createTriggerFromIntention(com.tnsai.models.agent.Intention intention, String source)
      Creates a decision trigger from intention activation.
      Parameters:
      intention - the activated intention
      source - the source of activation
      Returns:
      decision trigger
    • createTriggerFromBeliefChange

      public com.tnsai.context.decision.DecisionTrigger createTriggerFromBeliefChange(com.tnsai.models.agent.Belief oldBelief, com.tnsai.models.agent.Belief newBelief)
      Creates a decision trigger from belief change.
      Parameters:
      oldBelief - previous belief (null if new)
      newBelief - new belief
      Returns:
      decision trigger
    • createPolicyFromBeliefs

      public com.tnsai.context.decision.DecisionPolicy createPolicyFromBeliefs(List<com.tnsai.models.agent.Belief> beliefs)
      Creates decision policy from beliefs about rules.

      Extracts policy rules from beliefs that contain rule-like statements.

      Parameters:
      beliefs - beliefs that may contain rules
      Returns:
      decision policy
    • getConfidenceThreshold

      public double getConfidenceThreshold()
      Gets the confidence threshold used by this mapper.
      Returns:
      confidence threshold (0.0 - 1.0)