jac-node-edge-patterns

Defines nodes, edges, and graph traversal patterns for Jac Object-Spatial Programming.

Updated Jul 26, 2026
One-click install
npx skills add https://github.com/PMN123/trapdoor --skill jac-node-edge-patterns-pmn123
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jac-node-edge-patterns
Source: https://github.com/PMN123/trapdoor/tree/main/.agents/skills/jac-node-edge-patterns
Command: npx skills add https://github.com/PMN123/trapdoor --skill jac-node-edge-patterns-pmn123

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing graph-persistent code in Jac requires knowing the exact arrow-operator syntax, typed edge construction, and filter semantics of Object-Spatial Programming, and small mistakes silently produce wrong results or runtime errors. ## Core Features & Use Cases - Node and Edge Modeling: Define graph-persistent node and typed edge archetypes with has fields and typed endpoints for correct type inference. - Traversal and Filtering: Read graphs with direction-aware references, nested [?...] filters, edge-attribute predicates, multi-hop chains, and assign comprehensions for bulk updates. - Pitfall Avoidance: Documents verified failure modes such as silently dropped edge-field assignments, untyped edge predicates raising runtime errors, and stale .jac/ persistence between runs. - Use Case: When modeling a social network in Jac, use this guide to declare edge Follows: Person --> Person, connect users with +>:Follows(since=2020):+>, and query adult followers with [me ->:Follows:since > 2020:-> [?:Person, age >= 18]]. ## Quick Start Ask the AI to model your entities as Jac nodes and edges and write a filtered multi-hop graph query using these OSP patterns.

Frequently Asked Questions about jac-node-edge-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I define nodes and edges in Jac OSP?

Declare graph-persistent entities with `node` archetypes and connections with `edge` archetypes, optionally typed with endpoints like `edge Follows: Person --> Person`. Connect instances using `++>` for untyped edges or `+>:EdgeType(fields):+>` for typed edges with field values.

How do I filter graph traversal results in Jac?

Nest a `[?...]` filter inside the reference, such as `[root -->[?:Person, age > 30]]` for node type and field predicates, or `[a ->:Follows:since > 2020:->]` for edge-attribute predicates. Filters compose per hop in multi-hop chains and predicates AND together.

Why does my Jac typed edge ignore the field values I set?

The colon-assign form `+>:E:field=val:+>` parses but silently drops the assignment, leaving fields at defaults. Always pass field values through the constructor parentheses: `+>:E(field=val):+>`.

Why does Jac traversal return Unknown-typed nodes?

Edges declared without endpoint types give no type information to the checker, so attribute access only warns and typed function calls fail. Declare endpoints on the edge (`edge E: Src --> Tgt {}`) or nest `[?:NodeType]` at the read site.

How do I delete a typed edge in Jac?

The `del -->` operator works only on untyped edges. For typed edges, query the edge objects with `[edge a ->:E:-> b]` and delete each in a loop; deleting a node cascades to all of its edges.

Why does re-running my Jac script duplicate nodes?

`jac run` persists graph state in the `.jac/` directory, so each run adds new copies of nodes. Reset with `jac clean --all` or remove the `.jac/` directory before re-running.