Garphield

Build, style, lay out, share and export network graphs from tables and graph files.

我该使用它吗

质量与安全性

A
描述质量
100%
模式完整度
95%
命名质量
80%
投毒风险
100%
权限匹配度
100%
协议合规性
100%

基于对工具定义和协议合规性的自动分析。

上下文开销

~14,534token 数(工具定义)
~17.0 KB典型响应大小
对注意力有显著影响(占 128k 上下文窗口的 11.35%)

这是每次将服务器的工具加载到模型上下文窗口时所消耗的大致 token 数。数值越高,可用于其他任务的注意力就越少。

安装

一键安装

将以下内容添加到你的 `claude_desktop_config.json` 文件中:

{
  "mcpServers": {
    "garphield": {
      "command": "npx",
      "args": [
        "garphield-mcp"
      ]
    }
  }
}

可运行的软件包

npmgarphield-mcp0.1.3stdio

远程端点

https://mcp.garphield.com/mcpstreamable-http

它能做什么

工具清单

工具(9)

🟢 只读🟡 写入🔴 删除⚪ 未知
🟡garphield_create(name, graph, table, file, url)

Create a stored graph document from data and return its reference (doc). Pass exactly one of: graph (node-link JSON: nodes [{id, ...attributes}] and edges [{source, target, ...attributes}]), table (CSV text for links, optionally nodes), file (a GEXF, GraphML, GML, node-link JSON, Cytoscape JSON, a Gephi Lite workspace, Kumu JSON, edge list, Matrix Market, graph6 or .gph text), or url. url fetches from three public sources only, and refuses every other site: a file on GitHub (raw.githubusercontent.com, a github.com/<owner>/<repo>/blob/... page, or a gist's raw link), a Google Sheet shared with anyone with the link or published to the web, or a table on a Wikipedia article (<lang>.wikipedia.org/wiki/<Title>; url.wikitable picks which). For a table, name the link columns with url.source and url.target. The result lists the bindable fields with their ids and types, the names a binding accepts.

输入模式

{
  "type": "object",
  "properties": {
    "name": {
      "description": "Title shown in the workbench and in share previews.",
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "graph": {
      "type": "object",
      "properties": {
        "directed": {
          "description": "Default false.",
          "type": "boolean"
        },
        "multigraph": {
          "description": "NetworkX's flag, accepted and ignored: a repeated pair keeps its first link.",
          "type": "boolean"
        },
        "graph": {
          "description": "Graph attributes (NetworkX's graph key), kept on the document.",
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {}
        },
        "nodes": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "number"
                  }
                ]
              }
            },
            "required": [
              "id"
            ],
            "additionalProperties": {},
            "description": "A node: its id plus any attributes (label, role, x, y, ...)."
          }
        },
        "edges": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "number"
                  }
                ]
              },
              "target": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "number"
                  }
                ]
              }
            },
            "required": [
              "source",
              "target"
            ],
            "additionalProperties": {},
            "description": "A link between two node ids, plus any attributes (weight, ...)."
          }
        },
        "links": {
          "description": "NetworkX's older name for edges; pass one or the other.",
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "number"
                  }
                ]
              },
              "target": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "number"
                  }
                ]
              }
            },
            "required": [
              "source",
              "target"
            ],
            "additionalProperties": {},
            "description": "A link between two node ids, plus any attributes (weight, ...)."
          }
        }
      },
      "additionalProperties": false,
      "description": "Node-link JSON. Nodes named only by a link are created. Ids are stored as strings."
    },
    "table": {
      "type": "object",
      "properties": {
        "edges": {
          "type": "string",
          "minLength": 1,
          "description": "Links table: CSV, TSV or semicolon text with a header row."
        },
        "nodes": {
          "description": "Optional node table with a header row; its rows add attributes.",
          "type": "string",
          "minLength": 1
        },
        "source": {
          "description": "Links column holding the source id. Default \"source\".",
          "type": "string",
          "minLength": 1
        },
        "target": {
          "description": "Links column holding the target id. Default \"target\".",
          "type": "string",
          "minLength": 1
        },
        "nodeId": {
          "description": "Node table column holding the id. Default \"id\".",
          "type": "string",
          "minLength": 1
        },
        "directed": {
          "description": "Default false.",
          "type": "boolean"
        }
      },
      "required": [
        "edges"
      ],
      "additionalProperties": false,
      "description": "Tables as text. Columns match case-insensitively; numeric cells become numbers and blank cells stay missing."
    },
    "file": {
      "type": "object",
      "properties": {
        "format": {
          "type": "string",
          "enum": [
            "gph",
            "nodelink",
            "compactjson",
            "cyjs",
            "gephilite",
            "kumu",
            "gexf",
            "graphml",
            "gml",
            "edgelist",
            "matrixmarket",
            "graph6",
            "sparse6",
            "digraph6"
          ]
        },
        "text": {
          "type": "string",
          "minLength": 1,
          "description": "The file's contents."
        }
      },
      "required": [
        "format",
        "text"
      ],
      "additionalProperties": false,
      "description": "A graph file in a format the workbench opens (not DOT)."
    },
    "url": {
      "type": "object",
      "properties": {
        "href": {
          "type": "string",
          "minLength": 1,
          "maxLength": 2048,
          "description": "An https link to a GitHub file (raw.githubusercontent.com, github.com/<owner>/<repo>/blob/..., gist.githubusercontent.com), a Google Sheet shared publicly or published (docs.google.com/spreadsheets/d/...; #gid= picks the tab), or a Wikipedia article (<lang>.wikipedia.org/wiki/<Title>). Other sites are refused."
        },
        "source": {
          "description": "For a table (CSV/TSV file, sheet, Wikipedia table): the column holding the source id. Default \"source\".",
          "type": "string",
          "minLength": 1
        },
        "target": {
          "description": "For a table: the column holding the target id. Default \"target\".",
          "type": "string",
          "minLength": 1
        },
        "directed": {
          "description": "Default false.",
          "type": "boolean"
        },
        "wikitable": {
          "description": "Wikipedia only: which wikitable on the page, counting from 1 in page order. Default 1.",
          "type": "integer",
          "minimum": 1,
          "maximum": 1000
        }
      },
      "required": [
        "href"
      ],
      "additionalProperties": false,
      "description": "Data fetched from a public link. A table's columns match case-insensitively; when source or target is missing, the error lists the columns."
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}
🟢garphield_inspect(doc, include)

Describe a stored graph: size, density, connected components, whether it has saved positions, its data fields (ids to bind, type num or cat, missing counts, ranges or example values; temporal: true marks a date field, listed as (date), which a time filter can read, and years: true a numeric field of years), the channels and the types each accepts, the computed algorithms, the current view config (bindings, filters and saved sets), and a quality grade of the saved layout. The field ids it lists are the names a binding accepts.

输入模式

{
  "type": "object",
  "properties": {
    "doc": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1024,
      "description": "Document reference: a stored document id, a file path, or \"current\" in the workbench."
    },
    "include": {
      "description": "Sections to return. Default [\"fields\", \"channels\", \"config\"]. \"algorithms\" lists computed sources (degree, louvain, ...) with their params; \"scales\" gives what each binding draws (every value's mark, label and count, or the numeric domain and range), in the form a binding's scale takes; \"quality\" grades the saved positions.",
      "minItems": 1,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "fields",
          "algorithms",
          "channels",
          "config",
          "scales",
          "quality"
        ]
      }
    }
  },
  "required": [
    "doc"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}
🔴garphield_style(doc, bindings, replace, layout, edgeDirection, ...)

Bind data fields or computed algorithms to visual channels, and set the layout mode, how links show direction (arrows), theme, tooltip templates for nodes and links, drawing values (appearance: link width and opacity, node size, curvature, label placement), structure (Group by rings, the Backbone, or a merge into one node per field value) and a time filter on a date field (timeFilter) of a stored graph. Example binding: {"channel": "edgeWidth", "field": "amount_bn"}; a bare field name resolves to the field on the channel's target (node or edge). Strict and atomic: if any entry is invalid nothing is written and each problem comes back with a path, the expected values and suggestions. Merges by channel unless replace is true. The result echoes every stored binding. preview: true also returns a small image of the styled graph; it adds a render (10-20 s on the hosted server), so ask for it when you mean to look.

输入模式

{
  "type": "object",
  "properties": {
    "doc": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1024,
      "description": "Document reference: a stored document id, a file path, or \"current\" in the workbench."
    },
    "bindings": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "channel": {
            "type": "string",
            "minLength": 1,
            "description": "Channel id, e.g. color, size, edgeWidth, edgeColor, hull."
          },
          "field": {
            "description": "A data field by name (\"amount_bn\") or id (\"efield:amount_bn\"); a bare name resolves to the field on the channel's target.",
            "type": "string",
            "minLength": 1
          },
          "algorithm": {
            "description": "A computed source id, e.g. degree, pagerank, louvain.",
            "type": "string",
            "minLength": 1
          },
          "set": {
            "description": "A set id saved in the document.",
            "type": "string",
            "minLength": 1
          },
          "params": {
            "description": "Algorithm params; each must be declared and in range.",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "source": {
            "description": "The stored wire form instead of field/algorithm/set; requires resultType.",
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "algorithm",
                  "field",
                  "transform",
                  "set"
                ]
              },
              "id": {
                "type": "string",
                "minLength": 1
              },
              "target": {
                "type": "string",
                "enum": [
                  "node",
                  "edge"
                ]
              },
              "params": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              "temporal": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "instant"
                  }
                },
                "required": [
                  "kind"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "resultType": {
            "description": "Override the source's type, e.g. cat to colour a numeric field by value. Required with source.",
            "type": "string",
            "enum": [
              "num",
              "cat",
              "set",
              "trf"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "scale": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "categories": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "value": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "number"
                            },
                            {
                              "type": "boolean"
                            }
                          ],
                          "description": "A data value, matched by its text form: 3 and \"3\" are the same value. A set binding's values are true (member) and false."
                        },
                        "mark": {
                          "type": "string",
                          "description": "The mark for this value: a CSS colour (#rrggbb, rgb(), hsl()) for color, edgeColor, border, hull and contour; circle, square, triangle or diamond for shape; solid or dashed for edgeStyle; a glyph (text, inline <svg>, or image URL) for glyph."
                        },
                        "label": {
                          "type": "string",
                          "description": "What the legend shows for this value, instead of the value."
                        }
                      },
                      "required": [
                        "value"
                      ],
                      "additionalProperties": false
                    },
                    "description": "One entry per value, in legend order. Values not listed keep the default palette or shape cycle."
                  },
                  "missing": {
                    "type": "object",
                    "properties": {
                      "mark": {
                        "type": "string",
                        "description": "The mark for this value: a CSS colour (#rrggbb, rgb(), hsl()) for color, edgeColor, border, hull and contour; circle, square, triangle or diamond for shape; solid or dashed for edgeStyle; a glyph (text, inline <svg>, or image URL) for glyph."
                      },
                      "label": {
                        "type": "string",
                        "description": "What the legend shows for this value, instead of the value."
                      }
                    },
                    "additionalProperties": false,
                    "description": "The mark and label for items with no value."
                  }
                },
                "required": [
                  "categories"
                ],
                "additionalProperties": false,
                "description": "Marks and labels for a cat or set binding's values."
              },
              {
                "type": "object",
                "properties": {
                  "domain": {
                    "type": "array",
                    "prefixItems": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "number"
                      }
                    ],
                    "description": "The data values that map to the two ends of the range. Values outside it are clamped."
                  },
                  "range": {
                    "anyOf": [
                      {
                        "type": "array",
                        "prefixItems": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "number"
                          }
                        ]
                      },
                      {
                        "minItems": 2,
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    ],
                    "description": "Two lengths in px (size: node radius; edgeWidth: link width), or two or more CSS colours as ramp stops (color, edgeColor)."
                  }
                },
                "required": [
                  "domain",
                  "range"
                ],
                "additionalProperties": false,
                "description": "A pinned domain and range for a num binding."
              }
            ],
            "description": "Explicit marks for the binding's values. Omit it to use the defaults."
          },
          "intensity": {
            "description": "hull and heatmap only: drawing strength, 0-1.",
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "bandwidth": {
            "description": "contour and heatmap only: kernel bandwidth as a multiple of the automatic one, half of Scott's rule on each group's spread (in kilometres on a Geo basemap). Under 1 separates tighter clusters; default 1.",
            "type": "number",
            "minimum": 0.25,
            "maximum": 4
          },
          "levels": {
            "description": "contour only: the regions to outline, as the share of each group's density each encloses (whole percentages); default [50, 75, 90].",
            "minItems": 1,
            "maxItems": 5,
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 99
            }
          },
          "remove": {
            "description": "Unbind this channel. Pass only channel with it.",
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "channel"
        ],
        "additionalProperties": false,
        "description": "One binding: a channel plus exactly one of field, algorithm, set or source; or a channel with remove."
      }
    },
    "replace": {
      "description": "true replaces every binding with this list; false (default) merges by channel.",
      "type": "boolean"
    },
    "layout": {
      "description": "Layout the workbench uses on open. Sets config only and computes no positions.",
      "type": "string",
      "enum": [
        "force",
        "levels",
        "geo"
      ]
    },
    "edgeDirection": {
      "description": "How links show their direction in a directed graph: arrow (arrowheads), tapered (each link narrows toward its target, the workbench default), flow (animated) or line (none).",
      "type": "string",
      "enum": [
        "line",
        "tapered",
        "arrow",
        "flow"
      ]
    },
    "theme": {
      "description": "Default theme for embed links (and the saved view, if the document has one). null clears it; a saved view returns to the light default.",
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "light",
            "dark",
            "seafoam"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "tooltipTemplate": {
      "description": "Embed tooltip Markdown with {attribute} placeholders, e.g. \"### {label}\\n{role}\". null clears it.",
      "anyOf": [
        {
          "type": "string",
          "maxLength": 4000
        },
        {
          "type": "null"
        }
      ]
    },
    "linkTooltipTemplate": {
      "description": "Embed hover card for links: the same Markdown over link attributes, plus {source} and {target} (the end nodes' labels), e.g. \"### {source} to {target}\\n{tasks} tasks\". A line that is only {@markdown field} renders that attribute's own lists and emphasis. Without it links get no card; null clears it.",
      "anyOf": [
        {
          "type": "string",
          "maxLength": 4000
        },
        {
          "type": "null"
        }
      ]
    },
    "structure": {
      "type": "object",
      "properties": {
        "groups": {
          "description": "Group by: nodes drawn as dots in nested rings, one ring per value. null turns it off.",
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "by": {
                  "maxItems": 4,
                  "type": "array",
                  "items": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "description": "A node field."
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "algorithm"
                          },
                          "id": {
                            "type": "string",
                            "minLength": 1,
                            "description": "A categorical node algorithm: louvain, leiden, label_propagation, asyn_lpa, greedy_modularity, k_clique, spectral_bisection, kernighan_lin, connected_components."
                          }
                        },
                        "required": [
                          "kind",
                          "id"
                        ],
                        "additionalProperties": false,
                        "description": "An algorithm's groups, written as a binding source: connected_components draws one ring per connected component, with isolated nodes in one ring."
                      }
                    ]
                  },
                  "description": "Levels, outer to inner, each once: node fields and algorithms, e.g. [{\"kind\": \"algorithm\", \"id\": \"connected_components\"}, \"team\"]; [] groups by nested Louvain communities."
                },
                "links": {
                  "description": "Links drawn besides those at hovered or selected nodes: none (default), inside (within the innermost group) or all (faded).",
                  "type": "string",
                  "enum": [
                    "none",
                    "inside",
                    "between",
                    "all"
                  ]
                }
              },
              "required": [
                "by"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "backbone": {
          "description": "Backbone: only the links that carry the structure. The workbench draws it where it can build one for the graph. null turns it off.",
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "background": {
                  "description": "How links outside the Backbone draw: auto (default), faded or hidden.",
                  "type": "string",
                  "enum": [
                    "auto",
                    "faded",
                    "hidden"
                  ]
                }
              },
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "merge": {
          "description": "Merge: one node per value of the fields, with the links between two merged nodes combined into one per direction. null turns it off.",
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "by": {
                  "minItems": 1,
                  "maxItems": 4,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  },
                  "description": "Node fields; one merged node per value, each field once."
                },
                "label": {
                  "description": "Label template over the merged fields: {field}, {members} (how many nodes merged), and {field by other} (field per value of other, joined \" → \"), e.g. \"{role}  {tasks by side}\".",
                  "type": "string",
                  "maxLength": 400
                },
                "combine": {
                  "description": "Rules per node or link field. Defaults: numbers sum, the size channel's field adds areas, categories keep the most common value, long text is listed.",
                  "type": "object",
                  "propertyNames": {
                    "type": "string",
                    "minLength": 1
                  },
                  "additionalProperties": {
                    "type": "string",
                    "enum": [
                      "sum",
                      "mean",
                      "min",
                      "max",
                      "area",
                      "first",
                      "mode",
                      "list"
                    ]
                  }
                }
              },
              "required": [
                "by"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false,
      "description": "How the workbench and embeds draw the graph on open: Group by, Backbone and merge. Each part changes only what is given. A merge draws with neither groups nor the Backbone: turning it on turns them off, and turning either on turns it off. The network and its positions are unchanged."
    },
    "timeFilter": {
      "description": "A time filter on a date field: only what is dated inside the window shows. It replaces the document's time filter; null removes it. An embed with chrome=time draws a time bar for it, and a host page moves it with the driver's setTimeFilter.",
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "field": {
              "type": "string",
              "minLength": 1,
              "description": "A date field, by name (\"published\") or id (\"field:published\", \"efield:sent\"): one whose values are YYYY-MM-DD dates or RFC3339 timestamps, which inspect lists as (date)."
            },
            "to": {
              "description": "End of the window, inclusive. Default: the field's latest date, so every dated item shows.",
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1
                },
                {
                  "type": "number"
                }
              ]
            },
            "from": {
              "description": "Start of the window, inclusive; absent or null for none.",
              "anyOf": [
                {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1
                    },
                    {
                      "type": "number"
                    }
                  ],
                  "description": "A date: YYYY-MM-DD (UTC midnight), an RFC3339 timestamp with a timezone, or epoch milliseconds."
                },
                {
                  "type": "null"
                }
              ]
            },
            "mode": {
              "description": "hide (default) leaves out what falls outside the window; fade dims it.",
              "type": "string",
              "enum": [
                "hide",
                "fade"
              ]
            },
            "includeMissing": {
              "description": "Show items with no date as context. Default false.",
              "type": "boolean"
            }
          },
          "required": [
            "field"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "appearance": {
      "description": "The Style pane's drawing values, e.g. {\"linkWidth\": 4, \"linkOpacity\": 0.7}. Merges with the values already set; null returns them all to the defaults.",
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "nodeSize": {
              "description": "Multiplies every node's drawn size. 0.5 to 2.5; default 1.",
              "type": "number",
              "minimum": 0.5,
              "maximum": 2.5
            },
            "nodeGap": {
              "description": "Pixels kept clear between nodes. 0 to 8; default 2.",
              "type": "number",
              "minimum": 0,
              "maximum": 8
            },
            "labelBudget": {
              "description": "Label density: how many node labels show at once. 0.5 to 10; default 1.",
              "type": "number",
              "minimum": 0.5,
              "maximum": 10
            },
            "labelPlacement": {
              "description": "Node labels beside the node (default), centred on it, or text: each node drawn as its label in a box sized to the text, for concept maps.",
              "type": "string",
              "enum": [
                "beside",
                "center",
                "text"
              ]
            },
            "linkWidth": {
              "description": "Multiplies every link's drawn width. 0.1 to 8; default 1.",
              "type": "number",
              "minimum": 0.1,
              "maximum": 8
            },
            "linkOutline": {
              "description": "Link outline width in pixels. 0 to 20; default 2.",
              "type": "number",
              "minimum": 0,
              "maximum": 20
            },
            "arrowSize": {
              "description": "Arrowhead size, for flow links. 0.5 to 3; default 2.",
              "type": "number",
              "minimum": 0.5,
              "maximum": 3
            },
            "curvature": {
              "description": "How far links bend, from 0 (straight) to 100. 0 to 100; default 0.",
              "type": "number",
              "minimum": 0,
              "maximum": 100
            },
            "linkOpacity": {
              "description": "Multiplies link opacity; under 1 is fainter. 0.05 to 2; default 1.",
              "type": "number",
              "minimum": 0.05,
              "maximum": 2
            }
          },
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "preview": {
      "description": "true returns a 600x400 image of the saved graph, so you can check it for overlapping nodes, tangles and unreadable labels and fix them. A render can take 10-20 s and counts toward the host's image limit; the change is saved even when no preview can be made. Default false.",
      "type": "boolean"
    }
  },
  "required": [
    "doc"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}
🔴garphield_story(doc, remove, update, add)

Add, change or remove the scenes of a stored graph's Story: the steps the workbench's Story bar and an embed play through, each a saved view with a caption. A new scene starts from the document's view (as the style tool left it) and takes the same changes the style tool does: bindings, layout, edgeDirection, theme, appearance, structure (Group by, Backbone, merge) and timeFilter, plus a camera and a node to frame. An update applies its changes on top of that scene's view. remove runs first, then update, then add. Strict and atomic: if any part is invalid nothing is written. Example, one scene per year: {"doc": "...", "add": [{"caption": "2001", "timeFilter": {"field": "published", "to": "2001-12-31"}}, {"caption": "2002", "timeFilter": {"field": "published", "to": "2002-12-31"}}]}. The result lists every scene with its id. Call with only doc to list them. An embed opens on the first scene.

输入模式

{
  "type": "object",
  "properties": {
    "doc": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1024,
      "description": "Document reference: a stored document id, a file path, or \"current\" in the workbench."
    },
    "remove": {
      "description": "Ids of scenes to remove. Runs first.",
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "update": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "description": "The scene's id, from an earlier result."
          },
          "caption": {
            "description": "The scene's caption, shown in the Story bar.",
            "type": "string",
            "maxLength": 500
          },
          "bindings": {
            "description": "Bindings for this scene, in the style tool's form.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "channel": {
                  "type": "string",
                  "minLength": 1,
                  "description": "Channel id, e.g. color, size, edgeWidth, edgeColor, hull."
                },
                "field": {
                  "description": "A data field by name (\"amount_bn\") or id (\"efield:amount_bn\"); a bare name resolves to the field on the channel's target.",
                  "type": "string",
                  "minLength": 1
                },
                "algorithm": {
                  "description": "A computed source id, e.g. degree, pagerank, louvain.",
                  "type": "string",
                  "minLength": 1
                },
                "set": {
                  "description": "A set id saved in the document.",
                  "type": "string",
                  "minLength": 1
                },
                "params": {
                  "description": "Algorithm params; each must be declared and in range.",
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                },
                "source": {
                  "description": "The stored wire form instead of field/algorithm/set; requires resultType.",
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "algorithm",
                        "field",
                        "transform",
                        "set"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "target": {
                      "type": "string",
                      "enum": [
                        "node",
                        "edge"
                      ]
                    },
                    "params": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "temporal": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "instant"
                        }
                      },
                      "required": [
                        "kind"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "kind",
                    "id"
                  ],
                  "additionalProperties": false
                },
                "resultType": {
                  "description": "Override the source's type, e.g. cat to colour a numeric field by value. Required with source.",
                  "type": "string",
                  "enum": [
                    "num",
                    "cat",
                    "set",
                    "trf"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "scale": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "categories": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "value": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "boolean"
                                  }
                                ],
                                "description": "A data value, matched by its text form: 3 and \"3\" are the same value. A set binding's values are true (member) and false."
                              },
                              "mark": {
                                "type": "string",
                                "description": "The mark for this value: a CSS colour (#rrggbb, rgb(), hsl()) for color, edgeColor, border, hull and contour; circle, square, triangle or diamond for shape; solid or dashed for edgeStyle; a glyph (text, inline <svg>, or image URL) for glyph."
                              },
                              "label": {
                                "type": "string",
                                "description": "What the legend shows for this value, instead of the value."
                              }
                            },
                            "required": [
                              "value"
                            ],
                            "additionalProperties": false
                          },
                          "description": "One entry per value, in legend order. Values not listed keep the default palette or shape cycle."
                        },
                        "missing": {
                          "type": "object",
                          "properties": {
                            "mark": {
                              "type": "string",
                              "description": "The mark for this value: a CSS colour (#rrggbb, rgb(), hsl()) for color, edgeColor, border, hull and contour; circle, square, triangle or diamond for shape; solid or dashed for edgeStyle; a glyph (text, inline <svg>, or image URL) for glyph."
                            },
                            "label": {
                              "type": "string",
                              "description": "What the legend shows for this value, instead of the value."
                            }
                          },
                          "additionalProperties": false,
                          "description": "The mark and label for items with no value."
                        }
                      },
                      "required": [
                        "categories"
                      ],
                      "additionalProperties": false,
                      "description": "Marks and labels for a cat or set binding's values."
                    },
                    {
                      "type": "object",
                      "properties": {
                        "domain": {
                          "type": "array",
                          "prefixItems": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "number"
                            }
                          ],
                          "description": "The data values that map to the two ends of the range. Values outside it are clamped."
                        },
                        "range": {
                          "anyOf": [
                            {
                              "type": "array",
                              "prefixItems": [
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "number"
                                }
                              ]
                            },
                            {
                              "minItems": 2,
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          ],
                          "description": "Two lengths in px (size: node radius; edgeWidth: link width), or two or more CSS colours as ramp stops (color, edgeColor)."
                        }
                      },
                      "required": [
                        "domain",
                        "range"
                      ],
                      "additionalProperties": false,
                      "description": "A pinned domain and range for a num binding."
                    }
                  ],
                  "description": "Explicit marks for the binding's values. Omit it to use the defaults."
                },
                "intensity": {
                  "description": "hull and heatmap only: drawing strength, 0-1.",
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                },
                "bandwidth": {
                  "description": "contour and heatmap only: kernel bandwidth as a multiple of the automatic one, half of Scott's rule on each group's spread (in kilometres on a Geo basemap). Under 1 separates tighter clusters; default 1.",
                  "type": "number",
                  "minimum": 0.25,
                  "maximum": 4
                },
                "levels": {
                  "description": "contour only: the regions to outline, as the share of each group's density each encloses (whole percentages); default [50, 75, 90].",
                  "minItems": 1,
                  "maxItems": 5,
                  "type": "array",
                  "items": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 99
                  }
                },
                "remove": {
                  "description": "Unbind this channel. Pass only channel with it.",
                  "type": "boolean",
                  "const": true
                }
              },
              "required": [
                "channel"
              ],
              "additionalProperties": false,
              "description": "One binding: a channel plus exactly one of field, algorithm, set or source; or a channel with remove."
            }
          },
          "replace": {
            "description": "true replaces the scene's bindings with this list; false (default) merges by channel.",
            "type": "boolean"
          },
          "layout": {
            "type": "string",
            "enum": [
              "force",
              "levels",
              "geo"
            ]
          },
          "edgeDirection": {
            "type": "string",
            "enum": [
              "line",
              "tapered",
              "arrow",
              "flow"
            ]
          },
          "theme": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "light",
                  "dark",
                  "seafoam"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "appearance": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "nodeSize": {
                    "description": "Multiplies every node's drawn size. 0.5 to 2.5; default 1.",
                    "type": "number",
                    "minimum": 0.5,
                    "maximum": 2.5
                  },
                  "nodeGap": {
                    "description": "Pixels kept clear between nodes. 0 to 8; default 2.",
                    "type": "number",
                    "minimum": 0,
                    "maximum": 8
                  },
                  "labelBudget": {
                    "description": "Label density: how many node labels show at once. 0.5 to 10; default 1.",
                    "type": "number",
                    "minimum": 0.5,
                    "maximum": 10
                  },
                  "labelPlacement": {
                    "description": "Node labels beside the node (default), centred on it, or text: each node drawn as its label in a box sized to the text, for concept maps.",
                    "type": "string",
                    "enum": [
                      "beside",
                      "center",
                      "text"
                    ]
                  },
                  "linkWidth": {
                    "description": "Multiplies every link's drawn width. 0.1 to 8; default 1.",
                    "type": "number",
                    "minimum": 0.1,
                    "maximum": 8
                  },
                  "linkOutline": {
                    "description": "Link outline width in pixels. 0 to 20; default 2.",
                    "type": "number",
                    "minimum": 0,
                    "maximum": 20
                  },
                  "arrowSize": {
                    "description": "Arrowhead size, for flow links. 0.5 to 3; default 2.",
                    "type": "number",
                    "minimum": 0.5,
                    "maximum": 3
                  },
                  "curvature": {
                    "description": "How far links bend, from 0 (straight) to 100. 0 to 100; default 0.",
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "linkOpacity": {
                    "description": "Multiplies link opacity; under 1 is fainter. 0.05 to 2; default 1.",
                    "type": "number",
                    "minimum": 0.05,
                    "maximum": 2
                  }
                },
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "structure": {
            "type": "object",
            "properties": {
              "groups": {
                "description": "Group by: nodes drawn as dots in nested rings, one ring per value. null turns it off.",
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "by": {
                        "maxItems": 4,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "description": "A node field."
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "algorithm"
                                },
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "A categorical node algorithm: louvain, leiden, label_propagation, asyn_lpa, greedy_modularity, k_clique, spectral_bisection, kernighan_lin, connected_components."
                                }
                              },
                              "required": [
                                "kind",
                                "id"
                              ],
                              "additionalProperties": false,
                              "description": "An algorithm's groups, written as a binding source: connected_components draws one ring per connected component, with isolated nodes in one ring."
                            }
                          ]
                        },
                        "description": "Levels, outer to inner, each once: node fields and algorithms, e.g. [{\"kind\": \"algorithm\", \"id\": \"connected_components\"}, \"team\"]; [] groups by nested Louvain communities."
                      },
                      "links": {
                        "description": "Links drawn besides those at hovered or selected nodes: none (default), inside (within the innermost group) or all (faded).",
                        "type": "string",
                        "enum": [
                          "none",
                          "inside",
                          "between",
                          "all"
                        ]
                      }
                    },
                    "required": [
                      "by"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "backbone": {
                "description": "Backbone: only the links that carry the structure. The workbench draws it where it can build one for the graph. null turns it off.",
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "background": {
                        "description": "How links outside the Backbone draw: auto (default), faded or hidden.",
                        "type": "string",
                        "enum": [
                          "auto",
                          "faded",
                          "hidden"
                        ]
                      }
                    },
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "merge": {
                "description": "Merge: one node per value of the fields, with the links between two merged nodes combined into one per direction. null turns it off.",
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "by": {
                        "minItems": 1,
                        "maxItems": 4,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        },
                        "description": "Node fields; one merged node per value, each field once."
                      },
                      "label": {
                        "description": "Label template over the merged fields: {field}, {members} (how many nodes merged), and {field by other} (field per value of other, joined \" → \"), e.g. \"{role}  {tasks by side}\".",
                        "type": "string",
                        "maxLength": 400
                      },
                      "combine": {
                        "description": "Rules per node or link field. Defaults: numbers sum, the size channel's field adds areas, categories keep the most common value, long text is listed.",
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "minLength": 1
                        },
                        "additionalProperties": {
                          "type": "string",
                          "enum": [
                            "sum",
                            "mean",
                            "min",
                            "max",
                            "area",
                            "first",
                            "mode",
                            "list"
                          ]
                        }
                      }
                    },
                    "required": [
                      "by"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "additionalProperties": false,
            "description": "How the workbench and embeds draw the graph on open: Group by, Backbone and merge. Each part changes only what is given. A merge draws with neither groups nor the Backbone: turning it on turns them off, and turning either on turns it off. The network and its positions are unchanged."
          },
          "timeFilter": {
            "description": "A time filter on a date field: only what is dated inside the window shows. It replaces the document's time filter; null removes it. An embed with chrome=time draws a time bar for it, and a host page moves it with the driver's setTimeFilter.",
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "field": {
                    "type": "string",
                    "minLength": 1,
                    "description": "A date field, by name (\"published\") or id (\"field:published\", \"efield:sent\"): one whose values are YYYY-MM-DD dates or RFC3339 timestamps, which inspect lists as (date)."
                  },
                  "to": {
                    "description": "End of the window, inclusive. Default: the field's latest date, so every dated item shows.",
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "number"
                      }
                    ]
                  },
                  "from": {
                    "description": "Start of the window, inclusive; absent or null for none.",
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1
                          },
                          {
                            "type": "number"
                          }
                        ],
                        "description": "A date: YYYY-MM-DD (UTC midnight), an RFC3339 timestamp with a timezone, or epoch milliseconds."
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "mode": {
                    "description": "hide (default) leaves out what falls outside the window; fade dims it.",
                    "type": "string",
                    "enum": [
                      "hide",
                      "fade"
                    ]
                  },
                  "includeMissing": {
                    "description": "Show items with no date as context. Default false.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "field"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "camera": {
            "description": "Where the camera goes. Absent or null leaves it where the previous scene put it (the opening fit for the first).",
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "x": {
                    "type": "number"
                  },
                  "y": {
                    "type": "number"
                  },
                  "ratio": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "angle": {
                    "type": "number"
                  }
                },
                "required": [
                  "x",
                  "y",
                  "ratio"
                ],
                "additionalProperties": false,
                "description": "Camera in the drawing's own frame, as the workbench's camera state: x and y from 0 to 1 across the drawing (0.5, 0.5 is its middle), ratio the zoom (1 shows it all, 0.25 four times closer), angle in radians."
              },
              {
                "type": "null"
              }
            ]
          },
          "frame": {
            "description": "A node id to centre and zoom on once the scene is shown; null clears it.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id"
        ],
        "additionalProperties": false,
        "description": "Changes to one scene's view, applied on top of that scene."
      }
    },
    "add": {
      "description": "Scenes to add. Runs last.",
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "caption": {
            "description": "The scene's caption, shown in the Story bar.",
            "type": "string",
            "maxLength": 500
          },
          "bindings": {
            "description": "Bindings for this scene, in the style tool's form.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "channel": {
                  "type": "string",
                  "minLength": 1,
                  "description": "Channel id, e.g. color, size, edgeWidth, edgeColor, hull."
                },
                "field": {
                  "description": "A data field by name (\"amount_bn\") or id (\"efield:amount_bn\"); a bare name resolves to the field on the channel's target.",
                  "type": "string",
                  "minLength": 1
                },
                "algorithm": {
                  "description": "A computed source id, e.g. degree, pagerank, louvain.",
                  "type": "string",
                  "minLength": 1
                },
                "set": {
                  "description": "A set id saved in the document.",
                  "type": "string",
                  "minLength": 1
                },
                "params": {
                  "description": "Algorithm params; each must be declared and in range.",
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                },
                "source": {
                  "description": "The stored wire form instead of field/algorithm/set; requires resultType.",
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "algorithm",
                        "field",
                        "transform",
                        "set"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "target": {
                      "type": "string",
                      "enum": [
                        "node",
                        "edge"
                      ]
                    },
                    "params": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "temporal": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "instant"
                        }
                      },
                      "required": [
                        "kind"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "kind",
                    "id"
                  ],
                  "additionalProperties": false
                },
                "resultType": {
                  "description": "Override the source's type, e.g. cat to colour a numeric field by value. Required with source.",
                  "type": "string",
                  "enum": [
                    "num",
                    "cat",
                    "set",
                    "trf"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "scale": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "categories": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "value": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "boolean"
                                  }
                                ],
                                "description": "A data value, matched by its text form: 3 and \"3\" are the same value. A set binding's values are true (member) and false."
                              },
                              "mark": {
                                "type": "string",
                                "description": "The mark for this value: a CSS colour (#rrggbb, rgb(), hsl()) for color, edgeColor, border, hull and contour; circle, square, triangle or diamond for shape; solid or dashed for edgeStyle; a glyph (text, inline <svg>, or image URL) for glyph."
                              },
                              "label": {
                                "type": "string",
                                "description": "What the legend shows for this value, instead of the value."
                              }
                            },
                            "required": [
                              "value"
                            ],
                            "additionalProperties": false
                          },
                          "description": "One entry per value, in legend order. Values not listed keep the default palette or shape cycle."
                        },
                        "missing": {
                          "type": "object",
                          "properties": {
                            "mark": {
                              "type": "string",
                              "description": "The mark for this value: a CSS colour (#rrggbb, rgb(), hsl()) for color, edgeColor, border, hull and contour; circle, square, triangle or diamond for shape; solid or dashed for edgeStyle; a glyph (text, inline <svg>, or image URL) for glyph."
                            },
                            "label": {
                              "type": "string",
                              "description": "What the legend shows for this value, instead of the value."
                            }
                          },
                          "additionalProperties": false,
                          "description": "The mark and label for items with no value."
                        }
                      },
                      "required": [
                        "categories"
                      ],
                      "additionalProperties": false,
                      "description": "Marks and labels for a cat or set binding's values."
                    },
                    {
                      "type": "object",
                      "properties": {
                        "domain": {
                          "type": "array",
                          "prefixItems": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "number"
                            }
                          ],
                          "description": "The data values that map to the two ends of the range. Values outside it are clamped."
                        },
                        "range": {
                          "anyOf": [
                            {
                              "type": "array",
                              "prefixItems": [
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "number"
                                }
                              ]
                            },
                            {
                              "minItems": 2,
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          ],
                          "description": "Two lengths in px (size: node radius; edgeWidth: link width), or two or more CSS colours as ramp stops (color, edgeColor)."
                        }
                      },
                      "required": [
                        "domain",
                        "range"
                      ],
                      "additionalProperties": false,
                      "description": "A pinned domain and range for a num binding."
                    }
                  ],
                  "description": "Explicit marks for the binding's values. Omit it to use the defaults."
                },
                "intensity": {
                  "description": "hull and heatmap only: drawing strength, 0-1.",
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                },
                "bandwidth": {
                  "description": "contour and heatmap only: kernel bandwidth as a multiple of the automatic one, half of Scott's rule on each group's spread (in kilometres on a Geo basemap). Under 1 separates tighter clusters; default 1.",
                  "type": "number",
                  "minimum": 0.25,
                  "maximum": 4
                },
                "levels": {
                  "description": "contour only: the regions to outline, as the share of each group's density each encloses (whole percentages); default [50, 75, 90].",
                  "minItems": 1,
                  "maxItems": 5,
                  "type": "array",
                  "items": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 99
                  }
                },
                "remove": {
                  "description": "Unbind this channel. Pass only channel with it.",
                  "type": "boolean",
                  "const": true
                }
              },
              "required": [
                "channel"
              ],
              "additionalProperties": false,
              "description": "One binding: a channel plus exactly one of field, algorithm, set or source; or a channel with remove."
            }
          },
          "replace": {
            "description": "true replaces the scene's bindings with this list; false (default) merges by channel.",
            "type": "boolean"
          },
          "layout": {
            "type": "string",
            "enum": [
              "force",
              "levels",
              "geo"
            ]
          },
          "edgeDirection": {
            "type": "string",
            "enum": [
              "line",
              "tapered",
              "arrow",
              "flow"
            ]
          },
          "theme": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "light",
                  "dark",
                  "seafoam"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "appearance": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "nodeSize": {
                    "description": "Multiplies every node's drawn size. 0.5 to 2.5; default 1.",
                    "type": "number",
                    "minimum": 0.5,
                    "maximum": 2.5
                  },
                  "nodeGap": {
                    "description": "Pixels kept clear between nodes. 0 to 8; default 2.",
                    "type": "number",
                    "minimum": 0,
                    "maximum": 8
                  },
                  "labelBudget": {
                    "description": "Label density: how many node labels show at once. 0.5 to 10; default 1.",
                    "type": "number",
                    "minimum": 0.5,
                    "maximum": 10
                  },
                  "labelPlacement": {
                    "description": "Node labels beside the node (default), centred on it, or text: each node drawn as its label in a box sized to the text, for concept maps.",
                    "type": "string",
                    "enum": [
                      "beside",
                      "center",
                      "text"
                    ]
                  },
                  "linkWidth": {
                    "description": "Multiplies every link's drawn width. 0.1 to 8; default 1.",
                    "type": "number",
                    "minimum": 0.1,
                    "maximum": 8
                  },
                  "linkOutline": {
                    "description": "Link outline width in pixels. 0 to 20; default 2.",
                    "type": "number",
                    "minimum": 0,
                    "maximum": 20
                  },
                  "arrowSize": {
                    "description": "Arrowhead size, for flow links. 0.5 to 3; default 2.",
                    "type": "number",
                    "minimum": 0.5,
                    "maximum": 3
                  },
                  "curvature": {
                    "description": "How far links bend, from 0 (straight) to 100. 0 to 100; default 0.",
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "linkOpacity": {
                    "description": "Multiplies link opacity; under 1 is fainter. 0.05 to 2; default 1.",
                    "type": "number",
                    "minimum": 0.05,
                    "maximum": 2
                  }
                },
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "structure": {
            "type": "object",
            "properties": {
              "groups": {
                "description": "Group by: nodes drawn as dots in nested rings, one ring per value. null turns it off.",
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "by": {
                        "maxItems": 4,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "description": "A node field."
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "algorithm"
                                },
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "A categorical node algorithm: louvain, leiden, label_propagation, asyn_lpa, greedy_modularity, k_clique, spectral_bisection, kernighan_lin, connected_components."
                                }
                              },
                              "required": [
                                "kind",
                                "id"
                              ],
                              "additionalProperties": false,
                              "description": "An algorithm's groups, written as a binding source: connected_components draws one ring per connected component, with isolated nodes in one ring."
                            }
                          ]
                        },
                        "description": "Levels, outer to inner, each once: node fields and algorithms, e.g. [{\"kind\": \"algorithm\", \"id\": \"connected_components\"}, \"team\"]; [] groups by nested Louvain communities."
                      },
                      "links": {
                        "description": "Links drawn besides those at hovered or selected nodes: none (default), inside (within the innermost group) or all (faded).",
                        "type": "string",
                        "enum": [
                          "none",
                          "inside",
                          "between",
                          "all"
                        ]
                      }
                    },
                    "required": [
                      "by"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "backbone": {
                "description": "Backbone: only the links that carry the structure. The workbench draws it where it can build one for the graph. null turns it off.",
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "background": {
                        "description": "How links outside the Backbone draw: auto (default), faded or hidden.",
                        "type": "string",
                        "enum": [
                          "auto",
                          "faded",
                          "hidden"
                        ]
                      }
                    },
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "merge": {
                "description": "Merge: one node per value of the fields, with the links between two merged nodes combined into one per direction. null turns it off.",
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "by": {
                        "minItems": 1,
                        "maxItems": 4,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        },
                        "description": "Node fields; one merged node per value, each field once."
                      },
                      "label": {
                        "description": "Label template over the merged fields: {field}, {members} (how many nodes merged), and {field by other} (field per value of other, joined \" → \"), e.g. \"{role}  {tasks by side}\".",
                        "type": "string",
                        "maxLength": 400
                      },
                      "combine": {
                        "description": "Rules per node or link field. Defaults: numbers sum, the size channel's field adds areas, categories keep the most common value, long text is listed.",
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "minLength": 1
                        },
                        "additionalProperties": {
                          "type": "string",
                          "enum": [
                            "sum",
                            "mean",
                            "min",
                            "max",
                            "area",
                            "first",
                            "mode",
                            "list"
                          ]
                        }
                      }
                    },
                    "required": [
                      "by"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "additionalProperties": false,
            "description": "How the workbench and embeds draw the graph on open: Group by, Backbone and merge. Each part changes only what is given. A merge draws with neither groups nor the Backbone: turning it on turns them off, and turning either on turns it off. The network and its positions are unchanged."
          },
          "timeFilter": {
            "description": "A time filter on a date field: only what is dated inside the window shows. It replaces the document's time filter; null removes it. An embed with chrome=time draws a time bar for it, and a host page moves it with the driver's setTimeFilter.",
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "field": {
                    "type": "string",
                    "minLength": 1,
                    "description": "A date field, by name (\"published\") or id (\"field:published\", \"efield:sent\"): one whose values are YYYY-MM-DD dates or RFC3339 timestamps, which inspect lists as (date)."
                  },
                  "to": {
                    "description": "End of the window, inclusive. Default: the field's latest date, so every dated item shows.",
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "number"
                      }
                    ]
                  },
                  "from": {
                    "description": "Start of the window, inclusive; absent or null for none.",
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1
                          },
                          {
                            "type": "number"
                          }
                        ],
                        "description": "A date: YYYY-MM-DD (UTC midnight), an RFC3339 timestamp with a timezone, or epoch milliseconds."
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "mode": {
                    "description": "hide (default) leaves out what falls outside the window; fade dims it.",
                    "type": "string",
                    "enum": [
                      "hide",
                      "fade"
                    ]
                  },
                  "includeMissing": {
                    "description": "Show items with no date as context. Default false.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "field"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "camera": {
            "description": "Where the camera goes. Absent or null leaves it where the previous scene put it (the opening fit for the first).",
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "x": {
                    "type": "number"
                  },
                  "y": {
                    "type": "number"
                  },
                  "ratio": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "angle": {
                    "type": "number"
                  }
                },
                "required": [
                  "x",
                  "y",
                  "ratio"
                ],
                "additionalProperties": false,
                "description": "Camera in the drawing's own frame, as the workbench's camera state: x and y from 0 to 1 across the drawing (0.5, 0.5 is its middle), ratio the zoom (1 shows it all, 0.25 four times closer), angle in radians."
              },
              {
                "type": "null"
              }
            ]
          },
          "frame": {
            "description": "A node id to centre and zoom on once the scene is shown; null clears it.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ]
          },
          "at": {
            "description": "Position in the story, from 0; default the end. Scenes are added in order.",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "additionalProperties": false,
        "description": "A new scene: the document's view (bindings, filters, structure, style) with these changes."
      }
    }
  },
  "required": [
    "doc"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}
🔴garphield_focus(doc, clear, sets, filters, mark)

Save named sets of nodes and focus the view on them; the app, share links, embeds and PNG exports all show the result. A set comes from exactly one of: nodes (ids), edges ([source, target] pairs, kept as their endpoints), path (a shortest path from one node to another), top (the k highest or lowest by a field or algorithm such as degree), or match (a range, values, or one node's value of a field or algorithm, e.g. a louvain community). filters fade (default) or hide everything outside a set ({"set": "path"}) or outside a range or values of a field or algorithm. mark rings a set's nodes. clear empties the filters, or with "all" every set too. Example, highlight a path: {"sets": [{"id": "route", "path": {"from": "a", "to": "e"}}], "filters": [{"set": "route"}]}. Show only the top 20 by degree: {"sets": [{"id": "hubs", "top": {"algorithm": "degree", "k": 20}}], "filters": [{"set": "hubs", "mode": "hide"}]}. Strict and atomic: if anything is invalid nothing is written, and each problem comes back with a path and suggestions (unknown node ids suggest near ids and nodes with that label).

输入模式

{
  "type": "object",
  "properties": {
    "doc": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1024,
      "description": "Document reference: a stored document id, a file path, or \"current\" in the workbench."
    },
    "clear": {
      "description": "Applied first. \"filters\" empties the filter stack; \"all\" also deletes every set and every binding that reads one.",
      "type": "string",
      "enum": [
        "filters",
        "all"
      ]
    },
    "sets": {
      "minItems": 1,
      "maxItems": 20,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[\\w.:-]{1,64}$",
            "description": "The set's id (letters, digits, _ . : -). An existing id is replaced."
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "note": {
            "type": "string",
            "maxLength": 4000
          },
          "nodes": {
            "description": "These node ids.",
            "minItems": 1,
            "maxItems": 10000,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            }
          },
          "edges": {
            "description": "The endpoints of these links, each a [source, target] pair of node ids.",
            "minItems": 1,
            "maxItems": 10000,
            "type": "array",
            "items": {
              "type": "array",
              "prefixItems": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1024
                },
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1024
                }
              ]
            }
          },
          "path": {
            "description": "The nodes on a shortest path, following link direction on a directed graph.",
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1024
              },
              "to": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1024
              }
            },
            "required": [
              "from",
              "to"
            ],
            "additionalProperties": false
          },
          "top": {
            "description": "The k nodes (or the endpoints of the k links, for an edge source) with the highest or lowest values.",
            "type": "object",
            "properties": {
              "field": {
                "description": "A data field by name (\"role\") or id (\"field:role\", \"efield:amount_bn\"); a bare name resolves to the node field first.",
                "type": "string",
                "minLength": 1
              },
              "algorithm": {
                "description": "A computed source id, e.g. degree, pagerank, betweenness, louvain.",
                "type": "string",
                "minLength": 1
              },
              "params": {
                "description": "Algorithm params; each must be declared and in range.",
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              "k": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991,
                "description": "How many to keep."
              },
              "order": {
                "description": "highest (default) or lowest values first.",
                "type": "string",
                "enum": [
                  "highest",
                  "lowest"
                ]
              }
            },
            "required": [
              "k"
            ],
            "additionalProperties": false
          },
          "match": {
            "description": "The nodes whose value meets one criterion: a range, values, or the value of a node.",
            "type": "object",
            "properties": {
              "field": {
                "description": "A data field by name (\"role\") or id (\"field:role\", \"efield:amount_bn\"); a bare name resolves to the node field first.",
                "type": "string",
                "minLength": 1
              },
              "algorithm": {
                "description": "A computed source id, e.g. degree, pagerank, betweenness, louvain.",
                "type": "string",
                "minLength": 1
              },
              "params": {
                "description": "Algorithm params; each must be declared and in range.",
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              "range": {
                "description": "Numeric sources: keep values from min to max inclusive. An omitted bound is the source's own minimum or maximum.",
                "type": "object",
                "properties": {
                  "min": {
                    "type": "number"
                  },
                  "max": {
                    "type": "number"
                  }
                },
                "additionalProperties": false
              },
              "values": {
                "description": "Categorical sources (or a numeric field read as categories): keep these values. Community ids are numbers from 0.",
                "minItems": 1,
                "maxItems": 500,
                "type": "array",
                "items": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    }
                  ]
                }
              },
              "node": {
                "description": "Keep the value this node has, e.g. {\"algorithm\": \"louvain\", \"node\": \"valjean\"} for that node's community.",
                "type": "string",
                "minLength": 1,
                "maxLength": 1024
              }
            },
            "additionalProperties": false
          },
          "remove": {
            "description": "Delete the set. Pass only id with it.",
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "id"
        ],
        "additionalProperties": false,
        "description": "Create or replace a named set from exactly one of nodes, edges, path, top or match; or remove one."
      }
    },
    "filters": {
      "description": "Merged into the filter stack by id.",
      "minItems": 1,
      "maxItems": 20,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "description": "Filter entry id. Default \"focus-<set id>\" or \"focus-<source id>\"; an existing id is replaced.",
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "set": {
            "description": "Keep the members of this set (saved or defined in this call).",
            "type": "string",
            "minLength": 1
          },
          "field": {
            "description": "A data field by name (\"role\") or id (\"field:role\", \"efield:amount_bn\"); a bare name resolves to the node field first.",
            "type": "string",
            "minLength": 1
          },
          "algorithm": {
            "description": "A computed source id, e.g. degree, pagerank, betweenness, louvain.",
            "type": "string",
            "minLength": 1
          },
          "params": {
            "description": "Algorithm params; each must be declared and in range.",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "range": {
            "description": "Numeric sources: keep values from min to max inclusive. An omitted bound is the source's own minimum or maximum.",
            "type": "object",
            "properties": {
              "min": {
                "type": "number"
              },
              "max": {
                "type": "number"
              }
            },
            "additionalProperties": false
          },
          "values": {
            "description": "Categorical sources (or a numeric field read as categories): keep these values. Community ids are numbers from 0.",
            "minItems": 1,
            "maxItems": 500,
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                }
              ]
            }
          },
          "node": {
            "description": "Keep the value this node has, e.g. {\"algorithm\": \"louvain\", \"node\": \"valjean\"} for that node's community.",
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          },
          "mode": {
            "description": "fade (default) dims what the filter drops; hide removes it from the drawing.",
            "type": "string",
            "enum": [
              "fade",
              "hide"
            ]
          },
          "remove": {
            "description": "Delete the filter entry with this id. Pass only id with it.",
            "type": "boolean",
            "const": true
          }
        },
        "additionalProperties": false,
        "description": "Keep a set, or keep what one criterion on a field or algorithm selects; fade or hide the rest."
      }
    },
    "mark": {
      "description": "Ring this set's nodes (the border channel bound to the set). null removes a set ring.",
      "anyOf": [
        {
          "type": "string",
          "minLength": 1
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "doc"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}
🔴garphield_layout(doc, mode, aspect, levels, clear, ...)

Compute and save node positions for a stored graph with the workbench's own layout recipes, and grade the result with its quality gate. Optional: a graph without positions is laid out by the browser when it opens. Use this to bake positions (for a gallery file or a stable share) or to get a quality grade. Reports which engine ran. Large graphs over the host's budget return LAYOUT_TOO_LARGE; clear: true removes saved positions. preview: true also returns a small image of the result, to check for overlaps, tangles and unreadable labels against the grade's findings; it adds a render (10-20 s on the hosted server), so ask for it when you mean to look.

输入模式

{
  "type": "object",
  "properties": {
    "doc": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1024,
      "description": "Document reference: a stored document id, a file path, or \"current\" in the workbench."
    },
    "mode": {
      "description": "force (production Blend, or ForceAtlas2 for large graphs), levels (layered bands, or a tidy tree with levels.style tree), or geo (the browser places nodes by their coordinate fields). Default: the document's layout, else force.",
      "type": "string",
      "enum": [
        "force",
        "levels",
        "geo"
      ]
    },
    "aspect": {
      "description": "Width over height of the frame to fit. Default 1.6.",
      "type": "number",
      "minimum": 0.25,
      "maximum": 4
    },
    "levels": {
      "description": "levels mode only.",
      "type": "object",
      "properties": {
        "roots": {
          "description": "Node ids for the top level.",
          "minItems": 1,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "levelAttribute": {
          "description": "A numeric node field that orders the levels.",
          "type": "string",
          "minLength": 1
        },
        "style": {
          "description": "layered (default) bands every node by level; tree draws a tidy tree, an organisation chart: each node under one parent, wide sets of leaves wrapped into rows or columns, links as elbows. A graph that is not a tree is drawn from a spanning tree, its other links as curves.",
          "type": "string",
          "enum": [
            "layered",
            "tree"
          ]
        },
        "direction": {
          "description": "tree only: down (default) or right.",
          "type": "string",
          "enum": [
            "down",
            "right"
          ]
        }
      },
      "additionalProperties": false
    },
    "clear": {
      "description": "Remove saved positions instead, so the browser lays the graph out when it opens. Pass only doc with it.",
      "type": "boolean",
      "const": true
    },
    "preview": {
      "description": "true returns a 600x400 image of the saved graph, so you can check it for overlapping nodes, tangles and unreadable labels and fix them. A render can take 10-20 s and counts toward the host's image limit; the change is saved even when no preview can be made. Default false.",
      "type": "boolean"
    }
  },
  "required": [
    "doc"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}
🟢garphield_validate(doc, document)

Check a stored document (doc) or a raw .gph document (document) the way the workbench would load it, strictly: the schema, the graph, every binding against the graph's fields and the channel rules, and the filter stack. Returns ok, errors (code, path, message, expected, suggestions) and warnings such as UNLAID (no saved positions) and TEMPLATE_SENDS_FIELDS (a card template puts field values in a URL on another host).

输入模式

{
  "type": "object",
  "properties": {
    "doc": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1024,
      "description": "Document reference: a stored document id, a file path, or \"current\" in the workbench."
    },
    "document": {
      "description": "A whole .gph document as JSON, for callers who wrote one themselves.",
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {}
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}
🟢garphield_share(doc, target, chrome, theme)

Get links that open a stored graph in the Garphield workbench and in its embeddable view, plus an iframe snippet. Depending on the host the link points at the stored document (anyone with the link can open it, until expiresAt), carries the whole document in the URL (selfContained), or, in the workbench, carries just the view of a built-in sample or generator. Rendering happens in the viewer's browser; a graph without saved positions is laid out when it opens.

输入模式

{
  "type": "object",
  "properties": {
    "doc": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1024,
      "description": "Document reference: a stored document id, a file path, or \"current\" in the workbench."
    },
    "target": {
      "description": "Which link `url` is: the full workbench (\"app\", default) or the chromeless embed.",
      "type": "string",
      "enum": [
        "app",
        "embed"
      ]
    },
    "chrome": {
      "description": "Embed controls to show. Omitted: the embed's defaults. -wordmark takes the link off the Garphield wordmark; the mark stays.",
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "toolbar",
          "minimap",
          "search",
          "legend",
          "legend:open",
          "legend:closed",
          "tooltip",
          "tooltip:hover",
          "tooltip:select",
          "time",
          "time:open",
          "time:closed",
          "-wordmark"
        ]
      }
    },
    "theme": {
      "description": "Embed theme. Default: the document's theme, if it has one.",
      "type": "string",
      "enum": [
        "light",
        "dark",
        "seafoam"
      ]
    }
  },
  "required": [
    "doc"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}
🟢garphield_export(doc, format, inline, width, height)

Export a stored graph as a .gph project (with its view config and positions), as node-link JSON, GEXF, GraphML or GML, or as a PNG where the host can render. Text formats come back inline up to the host's result limit; gph also reports where the stored file is, when the host has a location. The export is a frozen copy: later style or layout calls do not change it. Where the host stores images, a png export is also kept as the document's preview image.

输入模式

{
  "type": "object",
  "properties": {
    "doc": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1024,
      "description": "Document reference: a stored document id, a file path, or \"current\" in the workbench."
    },
    "format": {
      "type": "string",
      "enum": [
        "gph",
        "nodeLink",
        "gexf",
        "graphml",
        "gml",
        "png"
      ],
      "description": "gph is the full Garphield project; nodeLink, gexf, graphml and gml carry the graph and its attributes; png is an image where the host can render one."
    },
    "inline": {
      "description": "gph only: false returns just the stored location and size, without the text. Default true.",
      "type": "boolean"
    },
    "width": {
      "description": "png only.",
      "type": "integer",
      "minimum": 64,
      "maximum": 4096
    },
    "height": {
      "description": "png only.",
      "type": "integer",
      "minimum": 64,
      "maximum": 4096
    }
  },
  "required": [
    "doc",
    "format"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}

社区

评价此服务器

证据

最近观测

已验证未记录版本9 个工具