1

I am sending a message containing a concept from my ontology, between two agents. The Concept object is encapsulated inside an action, and encoded like so:

SendAction sendObject = new SendAction ("action info", conceptObject);

Action action = new Action();
action.setAction(sendObject);
action.setActor(getAID());

getContentManager().fillContent(message, action);

However, upon decoding the message content in the recipient agent like so:

ContentElement content = getContentManager().extractContent(message);

The concept object's default constructor is called, thus a 'SendAction' containing an empty concept object is extracted rather than the object I encoded.

Interestingly, the 'Send Action' itself is encoded and decoded properly, as the "action info" string remains. Only the conceptObject is default.

Why is this happening, and how can I prevent it?

Torantula
  • 177
  • 1
  • 13
  • Please take the [tour] to learn how Stack Overflow works and read [ask] on how to improve the quality of your question. Then [edit] your question to include your full source code you have as a [mcve], which can be compiled and tested by others. – Progman Dec 01 '19 at 18:30
  • 1
    are you sure that your ontology is correct? It should invoke set-methods accoding to your ontology. Can you attach your ontology and "conceptObject"? – nikelyn Dec 03 '19 at 15:54

1 Answers1

1

I have solved the problem, so thought I'd answer it for future users, especially because there isn't much on the subject available online.

In this case, there were two problems:

First, the use of a HashMap in the ontology's 'conceptObject'. Apparently Jade's content manager doesn't play well with the serialisation of HashMaps. I know this only from the combined experience of myself, my professors and classmates.

Second, the setters on my 'conceptObject' were set to private. I wasn't aware at the time, but Jade's content manager requires public setters in order to handle serialisation and deserialisation of content objects.

Note: It also requires a default constructor.

Torantula
  • 177
  • 1
  • 13