Bug ? "Missing value for mandatory slot..."


Subject: Bug ? "Missing value for mandatory slot..."
From: Tiago Lima (t-lima@clix.pt)
Date: Wed Feb 05 2003 - 23:05:04 MET


Hi,

I have defined (in JADE2.61) a Blocks World Ontology and defined a
Predicate WORLDSTATE like the following:

        // WORLD_STATE
        PredicateSchema worldStatePredicateSchema = new
PredicateSchema(WORLD_STATE);
        worldStatePredicateSchema.add(BLOCKS_ON, setSchema);
        worldStatePredicateSchema.addFacet(BLOCKS_ON, new
TypedAggregateFacet(blockSchema));
        worldStatePredicateSchema.addFacet(BLOCKS_ON, new
jade.content.schema.facets.CardinalityFacet(0, Integer.MAX_VALUE));
        worldStatePredicateSchema.add(BLOCKS_ON_FLOOR, setSchema);
        worldStatePredicateSchema.addFacet(BLOCKS_ON_FLOOR, new
TypedAggregateFacet(blockSchema));
        add(worldStatePredicateSchema, WorldStatePredicate.class);

Please note that BLOCKS_ON slot is a setSchema. (the CardinalityFacet
was added later and it is an only an insurance.)

Now if I attempt to send a message like this:

        WorldStatePredicate worldState = new WorldStatePredicate();
        
        List onFloorList =
convertToBlockConcepts(this._world.getBlocksOnFloor());
        worldState.setBlocksOnFloor(onFloorList);
        
        List onList = convertToBlockConcepts(this._world.getBlocksOn());
        worldState.setBlocksOn(onList);

And for example the world hasn't blocks on top of another blocks then
this._world.getBlocksOn() returns a list with no elements. Ok. That is
fine!

Now, when I try to send the message:

        ACLMessage reply = msgArrived.createReply();
        reply.setOntology(getOntology());
        reply.setLanguage(getCodec());
        reply.setPerformative(ACLMessage.INFORM);
        
        sendOntoMessage(reply, worldState);

And having defined sendOntoMessage function like this :

        /** Sends a "ontological" message.
         * @param msg the message.
         * @param elem a content element.
         */
        protected void sendOntoMessage(ACLMessage msg, ContentElement
elem) {
                try {
                        getContentManager().fillContent(msg, elem);
                        send(msg);
                } catch (Codec.CodecException e) {
                        throw new RuntimeException("Message was not
sent: content is not compliant with content language (codec) used in the
message.", e);
                } catch (OntologyException e) {
                        throw new RuntimeException("Message was not
sent: some inconsistency with the ontology was detected.", e);
                }
        }

I receive the following exception :

java.lang.RuntimeException: Message was not sent: some inconsistency
with the ontology was detected.
        at iaa.agent.IaaAgent.sendOntoMessage(IaaAgent.java:123)
        at
iaa.example2.BlocksWorldAgent.sendWorldState(BlocksWorldAgent.java:237)
        at
iaa.example2.BlocksWorldAgent$ReceiveBeginMessageBehaviour.action(Blocks
WorldAgent.java:69)
        at jade.core.behaviours.Behaviour.actionWrapper(Unknown Source)
        at jade.core.behaviours.CompositeBehaviour.action(Unknown
Source)
        at jade.core.behaviours.Behaviour.actionWrapper(Unknown Source)
        at jade.core.Agent.mainLoop(Unknown Source)
        at jade.core.Agent.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:536)
Caused by: jade.content.onto.OntologyException: Missing value for
mandatory slot BLOCKSON. Schema is
jade.content.schema.PredicateSchema-WORLDSTATE
        at jade.content.schema.ObjectSchemaImpl.validate(Unknown Source)
        at jade.content.schema.ObjectSchemaImpl.validateSlots(Unknown
Source)
        at jade.content.schema.PredicateSchema.validate(Unknown Source)
        at jade.content.ContentManager.validate(Unknown Source)
        at jade.content.ContentManager.fillContent(Unknown Source)
        at iaa.agent.IaaAgent.sendOntoMessage(IaaAgent.java:118)
        ... 8 more

Caused by
        Missing value for mandatory slot BLOCKSON. Schema is
jade.content.schema.PredicateSchema-WORLDSTATE

Right? But in JADE2.5 works just fine!!!

The problem is perhaps trying to send a predicate with a slot containing
a list with no elements...
How do I solve this?

        Tiago Lima



This archive was generated by hypermail 2a22 : Wed Feb 05 2003 - 23:02:41 MET