This is conventional loss function used to learn knowledge graph embeddings.
given a p-th triplet (e s , r, e o ) p from training set D, we sample C negative samples by replacing either head or tail entity and define a contrastive max margin function as shown in (Socher et al., 2013): where, γ is margin, e s c represent corrupted entity and g (e s c , r p , e o p ) represent corrupted triplet score.