Hey Guys,
I spend a few hours searching for an solution of my Problem. I'm now posting it here because I didn't found any solution which solved my Problem. So i hope you can help me.
The situation is the following:
I use Jade an I'm able to send messages. Now I try to send a Message with not only integers or strings as content but with another concept as content.
Here I want to send a Message of the Media, which contains any number of Trackdata.
(I left out the import and other blabla stuff cause i is working)
In my Ontology I define:
add(new ConceptSchema(MEDIAINFO), Mediainfo.class); add(new ConceptSchema(TRACKDATA), Trackdata.class); //Mediainfo cs = (ConceptSchema) getSchema(MEDIAINFO); cs.add(CURRENTTRACK, (PrimitiveSchema) getSchema(BasicOntology.INTEGER), ObjectSchema.MANDATORY); cs.add(TRACKINFOS, (ConceptSchema) getSchema(TRACKDATA), 1 , ObjectSchema.UNLIMITED); //Trackdata cs = (ConceptSchema) getSchema(TRACKDATA); cs.add(TRACKNUMBER, (PrimitiveSchema) getSchema(BasicOntology.INTEGER), ObjectSchema.MANDATORY); cs.add(TRACKTYPE, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); cs.add(TRACKPLAYED, (PrimitiveSchema) getSchema(BasicOntology.BOOLEAN), ObjectSchema.MANDATORY);
Now in the Mediainfo class I define:
public class Mediainfo implements SystemVocabulary, Concept{ private Integer currentrack; private ArrayList<Trackdata> trackinfos; public void printSysteminfo(){ System.out.println("\n<<<===== Systeminfo ======>>>\n" + "\n\t Current Track: " + currenttrack + "\n\t Infos of the Trackss: " + trackinfos + "\n\n<<<===============================>>>\n" ); } public Integer getCurrenttrack() { return currenttrack; } public void setCurrenttrack (Integer currenttrack) { this.currenttrack = currenttrack; } public ArrayList<Trackdata> getTrackinfos() { return trackinfos; } public void setTrackinfos (ArrayList<Trackdata> trackinfos) { this.trackinfos = trackinfos; } }
And last but not least in an Agent I want to send a Message (the Trackdata class doesn't make any Problems i think):
protected Mediainfo mi; protected Trackdata td; mi = new Systeminfo(); mi.setCurrenttrack(2); ArrayList<Trackdata> track_data = new ArrayList<Trackdata>(); td = new Trackdata(); td.setTracknumber(1); td.setTracktype("rock"); td.setTrackplayed(true); track_data.add(td); td = new Trackdata(); td.setTracknumber(2); td.setTracktype("pop"); td.setTrackplayed(false); track_data.add(td); mi.setTrackinfos(track_data); this.sendMessage(ACLMessage.INFORM,getAIDofService(MANAGER_SERVICE),mi);
When I run my Programm I get the following error:
jade.content.onto.OntologyException: No schema found for class java.util.ArrayList
at jade.content.onto.Ontology.fromObject(Ontology.jav a:433)
at jade.content.onto.Ontology.externalize(Ontology.ja va:698)
at jade.content.onto.Ontology.fromObject(Ontology.jav a:645)
at jade.content.onto.Ontology.fromObject(Ontology.jav a:654)
at jade.content.onto.Ontology.fromObject(Ontology.jav a:427)
at jade.content.onto.basic.Action.externalise(Action. java:71)
at jade.content.onto.BasicOntology.fromObject(BasicOn tology.java:409)
at jade.content.onto.Ontology.fromObject(Ontology.jav a:654)
at jade.content.onto.Ontology.fromObject(Ontology.jav a:654)
at jade.content.onto.Ontology.fromObject(Ontology.jav a:427)
at jade.content.ContentManager.fillContent(ContentMan ager.java:205)
at MAINAgents.MasterAgent.sendMessage(MasterAgent.jav a:143)
at GUIAgents.GUIAgent.setup(GUIAgent.java:69)
at jade.core.Agent$ActiveLifeCycle.init(Agent.java:15 22)
at jade.core.Agent.run(Agent.java:1468)
at java.lang.Thread.run(Thread.java:662)
Can anybody explain to me why I get this error and how I can solve the problem?
Regrads
Dampfi