Add a Data Management System
#
PurposeThe SemApps project is primarily focused on the backend. You need a frontend if you want to interact with the semantic data that are managed by the backend.
However, it is important for many projects to offer visibility on the data they manage, and thus we have provided tools to help you easily build a Data Management System (DMS).
The DMS you will create on this guide is based on React-Admin, a complete framework to build backoffices with React. Used by thousands of developers, it is easy to adapt to your needs.
In this guide, you will :
- Create a DMS using React-Admin;
- Add/modify/delete data using the DMS.
#
PrerequisitesThe only prerequisites is to have NodeJS installed on your computer (use NodeJS version 12).
You will of course also need a LDP server, configured with a SPARQL endpoint. Please see this guide if you didn't set it up yet.
#
Create the DMS#
Setup the DMSWe provide a custom template for Create-React-App to ease the creation of the DMS.
To use it, run this command in the same directory where you ran the moleculer init assemblee-virtuelle/semapps-template-ldp my-project command:
You can now go to the newly-created directory:
#
Launch the DMSTo launch your DMS, run the following command:
Your instance of the DMS is available at http://localhost:5000.
You should get something like this:
#
ConfigurationBy default, the DMS will look on port 3000 of your computer for the LDP server. You can change this by editing the .env
file or by adding a .env.local
file. You will also be able to change the port of the DMS:
#
Adding more resources#
Add more peopleAs we have done in the guide about the LDP server (, you can try to add new people, change their name or surname, and try to remove them.
If everything works well, the changes should appear both on the LDP server (http://localhost:3000/) and on the Jena Fuseki instance corresponding to the semantic database (http://localhost:3030/).
#
Add more types of dataBy default, the template will be configured to have one type of resource, of the semantic type foaf:Person
. You can change this by editing the ./src/config/resources.js
file:
If no types
are defined for the resource, React-Admin will fetch the data from the LDP container at the URL containerUri
.
If types
are defined, the containerUri
field is required only if you need to create new data.
You can then modify the ./src/App.js
component to list the resources, define an edit form, etc. Please see the example provided, and read the excellent React-Admin documentation.