name: perseus-ontology
description: >
Use when the user wants to create an ontology for Perseus, constrain extraction
to specific entity types, or asks about "ontology", "typed extraction",
"constrained extraction", "entity types", "schema for extraction".
version: 1.0.0
argument-hint: [entity-types-or-file-path]
Perseus Ontology — Guided Ontology Workflow
Help the user create or upload an ontology, test it with constrained extraction, iterate, and apply at scale.
Input: $ARGUMENTS
Starter Template
See templates/starter-ontology.ttl for the base TTL template.
Workflow
Step 1: Determine Ontology Source
Examine $ARGUMENTS:
- Entity type names (e.g., "Drug Gene Disease", "Person Organization Location"): enter Draft Mode (Step 2).
- File path (ends in
.ttl or .owl): skip to Upload (Step 3) using upload_ontology.
- No arguments: ask the user whether they want to:
- Draft a new ontology by listing entity types
- Upload an existing TTL/OWL file
- See the starter template for reference
Step 2: Draft Mode
Generate a TTL ontology based on the entity types the user specified:
- Read the starter template from templates/starter-ontology.ttl.
- For each entity type name in
$ARGUMENTS:
- Define it as
ex:TypeName a rdfs:Class .
- Infer plausible relationships between the entity types:
- e.g., if the user listed "Person" and "Organization", add
ex:worksAt a rdf:Property ; rdfs:domain ex:Person ; rdfs:range ex:Organization .
- If the user listed "Drug" and "Disease", add
ex:treats a rdf:Property ; rdfs:domain ex:Drug ; rdfs:range ex:Disease .
- Show the generated TTL to the user and ask if they want to adjust it before uploading.
Step 3: Upload
- Inline TTL (from Draft Mode or user-provided text): call
upload_ontology_from_text(content=..., name="ontology.ttl").
- File path: call
upload_ontology(ontology_path=...).
Report the ontology ID and status.
Step 4: Test Extraction
Ask the user for a sample document or text to test against. Then:
- If they provide text: call
build_graph_from_text(content=..., TTL from above>).
- If they provide a file: call
build_graph(file_paths=[...],>.
- Call
get_graph_summary(graph_id=...) and get_graph_entities(graph_id=...) on the result.
Present the results:
- Entity count and types — are they the types defined in the ontology?
- Relation count and types — do they match the ontology's properties?
- Any surprising or missing extractions?
Step 5: Iterate
Ask the user:
- "Want to add or remove entity types?"
- "Want to add properties or change relationship definitions?"
- "Want to re-run on the same sample?"
If yes, go back to Step 2 (re-draft) or Step 3 (re-upload) and repeat. Each iteration should show the before/after comparison — how the graph changed with the updated ontology.
Step 6: Apply at Scale
Once the user is satisfied:
- Offer to run
build_graph(file_paths=[...],> across a batch of files.
- If multiple graphs result, offer to
interlink_graphs.
- Suggest export options (TTL, CQL, Neo4j, FalkorDB).
Rules
- Always show the generated TTL to the user before uploading — never upload silently.
- When showing test extraction results, highlight whether entity types match the ontology (this is the core value prop).
- Keep the iteration loop tight — minimize steps between "edit ontology" and "see results."
- If the user provides domain-specific entity types you're unfamiliar with, generate the class definitions but flag that the inferred relationships are guesses and should be reviewed.
1---2name: perseus-ontology3description: Use when the user wants to create an ontology for Perseus, constrain extraction to specific entity types, or asks about "ontology", "typed extraction", "constra4---5---6name: perseus-ontology7description: >8 Use when the user wants to create an ontology for Perseus, constrain extraction9 to specific entity types, or asks about "ontology", "typed extraction",10 "constrained extraction", "entity types", "schema for extraction".11version: 1.0.012argument-hint: [entity-types-or-file-path]13---1415# Perseus Ontology — Guided Ontology Workflow1617Help the user create or upload an ontology, test it with constrained extraction, iterate, and apply at scale.1819Input: $ARGUMENTS2021## Starter Template2223See [templates/starter-ontology.ttl](templates/starter-ontology.ttl) for the base TTL template.2425## Workflow2627### Step 1: Determine Ontology Source2829Examine `$ARGUMENTS`:3031- **Entity type names** (e.g., "Drug Gene Disease", "Person Organization Location"): enter Draft Mode (Step 2).32- **File path** (ends in `.ttl` or `.owl`): skip to Upload (Step 3) using `upload_ontology`.33- **No arguments**: ask the user whether they want to:34 - Draft a new ontology by listing entity types35 - Upload an existing TTL/OWL file36 - See the starter template for reference3738### Step 2: Draft Mode3940Generate a TTL ontology based on the entity types the user specified:41421. Read the starter template from [templates/starter-ontology.ttl](templates/starter-ontology.ttl).432. For each entity type name in `$ARGUMENTS`:44 - Define it as `ex:TypeName a rdfs:Class .`453. Infer plausible relationships between the entity types:46 - e.g., if the user listed "Person" and "Organization", add `ex:worksAt a rdf:Property ; rdfs:domain ex:Person ; rdfs:range ex:Organization .`47 - If the user listed "Drug" and "Disease", add `ex:treats a rdf:Property ; rdfs:domain ex:Drug ; rdfs:range ex:Disease .`484. Show the generated TTL to the user and ask if they want to adjust it before uploading.4950### Step 3: Upload5152- **Inline TTL** (from Draft Mode or user-provided text): call `upload_ontology_from_text(content=..., name="ontology.ttl")`.53- **File path**: call `upload_ontology(ontology_path=...)`.5455Report the ontology ID and status.5657### Step 4: Test Extraction5859Ask the user for a sample document or text to test against. Then:60611. If they provide text: call `build_graph_from_text(content=..., ontology_ttl=<the TTL from above>)`.622. If they provide a file: call `build_graph(file_paths=[...], ontology_path=<path>)`.633. Call `get_graph_summary(graph_id=...)` and `get_graph_entities(graph_id=...)` on the result.6465Present the results:66- Entity count and types — are they the types defined in the ontology?67- Relation count and types — do they match the ontology's properties?68- Any surprising or missing extractions?6970### Step 5: Iterate7172Ask the user:73- "Want to add or remove entity types?"74- "Want to add properties or change relationship definitions?"75- "Want to re-run on the same sample?"7677If yes, go back to Step 2 (re-draft) or Step 3 (re-upload) and repeat. Each iteration should show the before/after comparison — how the graph changed with the updated ontology.7879### Step 6: Apply at Scale8081Once the user is satisfied:82- Offer to run `build_graph(file_paths=[...], ontology_path=...)` across a batch of files.83- If multiple graphs result, offer to `interlink_graphs`.84- Suggest export options (TTL, CQL, Neo4j, FalkorDB).8586## Rules8788- Always show the generated TTL to the user before uploading — never upload silently.89- When showing test extraction results, highlight whether entity types match the ontology (this is the core value prop).90- Keep the iteration loop tight — minimize steps between "edit ontology" and "see results."91- If the user provides domain-specific entity types you're unfamiliar with, generate the class definitions but flag that the inferred relationships are guesses and should be reviewed.