code: public void addReferencePlaceholders(final IdentifierConverter<Resource,FedoraResource> idTranslator,
                                            final Node node,
                                            final String propertyName,
                                            final Resource resource) throws RepositoryException {
  
          try {
              final Node refNode = getJcrNode(idTranslator.convert(resource));
  
              if (isExternalNode.test(refNode)) {
                  // we can't apply REFERENCE properties to external resources
                  return;
              }
  
              final String referencePropertyName = getReferencePropertyName(propertyName);
  
              if (!isMultivaluedProperty(node, propertyName)) {
                  if (node.hasProperty(referencePropertyName)) {
                      node.getProperty(referencePropertyName).remove();
                  }
  
                  if (node.hasProperty(propertyName)) {
                      node.getProperty(propertyName).remove();
                  }
              }
  
              final Value v = node.getSession().getValueFactory().createValue(refNode, true);
              appendOrReplaceNodeProperty(node, referencePropertyName, v);
  
          } catch (final IdentifierConversionException e) {
              // no-op
          }
      }
docs: Add a reference placeholder from one node to another in-domain resource
  @param idTranslator the id translator
  @param node the node
  @param propertyName the property name
  @param resource the resource
  @throws RepositoryException if repository exception occurred