# Writing to Graph Databases

## Graph Writer

To write to a graph database, you will need to use the [Graph Writer](/EGeX4aTAJLlpg9Hh8kfl/graph-writer.md). This applies to both Labelled Property Graphs and Semantic Graphs.

The Graph Writer supports Update and Insert modes.

### Automatic processing with Kafka integration

If you have integrated Kafka into your stack, graph models can be automatically written, by the graph writer, to a configured target graph database. See [Stack Run Configurations](/EGeX4aTAJLlpg9Hh8kfl/stack-run-configurations.md) for examples.

The process is as follows:

1. A transformer successfully completes a transformation task, which results in
   1. New graph models successfully written to disk or S3&#x20;
   2. New success message posted to Kafka "success" topic, containing the path to the new files
2. The writer, configured to listen to the Kafka 'success' topic, performs the following tasks
   1. Consume a 'success' message from the Kafka topic
   2. Read the new graph models into memory
   3. Persist to the configured target graph database

### Manual processing using the REST endpoint

If however you do not have a Kafka service running, or you wish to push data manually to your graph, you can use the Graph Writer's RESTful API endpoint.

Firstly, get the URL of the file you wish to import, ensuring that the Writer has direct access to it. If generated by the Transformers, this will be the same file URL shown in the successful transformation report. Using this file URL, run a `GET` request on the following endpoint:

`http://<graph-writer-endpoint>:<graph-writer-port>/process?inputRdfURL=<graph-data-file-URL>`

For example:

`http://127.0.0.1:9610/process?inputRdfURL=s3://graphbuild/output/SS-Transformer-1234.nq`

Upon completion, a processing report will be provided in the response message.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.graph.build/EGeX4aTAJLlpg9Hh8kfl/getting-started-tutorial/writing-to-graph-databases.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
