Ls LDP Container using LDFlex

I’m trying to play with LDFlex, but I failed to list items inside a folder.

const data = ldflex['https://linonetwo.solid.authing.cn/public/tiddlywiki/main']
console.log('data', await data['http://www.w3.org/ns/ldp#contains'])
// logs undefined

So how to read what it contains?

I tried this:

        const data = ldflex[containerURI]
        const items = await data['ldp:contains'].sparql

which gaves me the sparql:

SELECT ?contains WHERE {
  <https://linonetwo.solid.authing.cn/public/tiddlywiki/main> <http://www.w3.org/ns/ldp#contains> ?contains.
}

I tried it on the following ttl file on the playground https://ci.mines-stetienne.fr/sparql-generate/playground.html :

@prefix : <#>.
@prefix m: <>.
@prefix ldp: <http://www.w3.org/ns/ldp#>.
@prefix terms: <http://purl.org/dc/terms/>.
@prefix XML: <http://www.w3.org/2001/XMLSchema#>.
@prefix st: <http://www.w3.org/ns/posix/stat#>.
@prefix tur: <http://www.w3.org/ns/iana/media-types/text/turtle#>.

m:
    a ldp:BasicContainer, ldp:Container;
    terms:modified "2019-12-24T03:53:21Z"^^XML:dateTime;
    ldp:contains
        <%2524%253A%252FStoryList>, <%2524%253A%252FStoryList.metadata>,
        <Draft%2520of%2520'New%2520Tiddler'%2520by%2520https%253A%252F%252Flinonetwo.solid.authing.cn%252Fprofile%252Fcard%2523me.metadata>,
        m:Test, <Test.metadata>, m:Test123, <Test123.metadata>;
    st:mtime 1577159601.427;
    st:size 4096.

With no result.
And I found that, if I change

@prefix : <#>.
@prefix m: <>.

to

@prefix : <#>.
@prefix m: <https://linonetwo.solid.authing.cn/public/tiddlywiki/main>.

then I’m able to get the result.

So the problem is <>, it should be <https://linonetwo.solid.authing.cn/public/tiddlywiki/main> to let LDFlex work.
Maybe ldflex can add a function that enables me to replace <> with <https://linonetwo.solid.authing.cn/public/tiddlywiki/main> ?

I think it’s the missing trailing slash. This works for me in ldflex playground:

data[https://linonetwo.solid.authing.cn/public/tiddlywiki/main/][http://www.w3.org/ns/ldp#contains]

Thank you @aveltens ! That is very tricky!

When trust an origin, we should not add slash: I should trust http://localhost:8080, not http://localhost:8080/

Slash problems are so tricky!

Yes indeed. It’s helpful to understand the several parts oft an URI. While the origin only consists oft scheme+host+port a ressource is identified with a full URI including path, query and fragment. But even then trailing slashes are easily overlooked…

Just to note, we are going to improve the trusted applications in the data browsers by automatically remove the trailing slash when people accidentally add it - https://github.com/solid/mashlib/issues/74

3 Likes