# RDFLIB documentation

**URL:** <https://forum.solidproject.org/t/rdflib-documentation/585>\
**Category:** Instructions\
**Created:** [November 15, 2018, 7:18pm UTC](https://forum.solidproject.org/t/rdflib-documentation/585 "2018-11-15T19:18:24Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![JornWildt](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/jornwildt/32/112_2.png) [@JornWildt](https://forum.solidproject.org/u/JornWildt)\
**Post date:** [November 15, 2018, 9:39pm UTC](https://forum.solidproject.org/t/rdflib-documentation/585/5 "2018-11-15T21:39:32Z")

</div>

This thread covers my discoverings on the subject: [My first app - adding resources?](http://forum.solidproject.org/t/my-first-app-adding-resources/275)

I’ve managed to use RDFLIB without any low level HTTP work. Add, Query, Update, Delete works like this:

Adding resource at URL X:

- Add statements \<X, some-predicate, some-value, X\> for each property of the resource. Use store.add(X,p,v,X) to save the statements locally;
- PUT the new statements onto the web: Use fetcher.putBack(X);

Reading list of resources:

- Load all resources into local store using the fetcher to first load the container and then load each item, one by one, in it.
- Extract all the found data from the local store. Use store.match(…)

Remove a single resource at url X:

- Remove the resource from the web. Use fetcher.delete(X).
- Remove local knowledge of the resource: Use store.removeDocument(X).
- Remove all local statements: Use store.removeMatches(X);

Update a single resource at url X:

- Use update-manager.update()
- Or replace it completely with fetcher.putBack(x) … haven’t tried this though.

And beware that the web-oriented operations in the fetcher are all async using promises.

It took me a while to figure out why my “refresh list” operation did not include a newly added resource. That was because the “put” operation executed asynchronously and did not complete before the refresh list called the server for a an update.

Be careful to add await .then() and .catch() to the right places in your code.

See also my experimental “Object to RDF mapper” at [https://github.com/JornWildt/SolidRC/blob/master/wwwroot/js/ORDFMapper.js](https://github.com/JornWildt/SolidRC/blob/master/wwwroot/js/ORDFMapper.js) that includes all the CRUD methods.

---

_[View the full topic](https://forum.solidproject.org/t/rdflib-documentation/585)._
