Datastores
Address one tenant's knowledge graph from React and from the CLIs.
What it is
A datastore is one tenant’s knowledge graph, addressed by its id. React, the CLIs, and the HTTP APIs all take that id. A caller only reaches the datastores they have been granted.
Browser requests carry the session cookie of your Manta deployment. EmbeddedChatProviders names that deployment with mantaBaseUrl, which defaults to https://app.hiremanta.com. The datastore id travels separately, as the datastoreId prop in React and as --datastore on manta-codegen and manta-upload.
Get a datastore
A datastore is never created by an upload or a query. Manta creates your organization’s datastore when the organization is set up, and one for each team named then. To add one later, for example one per customer, contact us. Use the id Manta gives you rather than deriving it from a name.
A custom app reaches only the datastores picked for it, so pick a new datastore in the app’s settings before the app writes to it. See Which datastores an app reaches.
Import
import { EmbeddedChatProviders } from "@manta-eu/react/providers";
Example
<EmbeddedChatProviders datastoreId="your-datastore">
<YourApp />
</EmbeddedChatProviders>
datastoreId is optional. YourApp is your own tree: anything rendered here uses that datastore. mantaBaseUrl defaults to https://app.hiremanta.com. The same id on the CLIs:
pnpm manta-codegen generate --datastore your-datastore --out ./.ldkit
Request
With datastoreId set, GraphQL and SPARQL from that tree send x-manta-datastore and include the session cookie. A SPARQL read is a POST to /sparql:
fetch(new URL("/sparql", "https://app.hiremanta.com"), {
method: "POST",
credentials: "include",
headers: {
"x-manta-datastore": "your-datastore",
"Content-Type": "application/sparql-query",
Accept: "application/sparql-results+json",
},
body: "SELECT ?s WHERE { ?s a ?type } LIMIT 10",
});
manta-codegen puts the id in the path instead. --datastore your-datastore reads https://app.hiremanta.com/d/your-datastore/sparql.
Response
Setting datastoreId does not return a body. Later reads are scoped to that id.
A SELECT comes back with Content-Type: application/sparql-results+json (the upstream body, passed through). A
CONSTRUCT or DESCRIBE defaults to text/turtle. The endpoint sends the caller’s Accept header through, and uses
that default only when Accept is omitted. A query the endpoint rejects is JSON { "error": "<why>" } with status 403. That includes a query that fails to parse. A query that fails upstream is JSON
{ "error": "SPARQL query failed: <status>", "details": "<upstream text>" }.
manta-codegen prints what it read, on stderr:
manta-codegen: reading the shapes from https://app.hiremanta.com/d/your-datastore/sparql
manta-codegen: the realm vocabulary base is <vocab base>
manta-codegen: the datastore describes <n> class(es):
<prefix>: <count>
manta-codegen: wrote the LDkit schemas to <directory>
When the datastore describes no class, it also prints manta-codegen: the datastore describes no class. Check the datastore id.