def mapping(files):
    """
    Creates a unique index for ever entity and relation.
    """
    E = set()
    R = set()
    
    for filename in files:           
        with open(filename,'r') as f:
            for line in f:
                s,p,o = line.split()
                E.add(s)
                E.add(o)
                R.add(p)
    
    E_mapping = {e:i for i,e in enumerate(E)}
    R_mapping = {e:i for i,e in enumerate(R)}
    
    return E_mapping, R_mapping