Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(kopflos): handler pipeline #29

Merged
merged 8 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/apis/kopflos/explanations/_category_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
label: Explanations
position: 3
70 changes: 70 additions & 0 deletions docs/apis/kopflos/explanations/request-pipeline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
title: Request pipeline
sidebar_position: 1
---

# Kopflos request pipeline

```
Incoming Request
└─▶ Kopflos handler
4**/5** ◀─┴─▶ Resource Shape Lookup
4**/5** ◀─┴─▶ Resource Loader Lookup
4**/5** ◀─┴─▶ Load Resource
4** ◀─┴─▶ Authorization
400 ◀─┴─▶ Validation
4**/5** ◀─┴─▶ (User handler)
└─▶ Reply
```

## Incoming request

Incoming request is handled by the server library, such as express or fastify and then forwarded to Kopflos.

## Kopflos handler

Kopflos handler is the main entry point for all incoming requests. It is responsible for orchestrating the request pipeline.

## Resource Shape Lookup

Resource Shape Lookup executes SPARQL against the `default` query endpoint to find the shape targeting the requested resource.

:::tip
See also: [How to Select which resources should be served by the API](../how-to/resource-shape.md)
:::

## Resource Loader Lookup + Load Resource

When the Resource Shape is found, a resource loader is selected based from `kopflos:resourceLoader` property, going bottom-up from the Resource/Property Shape to the share `kopflos:Config` resource.

It is used to load the requested resource's Core Representation.

:::info
The Core Representation are the triples returned by the resource loader. Typically, that would be the result of a SPARQL `DESCRIBE` query or contents of resource's "own graph".
:::

:::warning
By default, a loader which returns the resource's own graph is used.
:::

## Authorization

Not implemented yet.

## Validation

Not implemented yet.

## User handler

Finally, the handler is executed. If no handler is defined, and the request method is a GET, the resource's Core Representation is returned.

The result of the handler is forwarded back to the server library to be sent as a response.
Loading