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

ISparqlResultsHandler Design Issue #478

Closed
jiatao99 opened this issue May 27, 2022 · 2 comments · Fixed by #596
Closed

ISparqlResultsHandler Design Issue #478

jiatao99 opened this issue May 27, 2022 · 2 comments · Fixed by #596
Milestone

Comments

@jiatao99
Copy link

In ISparqlResultsHandler.cs you guys defined a function of: bool HandleResult(ISparqlResult result);. However the parser always create a new instance of SparqlResult.

Is it possible add one more function inside ISparqlResultsHandler:

ISparqlResult CreateResult();

The parser will invoke this function to create the ISparqlResult object. In this case, if I want to create my own implementation of ISparqlResultsHandler, I can construct my own implementation of ISparqlResult object.

Thanks

Tao

@kal
Copy link
Contributor

kal commented May 29, 2022

I think it would maybe be better to allow a factory to be injected when you build the query processor rather than in the handler as generating the results is really the concern of the query processor.

I'm thinking we could add support for this by extending VDS.RDF.Query.LeviathanQueryOptions to allow a factory instance to be passed in, this would implement a simple interface with a MakeResult method on it that would be invoked with an IEnumerable<KeyValuePair<string, INode>> that provides the bindings for the result and returns a single ISparqlResult instance. Would that work for your use case?

@jiatao99
Copy link
Author

jiatao99 commented Jun 13, 2022

Either way is fine. Just thought extending the interface is a lot easier since the implementation class has to implement this interface anyway.

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

Successfully merging a pull request may close this issue.

2 participants