surfacevisualizationmermaid_triples
Visualizationpipeline · returns table

MERMAID_TRIPLES

Convert triples to Mermaid graph visualization

Table-in, table-out — composes downstream of SELECTs.

visualizationllmpipeline-composabletext

Syntax

THEN MERMAID_TRIPLES
THEN MERMAID_TRIPLES({{ subject_col }})
THEN MERMAID_TRIPLES({{ subject_col }}, {{ predicate_col }}, {{ object_col }})
THEN MERMAID_TRIPLES({{ subject_col }}, {{ predicate_col }}, {{ object_col }}, {{ direction }})

Arguments

nametypedescription
subject_col(optional)VARCHAR
predicate_col(optional)VARCHAR
object_col(optional)VARCHAR
direction(optional)VARCHAR
_tableTABLE

About

PIPELINE cascade for converting triples data to Mermaid graph visualization. Uses pure Python - no LLM calls. Usage: SELECT * FROM docs, LATERAL triples_rows(content) t THEN MERMAID_TRIPLES SELECT src AS subject, rel AS predicate, dst AS object FROM edges THEN MERMAID_TRIPLES('src', 'rel', 'dst')

Examples

Produces Mermaid graph output from subject-predicate-object triples

SELECT
  *
FROM
  (
    VALUES
      ('Alice', 'knows', 'Bob'),
      ('Bob', 'reports_to', 'Carol')
  ) AS t (subject, predicate, object) THEN MERMAID_TRIPLES THEN PYTHON (
    'result = pd.DataFrame({"ok":[df.iloc[0]["format"] == "mermaid-graph" and "Alice" in df.iloc[0]["mermaid"] and "Bob" in df.iloc[0]["mermaid"]]})'
  )

Nearby rabbit holes

same domain
Climb back to The Looking Glass