Built-in domain schemas
The eight built-in domain schemas from Domain schemas reference, the relationships their ontology templates declare, and how to select one for extraction.
Available schemas
The exact keys below are labels supplied to GLiNER2.5. They are not necessarily the stored Entity.type; the extractor maps labels to POLE+O types/subtypes (see Entity type mapping). The tables are the catalogs in DOMAIN_SCHEMAS (neo4j_agent_memory.extraction.domain_schemas), which get_schema(name) returns.
Extraction uses the ontology template of the same name (neo4j_agent_memory.ontology.get_template). Every template except poleo is its catalog converted with to_ontology(), with relationships attached for podcast and news. The poleo template is the curated POLEO_ONTOLOGY described under poleo. Every template keeps the document default no_self_loops=True, so no declared relationship accepts a self-loop.
poleo
| Extraction label | Description |
|---|---|
|
A human individual, including their name, alias, or persona |
|
A company, institution, government agency, or group |
|
A geographic place, address, city, country, or landmark |
|
An incident, meeting, transaction, or notable occurrence |
|
A physical or digital item like a vehicle, device, or document |
get_template("poleo"), GLiNER2Extractor.for_schema("poleo"), GLiNER2Extractor.for_poleo() and ExtractorBuilder.with_gliner_schema("poleo") use POLEO_ONTOLOGY (neo4j_agent_memory.ontology) rather than this flat catalog: the same five types, labelled Person, Organization, Location, Event and Object, with longer annotation guidelines and these relationships:
| Type | Permitted endpoints | Constraints |
|---|---|---|
|
|
— |
|
|
acyclic |
|
|
— |
|
|
unique source |
|
|
— |
|
|
— |
|
|
— |
|
|
unique source |
|
|
unique source |
|
|
— |
|
|
— |
|
|
— |
|
|
acyclic |
|
|
— |
|
any label → any label |
threshold 0.6 |
|
any label → any label |
threshold 0.6 |
podcast
| Extraction label | Description |
|---|---|
|
A person mentioned in the podcast, including hosts, guests, and people discussed |
|
A company, startup, or business organization |
|
A product, service, app, or software tool |
|
A business concept, methodology, framework, or strategy |
|
A book, publication, or written work |
|
A city, country, region, or specific place |
|
A conference, meeting, milestone, or notable occurrence |
|
A job title, position, or professional role |
|
A business metric, KPI, or measurement |
|
A technology, platform, programming language, or technical tool |
Relationships declared by the podcast template:
| Type | Permitted endpoints |
|---|---|
|
|
|
|
|
|
|
|
news
| Extraction label | Description |
|---|---|
|
A person mentioned in the news article |
|
A company, government body, or institution |
|
A geographic location, city, or country |
|
A news event, incident, or occurrence |
|
A date, time period, or temporal reference |
Relationships declared by the news template:
| Type | Permitted endpoints |
|---|---|
|
|
|
|
|
|
|
|
scientific
| Extraction label | Description |
|---|---|
|
A researcher or paper author |
|
A university, research lab, or academic organization |
|
A scientific method, algorithm, or technique |
|
A dataset, corpus, or data collection |
|
A performance metric or evaluation measure |
|
A scientific concept, theory, or term |
|
A software tool, library, or framework |
The scientific template declares no relationships, so an extractor built from it decodes entities only. Attach typed relationships with to_ontology(relationships=[…]); see Converting a schema to an ontology.
business
| Extraction label | Description |
|---|---|
|
A business, corporation, or startup |
|
A business person, executive, or founder |
|
A product, service, or offering |
|
An industry sector or market |
|
A financial metric, revenue, or valuation |
|
A business location, headquarters, or market |
The business template declares no relationships, so an extractor built from it decodes entities only. Attach typed relationships with to_ontology(relationships=[…]); see Converting a schema to an ontology.
entertainment
| Extraction label | Description |
|---|---|
|
An actor, actress, or performer |
|
A film or TV director |
|
A movie, documentary, or film |
|
A television series or show |
|
A fictional character |
|
An award, nomination, or recognition |
|
A production studio or entertainment company |
|
A genre or category of entertainment |
The entertainment template declares no relationships, so an extractor built from it decodes entities only. Attach typed relationships with to_ontology(relationships=[…]); see Converting a schema to an ontology.
medical
| Extraction label | Description |
|---|---|
|
A disease, condition, or disorder |
|
A medication, drug, or treatment |
|
A symptom or clinical sign |
|
A medical procedure or intervention |
|
An anatomical structure or body part |
|
A gene, protein, or biomarker |
|
A pathogen, virus, or organism |
The medical template declares no relationships, so an extractor built from it decodes entities only. Attach typed relationships with to_ontology(relationships=[…]); see Converting a schema to an ontology.
legal
| Extraction label | Description |
|---|---|
|
A legal case or lawsuit |
|
A party, lawyer, or judge |
|
A law firm, court, or legal entity |
|
A law, statute, or regulation |
|
A court or judicial body |
|
A legal date, filing date, or deadline |
|
A settlement, fine, or monetary value |
The legal template declares no relationships, so an extractor built from it decodes entities only. Attach typed relationships with to_ontology(relationships=[…]); see Converting a schema to an ontology.
Using schemas
With GLiNER2Extractor
from neo4j_agent_memory.extraction import GLiNER2Extractor
# Use named schema
extractor = GLiNER2Extractor.for_schema("podcast")
# With custom threshold
extractor = GLiNER2Extractor.for_schema("medical", threshold=0.6)
for_schema() resolves the name with get_template, so the extractor receives the template’s relationships as well as its labels. An unknown name raises ValueError.
With ExtractorBuilder
from neo4j_agent_memory.extraction import ExtractorBuilder
extractor = (
ExtractorBuilder()
.with_gliner_schema("news", threshold=0.5)
.build()
)
Listing available schemas
from neo4j_agent_memory.extraction import list_schemas, get_schema
# List all schema names
print(list_schemas())
# ['poleo', 'podcast', 'news', 'scientific', 'business', 'entertainment', 'medical', 'legal']
# Get schema details
schema = get_schema("podcast")
for entity_type, description in schema.entity_types.items():
print(f"{entity_type}: {description}")
neo4j_agent_memory.ontology.list_templates() returns the same eight names, and get_template(name) returns the template’s OntologyDocument.
Converting a schema to an ontology
DomainSchema.to_ontology() maps each label onto its POLE+O type and subtype and keeps the description as the annotation guideline. Pass relationships to add typed relationships:
from neo4j_agent_memory.extraction import GLiNER2Extractor, get_schema
from neo4j_agent_memory.ontology import RelationshipDef
# Labels only
doc = get_schema("medical").to_ontology()
# Labels plus typed relationships
doc = get_schema("medical").to_ontology(
relationships=[
RelationshipDef(
type="TREATS",
source="drug",
target="disease",
description="A medication used to treat a condition",
),
],
)
extractor = GLiNER2Extractor.for_ontology(doc)
Each source and target must name a label the schema declares; compiling a document that names an undeclared label raises ValueError. A relationship without a description takes one from DomainSchema.relation_types when it names the same type.