<commit_before>/*****************************************************************
JADE - Java Agent DEvelopment Framework is a framework to develop
multi-agent systems in compliance with the FIPA specifications.
Copyright (C) 2000 CSELT S.p.A. 

GNU Lesser General Public License

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation, 
version 2.1 of the License. 

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA  02111-1307, USA.
*****************************************************************/


package examples.ontology.employment;

import jade.onto.Frame;
import jade.onto.Ontology;
import jade.onto.DefaultOntology;
import jade.onto.SlotDescriptor;
import jade.onto.RoleEntityFactory;
import jade.onto.OntologyException;

import jade.onto.basic.*;

import java.util.*;

/**
   Javadoc documentation for the file EmploymentOntology
   @author <NAME> - CSELT S.p.A.
   @version $Date$ $Revision$
*/

public class EmploymentOntology {

  /**
    A symbolic constant, containing the name of this ontology.
   */
  public static final String NAME = "employment-ontology";

  // VOCABULARY
  // Concepts
  public static final String ADDRESS = "ADDRESS";
  public static final String PERSON = "PERSON";
  public static final String COMPANY = "COMPANY";
  // Actions
  public static final String ENGAGE = "ENGAGE";
  // Predicates
  public static final String WORKS_FOR = "WORKS-FOR";
	// Propositions
  public static final String ENGAGEMENT_ERROR = "ENGAGEMENT-ERROR";
  public static final String PERSON_TOO_OLD = "PERSON-TOO-OLD";
  
  private static Ontology theInstance = new DefaultOntology();

  static {
    initInstance();
  }

  /**
     This method grants access to the unique instance of the
     employment ontology.
     @return An <code>Ontology</code> object, containing the concepts
     of the employment ontology.
  */
  public static Ontology instance() {
    return theInstance;
  }

  private EmploymentOntology() {
  }

  private static void initInstance() {
    try {
			// Adds the roles of the basic ontology (ACTION, AID,...)
    	theInstance.joinOntology(BasicOntologyManager.instance());
    	
			// Adds ADDRESS role
    	theInstance.addRole(
				ADDRESS, 
				new SlotDescriptor[] {
	  			new SlotDescriptor("street", Ontology.PRIMITIVE_SLOT, Ontology.STRING_TYPE, Ontology.M),
	  			new SlotDescriptor("number", Ontology.PRIMITIVE_SLOT, Ontology.LONG_TYPE, Ontology.M),
	  			new SlotDescriptor("city", Ontology.PRIMITIVE_SLOT, Ontology.STRING_TYPE, Ontology.M)
				}, 
				new RoleEntityFactory() {
	     		public Object create(Frame f) { return new Address(); }
	     		public Class getClassForRole() { return Address.class; }
				}
			);

			// Adds PERSON role
			theInstance.addRole(
				PERSON, 
				new SlotDescriptor[] {
	  			new SlotDescriptor("name", Ontology.PRIMITIVE_SLOT, Ontology.STRING_TYPE, Ontology.M),
	  			new SlotDescriptor("age", Ontology.PRIMITIVE_SLOT, Ontology.LONG_TYPE, Ontology.O),
	  			new SlotDescriptor("address", Ontology.FRAME_SLOT, ADDRESS, Ontology.O)
				}, 
				new RoleEntityFactory() {
	     		public Object create(Frame f) { return new Person(); }
	     		public Class getClassForRole() { return Person.class; }
				}
			);
	
			// Adds COMPANY role
			theInstance.addRole(
				COMPANY, 
				new SlotDescriptor[]{
	  			new SlotDescriptor("name", Ontology.PRIMITIVE_SLOT, Ontology.STRING_TYPE, Ontology.M),
	  			new SlotDescriptor("address", Ontology.FRAME_SLOT, ADDRESS, Ontology.M)
				}, 
				new RoleEntityFactory() {
					public Object create(Frame f) { return new Company(); } 
					public Class getClassForRole() { return Company.class; }
				}
			);

			// Adds WORKS_FOR role
			theInstance.addRole(
				WORKS_FOR, 
				new SlotDescriptor[]{
	  			new SlotDescriptor(Ontology.FRAME_SLOT, PERSON, Ontology.M),
	  			new SlotDescriptor(Ontology.FRAME_SLOT, COMPANY, Ontology.M)
				}, 
				new RoleEntityFactory() {
					public Object create(Frame f) { return new WorksFor(); } 
					public Class getClassForRole() { return WorksFor.class; }
				}
			);

			// Adds ENGAGE role
			theInstance.addRole(
				ENGAGE, 
				new SlotDescriptor[]{
	  			new SlotDescriptor(Ontology.FRAME_SLOT, PERSON, Ontology.M),
	  			new SlotDescriptor(Ontology.FRAME_SLOT, COMPANY, Ontology.M)
				}, 
				new RoleEntityFactory() {
					public Object create(Frame f) { return new Engage(); } 
					public Class getClassForRole() { return Engage.class; }
				}
			);
	
			// Adds PERSON_TO_OLD role
			theInstance.addRole(
				EmploymentOntology.PERSON_TOO_OLD, 
				new SlotDescriptor[]{
				}, 
				new RoleEntityFactory() {
					public Object create(Frame f) { return new PersonTooOld(); } 
					public Class getClassForRole() { return PersonTooOld.class; }
				}
			);

			// Adds ENGAGEMENT_ERROR role
			theInstance.addRole(
				EmploymentOntology.ENGAGEMENT_ERROR, 
				new SlotDescriptor[]{
				}, 
				new RoleEntityFactory() {
					public Object create(Frame f) { return new EngagementError(); } 
					public Class getClassForRole() { return EngagementError.class; }
				}
			);

			// DEBUG: PRINT VOCABULARY
	  	List voc = theInstance.getVocabulary();
	  	Iterator i = voc.iterator();
	  	while (i.hasNext())
	  		System.out.println((String) (i.next()));
	  	
    }	// End of try
    catch(OntologyException oe) {
      oe.printStackTrace();
    }
  } //end of initInstance

}<commit_msg>Commented some debugging prints<commit_after>/*****************************************************************
JADE - Java Agent DEvelopment Framework is a framework to develop
multi-agent systems in compliance with the FIPA specifications.
Copyright (C) 2000 CSELT S.p.A. 

GNU Lesser General Public License

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation, 
version 2.1 of the License. 

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA  02111-1307, USA.
*****************************************************************/


package examples.ontology.employment;

import jade.onto.Frame;
import jade.onto.Ontology;
import jade.onto.DefaultOntology;
import jade.onto.SlotDescriptor;
import jade.onto.RoleEntityFactory;
import jade.onto.OntologyException;

import jade.onto.basic.*;

import java.util.*;

/**
   Javadoc documentation for the file EmploymentOntology
   @author <NAME> - CSELT S.p.A.
   @version $Date$ $Revision$
*/

public class EmploymentOntology {

  /**
    A symbolic constant, containing the name of this ontology.
   */
  public static final String NAME = "employment-ontology";

  // VOCABULARY
  // Concepts
  public static final String ADDRESS = "ADDRESS";
  public static final String PERSON = "PERSON";
  public static final String COMPANY = "COMPANY";
  // Actions
  public static final String ENGAGE = "ENGAGE";
  // Predicates
  public static final String WORKS_FOR = "WORKS-FOR";
	// Propositions
  public static final String ENGAGEMENT_ERROR = "ENGAGEMENT-ERROR";
  public static final String PERSON_TOO_OLD = "PERSON-TOO-OLD";
  
  private static Ontology theInstance = new DefaultOntology();

  static {
    initInstance();
  }

  /**
     This method grants access to the unique instance of the
     employment ontology.
     @return An <code>Ontology</code> object, containing the concepts
     of the employment ontology.
  */
  public static Ontology instance() {
    return theInstance;
  }

  private EmploymentOntology() {
  }

  private static void initInstance() {
    try {
			// Adds the roles of the basic ontology (ACTION, AID,...)
    	theInstance.joinOntology(BasicOntologyManager.instance());
    	
			// Adds ADDRESS role
    	theInstance.addRole(
				ADDRESS, 
				new SlotDescriptor[] {
	  			new SlotDescriptor("street", Ontology.PRIMITIVE_SLOT, Ontology.STRING_TYPE, Ontology.M),
	  			new SlotDescriptor("number", Ontology.PRIMITIVE_SLOT, Ontology.LONG_TYPE, Ontology.M),
	  			new SlotDescriptor("city", Ontology.PRIMITIVE_SLOT, Ontology.STRING_TYPE, Ontology.M)
				}, 
				new RoleEntityFactory() {
	     		public Object create(Frame f) { return new Address(); }
	     		public Class getClassForRole() { return Address.class; }
				}
			);

			// Adds PERSON role
			theInstance.addRole(
				PERSON, 
				new SlotDescriptor[] {
	  			new SlotDescriptor("name", Ontology.PRIMITIVE_SLOT, Ontology.STRING_TYPE, Ontology.M),
	  			new SlotDescriptor("age", Ontology.PRIMITIVE_SLOT, Ontology.LONG_TYPE, Ontology.O),
	  			new SlotDescriptor("address", Ontology.FRAME_SLOT, ADDRESS, Ontology.O)
				}, 
				new RoleEntityFactory() {
	     		public Object create(Frame f) { return new Person(); }
	     		public Class getClassForRole() { return Person.class; }
				}
			);
	
			// Adds COMPANY role
			theInstance.addRole(
				COMPANY, 
				new SlotDescriptor[]{
	  			new SlotDescriptor("name", Ontology.PRIMITIVE_SLOT, Ontology.STRING_TYPE, Ontology.M),
	  			new SlotDescriptor("address", Ontology.FRAME_SLOT, ADDRESS, Ontology.M)
				}, 
				new RoleEntityFactory() {
					public Object create(Frame f) { return new Company(); } 
					public Class getClassForRole() { return Company.class; }
				}
			);

			// Adds WORKS_FOR role
			theInstance.addRole(
				WORKS_FOR, 
				new SlotDescriptor[]{
	  			new SlotDescriptor(Ontology.FRAME_SLOT, PERSON, Ontology.M),
	  			new SlotDescriptor(Ontology.FRAME_SLOT, COMPANY, Ontology.M)
				}, 
				new RoleEntityFactory() {
					public Object create(Frame f) { return new WorksFor(); } 
					public Class getClassForRole() { return WorksFor.class; }
				}
			);

			// Adds ENGAGE role
			theInstance.addRole(
				ENGAGE, 
				new SlotDescriptor[]{
	  			new SlotDescriptor(Ontology.FRAME_SLOT, PERSON, Ontology.M),
	  			new SlotDescriptor(Ontology.FRAME_SLOT, COMPANY, Ontology.M)
				}, 
				new RoleEntityFactory() {
					public Object create(Frame f) { return new Engage(); } 
					public Class getClassForRole() { return Engage.class; }
				}
			);
	
			// Adds PERSON_TO_OLD role
			theInstance.addRole(
				EmploymentOntology.PERSON_TOO_OLD, 
				new SlotDescriptor[]{
				}, 
				new RoleEntityFactory() {
					public Object create(Frame f) { return new PersonTooOld(); } 
					public Class getClassForRole() { return PersonTooOld.class; }
				}
			);

			// Adds ENGAGEMENT_ERROR role
			theInstance.addRole(
				EmploymentOntology.ENGAGEMENT_ERROR, 
				new SlotDescriptor[]{
				}, 
				new RoleEntityFactory() {
					public Object create(Frame f) { return new EngagementError(); } 
					public Class getClassForRole() { return EngagementError.class; }
				}
			);

			// DEBUG: PRINT VOCABULARY
	  	//List voc = theInstance.getVocabulary();
	  	//Iterator i = voc.iterator();
	  	//while (i.hasNext())
	  	//	System.out.println((String) (i.next()));
	  	
    }	// End of try
    catch(OntologyException oe) {
      oe.printStackTrace();
    }
  } //end of initInstance

}
{'fraction_non_alphanumeric': 0.11558728539860616, 'fraction_numerical': 0.003399626041135475, 'mean_word_length': 3.400523560209424, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3105363', 'n_tokens_mistral': 4120, 'n_tokens_neox': 3543, 'n_words': 1027}