public static Vertex createVertex(final Attachable<Vertex> attachableVertex, final Graph hostGraph) {
            final Vertex baseVertex = attachableVertex.get();
            final Vertex vertex = hostGraph.features().vertex().willAllowId(baseVertex.id()) ?
                    hostGraph.addVertex(T.id, baseVertex.id(), T.label, baseVertex.label()) :
                    hostGraph.addVertex(T.label, baseVertex.label());
            final Map<String, List<VertexProperty<Object>>> propertyMap = new HashMap<>();
            baseVertex.properties().forEachRemaining(vp -> propertyMap.computeIfAbsent(vp.key(), k -> new ArrayList<>()).add(vp));
            for (Map.Entry<String, List<VertexProperty<Object>>> entry : propertyMap.entrySet()) {
                final VertexProperty.Cardinality cardinality = hostGraph.features().vertex().getCardinality(entry.getKey());
                if (VertexProperty.Cardinality.single == cardinality && entry.getValue().size() > 1) {
                    logger.warn("{} has SINGLE cardinality but with more than one value: {}. Only last value will be retained.",
                        entry.getKey(), entry.getValue());
                }
                for (VertexProperty<Object> vp : entry.getValue()) {
                    final VertexProperty<Object> vertexProperty = hostGraph.features().vertex().properties().willAllowId(vp.id()) ?
                        vertex.property(cardinality, vp.key(), vp.value(), T.id, vp.id()) :
                        vertex.property(cardinality, vp.key(), vp.value());
                    vp.properties().forEachRemaining(p -> vertexProperty.property(p.key(), p.value()));
                }
            }
            return vertex;
        }
A collection of general methods of attachment. Note that more efficient methods of attachment might exist
if the user knows the source data being attached and the features of the graph that the data is being
attached to.
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/Attachable.java