> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hystersis.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Ontologies

> External knowledge grounding with RDF, OWL, and SKOS ontologies

# Ontologies

Hystersis supports external knowledge grounding through RDF, OWL, and SKOS ontologies.

## Overview

Ontologies allow you to:

* Ground entities in established knowledge structures
* Link memories to external knowledge bases (medical, legal, scientific)
* Improve accuracy through semantic standardization
* Enable reasoning across knowledge domains

## Supported Formats

| Format | Description                          | Use Case                        |
| ------ | ------------------------------------ | ------------------------------- |
| RDF    | Resource Description Framework       | General knowledge graphs        |
| OWL    | Web Ontology Language                | Formal knowledge representation |
| SKOS   | Simple Knowledge Organization System | Taxonomies, thesauri            |

## Usage

### Loading an Ontology

```go theme={null}
// Load from URL
provider := ontology.NewRDFProvider()
onto, err := provider.Load(ctx, "https://example.com/medical-ontology.rdf")

// Load from file
onto, err := provider.Load(ctx, "/path/to/ontology.rdf")
```

### Querying Concepts

```go theme={null}
// Search for concepts
concepts, err := provider.Query(ctx, ontology, "machine learning")
```

### Linking Entities to Ontology

```go theme={null}
// Link an entity to matching ontology concepts
entity := &types.Entity{
    Name: "Neural Network",
    Type: "concept",
}

links, err := provider.Link(ctx, entity, ontology)
// Returns matching concepts with confidence scores
```

## Ontology Link Results

```json theme={null}
{
  "concept_id": "http://example.com/nn",
  "concept_name": "Neural Network",
  "match_score": 0.95,
  "link_type": "exact_match",
  "properties": {
    "definition": "Computing system inspired by biological neural networks",
    "domain": "machine_learning"
  }
}
```

## Built-in Providers

### RDF Provider

```go theme={null}
provider := ontology.NewRDFProvider()
onto, _ := provider.Load(ctx, source)
```

### OWL Provider

```go theme={null}
provider := ontology.NewOWLProvider()
onto, _ := provider.Load(ctx, source)
```

### SKOS Provider

```go theme={null}
provider := ontology.NewSKOSProvider()
onto, _ := provider.Load(ctx, source)
```

## Common Ontologies

* **Medical**: SNOMED CT, UMLS, ICD-10
* **Legal**: Legal Knowledge Interchange Format (LKIF)
* **Scientific**: Gene Ontology, Semantic Science Ontology
* **General**: DBpedia, Wikidata
