Class Graph.Builder

java.lang.Object
org.geneontology.obographs.core.model.Graph.Builder
Enclosing class:
Graph

@NotThreadSafe public static final class Graph.Builder extends Object
Builds instances of type Graph. Initialize attributes and then invoke the build() method to create an immutable instance.

Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

  • Constructor Details

    • Builder

      public Builder()
      Creates a builder for Graph instances.
       new Graph.Builder()
          .id(String) // optional id
          .lbl(String) // optional lbl
          .meta(org.geneontology.obographs.core.model.Meta | null) // nullable meta
          .addNode|addAllNodes(Node) // nodes elements
          .addEdge|addAllEdges(Edge) // edges elements
          .addEquivalentNodesSet|addAllEquivalentNodesSets(org.geneontology.obographs.core.model.axiom.EquivalentNodesSet) // equivalentNodesSets elements
          .addLogicalDefinitionAxiom|addAllLogicalDefinitionAxioms(org.geneontology.obographs.core.model.axiom.LogicalDefinitionAxiom) // logicalDefinitionAxioms elements
          .addDomainRangeAxiom|addAllDomainRangeAxioms(org.geneontology.obographs.core.model.axiom.DomainRangeAxiom) // domainRangeAxioms elements
          .addPropertyChainAxiom|addAllPropertyChainAxioms(org.geneontology.obographs.core.model.axiom.PropertyChainAxiom) // propertyChainAxioms elements
          .build();
       
  • Method Details

    • from

      public final Graph.Builder from(AbstractGraph instance)
      Fill a builder with attribute values from the provided AbstractGraph instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • id

      public final Graph.Builder id(String id)
      Initializes the value for the id attribute.

      If not set, this attribute will have a default value as returned by the initializer of id.

      Parameters:
      id - The value for id
      Returns:
      this builder for use in a chained invocation
    • lbl

      public final Graph.Builder lbl(String lbl)
      Initializes the value for the lbl attribute.

      If not set, this attribute will have a default value as returned by the initializer of lbl.

      Parameters:
      lbl - The value for lbl
      Returns:
      this builder for use in a chained invocation
    • meta

      public final Graph.Builder meta(@Nullable Meta meta)
      Initializes the value for the meta attribute.
      Parameters:
      meta - The value for meta (can be null)
      Returns:
      this builder for use in a chained invocation
    • addNode

      public final Graph.Builder addNode(Node element)
      Adds one element to nodes list.
      Parameters:
      element - A nodes element
      Returns:
      this builder for use in a chained invocation
    • addNodes

      public final Graph.Builder addNodes(Node... elements)
      Adds elements to nodes list.
      Parameters:
      elements - An array of nodes elements
      Returns:
      this builder for use in a chained invocation
    • nodes

      public final Graph.Builder nodes(Iterable<? extends Node> elements)
      Sets or replaces all elements for nodes list.
      Parameters:
      elements - An iterable of nodes elements
      Returns:
      this builder for use in a chained invocation
    • addAllNodes

      public final Graph.Builder addAllNodes(Iterable<? extends Node> elements)
      Adds elements to nodes list.
      Parameters:
      elements - An iterable of nodes elements
      Returns:
      this builder for use in a chained invocation
    • addEdge

      public final Graph.Builder addEdge(Edge element)
      Adds one element to edges list.
      Parameters:
      element - A edges element
      Returns:
      this builder for use in a chained invocation
    • addEdges

      public final Graph.Builder addEdges(Edge... elements)
      Adds elements to edges list.
      Parameters:
      elements - An array of edges elements
      Returns:
      this builder for use in a chained invocation
    • edges

      public final Graph.Builder edges(Iterable<? extends Edge> elements)
      Sets or replaces all elements for edges list.
      Parameters:
      elements - An iterable of edges elements
      Returns:
      this builder for use in a chained invocation
    • addAllEdges

      public final Graph.Builder addAllEdges(Iterable<? extends Edge> elements)
      Adds elements to edges list.
      Parameters:
      elements - An iterable of edges elements
      Returns:
      this builder for use in a chained invocation
    • addEquivalentNodesSet

      public final Graph.Builder addEquivalentNodesSet(EquivalentNodesSet element)
      Adds one element to equivalentNodesSets list.
      Parameters:
      element - A equivalentNodesSets element
      Returns:
      this builder for use in a chained invocation
    • addEquivalentNodesSets

      public final Graph.Builder addEquivalentNodesSets(EquivalentNodesSet... elements)
      Adds elements to equivalentNodesSets list.
      Parameters:
      elements - An array of equivalentNodesSets elements
      Returns:
      this builder for use in a chained invocation
    • equivalentNodesSets

      public final Graph.Builder equivalentNodesSets(Iterable<? extends EquivalentNodesSet> elements)
      Sets or replaces all elements for equivalentNodesSets list.
      Parameters:
      elements - An iterable of equivalentNodesSets elements
      Returns:
      this builder for use in a chained invocation
    • addAllEquivalentNodesSets

      public final Graph.Builder addAllEquivalentNodesSets(Iterable<? extends EquivalentNodesSet> elements)
      Adds elements to equivalentNodesSets list.
      Parameters:
      elements - An iterable of equivalentNodesSets elements
      Returns:
      this builder for use in a chained invocation
    • addLogicalDefinitionAxiom

      public final Graph.Builder addLogicalDefinitionAxiom(LogicalDefinitionAxiom element)
      Adds one element to logicalDefinitionAxioms list.
      Parameters:
      element - A logicalDefinitionAxioms element
      Returns:
      this builder for use in a chained invocation
    • addLogicalDefinitionAxioms

      public final Graph.Builder addLogicalDefinitionAxioms(LogicalDefinitionAxiom... elements)
      Adds elements to logicalDefinitionAxioms list.
      Parameters:
      elements - An array of logicalDefinitionAxioms elements
      Returns:
      this builder for use in a chained invocation
    • logicalDefinitionAxioms

      public final Graph.Builder logicalDefinitionAxioms(Iterable<? extends LogicalDefinitionAxiom> elements)
      Sets or replaces all elements for logicalDefinitionAxioms list.
      Parameters:
      elements - An iterable of logicalDefinitionAxioms elements
      Returns:
      this builder for use in a chained invocation
    • addAllLogicalDefinitionAxioms

      public final Graph.Builder addAllLogicalDefinitionAxioms(Iterable<? extends LogicalDefinitionAxiom> elements)
      Adds elements to logicalDefinitionAxioms list.
      Parameters:
      elements - An iterable of logicalDefinitionAxioms elements
      Returns:
      this builder for use in a chained invocation
    • addDomainRangeAxiom

      public final Graph.Builder addDomainRangeAxiom(DomainRangeAxiom element)
      Adds one element to domainRangeAxioms list.
      Parameters:
      element - A domainRangeAxioms element
      Returns:
      this builder for use in a chained invocation
    • addDomainRangeAxioms

      public final Graph.Builder addDomainRangeAxioms(DomainRangeAxiom... elements)
      Adds elements to domainRangeAxioms list.
      Parameters:
      elements - An array of domainRangeAxioms elements
      Returns:
      this builder for use in a chained invocation
    • domainRangeAxioms

      public final Graph.Builder domainRangeAxioms(Iterable<? extends DomainRangeAxiom> elements)
      Sets or replaces all elements for domainRangeAxioms list.
      Parameters:
      elements - An iterable of domainRangeAxioms elements
      Returns:
      this builder for use in a chained invocation
    • addAllDomainRangeAxioms

      public final Graph.Builder addAllDomainRangeAxioms(Iterable<? extends DomainRangeAxiom> elements)
      Adds elements to domainRangeAxioms list.
      Parameters:
      elements - An iterable of domainRangeAxioms elements
      Returns:
      this builder for use in a chained invocation
    • addPropertyChainAxiom

      public final Graph.Builder addPropertyChainAxiom(PropertyChainAxiom element)
      Adds one element to propertyChainAxioms list.
      Parameters:
      element - A propertyChainAxioms element
      Returns:
      this builder for use in a chained invocation
    • addPropertyChainAxioms

      public final Graph.Builder addPropertyChainAxioms(PropertyChainAxiom... elements)
      Adds elements to propertyChainAxioms list.
      Parameters:
      elements - An array of propertyChainAxioms elements
      Returns:
      this builder for use in a chained invocation
    • propertyChainAxioms

      public final Graph.Builder propertyChainAxioms(Iterable<? extends PropertyChainAxiom> elements)
      Sets or replaces all elements for propertyChainAxioms list.
      Parameters:
      elements - An iterable of propertyChainAxioms elements
      Returns:
      this builder for use in a chained invocation
    • addAllPropertyChainAxioms

      public final Graph.Builder addAllPropertyChainAxioms(Iterable<? extends PropertyChainAxiom> elements)
      Adds elements to propertyChainAxioms list.
      Parameters:
      elements - An iterable of propertyChainAxioms elements
      Returns:
      this builder for use in a chained invocation
    • build

      public Graph build()
      Builds a new Graph.
      Returns:
      An immutable instance of Graph
      Throws:
      IllegalStateException - if any required attributes are missing