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

refactor query command line handling to be reusable to have named parameterized queries in othe contexts #131

Closed
WolfgangFahl opened this issue Aug 21, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@WolfgangFahl
Copy link
Owner

Refactor Query Command Line Handling for Reusability and Named Parameterized Queries

Objective
Refactor the query command line handling in our project to make it more reusable and flexible, allowing for named parameterized queries to be used in various contexts beyond the current CLI application.

Description
Our current query command line handling is tightly coupled with the CLI application. We need to refactor this to create a more modular and reusable system that can be easily integrated into other parts of our project or even other projects.

Tasks

  • Extract the core query handling logic from QueryCmd and QueryMain classes into a new, independent module.
  • Create a flexible system for defining and managing named parameterized queries.
  • Implement a mechanism to load query definitions from various sources (e.g., YAML files, databases).
  • Develop a simple API for executing named queries with parameters.
  • Refactor the existing CLI to use this new system.
  • Update documentation and add examples for using the new query system in different contexts.

Current Command Line Options
For reference, here are the current command line options that need to be supported in the refactored system:

-d, --debug: Enable debug mode
-ep, --endpointPath: Path to YAML file for endpoint configuration
-fp, --formatsPath: Path to YAML file for format configuration
-en, --endpointName: Name of the endpoint to use for queries
-li, --list: Show the list of available queries
--limit: Set limit parameter of query
--params: Query parameters as key-value pairs
-le, --listEndpoints: Show the list of available endpoints
-sq, --showQuery: Show the query
-qp, --queriesPath: Path to YAML file with query definitions
-q, --query: The query to run
-qf, --queryFile: The query file to run
-qn, --queryName: Run a named query
--method: Method to be used for SPARQL queries
-f, --format: Output format (e.g., CSV, JSON, XML)
-m, --mimeType: MIME-type to use for the raw query
-p, --prefixes: Add predefined prefixes for endpoint
-raw: Return the raw query result from the endpoint
-l, --language: The query language to use (e.g., SPARQL, SQL)

Acceptance Criteria

  • A new module for handling parameterized queries is created and well-documented.
  • The existing CLI functionality is preserved using the new query handling system.
  • Named queries can be easily defined, loaded, and executed in various contexts.
  • Unit tests are written for the new query handling system.
  • Documentation is updated with examples of using the new system outside of the CLI context.
@WolfgangFahl WolfgangFahl added the enhancement New feature or request label Aug 21, 2024
@WolfgangFahl WolfgangFahl added this to the 0.12.0 milestone Aug 21, 2024
@WolfgangFahl WolfgangFahl self-assigned this Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant