Help using different libs: rdflibjs, tripledoc, ldflex, solid-file-client

I want to make a widget like @Vincent 's Notepod for Solidash

Some constraints :

  • I want my app that could be easily changeable and really simple, so I don’t want any webpack or build.
  • for the simplicity of hosting on github-pages or on a Pod, I don’t want any techno server as node/express, and use prepackages libs for accessing and managing data on a Pod.
    ( I put node but only to download modules, but I don’t want to use it in prod)
  • I don’t like Angular or React, perhaps because I’ve discovered Polymer first, and I like the concept of web-components Polymer provides.

So for every libs in the list and why not other, it would be nice if someone that know how to read data, create data, update data, to do the same actions as Notepod.
It could be a good example of how to do this type of action, and could help us to compare.
That could also be a complement to @Vincent cheatsheet.

Example of integration in app can be found here

and components are instance of LitElemet class like this one

  • I’ve tried with solid-file-client but I don’t know how to update, or add a line in a turtle file, and it seams that it loads more than one version of solid-auth !? @jeffz?
  • I’ve tried with tripledoc, but I was not able to load a browser version of tripledoc & rdf-namespaces

So I would like to build some examples of each lib as simple as possible to add some notes on a Pod. Could everyone expert on those libs help me ?


  • @dprat0821 :stuck_out_tongue_winking_eye:
    I’ve used evejs (Multi-agents js lib for communication between each component) but this must not interfere with rdf libs, because it’s another part of the project
1 Like

This repo has some examples that might be helpful:

For reference, here’s the cheatsheet mentioned.

I would certainly recommend a bundler, because it will remove code for you that is unused. However, I just published v2.4 of Tripledoc that also includes a browser bundle. Do note that you will also currently need to include rdflib in your page, which is used by Tripledoc. Here’s an example of how to run Tripledoc without a bundler. Update: Tripledoc v3 and above no longer use rdflib behind the scenes, but N3.js. Here’s an updated example of running Tripledoc without manually running a bundler.

The examples in the Cheatsheet for rdflib should work as well by just including a <script> tag pointing to rdflib, but you’ll need to change code like

import { graph } from "rdflib";

const store = graph();


const store = $rdf.graph();

Does that help?


@Vincent thxs , i will try it

1 Like

Thanks for sharing. Just checked that evejs does a good job in providing the multi-agent communication layer.

Just FYI, Rxjs can simplify your logic in handling some practical complexities (such as throttle to filter duplicated messages, etc.)

For the agent communication, the actor model (eg. Akka ) were once very popular, now ReactiveX (eg. Rxjs mentioned above) is trending as well. You can find implementations for different languages (Java, Js, C#, …) in case you need to support different platforms with same framework.

Cool, it folks on !
but on this page

  typeRegistration.addRef(solid.instance, document.asRef())

shouldn’t be

  typeRegistration.addRef(solid.instance, **notesList**.asRef())

-> How do you open the page that propose to the user to add your app to “Trusted Apps”?

Thanks for spotting that, that should indeed be notesList.asRef(). That was actually fixed in a draft version, but for some reason didn’t make it onto the live site - we’ll have that fixd soon.

As for your other question, you’re talking about this page right?

Users get that the first time they connect their Pod to an app on your origin (i.e. when that origin has not yet been added to their trusted apps, so if you follow the authentication guide, you should be set.

yes , this one, i’ll try, thxs

using this code

async function popupLogin() {
let session = await solid.auth.currentSession();
let popupUri = '';
if (!session)
session = await solid.auth.popupLogin({ popupUri });

in this module does not give me the page for “Trusted Apps” when I click on “login button”.

I use a copy of solid-auth-client.bundle.js found in “node_modules/solid-auth-client/dist-lib”
Do you have a idea why I don’t have the “trusted app” window ?

That’s because your popupUri refers to, so users are actually logging in to there. Presumably, is already in your trusted apps list, which is why you’re not seeing the login. This is what I get:

Note that it asks me to authorise rather than

To fix it, you can either:

  • Host the popup.html yourself - it can be downloaded from here.
  • Provide our own UI that allows people to enter their identity provider (e.g. or, instead of using popupLogin. Here’s an example.

ok, i use a local popup ( let popupUri = ‘./dist-popup/popup.html’:wink:
and it looks good.

1 Like

Hi Soliders are there big performance differences between the different libs

I’m asking that because I must impove performance of Shighl for Solidarity’s Chat.
For now Shighl is based on query-ldflex, but i think there is a lot of await to parse all chat messages and @jucole confirm some degradation So does anyone have an idea of which is the most performant for this task before i start to rewrite ?
Or do I have to low deal with Sparql query ?


As far as I know, all of those libraries use solid-auth-client.fetch() to do actual Input/Output. It would be interesting to see if they have much of a difference in speed, I wouldn’t expect it. Solid-File-Client is good at managing files and folders. If you need to copy a bunch of things or you need to create a certain file/folder structure on the user’s pod - it’s a good choice. It does not do any of the parsing, So if you need to do triple-level patching or reasoning or anything other than managing the files, you should use one of the other libraries for that. [Edit : well it does some parsing - it returns the structure and contents of folders and the types and other metadata of files and folders and parses link headers so that it knows how to handle .acl and other linked resources]

@Smag0 The important thing for LDflex is that it sits on top of a query layer. You can plug in either Comunica ( or rdflib.js ( to fulfill that role.

Right now, we have a performance issue in the browser (only) with Comunica ( but it is actively being worked on.

In the end, there should not be much difference compared to others, and the idea is even that a query engine will be able to do optimizations that libraries with more direct access cannot do.

But in general, it’s early days for performance testing.

1 Like

Thxs for that infos, is there a simple way to switch to rdflib instead of communica in ldflex-query?
Edit : forget Ok I see it

In the case of Soukai, something to keep in mind is that it implements the Active Record pattern. This is important because one of the main critiques to this pattern is performance issues. The problem is not the pattern itself, but the fact that because it’s so “easy” to interact with a database (in this case, the network) it hides away how queries (in this case requests) are being performed. Perhaps the most relevant example is the N+1 problem.

In my opinion this is not an issue and I use the pattern in most of my applications (not only Solid). But of course, you need to be careful with that. The important thing for performance issues is to inspect what queries are being performed under the hood (in this case network requests, which is easy to debug given browser dev tools :smiley:). If there is something too problematic, you can always fall back to other low-level solutions like using solid-auth-client yourself.

That is, assuming your bottleneck is the network (which it usually is). If your performance issues lie in the JS layer and not the network, you need to be careful with how many instances you are creating and what you are doing with them. But I really doubt that’s the problem.

Other than that, there is an open issue in node-solid-server and as far as I know, SPARQL queries are not supported. That’s why Soukai uses globbing under the hood and that can create problems depending how you have structured your data. I am having some performance issues in one application, but I don’t think it can be solved with any library since the problem lies in the server & data structure. In the end, I think my solution will be more related with having data cached in the browser rather than improving network requests, but I have to look into it.

There are no benchmarks I’m aware of, unfortunately, so I could only give you some high-level theorising about how different approaches might result in different performance characteristics, but since that would most likely be wrong (with limited knowledge of the different approaches and no benchmarks), I won’t try that.

In any case, LDflex uses Comunica behind the scenes, so that’s a switch that would not make sense. As Noel said, SPARQL is not supported, so you can scratch that approach as well. And Solid File Client is indeed focused more on complete files rather than parsing and manipulating RDF data, so that doesn’t really seem to make sense for this use case either.

Thus, the list could be shortened to Soukai, rdflib and Tripledoc - and potentially, manually sending requests with solid-auth-client. However, before trying it with a different library, take a look at the Network tab in your browser to rule out some potential other causes. Are you seeing many HTTP requests to your Pod that could theoretically be a single one, indicating that you could rewrite your code? Are you seeing requests that take a long time to return a response, indicating that the problem is in the server response time?

Don’t forget graphy.js which is performant wrt RDF processing and I’ve been using. More on this and other libs here:

1 Like

Sorry but i don’t know how to migrate to rdflib instead of communica
in my code here i use

import data from "@solid/query-ldflex";

trying to replace by '@solid/query-ldflex/lib/exports/rdflib'
doesn not work because there is no ‘exports’ folder in lib… Any idea ?

Are you using @solid/query-ldflex version 2.10.0?