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

person

A human individual, including their name, alias, or persona

organization

A company, institution, government agency, or group

location

A geographic place, address, city, country, or landmark

event

An incident, meeting, transaction, or notable occurrence

object

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

KNOWS

Person → Person

—

ALIAS_OF

Person → Person

acyclic

MEMBER_OF

Person → Organization

—

EMPLOYED_BY

Person → Organization

unique source

OWNS

Person → Object, Organization → Object

—

USES

Person → Object

—

LOCATED_AT

Person, Object, Organization or Event → Location

—

RESIDES_AT

Person → Location

unique source

HEADQUARTERS_AT

Organization → Location

unique source

PARTICIPATED_IN

Person → Event, Organization → Event

—

OCCURRED_AT

Event → Location

—

INVOLVED

Event → Object

—

SUBSIDIARY_OF

Organization → Organization

acyclic

PARTNER_WITH

Organization → Organization

—

RELATED_TO

any label → any label

threshold 0.6

MENTIONS

any label → any label

threshold 0.6

podcast

Extraction label Description

person

A person mentioned in the podcast, including hosts, guests, and people discussed

company

A company, startup, or business organization

product

A product, service, app, or software tool

concept

A business concept, methodology, framework, or strategy

book

A book, publication, or written work

location

A city, country, region, or specific place

event

A conference, meeting, milestone, or notable occurrence

role

A job title, position, or professional role

metric

A business metric, KPI, or measurement

technology

A technology, platform, programming language, or technical tool

Relationships declared by the podcast template:

Type Permitted endpoints

WORKS_AT

person → company

FOUNDED

person → company

LOCATED_IN

company → location

DISCUSSES

person → concept

news

Extraction label Description

person

A person mentioned in the news article

organization

A company, government body, or institution

location

A geographic location, city, or country

event

A news event, incident, or occurrence

date

A date, time period, or temporal reference

Relationships declared by the news template:

Type Permitted endpoints

WORKS_AT

person → organization

LOCATED_IN

organization → location

PARTICIPATED_IN

person → event

OCCURRED_AT

event → location

scientific

Extraction label Description

author

A researcher or paper author

institution

A university, research lab, or academic organization

method

A scientific method, algorithm, or technique

dataset

A dataset, corpus, or data collection

metric

A performance metric or evaluation measure

concept

A scientific concept, theory, or term

tool

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

company

A business, corporation, or startup

person

A business person, executive, or founder

product

A product, service, or offering

industry

An industry sector or market

financial_metric

A financial metric, revenue, or valuation

location

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

actor

An actor, actress, or performer

director

A film or TV director

film

A movie, documentary, or film

tv_show

A television series or show

character

A fictional character

award

An award, nomination, or recognition

studio

A production studio or entertainment company

genre

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

disease

A disease, condition, or disorder

drug

A medication, drug, or treatment

symptom

A symptom or clinical sign

procedure

A medical procedure or intervention

body_part

An anatomical structure or body part

gene

A gene, protein, or biomarker

organism

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.

Extraction label Description

case

A legal case or lawsuit

person

A party, lawyer, or judge

organization

A law firm, court, or legal entity

law

A law, statute, or regulation

court

A court or judicial body

date

A legal date, filing date, or deadline

monetary_amount

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.