LDflex / Query-Solid

Simple access to data in Solid pods through LDflex expressions
https://solid.github.io/query-ldflex/
MIT License
66 stars 15 forks source link

delete one triple in index.ttl#this + update the doc #65

Closed scenaristeur closed 4 years ago

scenaristeur commented 4 years ago

Hi please update the doc with delete function !

i've got an following function like that

  let user_following = following_folder+'index.ttl#this'
    await solid.data[user_following].as$items.add(namedNode(webId))

that gives me some triples like that

@prefix : <#>.
@prefix n0: <https://www.w3.org/ns/activitystreams#>.
@prefix c: <https://ewingson.dev.inrupt.net/profile/card#>.
@prefix c0: <https://spoggy-test4.solid.community/profile/card#>.
@prefix c1: <https://spoggy-test9.solid.community/profile/card#>.

:this n0:items c:me, c0:me, c1:me.

now i want to unfollow so i want to delete only one, for example "https://spoggy-test4.solid.community/profile/card#me"

but it does not seem that i can delete with a namedNode ? i've tried lot of thing, the last is

let user_following = following_folder+'index.ttl'
    let user_following_this = user_following+"#this"
    let webid = "https://spoggy-test4.solid.community/profile/card#me"
    let w_node = namedNode(webid)
      await solid.data.from(user_following)[user_following_this]["https://www.w3.org/ns/activitystreams#items"].delete(w_node)

But it does not seems to work :-( Does anyone have any idea ? thxs

RubenVerborgh commented 4 years ago

That should be possible indeed.

Could you translate your expression into a concrete example that we can test? As in, replace user_following and the other values by actual values?

You might want to place .sparql at the end of that expression to see the SPARQL query that would get executed; this might provide some insight into what is happening.

scenaristeur commented 4 years ago

data his here https://spoggy-test2.solid.community/public/agora/following/index.ttl i've granted everyone to Editor

the first add a webid as {index.ttl#this as$items webId }

but i want to be able to delete a specific webid I've tried with LDFLEX PLAYGROUND but does not work with nameNode()

something like

await solid.data.from("https://spoggy-test2.solid.community/public/agora/following/index.ttl")[https://spoggy-test2.solid.community/public/agora/following/index.ttl#this].as$items.delete("https://spoggy-test4.solid.community/profile/card#me")

but not with "literal" webid, with the namedNode.

RubenVerborgh commented 4 years ago

The following works:

await solid.data["https://spoggy-test2.solid.community/public/agora/following/index.ttl#this"].as$items.delete(namedNode("https://spoggy-test4.solid.community/profile/card#me"))

I did try it and it actually got removed, so I placed it back for you to test.

scenaristeur commented 4 years ago

Ok , thxs a lot @RubenVerborgh... I don't why it didn't work ;-) you are the LinkedDataMaster !