Quad.fromTriple constructor

Quad.fromTriple(
  1. Triple triple, [
  2. RdfGraphName? graphName
])

Creates a quad from an existing triple and optional graph name

This factory constructor provides convenient conversion from Triple to Quad by adding graph context. If no graph name is provided, the quad will belong to the default graph.

Parameters:

  • triple The RDF triple to convert
  • graphName Optional graph name (null = default graph)

Returns: A new Quad with the same S-P-O components as the triple plus the graph context.

Example:

final triple = Triple(alice, foaf.knows, bob);
final namedQuad = Quad.fromTriple(triple, socialGraphName);
final defaultQuad = Quad.fromTriple(triple); // default graph

Implementation

Quad.fromTriple(Triple triple, [RdfGraphName? graphName])
    : subject = triple.subject,
      predicate = triple.predicate,
      object = triple.object,
      graphName = graphName;