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

OslcQueryResult enumeration needs to be refactored #201

Open
berezovskyi opened this issue Oct 17, 2024 · 0 comments
Open

OslcQueryResult enumeration needs to be refactored #201

berezovskyi opened this issue Oct 17, 2024 · 0 comments

Comments

@berezovskyi
Copy link
Member

Right now there are some VERY strange things done in the OslcQueryResult. Some of them are the same strange things found in Lyo (strange on their own and more so in C#), some are even stranger:

  1. RDF parsing method is marked with a synchronized thread safety flag while enumerators are almost never thread safe.
  2. The .Current prop returns the OsclQueryResult for the NEXT page of results.
  3. The OsclQueryResult directly implements the IEnumerator, which requires it to expose the methods that users should never call. This saves maybe one allocation but is really wrong (given that other more expensive things are not optimized).
  4. The OsclQueryResult depends on the OslcClient. This is wrong for the result object to depend on a client and should not happen. Instead, we should consider OslcQuery to return some kind of OsclQueryResults object that has two props: .ResponseInfos (enumerable, not enumerator) and .QueryResponseInfo (ResponseInfo matching the query URI). Each ResponseInfo would have the .Pages enumerable property (of type OsclQueryResultPage) an async one that lazily yields the next page. .AllQueryResponseInfoPages could be added to help users avoid nested loops and extra if statements. Any enumerators should be hidden from the user.
@berezovskyi berezovskyi changed the title OsclQueryResult enumeration needs to be refactored OslcQueryResult enumeration needs to be refactored Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant