private void addRelationships(String path, GovernanceArtifact artifact) throws RegistryException {
   Map<String, AssociationInteger> typeMap = new LinkedHashMap<String, AssociationInteger>();
   for (Association relationship : relationshipDefinitions) {
     String type = relationship.getAssociationType();
     String source = relationship.getSourcePath();
     String target = relationship.getDestinationPath();
     if (typeMap.containsKey(type)) {
       AssociationInteger associationInteger = typeMap.get(type);
       if (source == null) {
         if (associationInteger.getInteger() < 0) {
           associationInteger.setInteger(0);
         }
         for (String targetPath : GovernanceUtils.getPathsFromPathExpression(target, artifact)) {
           associationInteger.getAssociations().add(new Association(path, targetPath, type));
         }
       } else if (target == null) {
         if (associationInteger.getInteger() > 0) {
           associationInteger.setInteger(0);
         }
         for (String sourcePath : GovernanceUtils.getPathsFromPathExpression(source, artifact)) {
           associationInteger.getAssociations().add(new Association(sourcePath, path, type));
         }
       }
     } else {
       AssociationInteger associationInteger = new AssociationInteger();
       if (source == null) {
         associationInteger.setInteger(1);
         for (String targetPath : GovernanceUtils.getPathsFromPathExpression(target, artifact)) {
           associationInteger.getAssociations().add(new Association(path, targetPath, type));
         }
       } else if (target == null) {
         associationInteger.setInteger(-1);
         for (String sourcePath : GovernanceUtils.getPathsFromPathExpression(source, artifact)) {
           associationInteger.getAssociations().add(new Association(sourcePath, path, type));
         }
       }
       typeMap.put(type, associationInteger);
     }
   }
   for (Map.Entry<String, AssociationInteger> e : typeMap.entrySet()) {
     AssociationInteger value = e.getValue();
     List<Association> associations = value.getAssociations();
     fixAssociations(
         path,
         e.getKey(),
         value.getInteger() >= 0,
         value.getInteger() <= 0,
         associations.toArray(new Association[associations.size()]));
   }
 }