Problem reading files from the pod


#1

Hi everybody,

We are trying to access to some routes in our pods, but we cant manage to access to them.
we are trying to acces obtaining the document but we cant access to the route since we are on the routes folder


We are news in Solid, so im sorry if its a really basic question, and we appreciate your help.
If you need any other folder or part of code you can find it here: https://github.com/Arquisoft/viade_es5c/tree/RDF


#2

The route inside the pod is this:


#3

Hi @aitorllanos99, judging by your second screenshot, your route is in /public/viade/routes/otro. However, on this line you read the value from /rutas/ - which does not exist. Thus, try fc.readFolder(storage + 'public/viade/routes/otro') instead, and see where that gets you :slight_smile:


#4

Hi @Vincent first of all thanks for answering!

Yeah we had already changed it but we didnt push it, im sorry to dont say it :sweat_smile:

We have the problem when we try to get the subject #Route from the pod, because it doesnt find it, and we dont know why.

Again, thanks for answering!


#5

Alright, well… Is there a place where we can see the current code? That would make it easier to help…

So again, judging by your second screenshot, it looks like the route is actually called #myRoute, rather than #Route? That would explain why you can’t find it :slight_smile:


#6

Yes, weve already pushed it.
The link is https://github.com/Arquisoft/viade_es5c/tree/RDF

This code is in src/parseo/parserRDFToRoute

We changed that aswell, really sorry for the inconveniences for showing you an older code.
Thank you very much for your help.


#7

Thanks for the updated link. So this line still says you’re looking in public/viade/routes - so without /otro. Have you tried public/viade/routes/otro as well?

If you did, what does the console.log("RUTISA:" + route); output?


#8

Yeah we tried, but its says that its null when we included /otro in the url of the folder.

about the output of the console it says.

There is where we are stucked. We cant accces to the properties of the route from there.

Again, really thankful for your reply


#9

Alright, that looks good! You can access the properties of that route using the listed methods, e.g. route.getString('http://xmlns.com/foaf/0.1/name') and route.getRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#type').

(I’m making some assumptions here about what your data looks like - if you have a link to the Pod containing the data in your second screenshot, I can verify that.)


#10

Thank you very much!.
The file to verify is in https://aitorllanos99.solid.community/.


#11

Hi vincent,
We´ve tried what you said about this:

And it returns us null… Would you know why?


#12

Yes, hovering over name at https://aitorllanos99.solid.community/public/viade/routes/otro, I see that it’s not actually a foaf:name but a schema:name, so it would have to be route.getString('http://schema.org/name').


#13

Hi @Vincent ! First of all thank you so much for your help, it is very important for us. We have tried what you have just said but it doesn’t work either… Here it is a new screenshot of what the code returns us:

You probably think that we don’t know nothing about this topic, but we are new and anyone has explained us how this “world” works. Again, thank you so much for spending your time helping us!!


#14

No problem, happy to see you venturing into the world of Solid and persisting despite it all being new :slight_smile:

Alright, so there’s one more thing that’s going wrong here. Looking at the route file, its contents is this:

@prefix viade: <http://arquisoft.github.io/viadeSpec/>.
@prefix : <http://example.org/>.
@prefix schema: <http://schema.org/>.
@prefix rdfs:   <http://www.w3.org/2000/01/rdf-schema#>.
@prefix xsd:    <http://www.w3.org/2001/XMLSchema#>.

:myRoute a viade:Route ;schema:name "otro" ;viade:point [schema:latitude -5.33935546875 ;schema:longitude 42.56926437219384 ;viade:order 1] ;viade:point [schema:latitude -5.80078125 ;schema:longitude 41.902277040963696 ;viade:order 2] ;viade:point [schema:latitude -4.85595703125 ;schema:longitude 42.049292638686836 ;viade:order 3] .

Most important here is this line:

@prefix : <http://example.org/>.

This means that, later in that document where it says :myRoute, the : gets replaced by http://example.org/. This means that the actual identifier of your route is http://example.org/myRoute, rather than #myRoute.

You can find a working code sample that uses that identifier here: https://codesandbox.io/s/tripledoc-quickstart-8plts?fontsize=14&hidenavigation=1&theme=dark

However, the actual fix would be to replace that bit in your route with:

    @prefix : <#>.

Then, the old version should (hopefully) work.


#15

Thank you so much!! We are starting to understand more or less how RDF works. Now we know how to obtain things from schema like our route’s name. But for example, to obtain our route’s points seems to be different. We thought that the “object” route had some property that returned its points but seem not to work like that.

We also know how to obtain the points. As point has viade’s type, we deduced that ‘viade:’ would be replaced for its prefix, as you explained us before. So we did this:

const points = routeDocument.getSubject(‘http://arquisoft.github.io/viadeSpec/point’);

But for a reason we don’t understand yet, we can’t have its values as you explained us with the route’s name. Maybe a different method? ( i talk about a method like ‘getSubject()’) Thanks very much!!


#16

Great to hear! And yes, your points are a bit different, but I figured I’d first help you with the first steps so you can gradually learn how things fit together :slight_smile:

In RDF terms, the points on your route are blank nodes (i.e. they don’t have a URL), whereas the route itself is a named node (i.e. it has a URL: currently http://example.org/myRoute, though it should’ve been https://aitorllanos99.solid.community/public/viade/routes/otro#myRoute).

So we’ve been calling e.g. getString() to get properties of the route, but how can we do the same for points on that route?

In Tripledoc, the library you’re using to access the data, you can access those points through getLocalSubject() (to access one of them) and getAllLocalSubjects() (to access multiple).

So in code, you could get access to the points using:

const points = route.getAllLocalSubjects('http://arquisoft.github.io/viadeSpec/point');

And then you can read values of a single point using the same methods you can use on the route, e.g.

const firstPointOrder = points[0].getInteger('http://arquisoft.github.io/viadeSpec/order');

A working code example can be found here:


#17

Vincent you dont know how really thankful we are for your help and for your lessons about RDF and how to work with it, this was really fructiferous, and we know much more about Solid.
From our heart, thanks in name of all our group.


#18

@Vincent Thank you so so much for your advices!! Thanks to you i hate a little less this university project hahaha. Seriously, you don’t know how much you had helped us.


#19

Happy to hear you’re making progress! If you encounter more challenges, be sure to start a new topic in this forum! There’s plenty of people willing to help, and it’ll also be helpful to others who encounter the same problems in the future.