From f8cc6d5e002748ce5d1a6c29d153d378d33b6360 Mon Sep 17 00:00:00 2001 From: sonesuke Date: Sun, 5 Apr 2026 14:18:15 +0000 Subject: [PATCH] fix: document Cypher parser limitations and correct claims query pattern - Document 5 known Cypher parser bugs (ORDER BY, WHERE, relationship patterns, p.claims, wrong labels) - Fix claims retrieval to use direct node match MATCH (c:claims) without ORDER BY - Remove p.claims from "everything" query (always null, claims are child nodes) Co-Authored-By: Claude Opus 4.6 --- claude-plugin/skills/patent-fetch/SKILL.md | 45 +++++++++++++++------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/claude-plugin/skills/patent-fetch/SKILL.md b/claude-plugin/skills/patent-fetch/SKILL.md index 7f4c065..f7f12bf 100644 --- a/claude-plugin/skills/patent-fetch/SKILL.md +++ b/claude-plugin/skills/patent-fetch/SKILL.md @@ -48,12 +48,31 @@ MATCH (p:Patent) RETURN p.title, p.abstract_text |--------------|------------------| | Assignee, owner, applicant | `p.assignee` | | Legal status, status, expired/active | `p.legal_status` | -| Claims, what is claimed | `MATCH (p:Patent)-[:claims]->(c:claims) RETURN c.number, c.text` | +| Claims, what is claimed | See claims section below | | Description, details, specification | `p.description` | | Filing date, application date | `p.filing_date` | -| Publication date | `p.publication_date` | +| Publication date, `p.publication_date` | | Priority date | `p.priority_date` | -| Everything, full details | `p.title, p.abstract_text, p.description, p.assignee, p.filing_date, p.publication_date, p.priority_date, p.legal_status` (claims: use relationship query) | + +**Claims retrieval:** + +`p.claims` is always null. You MUST query `:claims` child nodes directly: + +```cypher +MATCH (c:claims) RETURN c.number, c.text +``` + +**CRITICAL — Cypher Parser Limitations:** + +The Cypher parser has known bugs. Follow these rules strictly: + +1. **Do NOT use `ORDER BY`** — causes `c.text` to return `expression: null` +2. **Do NOT use `WHERE` clauses** — `WHERE d.text CONTAINS '...'` and `WHERE c.number = '1'` cause parse errors +3. **Do NOT use relationship patterns for property access** — `(p:Patent)-[:claims]->(c:claims) RETURN c.text` returns null +4. **Do NOT use `p.claims`** — always null, claims are stored as child nodes +5. **Do NOT use wrong labels** — `[:HAS_CHILD]->(c:claim)`, `[:claim]->(c:claim)`, `[:claims]->(c:claim)` return empty + +**Safe query pattern**: `MATCH (c:claims) RETURN c.number, c.text` (direct node match, no ORDER BY, no WHERE) **Example queries based on user request:** @@ -67,10 +86,14 @@ User: "What's the legal status of US9152718B2?" → Include legal_status: `MATCH (p:Patent) RETURN p.title, p.legal_status` User: "Get full details for US9152718B2" -→ Include everything: `MATCH (p:Patent) RETURN p.title, p.abstract_text, p.description, p.assignee, p.filing_date, p.publication_date, p.priority_date, p.legal_status` - -User: "What are the claims for US9152718B2?" -→ Use relationship: `MATCH (p:Patent)-[:claims]->(c:claims) RETURN c.number, c.text ORDER BY c.number` +→ Include everything: +```cypher +MATCH (p:Patent) RETURN p.title, p.abstract_text, p.description, p.assignee, p.filing_date, p.publication_date, p.legal_status +``` +Then get claims separately: +```cypher +MATCH (c:claims) RETURN c.number, c.text +``` ## Important Notes @@ -88,13 +111,9 @@ Patent data is loaded as a graph with the following structure: - `(:Patent)-[:description_paragraphs]->(:description_paragraphs)` - Description nodes - `(:Patent)-[:images]->(:images)` - Image nodes -**Accessing claims via relationship:** +**Accessing claims (direct node match — do NOT use relationship patterns or ORDER BY/WHERE):** ```cypher -# Get all claim numbers and texts -MATCH (p:Patent)-[:claims]->(c:claims) RETURN c.number, c.text - -# Get claims for a specific patent -MATCH (p:Patent)-[:claims]->(c:claims) WHERE p.id = 'US9152718B2' RETURN c.number, c.text ORDER BY c.number +MATCH (c:claims) RETURN c.number, c.text ``` ## Parameters