open-index/open-npm huggingface dataset:
npm package: @kopflos-cms/in-memory
Description: In-memory oxigraph store for Kopflos
Author: Zazuko GmbH
Latest version: 0.1.0

# @kopflos-cms/in-memory

In-memory oxigraph store for Kopflos.

It provides SPARQL clients that use an in-memory [Oxigraph](https://oxigraph.org/) store. This is useful for development, testing, or small applications that do not require a persistent database.

## Installation

```bash
npm install @kopflos-cms/in-memory
```

## Usage

In your `kopflos.config.ts`, you can use `createInMemoryClients` to configure the default SPARQL endpoint:

```typescript
import { KopflosConfig } from '@kopflos-cms/core'
import { createInMemoryClients } from '@kopflos-cms/in-memory'

export default <KopflosConfig>{
  // ...
  sparql: {
    default: createInMemoryClients(),
  },
  // ...
}
```

### Using an existing Oxigraph store

You can also pass an existing Oxigraph `Store` instance to `createInMemoryClients`:

```typescript
import * as oxigraph from 'oxigraph'
import { createInMemoryClients } from '@kopflos-cms/in-memory'

const store = new oxigraph.Store()
// ... populate store ...

const clients = createInMemoryClients(store)
```

## Features

- Provides both `StreamClient` and `ParsingClient` implementations.
- Supports `SELECT`, `CONSTRUCT`, `ASK`, and `UPDATE` queries.
- Implements `store` interface for `GET`, `POST`, and `PUT` operations.
- All queries executed against the union graph.
npm package: @kopflos-cms/shacl
Description: [Docs @ data-centric.zazuko.com](https://data-centric.zazuko.com/docs/apis/kopflos/reference/modules/shacl/)
Latest version: 0.3.1

# @kopflos-cms/shacl

[Docs @ data-centric.zazuko.com](https://data-centric.zazuko.com/docs/apis/kopflos/reference/modules/shacl/)
npm package: @kopflos-labs/handlebars
Description: Processes handlebars templates in kopflos. Used together with the [@kopflos-labs/html-template](https://npm.im/@kopflos-labs/html-template).
Author: Zazuko GmbH
Latest version: 0.1.1

# Handlebars templates in kopflos

Processes handlebars templates in kopflos. Used together with the [@kopflos-labs/html-template](https://npm.im/@kopflos-labs/html-template).

## Setup

Add to a handler chain to process handlebars templates.

```turtle
[
  a kl:ResourceShape ;
  kl:handler
    [
      a kl:Handler ;
      kl:method "GET" ;
      code:implementedBy
        (
          # ...previous handlers to prepare the template...
          [
            a code:EcmaScriptModule ;
            code:link <node:@kopflos-labs/html-template#default> ;
            code:arguments
              (
                [ a code:EcmaScriptModule; code:link <node:@kopflos-labs/handlebars#default> ]
                "${uri}"^^code:EcmaScriptTemplateLiteral
              ) ;
          ]
        )
    ] ;
] .
```

See [@kopflos-labs/html-template](https://npm.im/@kopflos-labs/html-template) for more general information
on writing templates.

## Template helpers

### `valueof`

Requires exactly one argument which is a named node or SHACL Property Path.

As a named node, it can be a prefixed name known to the `@zazuko/prefixes` package.

Presently, only Sequence Paths are supported.

```html
<!DOCTYPE html>
<html lang="en">
<head>
  <template target-class="/api/schema/Plaque">
    <title> {{ valueof 'schema:name' }} ::: Read the Plaque</title>
  </template>
</head>
<body>
  <template target-class="/api/schema/Plaque">
    <h1>{{ valueof 'schema:name' }}</h1>
    <img src="{{ valueof 'schema:image/schema:url' }}" />
  </template>
</body>
</html>
```
npm package: @kopflos-labs/html-template
Description: Renders `<template>` elements in kopflos but running their contents in a templating library.
Author: Zazuko GmbH
Latest version: 0.1.1

# Template processor for kopflos

Renders `<template>` elements in kopflos but running their contents in a templating library.

## Usage

Add to a handler chain to process templates.

Two parameters are required:
1. A `(template: string, graph: MultiPointer): string` function delegate
2. The URL of the resource to render (⚠️ This is bound to change soon ⚠️)

The function is called for every `<template>` element in the document, bottom up. The HTML contents
of the `<template>` element are passed as the `template` parameter. The `graph` parameter is a
[clownface](https://npm.im/clownface) object representing the resource to render. The node which it
represents depend on the nesting of the `<template>` elements.

```turtle
[
  a kl:ResourceShape ;
  kl:handler
    [
      a kl:Handler ;
      kl:method "GET" ;
      code:implementedBy
        (
          # ...previous handlers to prepare the template...
          [
            a code:EcmaScriptModule ;
            code:link <node:@kopflos-labs/html-template#default> ;
            code:arguments
              (
                [ a code:EcmaScriptModule; code:link <node:@kopflos-labs/handlebars#default> ]
                "${uri}"^^code:EcmaScriptTemplateLiteral
              ) ;
          ]
        )
    ] ;
] .
```

## Templating libraries

- [@kopflos-labs/handlebars](https://npm.im/@kopflos-labs/handlebars)

## Writing templates

### Target Class

The `target-class` attribute on the `<template>` element is used to select resources to render from
the `graph`.

The value can be a relative URL, which will be resolved against the API's base IRI.

```html
<!DOCTYPE html>
<html lang="en">
<body>
  <template target-class="/api/schema/Plaque">
    <!-- use a templating library to render instances of /api/schema/Plaque -->
    <div>
      <h1>{{ schema:name }}</h1>
    </div>
  </template>
</body>
</html>
```

### Property Paths

A `<template>` element with `property` attribute is used to drill down into the graph.

```html
<!DOCTYPE html>
<html lang="en">
<body>
  <template target-class="/api/schema/Plaque">
    <template property="schema:image">
      <!-- here the context changes to the image of the plaque resource -->
      <img src="{{ schema:url }}" />
    </template>   
  </template>
</body>
</html>
```