<!-- AUTO-GENERATED: do not edit by hand -->
# Kg

<!-- AUTO-DESC:START -->

## Overview

Knowledge-Graph builder endpoints. They drive the conversion of relational/CSV data into RDF triples loaded in a source's named graph, and expose helpers to inspect the underlying database schema. Companion entry point at the root: `kg.js` (whole-source build).

## Modules

### 1. Triple generation (`triples.js`)
- `POST` generates triples from a CSV file or a SQL table for a given source (`KGbuilder_main.importTriplesFromCsvOrTable`).
- `DELETE` removes triples previously generated by KGBuilder for a source, optionally restricted to a subset of tables.

### 2. Database introspection (`data.js`, `model.js`)
- `data.js` reads sample rows from a configured database, or executes a `SELECT` statement filtered by `UserRequestFiltering`.
- `model.js` returns the table → columns map of a database, used to populate the column pickers in MappingModeler.

### 3. Graph reset (`clearGraph.js`)
Drops every triple from a named graph (SPARQL `CLEAR GRAPH`). Typically called before a full rebuild.

### 4. Mapping persistence (`mappings.js`, `mappings/*`)
Saves a mapping document for a source and exposes nested routes to read/list mapping files and recreate triples from them.

### 5. Asset-level mappings (`assets/*`)
Reads global mapping documents shared across mappings targeting the same logical asset.

<!-- AUTO-DESC:END -->

```{toctree}
:maxdepth: 5
:caption: Contents

assets/index
mappings/index
```

<!-- AUTO-INLINE-FILES:START -->

## Files in this directory

- `clearGraph.js`
- `data.js`
- `mappings.js`
- `model.js`
- `triples.js`

<!-- AUTO-INLINE-FILES:END -->
