-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Turtle manipulation/validation #902
Comments
Hi @vanhumbeecka, thanks for the detailed description of your use case. The ability to parse plain Turtle into SolidDatasets is duly noted and something we'll hopefully be able to get to at some point. Something we are hoping to be able to get to in the nearer-term future is an officially supported way for solid-client to accept RDF/JS data as input. That would allow you to use any parser that generates RDF/JS data to parse your Turtle (such as n3.js, but others are available) and then continue working with it using solid-client. I'll add a reminder to notify you in this issue once that is available. Unfortunately, until then, keep in mind that we only support our publicly documented API's. Specifically, this does not include any method to insert Quads directly into SolidDatasets, which is the reason behind the errors you noticed when trying that. One workaround I can come up with for now is to host your Turtle files somewhere (with a Content-Type of import { overwriteFile, getSolidDataset } from "@inrupt/solid-client";
const yourTurtle = /* ... */;
await overwriteFile("https://your.pod/yourData", new Blob([yourTurtle]), { contentType: "text/turtle" });
const solidDataset = await getSolidDataset("https://your.pod/yourData"); Not great, but better than nothing... I hope that helps for now, and apologies that I don't have a more satisfying answer at this point in time. |
@vanhumbeecka - by the way, if you're connected with the creators of the Survey Ontology you might notify them that the server serving up their ontology at
...but when requesting Turtle with a high
As a separate issue, I'm intrigued by your desire to "to abstract away all the schema stuff", and your use of |
Thanks for the elaborated information! I'm fairly new to this space (semantic web) so this info certainly helps. @pmcb55 to answer your question about the use of
Take a look at the following sketch. There are still a lot of moving parts and unanswered question in this diagram, but the idea of the wrapper library, is to be able to use in all of these services that needs them (the 'creator' FE, the 'analytics' FE, the 'survey' FE, and possibly the aggregation service). By using the wrapper library, I should be able to create surveys as follows (example from test folder. This is still an early version so the api could still be improved, but you get the point): const factory = new SurveyProcedureFactory('newid')
const question1 = QuestionFactory.singleInputQuestion({text: 'Where do you live?', id: 'question_id_1'})
const question2 = QuestionFactory.singleInputQuestion({text: 'How old are you?', id: 'question_id_2'})
const survey =
factory
.addElement(question1)
.addElement(question2)
.build()
...
const turtle = survey.toTurtleString() I also realise this is not sufficient to make the turtle output compatible with Solid datastructures (since I still need to add some subject and other URI's to the mix). If you have any pointers in how to improve or change this approach with the use of JSON-LD, I'm eager to know. |
Hi @vanhumbeecka - ok, so it's certainly interesting what you're doing there. It's not how I'd personally approach the problem, but that's one of the beauties of RDF - it's really wide open to experimentation :) ! |
Hi @vanhumbeecka I had a similar need in my own project... I'm using I needed to send a Here's a gist of the code: https://gist.github.com/calummackervoy/f9cf214466044ccbefa5b49f582e00d7 e.g.
Note that this code skips the attaching of dataset infos which would be useful to functions like I wasn't sure whether to open a new issue about my use case because it's similar to this one so I thought I'd comment and ask :) |
Thanks @calummackervoy, the 👍 on the original issue is just fine. I'm hopeful we'll have a more reliable solution at some point, and this is the issue to follow for that. |
Search terms you've used
Asked this question in Gitter chat. Was directed here to explain the use case.
Use Case
This is part question/feature-request.
I'm working on a prototype that extensively uses solid pods for storing/retrieving information.
Because I noticed most solid apps use schema names all over the place, I was trying to abstract away all the schema names, so potential app developers could work with datastructures without worrying about underlying schema's. In my case, I'm working on a project that involves Surveys. Based on the 'survey-ontology' (that can be found at https://cefriel.github.io/survey-ontology/docs/index.html), I'm in the process of creating a simple wrapper library to abstract away all the schema stuff (which is a public npm package for now:
@consolidate/survey-ontology-ts
. This package is Solid agnostic and its goals is to provide an interface for creating survey datastructures and don't worry about the underlying schemas: it can generate turtle files out of the survey you constructed with it.However, I'm now noticing not every turtle file is solid compatible (or I'm building the wrong turtle files).
Whatever the case, I'm trying to convert my turtle files to valid SolidDatastructures. But there doesn't seem to be interfaces in the solid-client to deal with this. The only way to construct SOlidDatastructures is to use the interfaces provided by dealing with 'Quads' (which is part of the n3 library apparently).
Feature Request
It would certainly help to have some kind of 'processing' and/or 'validation' steps that can create SolidDatasets from turtle files directly. This would bypass the conversion from turtle >> quads >> load all quads in SolidDataset, and instead go directly from turtle >> SolidDataset. This could also potentially help if there is some build in validation of the provide turtlefile with helpfull messages regarding syntax and other errors.
(Another thing I noticed, is that, even though I'm able to add 'Quads' to an empty SolidDataset, that doesn't mean it's valid. When I try to save it to my solid-pod, I get a lot of errors telling me nothing was saved in the end without much further explanation. There is no build in 'validation'. You have to try and save it to know it's valid or not, but this validation step is maybe part of another feature request, so I'm leaving this here..)
Expected functionality/enhancement
Example usage:
So the
fromTurtle
could be a factory method:The text was updated successfully, but these errors were encountered: