merge method

RdfGraph merge(
  1. RdfGraph other
)

Merges this graph with another, producing a new graph

This creates a union of the two graphs, combining all their triples. Duplicate triples are automatically removed, as RDF graphs are mathematical sets where each triple can appear at most once. The order of triples in the resulting graph is not guaranteed to be preserved from either source graph.

Parameters:

  • other The graph to merge with this one

Returns: A new graph containing all unique triples from both graphs, with duplicates removed and no guaranteed ordering

Example:

// Merge two graphs to combine their information
final combinedGraph = personGraph.merge(addressGraph);

// Duplicate triples between graphs are automatically removed
final merged = graph1.merge(graph2); // Each unique triple appears only once

Implementation

RdfGraph merge(RdfGraph other) {
  return withTriples(other._triples);
}