Skip to content

Commit

Permalink
docs: configuring sparql endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Aug 9, 2024
1 parent 2b4333d commit 47f9bc8
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 1 deletion.
7 changes: 7 additions & 0 deletions docs/apis/apis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
sidebar_position: 1
---

# Data-Centric APIs

TBD - introduce the concept of data-centric APIs
2 changes: 2 additions & 0 deletions docs/apis/kopflos/_category_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
label: Kopflos
position: 2
2 changes: 2 additions & 0 deletions docs/apis/kopflos/how-to/_category_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
label: How-To
position: 2
66 changes: 66 additions & 0 deletions docs/apis/kopflos/how-to/sparql-endpoints.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Configure SPARQL endpoints

Kopflos can be configured with one or more SPARQL endpoints which can be accessed at runtime by
handler implementors. A single endpoint is required, named `default`.

To configure the endpoints, one of three methods is supported.

## From endpoint URL

The simplest option is to provide a single unauthenticated endpoint URL which will be used for queries and updates.

```js
import Kopflos from '@kopflos-cms/core'

let graph

const kopflos = new Kopflos(graph, {
sparql: {
default: 'http://example.com/query',
}
})
```

## From endpoint configuration object

A more complex scenario will often require separate query and update URLs and authentication. In such
cases, provide a full settings object as required by [`sparql-http-client`](https://github.com/rdf-ext/sparql-http-client).

```js
import Kopflos from '@kopflos-cms/core'

let graph

const kopflos = new Kopflos(graph, {
sparql: {
default: {
endpointUrl
}
}
})
```

## Provide instances of SPARQL clients

Lastly, it is possible to create the clients manually in code and pass them to Kopflos.
Both `stream` and `parsed` clients are required.

```js
import StreamClient from 'sparql-http-client'
import ParsingClient from 'sparql-http-client/ParsingClient.js'
import Kopflos from '@kopflos-cms/core'

let graph

const stream = new SparqlClient({ endpointUrl })
const parsed = new ParsingClient({ endpointUrl })

const kopflos = new Kopflos(graph, {
sparql: {
default: {
stream,
parsed
}
}
})
```
2 changes: 1 addition & 1 deletion docs/cubes/cubes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ sidebar_position: 1

# RDF Data Cubes

This sections contains information about practical usage of RDF Data Cubes represented with the [cube.link Cube Schema](https://cube.link/).
This section contains information about practical usage of RDF Data Cubes represented with the [cube.link Cube Schema](https://cube.link/).
6 changes: 6 additions & 0 deletions docusaurus.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ const config = {
position: 'left',
label: 'Workflows',
},
{
type: 'docSidebar',
sidebarId: 'apisSidebar',
position: 'left',
label: 'APIs',
},
{
type: 'docSidebar',
sidebarId: 'cubesSidebar',
Expand Down
1 change: 1 addition & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const sidebars = {
aboutSidebar: [{type: 'autogenerated', dirName: 'about'}],
rdfjsSidebar: [{type: 'autogenerated', dirName: 'rdfjs'}],
workflowsSidebar: [{type: 'autogenerated', dirName: 'workflows'}],
apisSidebar: [{type: 'autogenerated', dirName: 'apis'}],
cubesSidebar: [{type: 'autogenerated', dirName: 'cubes'}],

// But you can create a sidebar manually
Expand Down
10 changes: 10 additions & 0 deletions src/components/HomepageFeatures/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ const FeatureList: FeatureItem[] = [
</>
),
},
{
page: '/docs/apis/',
title: 'APIs',
image: '/img/kopflos.png',
description: (
<>
Simply create APIs for your data-centric applications
</>
),
},
{
page: '/docs/cubes/',
title: 'Cubes',
Expand Down
Binary file added static/img/kopflos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 47f9bc8

Please sign in to comment.