Skip to main content

Data Model

The dataModel config passed to the semantic data provider describes how we want the data to be displayed in React-Admin.

Usage

In the config below User is the name of the React-Admin resource. All the configs are solely for this given resource.

const dataModel = {
User: {
types: 'foaf:Person',
list: {
servers: '@all',
containers: {}, // Si spécifié, bypass la valeur servers. On passe quand même par SPARQL pour faire la requête.
blankNodes: [],
blankNodesDepth: 2.
forceArray: [],
predicates: [],
filter: {},
fetchContainer: false,
explicitEmbedOnFraming: true,
},
create: {
server: '@default',
container: null,
},
fieldsMapping: {
title: 'foaf:name'
}
},
Document: { ... }
};

Parameters

PropertyTypeDefaultDescription
typesArray or `StringrequiredType(s) of resources to fetch or create
list.serversArray or String"@all"The servers where to fetch the resource.
list.containersArray or StringURL(s) of the container(s) to fetch. If specified, will bypass the list.servers config.
list.blankNodesArrayPredicates listed are blank nodes and will be dereferenced in SPARQL queries. Automatically set if VoID endpoints are found.
list.blankNodesDepthIntegerIf no blank nodes are indicated above, the SPARQL query will automatically search for blank nodes 2-level deep. Setting this parameter to 0 is equivalent to blankNodes: [] (no blank nodes will be returned)
list.forceArrayArrayPredicates listed will be turned to arrays if they are simple strings. Used by for reified relationship. To be deprecated.
list.predicatesArrayWill only fetch the given predicates (and the @type). Benchmark
list.filterObjectReact-Admin permanent filter applied to all requests. Docs
list.fetchContainerBooleanfalseIf true, the data provider will fetch the LDP containers instead of doing a SPARQL request.
list.explicitEmbedOnFramingBooleantrueIf false, improve performances by not including the @embed rule in post-request JSON-LD framing
create.serverString"@default"The server where to create new resources.
create.containerStringURL of the container where to create new resources. If specified, will bypass the create.server config.
fieldsMapping.titleStringThe predicate of the title. Required by several components.

Servers special keys

For the list.servers and create.server config, you can use either the server key (the main key defined in the dataServers config) or the following special keys:

  • @default: The server with the config default: true
  • @auth: The server with the config authServer: true
  • @pod: The server with the config pod: true

For the list.servers config, you can use these additional special keys:

  • @all: All the servers defined
  • @remote: All servers which are not the default server