RDFLIB documentation

A bit of feedback: it is a bit difficult to figure out what documentation to look at when trying to get acquainted with rdflib.js.

All of these share a common ancestor, but are slightly different. It would be nice to have one single source of truth here.

5 Likes

I think it would be cool to If someone could clarify those différents options :

  • UpdateManager.update()
  • fetcher.weboperation()
    And
    solid.auth.fetch(currentFolder, {
    method: ‘POST’, // or ‘PUT’
    headers:{
    ‘Content-Type’: ‘text/turtle’,
    ‘Link’: ‘http://www.w3.org/ns/ldp#BasicContainer; rel=“type”’,
    ‘Slug’: newFolder
    }
    })

What is best to create / update / read folder /file / data ?

1 Like

Hi,

I’m newbie in the last few weeks so this is just my current understanding.

Use the rdflib if you want considerable client side storage and management of data, social data and queries of it.

If you are wanting solid pods to act as “secure USB sticks for the Web” for access anywhere and for collaboration then use the solid-auth-client which is Fetch with cors handled for you.

For my current app layer I’m using solid-auth-client to make a nodejs like fs https://github.com/DataDriven-CAM/solid-fs for isomorphic-git and io to app working on the git collaborative working copy.

1 Like

Updatemanager.update() is a high level function for working with RDF triples/quads - if you already use fetcher and store (all from rdflib.js) then the update manager is useful for making fine grained changes to existing documents/resources (using RDF patch) - whereas the fetcher only(?) allows you to load or write complete documents in one step.

This thread covers my discoverings on the subject: My first app - adding resources?

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 that includes all the CRUD methods.

3 Likes

Your solid-fs with isomorphic-git looks pretty cool i’m interested in versionning :+1:

Currently there are obstacles with

  1. binary and image data. (Content-Type isn’t happening just yet thru the node-solid-server) image/* and application/octet-stream are needed.

  2. limited from emulating a symlink; a symlink I believe can be done with rdf and LDP when more than one container is allowed to predicate a resource or other container.

when these are overcome it will bring the power of git client to pods and collaborative development on code thru solid

We at Inrupt are working hard on improving the documentation in general, and this is definitely something we want to improve :slight_smile: We’ll try to be more open about how we’re planning to do that when we have something more concrete to share.

1 Like

The Solid server does handle images (works for me). But unfortunately it does so by looking and the filename extension instead of the content-type you upload the data with. See Solid server ignores content type · Issue #925 · nodeSolidServer/node-solid-server · GitHub

Does anyone know where to submit request to fix the doc ?
for example : in the page http://linkeddata.github.io/rdflib.js/doc/Fetcher.html

we got
Fetcher The Fetcher object is a helper object for a quadstore which turns it from an offline store to an online store. The fetcher deals with loading data files rom the web, figuring how to parse them. It will also refresh, remove, the data and put back the fata to the web.

and i’d like to submit :

Fetcher The Fetcher object is a helper object for a quadstore which turns it from an offline store to an online store. The fetcher deals with loading data files **f**rom the web, figuring how to parse them. It will also refresh, remove, the data and put back the **d**ata to the web.
@RubenVerborgh ?

I suggest here: https://github.com/linkeddata/rdflib.js/issues

And you can probably find the source and submit a PR here: https://github.com/linkeddata/rdflib.js/tree/master/Documentation

1 Like