Easy ways to convert TypeScript interfaces into RDF?

I’m completely new to Solid, and RDF. I have a TypeScript application that I’m looking to move into the cloud and was hoping to use Solid as the decentralised/decentralisable data store.

  1. So far I have read the tutorial, created the code, run it locally and successfully edited my user profile name.
  2. I then moved to the vocabularies quickstart tutorial and got a bit stuck as I tried to write my own RDF schema in Turtle (where Turtle is a non-XML file format of RDF).

my TypeScript application uses:

  • interfaces that extend from other interfaces (inheritance / composition)
  • enums as stand alone and as types of interface properties
  • dictionaries as properties, that map from ids to other interfaces (classes)

Is there a tutorial out there that demonstrates:

a) using some more advanced schemas (and or work arounds for inheritance, enums, dictionaries)
b) the code to read and write from this data? (I will try to recreate this application from the tutorial locally as it errors for me in codesandbox.io.

Thank you

** edit 2 **

I have also been attempting to use the WebProtege tool link to from RelatedTools. I haven’t yet found the strong community / forum to enable and support learning or using that tool.

Impressions so far

My initial impression is that this project & ecosystem has made significant progress towards being accessible and it’s just got perhaps 3 steps (+ another 1 which in my mind is optional) left :black_square_button: to being understandable (to me):

  1. Solid Pod websites like solidcommunity.net are present, functional and actively improving :orange_heart:
  2. The tutorials are there and mostly work; the last steps of the vocabularies quickstart is currently broken but I’d imagine this is 30-90 minutes work for the person who built them to fix / update them :black_square_button:
  3. This forum is here! :smiley:
  4. The manual writing of RDFs is described in the tutorials. More advanced schemas (work arounds / implementations for inheritance, enums, dictionaries) being referenced from the tutorial would be useful :black_square_button:
  5. Optionally a tutorial to demonstrate the use of a mature tool that supports more of the “advanced” elements of writing RDFs (:black_square_button:)
  • webprotege seems good but can’t seem to add xsd namespace used in the tutorials, also can’t seem to export a RDF Turtle schema file
  • webprotege does seem to support a reasonable search function to find existing properties to reuse
  1. A tutorial that integrates the advanced schema, RDF composing tool (optional) and writes and reads from this data :black_square_button: covering aspects like:
  • data consistency model → can we ensure data consistency, if so how, if not then what types of applications can be build
  • data versioning
  • what types of access functions are there: only simple get requests or are there services that give more powerful search, compound queries etc.

To answer the question in the title: no, TypeScript interfaces cannot be easily converted into RDF. There can’t really be an easy way to do that, since they don’t map cleanly: for example, number data in RDF is commonly defined in terms of integers and floats, whereas TypeScript just has the type number.

As for the vocab tutorial being broken: pinging @zwifi, who worked on those. Other than that I’m pretty unfamiliar with all the vocab- and Protégé-related stuff.

You do identify some current pain points: there is currently no tooling for data consistency, although that’s something the Data Interoperability Panel is working on (@justin will probably be able to speak more to that).

There’s no tooling currently available for data versioning. It’s a hard problem to solve, so hopefully people will start experimenting in that direction at some point.

In terms of access: it is indeed all GET requests. There’s academic research into advanced querying mechanisms, but nothing that would be widely available across most Solid servers any time soon.

1 Like

Thank you so much @Vincent that is incredibly helpful information. Thank you (and the ping-ees) for the pings!

Vocabulary tutorial is fixed
I have now fixed the vocabulary quick start tutorial, repo here. It was primarily stubbing out the lit-vocab-term which is not available yet and “upgrading” IRIs from solid.community to solidcommunity.net . I also added a bit of UI to make it easier to use / understand.

JavaScript numbers
I will also try my best at exploring the limits of Solid + RDF and the typescript interfaces I want to support. For number I think I will first try with just using float as that is how (I think) the number is represented in javascript anyway. (Though this RFC suggests it’s a double, and this StackOverflow Q&A suggests it’s “nearest double”).

Data consistency & versioning
Ok I understand, thank you for the link, I’ll aim to join one of their meetings. My application is a prototype at the moment and I was hoping to just do it all client side without having a server side that could accept data and forward data. If anyone knows of any other application users of Solid that have built server-side abstractions to cope with data consistency / data versioning then any pointers would be very welcome, I don’t want to reinvent it :slight_smile:

The prototype currently pulls everything it needs into client side so that’s not a problem. I guessed search over distributed data would be a very hard nut to start cracking.

Ahh! There’s a part 2 tutorial on docs.inrupt.com (found link from this Q&A).

I guess the difference between inrupt.com and solidproject.org is the first is the commercial expression of the second which is the open source / community content? (I’m slightly less confused now! :slightly_smiling_face:)

Yes, you’ve pretty much got it. The solidproject.org website, this forum, the gitter chatrooms, the solidcommunity.net pod and identity provider, the github solid/* repos, the Solid World events, are part of Solid as an open source project. Inrupt is a private company using and promoting Solid that also provides separately a proprietary (inrupt.com) and open source (inrupt.net) pod and identity services, tutorials, and other useful things. They and other companies like Janiero provide some small funding and a lot of personal time to the open source project and are prominent in the facilitation of the project but are neither synonymous with, nor responsible for the open source project.

Most things like the tutorials benefit both Inrupt and the open source Solid project. Sometimes the same person writes for both. But at the end of the day, Inrupt is a company and solidproject.org is an open source community project and both want Solid to succeed.


Just to emphasise that mapping to vocabularies and shapes is tricky too.

It might be of interest to see how typescript interfaces generated from a shex shape deal with this, e.g. in a previous post: Using shape expressions to become interoperable just got a whole lot easier

1 Like

Since you’re getting started with Solid, and you’re asking about TypeScript, maybe you’d like to check out my soukai-solid library. It is not exactly what you are asking for, it’s an ActiveRecord implementation for Solid. But maybe you find it interesting, even if you don’t use it.

In the development branch (next), I have improved the inference as well, so if you just want to play around with it, I’d recommend using that one (you can install it with npm install soukai@next soukai-solid@next).

About models inheritance and interfaces, I haven’t done a lot of that myself because it hasn’t been necessary, but technically it should be possible by just extending the classes. If there is something that isn’t working as you’d expect, feel free to open an issue (I’d appreciate it :D).

TLDR would be:

class Person extends SolidModel {

    static rdfContexts = {
        'foaf': 'http://xmlns.com/foaf/0.1/',

    static rdfsClasses = ['foaf:Person'];

    static fields = {
        name: {
            type: FieldType.String,
            rdfProperty: 'foaf:name',


Soukai.loadModels({ Person });

// If you want to make authenticated requests, you should use the fetch method from an authentication library.
Soukai.useEngine(new SolidEngine(window.fetch.bind(window)));

const person = Person.at('https://example.org/people/').create({ name: 'John Doe' });

// Here, you can use person.name and it'll be inferred as a "string", you can also define other types of fields: Numbers, Arrays, Dates, etc.