Class Schema

java.lang.Object
dev.roanh.gmark.core.graph.Schema

public class Schema extends Object
Represents the schema configuration of a graph. This includes the set of predicates (edge labels), node types (node labels) and the configuration for how often edges with certain predicates are present between nodes of a certain type.
See Also:
  • Field Details

    • edges

      private List<Edge> edges
      List of schema edge configurations.
    • predicates

      private List<Predicate> predicates
      List of all valid edge predicates.
    • types

      private List<Type> types
      List of all valid node types.
  • Constructor Details

    • Schema

      public Schema(List<Edge> edges, List<Type> types, List<Predicate> predicates)
      Constructs a new schema with the given set of edges, node types and predicates.
      Parameters:
      edges - The list of schema edges.
      types - The list of node types.
      predicates - The list of edge predicates.
  • Method Details

    • getPredicates

      public List<Predicate> getPredicates()
      Gets all predicates for this schema.
      Returns:
      All predicates (edge labels).
    • getTypes

      public List<Type> getTypes()
      Gets all node types for this schema.
      Returns:
      All node types.
    • getEdges

      public List<Edge> getEdges()
      Gets all edge configuration objects for this schema.
      Returns:
      All edge configuration objects.
    • getTypeCount

      public int getTypeCount()
      Gets the total number of distinct node types for this schema.
      Returns:
      The total number of node types.
      See Also:
    • getPredicateCount

      public int getPredicateCount()
      Gets the total number of distinct predicates for this schema. Note: this does not include inverse predicates.
      Returns:
      The total number of predicates.
      See Also:
    • getEdgeCount

      public int getEdgeCount()
      Gets the total number of edge configurations in this schema.
      Returns:
      The total number of edge configurations.
      See Also:
    • asGraph

      public ConfigGraph asGraph()
      Gets this schema in graph format where all types are nodes and all edge configurations edges between these type nodes.
      Returns:
      This schema in graph format.
    • getType

      public Type getType(int id)
      Gets a type from this graph schema by its ID.
      Parameters:
      id - The ID of the type to get.
      Returns:
      The type with the given ID.
    • getType

      public Type getType(String alias)
      Gets a type from this graph schema by its textual alias name.
      Parameters:
      alias - The type alias.
      Returns:
      The type with the given alias.
    • getPredicate

      public Predicate getPredicate(int id)
      Gets a predicate from this graph schema by its ID.
      Parameters:
      id - The ID of the predicate to get.
      Returns:
      The predicate with the given ID.
    • getPredicate

      public Predicate getPredicate(String alias)
      Gets a predicate from this graph schema by its textual alias name.
      Parameters:
      alias - The predicate alias.
      Returns:
      The predicate with the given alias.