public static void defineDeptEmployeeTypes(TypeSystem ts) throws AtlasException {
  String _description="_description";
  EnumTypeDefinition orgLevelEnum=new EnumTypeDefinition("OrgLevel","OrgLevel" + _description,new EnumValue("L1",1),new EnumValue("L2",2));
  StructTypeDefinition addressDetails=createStructTypeDef("Address","Address" + _description,createRequiredAttrDef("street",DataTypes.STRING_TYPE),createRequiredAttrDef("city",DataTypes.STRING_TYPE));
  HierarchicalTypeDefinition<ClassType> deptTypeDef=createClassTypeDef(DEPARTMENT_TYPE,"Department" + _description,ImmutableSet.<String>of(),createRequiredAttrDef("name",DataTypes.STRING_TYPE),new AttributeDefinition("employees",String.format("array<%s>","Person"),Multiplicity.OPTIONAL,true,"department"));
  HierarchicalTypeDefinition<ClassType> personTypeDef=createClassTypeDef("Person","Person" + _description,ImmutableSet.<String>of(),createRequiredAttrDef("name",DataTypes.STRING_TYPE),createOptionalAttrDef("orgLevel","OrgLevel"),createOptionalAttrDef("address","Address"),new AttributeDefinition("department","Department",Multiplicity.REQUIRED,false,"employees"),new AttributeDefinition("manager","Manager",Multiplicity.OPTIONAL,false,"subordinates"),new AttributeDefinition("mentor","Person",Multiplicity.OPTIONAL,false,null),createOptionalAttrDef("birthday",DataTypes.DATE_TYPE),createOptionalAttrDef("hasPets",DataTypes.BOOLEAN_TYPE),createOptionalAttrDef("numberOfCars",DataTypes.BYTE_TYPE),createOptionalAttrDef("houseNumber",DataTypes.SHORT_TYPE),createOptionalAttrDef("carMileage",DataTypes.INT_TYPE),createOptionalAttrDef("shares",DataTypes.LONG_TYPE),createOptionalAttrDef("salary",DataTypes.DOUBLE_TYPE),createOptionalAttrDef("age",DataTypes.FLOAT_TYPE),createOptionalAttrDef("numberOfStarsEstimate",DataTypes.BIGINTEGER_TYPE),createOptionalAttrDef("approximationOfPi",DataTypes.BIGDECIMAL_TYPE));
  HierarchicalTypeDefinition<ClassType> managerTypeDef=createClassTypeDef("Manager","Manager" + _description,ImmutableSet.of("Person"),new AttributeDefinition("subordinates",String.format("array<%s>","Person"),Multiplicity.COLLECTION,false,"manager"));
  HierarchicalTypeDefinition<TraitType> securityClearanceTypeDef=createTraitTypeDef("SecurityClearance","SecurityClearance" + _description,ImmutableSet.<String>of(),createRequiredAttrDef("level",DataTypes.INT_TYPE));
  ts.defineTypes(ImmutableList.of(orgLevelEnum),ImmutableList.of(addressDetails),ImmutableList.of(securityClearanceTypeDef),ImmutableList.of(deptTypeDef,personTypeDef,managerTypeDef));
}

public static void defineDeptEmployeeTypes ( TypeSystem ts ) throws AtlasException { String _description = "_description" ; EnumTypeDefinition orgLevelEnum = new EnumTypeDefinition ( "OrgLevel" , "OrgLevel" + _description , new EnumValue ( "L1" , 1 ) , new EnumValue ( "L2" , 2 ) ) ; StructTypeDefinition addressDetails = createStructTypeDef ( "Address" , "Address" + _description , createRequiredAttrDef ( "street" , DataTypes . STRING_TYPE ) , createRequiredAttrDef ( "city" , DataTypes . STRING_TYPE ) ) ; HierarchicalTypeDefinition < ClassType > deptTypeDef = createClassTypeDef ( DEPARTMENT_TYPE , "Department" + _description , ImmutableSet . < String > of ( ) , createRequiredAttrDef ( "name" , DataTypes . STRING_TYPE ) , new AttributeDefinition ( "employees" , String . format ( "array<%s>" , "Person" ) , Multiplicity . OPTIONAL , true , "department" ) ) ; HierarchicalTypeDefinition < ClassType > personTypeDef = createClassTypeDef ( "Person" , "Person" + _description , ImmutableSet . < String > of ( ) , createRequiredAttrDef ( "name" , DataTypes . STRING_TYPE ) , createOptionalAttrDef ( "orgLevel" , "OrgLevel" ) , createOptionalAttrDef ( "address" , "Address" ) , new AttributeDefinition ( "department" , "Department" , Multiplicity . REQUIRED , false , "employees" ) , new AttributeDefinition ( "manager" , "Manager" , Multiplicity . OPTIONAL , false , "subordinates" ) , new AttributeDefinition ( "mentor" , "Person" , Multiplicity . OPTIONAL , false , null ) , createOptionalAttrDef ( "birthday" , DataTypes . DATE_TYPE ) , createOptionalAttrDef ( "hasPets" , DataTypes . BOOLEAN_TYPE ) , createOptionalAttrDef ( "numberOfCars" , DataTypes . BYTE_TYPE ) , createOptionalAttrDef ( "houseNumber" , DataTypes . SHORT_TYPE ) , createOptionalAttrDef ( "carMileage" , DataTypes . INT_TYPE ) , createOptionalAttrDef ( "shares" , DataTypes . LONG_TYPE ) , createOptionalAttrDef ( "salary" , DataTypes . DOUBLE_TYPE ) , createOptionalAttrDef ( "age" , DataTypes . FLOAT_TYPE ) , createOptionalAttrDef ( "numberOfStarsEstimate" , DataTypes . BIGINTEGER_TYPE ) , createOptionalAttrDef ( "approximationOfPi" , DataTypes . BIGDECIMAL_TYPE ) ) ; HierarchicalTypeDefinition < ClassType > managerTypeDef = createClassTypeDef ( "Manager" , "Manager" + _description , ImmutableSet . of ( "Person" ) , new AttributeDefinition ( "subordinates" , String . format ( "array<%s>" , "Person" ) , Multiplicity . COLLECTION , false , "manager" ) ) ; HierarchicalTypeDefinition < TraitType > securityClearanceTypeDef = createTraitTypeDef ( "SecurityClearance" , "SecurityClearance" + _description , ImmutableSet . < String > of ( ) , createRequiredAttrDef ( "level" , DataTypes . INT_TYPE ) ) ; ts . defineTypes ( ImmutableList . of ( orgLevelEnum ) , ImmutableList . of ( addressDetails ) , ImmutableList . of ( securityClearanceTypeDef ) , ImmutableList . of ( deptTypeDef , personTypeDef , managerTypeDef ) ) ; }
class hierarchy is : department ( name : string , employees : array [ person ] ) person ( name : string , department : department , manager : manager ) manager ( subordinates : array [ person ] ) extends person < p / > persons can have securityclearance ( level : int ) clearance .
