code: public void addMixin(final FedoraResource resource,
                           final Resource mixinResource,
                           final Map<String,String> namespaces)
              throws RepositoryException {
  
          final Node node = getJcrNode(resource);
          final Session session = node.getSession();
          final String mixinName = getPropertyNameFromPredicate(node, mixinResource, namespaces);
          if (!repositoryHasType(session, mixinName)) {
              final NodeTypeManager mgr = session.getWorkspace().getNodeTypeManager();
              final NodeTypeTemplate type = mgr.createNodeTypeTemplate();
              type.setName(mixinName);
              type.setMixin(true);
              type.setQueryable(true);
              mgr.registerNodeType(type, false);
          }
  
          if (node.isNodeType(mixinName)) {
              LOGGER.trace("Subject {} is already a {}; skipping", node, mixinName);
              return;
          }
  
          if (node.canAddMixin(mixinName)) {
              LOGGER.debug("Adding mixin: {} to node: {}.", mixinName, node.getPath());
              node.addMixin(mixinName);
          } else {
              throw new MalformedRdfException("Could not persist triple containing type assertion: "
                      + mixinResource.toString()
                      + " because no such mixin/type can be added to this node: "
                      + node.getPath() + "!");
          }
      }
docs: Add a mixin to a node
  @param resource the fedora resource
  @param mixinResource the mixin resource
  @param namespaces the namespace
  @throws RepositoryException if repository exception occurred