-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
label: Kopflos | ||
position: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
label: How-To | ||
position: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.