Skip to content

Commit d02303d

Browse files
sonesukeclaude
andauthored
fix: update cypher-rs to support claims via graph relationships (#76)
- Update cypher-rs to latest version with unified JSON-to-graph conversion - Fix API call: from_json_auto_as_root_with_label → from_json_with_label - Update SKILL.md to document relationship-based claims access With the new cypher-rs, array fields (claims, description_paragraphs) are converted to graph relationships rather than properties. Users must now access claims via: MATCH (p:Patent)-[:claims]->(c) RETURN c.number, c.text Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ab9053a commit d02303d

3 files changed

Lines changed: 27 additions & 5 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

claude-plugin/skills/patent-fetch/SKILL.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ MATCH (p:Patent) RETURN p.title, p.abstract_text
4848
|--------------|------------------|
4949
| Assignee, owner, applicant | `p.assignee` |
5050
| Legal status, status, expired/active | `p.legal_status` |
51-
| Claims, what is claimed | `p.claims` |
51+
| Claims, what is claimed | `MATCH (p:Patent)-[:claims]->(c:claims) RETURN c.number, c.text` |
5252
| Description, details, specification | `p.description` |
5353
| Filing date, application date | `p.filing_date` |
5454
| Publication date | `p.publication_date` |
5555
| Priority date | `p.priority_date` |
56-
| Everything, full details | `p.title, p.abstract_text, p.description, p.assignee, p.filing_date, p.publication_date, p.priority_date, p.legal_status, p.claims` |
56+
| 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) |
5757

5858
**Example queries based on user request:**
5959

@@ -67,14 +67,36 @@ User: "What's the legal status of US9152718B2?"
6767
→ Include legal_status: `MATCH (p:Patent) RETURN p.title, p.legal_status`
6868

6969
User: "Get full details for US9152718B2"
70-
→ 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, p.claims`
70+
→ 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`
71+
72+
User: "What are the claims for US9152718B2?"
73+
→ Use relationship: `MATCH (p:Patent)-[:claims]->(c:claims) RETURN c.number, c.text ORDER BY c.number`
7174

7275
## Important Notes
7376

7477
- The `output_file` returned by fetch_patent is for debugging purposes only
7578
- **Always use `execute_cypher` to access patent data** - do not use the Read tool on the output_file
7679
- The dataset is automatically loaded into memory for efficient querying
7780

81+
## Graph Structure
82+
83+
Patent data is loaded as a graph with the following structure:
84+
85+
- **Patent node** (`:Patent`) - Main patent with id, title, abstract_text, etc.
86+
- **Array fields become relationships**:
87+
- `(:Patent)-[:claims]->(:claims)` - Claim nodes with number, text
88+
- `(:Patent)-[:description_paragraphs]->(:description_paragraphs)` - Description nodes
89+
- `(:Patent)-[:images]->(:images)` - Image nodes
90+
91+
**Accessing claims via relationship:**
92+
```cypher
93+
# Get all claim numbers and texts
94+
MATCH (p:Patent)-[:claims]->(c:claims) RETURN c.number, c.text
95+
96+
# Get claims for a specific patent
97+
MATCH (p:Patent)-[:claims]->(c:claims) WHERE p.id = 'US9152718B2' RETURN c.number, c.text ORDER BY c.number
98+
```
99+
78100
## Parameters
79101

80102
- `patent_id` (string, required): Patent ID (e.g., "US9152718B2", "JP2023-123456-A")

src/mcp/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl PatentHandler {
234234
) -> Option<String> {
235235
// Try to create engine from the provided JSON
236236
let engine_result = if let Some(label) = root_label {
237-
CypherEngine::from_json_auto_as_root_with_label(json, label)
237+
CypherEngine::from_json_with_label(json, label)
238238
} else {
239239
CypherEngine::from_json_auto(json)
240240
};

0 commit comments

Comments
 (0)