<?xml version="1.0" encoding="UTF-8"?>
<IntegrationScript>

<view name="EmployeeIntegrDef">
<mainView>
view EmployeeIntegrDef {
	virtual EmployeeIntegr: record {
		idIntegr: integer;
		nameIntegr: string;
		surnameIntegr: string;
		sexIntegr: string;
		salaryIntegr: real;
		infoIntegr: string;
		birthDateIntegr: date;
		worksInIntegr: DepartmentIntegr;
	}[0..*] ;

	seed : record {e: <seedName></seedName>.EmployeeContrib;  }[0..*]
			{ return ( <contributions count="0"><operator id="0"></operator><contibutedPeerName id="0"></contibutedPeerName><virtObjPathWithDot id="0">.EmployeeContrib</virtObjPathWithDot></contributions> ) as e; } 

	on_retrieve { 
	  return e.(
	  	idContrib as idIntegr, 
	  	nameContrib as nameIntegr, 
	  	surnameContrib as surnameIntegr, 
	  	sexContrib as sexIntegr, 
	  	salaryContrib as salaryIntegr, 
	  	infoContrib as infoIntegr, 
	  	birthDateContrib as birthDateIntegr),
	  	(DepartmentIntegr where idIntegr = e.worksInContrib.DepartmentContrib.idContrib) as worksInIntegr ;
	}	

	on_update { e := value.(
		idIntegr as idContrib,
		nameIntegr as nameContrib, 
		surnameIntegr as surnameContrib,
		sexIntegr as sexContrib, 
		salaryIntegr as salaryContrib, 
		infoIntegr as infoContrib, 
		birthDateIntegr as birthDateContrib,
		ref( ( <contributions count="0"><operator id="0"></operator><contibutedPeerName id="0"></contibutedPeerName><virtObjPathWithDot id="0">.DepartmentContrib</virtObjPathWithDot></contributions> ) where idContrib = worksInIntegr.idIntegr) as worksInContrib); 
	}

	on_new { create permanent EmployeeContrib(value.(
		idIntegr as idContrib, 
		nameIntegr as nameContrib,
		surnameIntegr as surnameContrib, 
		sexIntegr as sexContrib, 
		salaryIntegr as salaryContrib, 
		infoIntegr as infoContrib,
		birthDateIntegr as birthDateContrib,
		ref(DepartmentContrib where idContrib = worksInIntegr.idIntegr) as worksInContrib));
	}
					
	on_delete { 
		delete e; }
</mainView>

<subView>
	view idIntegrDef {  
		virtual idIntegr: integer;
		seed: record { _id: <seedName></seedName>.EmployeeContrib.idContrib; } { return e.idContrib as _id; } 
		on_retrieve { return _id; }
		on_update {_id := value; }
	}
</subView>

<subView>
	view nameIntegrDef {  
		virtual nameIntegr: string;
		seed: record { _name: <seedName></seedName>.EmployeeContrib.nameContrib; } { return e.nameContrib as _name; } 
		on_retrieve { return _name; }
		on_update { _name := value; }
	}
</subView>

<subView>
	view surnameIntegrDef {  
		virtual surnameIntegr: string;
		seed: record { _surname: <seedName></seedName>.EmployeeContrib.surnameContrib; } { return e.surnameContrib as _surname; } 
		on_retrieve { return _surname; }
		on_update { _surname := value; }
	}
</subView>

<subView>
	view sexIntegrDef {  
		virtual sexIntegr: string;
		seed: record { _sex: <seedName></seedName>.EmployeeContrib.sexContrib; } { return e.sexContrib as _sex; } 
		on_retrieve { return _sex; }
		on_update { _sex := value; }
	}
</subView>

<subView>
	view salaryIntegrDef {  
		virtual salaryIntegr: real;
		seed: record { _salary: <seedName></seedName>.EmployeeContrib.salaryContrib; } { return e.salaryContrib as _salary; } 
		on_retrieve { return _salary; }
		on_update { _salary := value; }
	}
</subView>

<subView>
	view infoIntegrDef {  
		virtual infoIntegr: string;
		seed: record { _info: <seedName></seedName>.EmployeeContrib.infoContrib; } { return e.infoContrib as _info; } 
		on_retrieve { return _info; }
		on_update { _info := value; }
	}
</subView>

<subView>
	view birthDateIntegrDef {  
		virtual birthDateIntegr: date;
		seed: record { _birthDate: <seedName></seedName>.EmployeeContrib.birthDateContrib; } { return e.birthDateContrib as _birthDate; } 
		on_retrieve { return _birthDate; }
		on_update { _birthDate := value; }
	}
</subView>

<subView>
/*virtual pointer*/
	view worksInIntegrDef {
		virtual worksInIntegr: DepartmentIntegr[0..*];
		seed: record { _worksIn: DepartmentIntegr; }[0..*]
			{ return (DepartmentIntegr where idIntegr = (e.worksInContrib.DepartmentContrib.idContrib)) as _worksIn; } 
		on_retrieve { return _worksIn;}
		on_navigate { return _worksIn;}
	}
</subView>
}
</view>

<view name="DepartmentIntegrDef">
<mainView>
view DepartmentIntegrDef{
	virtual DepartmentIntegr: record {
		idIntegr: integer;
		nameIntegr: string;
		isLocatedInIntegr: LocationIntegr;
	}[0..*] ;

	seed : record {d: <seedName></seedName>.DepartmentContrib;  }[0..*]  
		{ return ( <contributions count="0"><operator id="0"></operator><contibutedPeerName id="0"></contibutedPeerName><virtObjPathWithDot id="0">.DepartmentContrib</virtObjPathWithDot></contributions> ) as d; } 

	on_retrieve { 
	  return d.(
	  	idContrib as idIntegr, 
	  	nameContrib as nameIntegr),
	  	(LocationIntegr where idIntegr = (d.isLocatedInContrib.LocationContrib.idContrib)) as isLocatedInIntegr ;
	}	

	on_delete { 
		delete d; 
	}
</mainView>

<subView>
	view idIntegrDef {  
		virtual idIntegr: integer;
		seed: record { _id: <seedName></seedName>.DepartmentContrib.idContrib; } { return d.idContrib as _id; } 
		on_retrieve { return _id; }
	}
</subView>

<subView>
	view nameIntegrDef {  
		virtual nameIntegr: string;
		seed: record { _name: <seedName></seedName>.DepartmentContrib.nameContrib; } { return d.nameContrib as _name; } 
		on_retrieve { return _name; }
		on_update { _name := value; }
	}
</subView>

<subView>
/*virtual pointer*/
	view isLocatedInIntegrDef {
		virtual isLocatedInIntegr: LocationIntegr;
		seed: record { _isLocatedIn: LocationIntegr; }
			{ return (LocationIntegr where idIntegr = (d.isLocatedInContrib.LocationContrib.idContrib)) as _isLocatedIn; } 
		on_retrieve { return _isLocatedIn;}
		on_navigate { return _isLocatedIn;}
	} 
</subView>
}
</view>

<view name="LocationIntegrDef">
<mainView>
view LocationIntegrDef{
	virtual LocationIntegr: record {
		idIntegr: integer;
		nameIntegr: string;
	}[0..*] ;
	
	seed : record {l: <seedName></seedName>.LocationContrib;  }[0..*]  
		{ return ( <contributions count="0"><operator id="0"></operator><contibutedPeerName id="0"></contibutedPeerName><virtObjPathWithDot id="0">.LocationContrib</virtObjPathWithDot></contributions> ) as l; } 
	
	on_retrieve { 
		return l.(
	  		idContrib as idIntegr, 
	  		nameContrib as nameIntegr);
	}	
	on_delete { 
		delete l; 
	}
</mainView>

<subView>
	view idIntegrDef {  
		virtual idIntegr: integer;
		seed: record { _id: <seedName></seedName>.LocationContrib.idContrib; } { return l.idContrib as _id; } 
		on_retrieve { return deref(_id); }
	}
</subView>

<subView>
	view nameIntegrDef {  
		virtual nameIntegr: string;
		seed: record { _name: <seedName></seedName>.LocationContrib.nameContrib; } { return l.nameContrib as _name; } 
		on_retrieve { return deref(_name); }
		on_update { _name := value; }
	}
</subView>
}
</view>

<view name="CarIntegrDef">
<mainView>
view CarIntegrDef{
	virtual CarIntegr: record {
		idIntegr: integer;
		colourIntegr: string;
		yearIntegr: integer;
		isModelIntegr: ModelIntegr;
		isOwnedByIntegr: EmployeeIntegr; 
	}[0..*] ;
	
	seed : record {c: <seedName></seedName>.CarContrib;  }[0..*]  
		{ return ( <contributions count="0"><operator id="0"></operator><contibutedPeerName id="0"></contibutedPeerName><virtObjPathWithDot id="0">.CarContrib</virtObjPathWithDot></contributions> ) as c; } 

	on_retrieve { 
	  return c.(
	  	idContrib as idIntegr, 
	  	colourContrib as colourIntegr,
	  	yearContrib as yearIntegr),
	  	(ModelIntegr where idIntegr = (c.isModelContrib.ModelContrib.idContrib)) as isModelIntegr,
	  	(EmployeeIntegr where idIntegr = (c.isOwnedByContrib.EmployeeContrib.idContrib)) as isOwnedByIntegr ;
	}	
	on_delete { 
		delete c; 
	}
</mainView>

<subView>
	view idIntegrDef {  
		virtual idIntegr: integer;
		seed: record { _id: <seedName></seedName>.CarContrib.idContrib; } { return c.idContrib as _id; } 
		on_retrieve { return deref(_id); }
	}
</subView>

<subView>
	view colourIntegrDef {  
		virtual colourIntegr: string;
		seed: record { _colour: <seedName></seedName>.CarContrib.colourContrib; } { return c.colourContrib as _colour; } 
		on_retrieve { return deref(_colour); }
		on_update { _colour := value; }
	}
</subView>

<subView>
	view yearIntegrDef {  
		virtual yearIntegr: integer;
		seed: record { _year: <seedName></seedName>.CarContrib.yearContrib; } { return c.yearContrib as _year; } 
		on_retrieve { return deref(_year); }
		on_update { _year := value; }
	}
</subView>

<subView>
/*virtual pointer*/
	view isModelIntegrDef {
		virtual isModelIntegr: ModelIntegr;
		seed: record { _isModel: ModelIntegr; }
			{ return (ModelIntegr where idIntegr = (c.isModelContrib.ModelContrib.idContrib)) as _isModel; } 
		on_retrieve { return _isModel;}
		on_navigate { return _isModel;}
	}
</subView>

<subView>
/*virtual pointer*/
	view isOwnedByIntegrDef {
		virtual isOwnedByIntegr: EmployeeIntegr;
		seed: record { _isOwnedBy: EmployeeIntegr; }
			{ return (EmployeeIntegr where idIntegr = (c.isOwnedByContrib.EmployeeContrib.idContrib)) as _isOwnedBy; } 
		on_retrieve { return _isOwnedBy;}
		on_navigate { return _isOwnedBy;}
	}
</subView>
}
</view>

<view name="ModelIntegrDef">
<mainView>
view ModelIntegrDef{
	virtual ModelIntegr: record {
		idIntegr: integer;
		nameIntegr: string;
		isMakeIntegr: MakeIntegr;
	}[0..*] ;
		
	seed : record {m: <seedName></seedName>.ModelContrib;  }[0..*]  
		{ return ( <contributions count="0"><operator id="0"></operator><contibutedPeerName id="0"></contibutedPeerName><virtObjPathWithDot id="0">.ModelContrib</virtObjPathWithDot></contributions> ) as m; } 

	on_retrieve { 
	  return m.(
	  	idContrib as idIntegr, 
	  	nameContrib as nameIntegr),
	  	(MakeIntegr where idIntegr = (m.isMakeContrib.MakeContrib.idContrib)) as isMakeIntegr ;
	}	
	on_delete { 
		delete m; 
	}
</mainView>

<subView>
	view idIntegrDef {  
		virtual idIntegr: integer;
		seed: record { _id: <seedName></seedName>.ModelContrib.idContrib; } { return m.idContrib as _id; } 
		on_retrieve { return deref(_id); }
	}
</subView>

<subView>
	view nameIntegrDef {  
		virtual nameIntegr: string;
		seed: record { _name: <seedName></seedName>.ModelContrib.nameContrib; } { return m.nameContrib as _name; } 
		on_retrieve { return deref(_name); }
		on_update { _name := value; }
	}
</subView>

<subView>
/*virtual pointer*/
	view isMakeIntegrDef {
		virtual isMakeIntegr: MakeIntegr;
		seed: record { _isMake: MakeIntegr; }
			{ return (MakeIntegr where idIntegr = (m.isMakeContrib.MakeContrib.idContrib)) as _isMake; } 
		on_retrieve { return _isMake;}
		on_navigate { return _isMake;}
	}
</subView>
}
</view>

<view name="MakeIntegrDef">
<mainView>
view MakeIntegrDef{
	virtual MakeIntegr: record {
		idIntegr: integer;
		nameIntegr: string;
	}[0..*] ;
		
	seed : record {m: <seedName></seedName>.MakeContrib;  }[0..*]  
		{ return ( <contributions count="0"><operator id="0"></operator><contibutedPeerName id="0"></contibutedPeerName><virtObjPathWithDot id="0">.MakeContrib</virtObjPathWithDot></contributions> ) as m; } 

	on_retrieve { 
	  return m.(
	  	idContrib as idIntegr, 
	  	nameContrib as nameIntegr);
	}	
	on_delete { 
		delete m; 
	}
</mainView>

<subView>
	view idIntegrDef {  
		virtual idIntegr: integer;
		seed: record { _id: <seedName></seedName>.MakeContrib.idContrib; } { return m.idContrib as _id; } 
		on_retrieve { return deref(_id); }
	}
</subView>

<subView>
	view nameIntegrDef {  
		virtual nameIntegr: string;
		seed: record { _name: <seedName></seedName>.MakeContrib.nameContrib; } { return m.nameContrib as _name; } 
		on_retrieve { return deref(_name); }
		on_update { _name := value; }
	}
</subView>
}
</view>

</IntegrationScript>