Skip to content
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

findMembersNT searches the whole store not just one document #565

Open
timea-solid opened this issue Jul 21, 2022 · 5 comments
Open

findMembersNT searches the whole store not just one document #565

timea-solid opened this issue Jul 21, 2022 · 5 comments
Assignees
Labels

Comments

@timea-solid
Copy link
Collaborator

I found a bug in my demo. And I nailed it down to a function in rdflib that does not take care to query in a given quad (context/graph):

ref1 = this.statementsMatching(void 0,
-> mind the missing quad
Example propagation of code:

Screenshot 2022-07-21 at 14 48 30

Now, one can debate this is a feature... I believe this to be a bug.
My store has loaded 2 similar resources but I specifically (well the solid-ui forms code) queries for data from only ONE resource and still, because of the findMembersNT function in rdflib retrieves cross resource all possibilities -> hence I got DUPLICATE records (triples) because they are different only in the quad they are stored on.
This bug is nasty, unless you know RDF really well you could not deduce this. (lucky I came across such behavior before)

@timbl
Copy link
Member

timbl commented Jul 22, 2022

The mashlib was originally developed for mashing up (combining together usefully) all sorts of data from different trusted sources. So if you have loaded data from Wikidata which says 5 things are cities, and some from DBPedia that says 7 things which are cities, then you want to find all 12. That's why it is like it is.

In your case the fact that you have duplicates is the thing you notice, and certainly the function may be more useful if it removed duplicates.

But the main thing which surprised you seems to be that the function searches the whole store, instead of just one document. We can certainly change the function to take an optional document to search. It i more secure, espcially now i a solid world where we see much untrusted data as well as trusted data, to be specific about which document to search .

@timbl timbl changed the title findMembersNT disregards quads findMembersNT searches the whole store not just one document Jul 22, 2022
@josephguillaume
Copy link

I've ended up here (rather belatedly) because I have a ui:Choice form that no longer works (error "Can't do selector with no options") since a customised dataDoc-specific version of findMembersNT was adopted .

This appears to be because the subClassOf definitions are in a separate file to the form, i.e. searching beyond the dataDoc is necessary, otherwise I have to duplicate those definitions from the ontology to the dataDoc.

I'll try to post something to solid-ui too, but I'd say please don't eliminate the ability to search the whole store :-)

@timea-solid
Copy link
Collaborator Author

timea-solid commented Mar 20, 2023

So maybe we just need 2 functions. @josephguillaume did you end up fixing your code?

@josephguillaume
Copy link

No, I'm just using an outdated mashlib for the time being.

Based on the conversation at #535, it actually sounds like what you implemented in solid-ui was a version of this function that takes an optional document to search - and leaving the document as null maintains the current behaviour. Any reason it wasn't merged here?

@timea-solid
Copy link
Collaborator Author

Ok, so an idea is to roll this back and maybe add a new one. We shall discuss in our SolidOS meetings (next wednesday). Sorry for the breaking changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants