%%%%%%%%%%%%%%%%%%%%%%%%
% DATA
%%%%%%%%%%%%%%%%%%%%%%%%%		
	 
data(Name,Container,Id_data,Id_container):-class(Name,Id_data),
			property_type(Id_data,_,Id_container),
			property_composite(true,_,Id_container),
			property_name(Container,_,Id_container).



%%%%%%%%%%%%%%%%%%%%%%%%
% role
%%%%%%%%%%%%%%%%%%%%%%%

role(NameP,Navigable,Min,Max,Id_prop,Id_role):- 
			property_name(NameP,Id_prop,Id_role),
			property_type(TypeP,Id_prop,Id_role),
			property_composite(false,Id_prop,Id_role),
			class(_,TypeP),
			property_lower(Min,Id_prop,Id_role),
			property_upper(Max,Id_prop,Id_role),
			(associationEnds(navigableOwnedEnd,Id_prop,Id_role)
			->Navigable=true;Navigable=false).
			

%%%%%%%%%%%%%%%%%%
% IS_DATA
%%%%%%%%%%%%%%%%%

is_data(Id_role,TypeP):-property_type(TypeP,_,Id_role),
			class(_,TypeP).

%%%%%%%%%%%%%%%%%%%%%%%%%%%
% RELATION 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%

attribute(Name,Type,Key,Id_data,Id_attribute):-property_name(Name,Id_data,Id_attribute),
		property_type(Type,Id_data,Id_attribute),
		property_composite(false,Id_data,Id_attribute),
		property_unique(Key,Id_data,Id_attribute),
		property_qualifier(false,Id_data,Id_attribute),
		associationEnds(ownedAttribute,Id_data,Id_attribute).


%%%%%%%%%%%%%%%%%%%%%%
% IS-ROLE
%%%%%%%%%%%%%%%%%%%%%%

is_role(Id_rel,Id_role):-associationEnds(ownedEnd,Id_rel,Id_role).

%%%%%%%%%%%%%%%%%%%%%%%%%%%
% RELATION  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%

relation(Name,Id):-association(Name,Id).

%%%%%%%%%%%%%%%%%%%%%%%%%%%
% QUALIFIER  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%


qualifier(Name,Type,Id_role,Id_qualifier):-
			associationEnds(ownedEnd,_,Id_role),
			property_name(Name,Id_role,Id_qualifier),
			property_qualifier(true,Id_role,Id_qualifier),
			property_type(Type,Id_role,Id_qualifier).


