Converts a complex property connection map (key:String, value:Set of Strings) to a simple property connection
map, so that the connections can easily be saved to the edges in the model graph.
342119
public static Map<String, String> convertPropertyConnectionsToSimpleForm(Map<String, Set<String>> connections) {
        Map<String, String> result = new HashMap<String, String>();
        if (connections == null) {
            return result;
        }
        for (Map.Entry<String, Set<String>> entry : connections.entrySet()) {
            result.put(entry.getKey(), Joiner.on(',').join(entry.getValue()));
        }
        return result;
    }
214955
def _map_value(self, value):
        '''  '''
        # TODO: Once we've gotten here, we've done the following:
        # -> Recieve the full response, copy it from network buffer it into a ByteBuffer (copy 1)
        # -> Copy all the data into a String (copy 2)
        # -> Deserialize that string (copy 3)
        # -> Map the deserialized JSON to our response format (copy 4, what we are doing in this method)
        # This should not bee needed. Technically, this mapping from transport format to python types should require exactly one copy, 
        # from the network buffer into the python VM.
        if isinstance(value, list):
            out = []
            for c in value:
                out.append(self._map_value( c ))
            return out
        elif isinstance(value, dict) and 'metadata' in value and 'labels' in value['metadata'] and 'self' in value:
            return neo4j.Node(ustr(value['metadata']['id']), value['metadata']['labels'], value['data'])
        elif isinstance(value, dict) and 'metadata' in value and 'type' in value and 'self' in value:
            return neo4j.Relationship(ustr(value['metadata']['id']), value['type'], value['start'].split('/')[-1], value['end'].split('/')[-1], value['data'])
        elif isinstance(value, dict):
            out = {}
            for k,v in value.items():
                out[k] = self._map_value( v )
            return out
        elif isinstance(value, str):
            return ustr(value)
        else:
            return value
523489
def _make_property_from_dict(self, property_def: Dict) -> Property:
        """"""
        property_hash = hash_dump(property_def)

        edge_property_model = self.object_cache_property.get(property_hash)
        if edge_property_model is None:
            edge_property_model = self.get_property_by_hash(property_hash)

            if not edge_property_model:
                property_def['sha512'] = property_hash
                edge_property_model = Property(**property_def)

            self.object_cache_property[property_hash] = edge_property_model

        return edge_property_model
586739
def mapping_fields(mapping, parent=[]):
    
    rtn_obj = {}
    for key, value in mapping.items():
        new_key = parent + [key]
        new_key = ".".join(new_key)
        rtn_obj.update({new_key: value.get('type')})
        if value.get('properties'):
            rtn_obj.update(mapping_fields(value['properties'], [new_key]))
        elif value.get('fields'):
            rtn_obj.update(mapping_fields(value['fields'], [new_key]))
            rtn_obj[new_key] = [rtn_obj[new_key]] + \
                    list(value['fields'].keys())
    return rtn_obj
218197
function toKeyValueStrings(dynamoDBMap) {
  return dynamoDBMap && typeof dynamoDBMap === 'object' ?
    Object.getOwnPropertyNames(dynamoDBMap).map(key => `${key}:${stringify(toValueFromAttributeValue(dynamoDBMap[key]))}`) : [];
}
848221
private static String mapToCQLString(Map<String, Object> valueMap) {
        StringBuffer buffer = new StringBuffer();
        buffer.append("{");
        boolean bFirst = true;
        for (String name : valueMap.keySet()) {
            if (bFirst) {
                bFirst = false;
            } else {
                buffer.append(",");
            }
            buffer.append("'");
            buffer.append(name);
            buffer.append("':");
            Object value = valueMap.get(name);
            if (value instanceof String) {
                buffer.append("'");
                buffer.append(value.toString());
                buffer.append("'");
            } else {
                buffer.append(value.toString());
            }
        }
        buffer.append("}");
        return buffer.toString();
    }
321405
static public Map<String,Object> propertiesToMap(Properties properties)
    {
        Map<String,Object> map = null;
        if (properties != null)
        {
	        map = new Hashtable<String,Object>();
	        for (Object key : properties.keySet())
	        {
                map.put((String)key, properties.get(key));	            
	        }
        }
        return map;
    }
499800
def _mappingGetValueSet(mapping, keys):
    
    setUnion = set()
    for k in keys:
        setUnion = setUnion.union(mapping[k])
    return setUnion
777117
def from_maps(*maps):
        
        result = AnyValueMap()
        
        if maps == None or len(maps) == 0:
            return result

        for map in maps:
            for (key, value) in map.items():
                key = StringConverter.to_string(key)
                result.put(key, value)

        return result
329497
def mapping_to_frozenset(mapping):
    

    aggregation = {}

    for key, value in mapping.items():
        if isinstance(value, Mapping):
            aggregation[key] = mapping_to_frozenset(value)
        elif isinstance(value, Sequence):
            value = list(value)
            for i, item in enumerate(value):
                if isinstance(item, Mapping):
                    value[i] = mapping_to_frozenset(item)
            aggregation[key] = tuple(value)
        elif isinstance(value, Set):
            aggregation[key] = frozenset(value)
        else:
            aggregation[key] = value

    return frozenset(aggregation.items())
252182
private static String relationalMapperName(Class<?> configuredClass, String resource){
		
		String className = configuredClass.getName().replaceAll("\\.","");
		
		if(isEmpty(resource)) 
			return className;
		
		if(!isPath(resource))
			return write(className, String.valueOf(resource.hashCode()));
		
		String[]dep = resource.split("\\\\");
		if(dep.length<=1)dep = resource.split("/");
		String xml = dep[dep.length-1];
		return write(className, xml.replaceAll("\\.","").replaceAll(" ",""));
	}
1100705
private Map<String, Object> removeUnusedMapEntries(
            AtlasVertex instanceVertex, String propertyName,
            Map<String, Object> currentMap,
            Map<String, Object> newMap, IDataType elementType,
            AttributeInfo attributeInfo)
                    throws AtlasException {

        Map<String, Object> additionalMap = new HashMap<>();
        for (String currentKey : currentMap.keySet()) {

            boolean shouldDeleteKey = !newMap.containsKey(currentKey);
            if (GraphHelper.isReference(elementType)) {

                //Delete the edge reference if its not part of new edges created/updated
                AtlasEdge currentEdge = (AtlasEdge)currentMap.get(currentKey);

                if (!newMap.values().contains(currentEdge)) {

                    boolean deleted =
                            deleteHandler.deleteEdgeReference(currentEdge, elementType.getTypeCategory(), attributeInfo.isComposite, true);
                    if (!deleted) {
                        additionalMap.put(currentKey, currentEdge);
                        shouldDeleteKey = false;
                    }
                }
            }

            if (shouldDeleteKey) {
                String propertyNameForKey = GraphHelper.getQualifiedNameForMapKey(propertyName, currentKey);
                GraphHelper.setProperty(instanceVertex, propertyNameForKey, null);
            }
        }
        return additionalMap;
    }
1194882
public Map<String, Object> convertPropertiesToMap(Properties properties) {
        return properties.entrySet().stream()
                .collect(toLinkedMap(
                        e -> e.getKey().toString(),
                        e -> e.getValue()));
    }
1146917
public static <K, V> Map<K, V> wrap(final String key, final Object value) {
        val map = new LinkedHashMap();
        if (value != null && StringUtils.isNotBlank(key)) {
            map.put(key, value);
        }
        return map;
    }
796463
public Map<String,Object> getTransportProperties()
    {
        Map<String,Object> propMessageTransport = null;
        Record recMessageTransport = Record.makeRecordFromClassName(MessageTransportModel.THICK_CLASS, this);
        recMessageTransport.setKeyArea(MessageTransportModel.CODE_KEY);
        String strMessageType = this.getMessageTransportType();
        recMessageTransport.getField(MessageTransportModel.CODE).setString(strMessageType);
        try {
            if (recMessageTransport.seek(null))
            {
                PropertiesField fldProperty = (PropertiesField)recMessageTransport.getField(MessageTransportModel.PROPERTIES);
                propMessageTransport = fldProperty.loadProperties();
            }
        } catch (DBException ex) {
            ex.printStackTrace();
        } finally {
            recMessageTransport.free();
            recMessageTransport = null;
        }
        return propMessageTransport;
    }
1205371
def connect(self, node, properties=None):
        
        self._check_node(node)

        if not self.definition['model'] and properties:
            raise NotImplementedError(
                "Relationship properties without using a relationship model "
                "is no longer supported."
            )

        params = {}
        rel_model = self.definition['model']
        rp = None  # rel_properties

        if rel_model:
            rp = {}
            # need to generate defaults etc to create fake instance
            tmp = rel_model(**properties) if properties else rel_model()
            # build params and place holders to pass to rel_helper
            for p, v in rel_model.deflate(tmp.__properties__).items():
                rp[p] = '{' + p + '}'
                params[p] = v

            if hasattr(tmp, 'pre_save'):
                tmp.pre_save()

        new_rel = _rel_helper(lhs='us', rhs='them', ident='r', relation_properties=rp, **self.definition)
        q = "MATCH (them), (us) WHERE id(them)={them} and id(us)={self} " \
            "CREATE UNIQUE" + new_rel

        params['them'] = node.id

        if not rel_model:
            self.source.cypher(q, params)
            return True

        rel_ = self.source.cypher(q + " RETURN r", params)[0][0][0]
        rel_instance = self._set_start_end_cls(rel_model.inflate(rel_), node)

        if hasattr(rel_instance, 'post_save'):
            rel_instance.post_save()

        return rel_instance
86818
def to_simple(self, value, **options):  # nolint
        "  "

        # (string, unicode)
        if isinstance(value, basestring):
            return smart_unicode(value)

        # (int, long, float, real, complex, decimal)
        if isinstance(value, Number):
            return float(str(value)) if isinstance(value, Decimal) else value

        # (datetime, data, time)
        if isinstance(value, (datetime, date, time)):
            return self.to_simple_datetime(value)

        # (dict, ordereddict, mutable mapping)
        if isinstance(value, collections.MutableMapping):
            return dict(
                (k, self.to_simple(v, **options)) for k, v in value.items())

        # (tuple, list, set, iterators)
        if isinstance(value, collections.Iterable):
            return [self.to_simple(o, **options) for o in value]

        # (None, True, False)
        if value is None or value is True or value is False:
            return value

        if hasattr(value, 'to_simple') and not inspect.isclass(value):
            return self.to_simple(value.to_simple(self), **options)

        if isinstance(value, Model):
            return self.to_simple_model(value, **options)

        return str(value)