Package hydra.pg

Class Merging

java.lang.Object
hydra.pg.Merging

public class Merging extends Object
Utilities for combining multiple vertex or edge types into a single "merged" vertex or edge type, and correspondingly encoding and decoding vertices and edges of these types.
  • Field Details

  • Constructor Details

    • Merging

      public Merging()
  • Method Details

    • createVertexAdapter

      public static <T, V> Flow<Unit,StatelessAdapter<List<VertexType<T>>,VertexType<T>,Vertex<V>,Vertex<V>>> createVertexAdapter(List<VertexType<T>> types, Merging.IdAdapters<T,V> idAdapters, boolean unifyIdenticalTypes)
      Create a vertex adapter based on a list of vertex types and given id adapters.
      Type Parameters:
      T - the type parameter for vertex types
      V - the value type for vertex properties
      Parameters:
      types - the list of vertex types to merge
      idAdapters - the id adapters for encoding/decoding vertex and edge ids
      unifyIdenticalTypes - whether to unify identical property types across vertex types
      Returns:
      a flow producing a stateless adapter for the merged vertex type
    • createEdgeAdapter

      public static <T, V> Flow<Unit,StatelessAdapter<List<EdgeType<T>>,EdgeType<T>,Edge<V>,Edge<V>>> createEdgeAdapter(List<EdgeType<T>> types, Merging.IdAdapters<T,V> idAdapters, boolean unifyIdenticalTypes)
      Create an edge adapter based on a list of edge types and given id adapters.
      Type Parameters:
      T - the type parameter for edge types
      V - the value type for edge properties
      Parameters:
      types - the list of edge types to merge
      idAdapters - the id adapters for encoding/decoding vertex and edge ids
      unifyIdenticalTypes - whether to unify identical property types across edge types
      Returns:
      a flow producing a stateless adapter for the merged edge type
    • stringIdAdapters

      public static <T, V> Merging.IdAdapters<T,V> stringIdAdapters(T stringType, Function<V,Flow<Unit,String>> fromLiteral, Function<String,V> toLiteral)
      Create string-based id adapters for merging vertex and edge types.
      Type Parameters:
      T - the type parameter for id types
      V - the value type for ids
      Parameters:
      stringType - the string type to use for merged ids
      fromLiteral - function to extract a string from a literal value
      toLiteral - function to create a literal value from a string
      Returns:
      id adapters configured for string-based ids