It does not matter if the turtle in the document and the SPARQL that queries it use different prefixes. All of the prefixes in the SPARQL will be expanded to whatever they were defined as before they perform the query and all of the prefixes in the source document will be expanded before the query is run against it.
Thanks for checking it out. Maybe Iāll have to look into this, but when you say āTTLā file does that mean youāre not using the solid protocol to read the file? Youāre trying to read the file directly from disk?
Normally, you should be able to do something like this:
SoukaiSolid.loadSolidModels();
Soukai.loadModels({ SocialAgent });
Soukai.useEngine(new SolidEngine(window.fetch.bind(fetch)));
const agents = await SocialAgent
.from('http://my-pod.com/ttl/')
.all({ $in: ['http://my-pod.com/ttl/alice.ttl'] });
console.log(agents);
But if you are not reading the files using HTTP, you probably have to read the file yourself and send it to soukai. I already have a method called newFromJsonLD
for this type of thing, so it should be easy to implement one called newFromTurtle
to do something like this:
// actually read the turtle file instead of doing this
const turtle = '<#it> a <http://www.w3.org/ns/solid/interop#SocialAgent> .';
const agent = await SocialAgent.newFromTurtle(turtle);
console.log(agent);
Engines serve to read/store data in different backends. The SolidEngine
reads/stores the data in a Solid POD using HTTP requests. The LocalStorageEngine
would read/store data from localStorage, not from disk, thatās why your example is not working.
Yes, this is what I understood, and that is actually how the shex-methods sees it.
Thank you for the confirmation!
Yes, I know this sounds silly I am trying to read from a local file.
I am working on a prototype for my master thesis, and I start from scratch (very little experience in vue and typescript, none in RDF and solid). So, Iām trying to work my way with baby steps.
- model RDF data in ts
- load RDF data into model (from file)
- play with model
- write model back to datafile
Thank you for bearing with me in my journey to RDF
I see, in that case maybe you shouldnāt use soukai because I donāt think itās beginner friendly at this point. It uses a design pattern called Active Record and even though it can make developing more enjoyable (depending who you ask xD), it does come with a bit of complexity.
Having said that, even if youāre getting started I donāt think it should be too much of a leap to read turtle using the Solid protocol. Itās easy to run a Solid POD locally if thatās what youāre worried about. And the only additional thing you need to do is to use an authentication library, but I think itās quite easy to use. In case it helps, I suggest that you check out this hello world application that is very simple to help people getting started: Solid Hello World. Also, if you want to find more, hereās a collection of Hello Worlds: Solid Hello Worlds
I see that LDFlex has already been suggested; and second that suggetion. Another really usefully package is rdf-object - Iāve also got a wrapper rdf-object-proxy which has a very similar syntax to what you have suggested for accessing publisher
.
Hey @jeswr, sorry for not replying any sooner.
Thank you for your suggestion, but I have decided to go with shex-codegen
& shex-method
from @anon85132706 (high-five). It generates exactly what I needed, though some features here and there are not supported yet.
Iāll keep an eye out for it still