Domain Schemas Reference
Reference for built-in domain schemas and custom schema creation.
Overview
Domain schemas define entity types with descriptions that improve GLiNER zero-shot extraction accuracy. Each schema is optimized for a specific domain.
Available Schemas
poleo
The POLE+O model for investigations and intelligence analysis.
| Entity Type | Description |
|---|---|
|
A person, individual, or named human being |
|
A physical or digital object, item, vehicle, device, or document |
|
A geographic location, address, place, or area |
|
An incident, meeting, transaction, or occurrence in time |
|
A company, agency, institution, or group |
podcast
Optimized for podcast transcripts and interviews.
| Entity Type | Description |
|---|---|
|
A person mentioned or interviewed |
|
A company, startup, or business organization |
|
A product, service, or platform |
|
A concept, methodology, or framework |
|
A book, publication, or written work |
|
A technology, programming language, or technical tool |
news
Optimized for news articles.
| Entity Type | Description |
|---|---|
|
A person mentioned in the news |
|
A company, government agency, or institution |
|
A city, country, or geographic location |
|
A news event, incident, or occurrence |
|
A specific date or time reference |
scientific
Optimized for research papers and scientific text.
| Entity Type | Description |
|---|---|
|
An author or researcher |
|
A university, research lab, or institution |
|
A methodology, algorithm, or technique |
|
A dataset or corpus |
|
A performance metric or measurement |
|
A software tool or framework |
business
Optimized for business documents.
| Entity Type | Description |
|---|---|
|
A company or corporation |
|
A business person, executive, or employee |
|
A product or service |
|
An industry or market sector |
|
A financial metric, revenue, or valuation |
entertainment
Optimized for movies, TV, and entertainment.
| Entity Type | Description |
|---|---|
|
An actor or performer |
|
A director or filmmaker |
|
A movie or film |
|
A television series |
|
A fictional character |
|
An award or recognition |
medical
Optimized for healthcare and medical text.
| Entity Type | Description |
|---|---|
|
A disease, condition, or disorder |
|
A medication, drug, or treatment |
|
A symptom or clinical sign |
|
A medical procedure or surgery |
|
An anatomical structure or body part |
|
A gene or genetic marker |
Using Schemas
With GLiNEREntityExtractor
from neo4j_agent_memory.extraction import GLiNEREntityExtractor
# Use named schema
extractor = GLiNEREntityExtractor.for_schema("podcast")
# With custom threshold
extractor = GLiNEREntityExtractor.for_schema("medical", threshold=0.6)
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}")
Creating Custom Schemas
DomainSchema Class
from neo4j_agent_memory.extraction.domain_schemas import DomainSchema
real_estate_schema = DomainSchema(
name="real_estate",
entity_types={
"property": "A real estate property, building, or land parcel",
"agent": "A real estate agent or broker",
"buyer": "A property buyer or purchaser",
"seller": "A property seller or owner",
"price": "A property price, valuation, or asking price",
"location": "A neighborhood, city, or street address",
},
)
extractor = GLiNEREntityExtractor(schema=real_estate_schema, threshold=0.5)
Schema Persistence
Store custom schemas in Neo4j for reuse:
from neo4j_agent_memory.schema import SchemaManager, EntitySchemaConfig, EntityTypeConfig
# Create schema config
config = EntitySchemaConfig(
name="real_estate",
version="1.0",
description="Real estate domain schema",
entity_types=[
EntityTypeConfig(name="PROPERTY", description="A real estate property"),
EntityTypeConfig(name="AGENT", description="A real estate agent"),
],
)
# Save to Neo4j
manager = SchemaManager(client._client)
stored = await manager.save_schema(config, created_by="admin")
# Load later
schema = await manager.load_schema("real_estate")
Entity Type Mapping
Map schema types to POLE+O for graph storage:
| Schema Type | POLE+O Type | Neo4j Labels |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Custom types not in POLE+O are stored with :Entity:{CustomType} labels.
See Also
-
Extractor Classes Reference - Extractor API
-
Configure Entity Extraction - Pipeline setup
-
POLE+O Model Explained - Entity classification concepts