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

Allow to pass query and model to SPARQLModelAdapter.query #184

Open
b1rger opened this issue Jan 9, 2025 · 1 comment
Open

Allow to pass query and model to SPARQLModelAdapter.query #184

b1rger opened this issue Jan 9, 2025 · 1 comment

Comments

@b1rger
Copy link
Member

b1rger commented Jan 9, 2025

currently I have to instantiate a SPARQLModelAdapter for every query I want to run. But the target is always the same. It would be great if I could have one instantiated SPARQLModelAdapter and then pass the query and the model to the query method

@lu-pl
Copy link
Contributor

lu-pl commented Jan 9, 2025

The association of a SPARQLModelAdapter instance with each route is a deliberate design choice, as this suggests a modular and flexible approach to defining endpoints, allowing the modification and extension of individual routes without affecting the rest of the API and also enabling a single RDFProxy-based backend to potentially connect with multiple SPARQL endpoints.

Please consider using partial application or other means of wrapping a SPARQLModelAdapter object, e.g.

PFPAdapter = functools.partial(SPARQLModelAdapter, target="your.endpoint")

adapter = PFPAdapter(query=query, model=model)
adapter.query()

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

No branches or pull requests

2 participants