feat: implement comprehensive query paradigm zoo system (issue #62)

- Created extensible BaseQueryParadigm interface with standardized QueryResult format
- Implemented QueryParadigmRegistry for paradigm discovery and management
- Added 5 working paradigms: SQL, FTS, GraphQL, JSONPath, Natural Language
- Documented 9 additional paradigms: QBE, Batch Manipulation, Visual Query Builder, REST API, NoSQL, UNIX Pipeline, XPath/XQuery, RAG, Data Transformation
- Integrated full CLI interface: list, search, show, exec, categories commands
- Added comprehensive test suite with 23 test cases covering all components
- Auto-registration system enables easy addition of new paradigms
- Organized paradigms by category (structural, textual, semantic, visual, procedural, network) and complexity (beginner, intermediate, advanced)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-03 23:06:57 +02:00
parent 1d13cbb355
commit 5143864a86
21 changed files with 3659 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
"""
Base classes for query paradigms.
"""
from abc import ABC, abstractmethod
from typing import Dict, Any, List, Optional, Union
from dataclasses import dataclass
from datetime import datetime
@dataclass
class QueryResult:
"""Standardized result format for all query paradigms."""
paradigm: str
query: str
execution_time_ms: float
result_count: int
results: List[Dict[str, Any]]
metadata: Dict[str, Any]
success: bool
error_message: Optional[str] = None
class BaseQueryParadigm(ABC):
"""Base class for all query paradigms."""
@property
@abstractmethod
def name(self) -> str:
"""Human-readable name of the paradigm."""
pass
@property
@abstractmethod
def description(self) -> str:
"""Description of what this paradigm does."""
pass
@property
@abstractmethod
def category(self) -> str:
"""Category: structural, textual, semantic, procedural."""
pass
@property
@abstractmethod
def complexity(self) -> str:
"""Complexity level: beginner, intermediate, advanced."""
pass
@abstractmethod
def execute(self, query: str, config: Dict[str, Any] = None) -> QueryResult:
"""Execute a query using this paradigm."""
pass
@abstractmethod
def get_examples(self) -> List[Dict[str, str]]:
"""Get example queries for this paradigm."""
pass
@abstractmethod
def validate_query(self, query: str) -> tuple[bool, Optional[str]]:
"""Validate if a query is valid for this paradigm."""
pass
def get_syntax_help(self) -> str:
"""Get syntax help for this paradigm."""
return f"{self.name} syntax help not yet implemented."
def can_translate_from(self, other_paradigm: str) -> bool:
"""Check if this paradigm can translate queries from another."""
return False
def translate_query(self, query: str, from_paradigm: str) -> Optional[str]:
"""Translate a query from another paradigm to this one."""
return None