powerbi-ontology-extractor 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cli/__init__.py +1 -0
- cli/pbi_ontology_cli.py +286 -0
- powerbi_ontology/__init__.py +38 -0
- powerbi_ontology/analyzer.py +420 -0
- powerbi_ontology/chat.py +303 -0
- powerbi_ontology/cli.py +530 -0
- powerbi_ontology/contract_builder.py +269 -0
- powerbi_ontology/dax_parser.py +305 -0
- powerbi_ontology/export/__init__.py +17 -0
- powerbi_ontology/export/contract_to_owl.py +408 -0
- powerbi_ontology/export/fabric_iq.py +243 -0
- powerbi_ontology/export/fabric_iq_to_owl.py +463 -0
- powerbi_ontology/export/json_schema.py +110 -0
- powerbi_ontology/export/ontoguard.py +177 -0
- powerbi_ontology/export/owl.py +522 -0
- powerbi_ontology/extractor.py +368 -0
- powerbi_ontology/mcp_config.py +237 -0
- powerbi_ontology/mcp_models.py +166 -0
- powerbi_ontology/mcp_server.py +1106 -0
- powerbi_ontology/ontology_diff.py +776 -0
- powerbi_ontology/ontology_generator.py +406 -0
- powerbi_ontology/review.py +556 -0
- powerbi_ontology/schema_mapper.py +369 -0
- powerbi_ontology/semantic_debt.py +584 -0
- powerbi_ontology/utils/__init__.py +13 -0
- powerbi_ontology/utils/pbix_reader.py +558 -0
- powerbi_ontology/utils/visualizer.py +332 -0
- powerbi_ontology_extractor-0.1.0.dist-info/METADATA +507 -0
- powerbi_ontology_extractor-0.1.0.dist-info/RECORD +33 -0
- powerbi_ontology_extractor-0.1.0.dist-info/WHEEL +5 -0
- powerbi_ontology_extractor-0.1.0.dist-info/entry_points.txt +4 -0
- powerbi_ontology_extractor-0.1.0.dist-info/licenses/LICENSE +21 -0
- powerbi_ontology_extractor-0.1.0.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Pydantic models for MCP Server.
|
|
3
|
+
|
|
4
|
+
Defines request/response models for all MCP tools.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import Any, Dict, List, Optional
|
|
8
|
+
from dataclasses import dataclass, field, asdict
|
|
9
|
+
from enum import Enum
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ExportFormat(str, Enum):
|
|
13
|
+
"""OWL export formats."""
|
|
14
|
+
XML = "xml"
|
|
15
|
+
TURTLE = "turtle"
|
|
16
|
+
JSON_LD = "json-ld"
|
|
17
|
+
N3 = "n3"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class MergeStrategy(str, Enum):
|
|
21
|
+
"""Ontology merge strategies."""
|
|
22
|
+
OURS = "ours"
|
|
23
|
+
THEIRS = "theirs"
|
|
24
|
+
UNION = "union"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@dataclass
|
|
28
|
+
class ExtractResult:
|
|
29
|
+
"""Result of pbix_extract tool."""
|
|
30
|
+
success: bool
|
|
31
|
+
entities_count: int = 0
|
|
32
|
+
relationships_count: int = 0
|
|
33
|
+
measures_count: int = 0
|
|
34
|
+
security_rules_count: int = 0
|
|
35
|
+
model_data: Dict[str, Any] = field(default_factory=dict)
|
|
36
|
+
error: Optional[str] = None
|
|
37
|
+
source_file: str = ""
|
|
38
|
+
|
|
39
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
40
|
+
return asdict(self)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@dataclass
|
|
44
|
+
class GenerateResult:
|
|
45
|
+
"""Result of ontology_generate tool."""
|
|
46
|
+
success: bool
|
|
47
|
+
ontology_data: Dict[str, Any] = field(default_factory=dict)
|
|
48
|
+
patterns_detected: List[str] = field(default_factory=list)
|
|
49
|
+
enhancements_suggested: int = 0
|
|
50
|
+
error: Optional[str] = None
|
|
51
|
+
|
|
52
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
53
|
+
return asdict(self)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@dataclass
|
|
57
|
+
class ExportOWLResult:
|
|
58
|
+
"""Result of export_owl tool."""
|
|
59
|
+
success: bool
|
|
60
|
+
owl_content: str = ""
|
|
61
|
+
summary: Dict[str, Any] = field(default_factory=dict)
|
|
62
|
+
error: Optional[str] = None
|
|
63
|
+
|
|
64
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
65
|
+
return asdict(self)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
@dataclass
|
|
69
|
+
class ExportJSONResult:
|
|
70
|
+
"""Result of export_json tool."""
|
|
71
|
+
success: bool
|
|
72
|
+
json_content: str = ""
|
|
73
|
+
output_path: Optional[str] = None
|
|
74
|
+
error: Optional[str] = None
|
|
75
|
+
|
|
76
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
77
|
+
return asdict(self)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@dataclass
|
|
81
|
+
class DebtConflict:
|
|
82
|
+
"""Single semantic conflict."""
|
|
83
|
+
conflict_type: str
|
|
84
|
+
severity: str
|
|
85
|
+
name: str
|
|
86
|
+
sources: List[str]
|
|
87
|
+
description: str
|
|
88
|
+
recommendation: str
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
@dataclass
|
|
92
|
+
class AnalyzeDebtResult:
|
|
93
|
+
"""Result of analyze_debt tool."""
|
|
94
|
+
success: bool
|
|
95
|
+
total_conflicts: int = 0
|
|
96
|
+
critical_count: int = 0
|
|
97
|
+
warning_count: int = 0
|
|
98
|
+
info_count: int = 0
|
|
99
|
+
conflicts: List[Dict[str, Any]] = field(default_factory=list)
|
|
100
|
+
report_markdown: str = ""
|
|
101
|
+
error: Optional[str] = None
|
|
102
|
+
|
|
103
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
104
|
+
return asdict(self)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
@dataclass
|
|
108
|
+
class DiffChange:
|
|
109
|
+
"""Single change in diff."""
|
|
110
|
+
change_type: str
|
|
111
|
+
element_type: str
|
|
112
|
+
path: str
|
|
113
|
+
old_value: Optional[str] = None
|
|
114
|
+
new_value: Optional[str] = None
|
|
115
|
+
details: str = ""
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
@dataclass
|
|
119
|
+
class DiffResult:
|
|
120
|
+
"""Result of ontology_diff tool."""
|
|
121
|
+
success: bool
|
|
122
|
+
has_changes: bool = False
|
|
123
|
+
total_changes: int = 0
|
|
124
|
+
added: int = 0
|
|
125
|
+
removed: int = 0
|
|
126
|
+
modified: int = 0
|
|
127
|
+
changes: List[Dict[str, Any]] = field(default_factory=list)
|
|
128
|
+
changelog: str = ""
|
|
129
|
+
error: Optional[str] = None
|
|
130
|
+
|
|
131
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
132
|
+
return asdict(self)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
@dataclass
|
|
136
|
+
class MergeConflict:
|
|
137
|
+
"""Single merge conflict."""
|
|
138
|
+
path: str
|
|
139
|
+
element_type: str
|
|
140
|
+
resolution: str
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
@dataclass
|
|
144
|
+
class MergeResult:
|
|
145
|
+
"""Result of ontology_merge tool."""
|
|
146
|
+
success: bool
|
|
147
|
+
merged_ontology: Dict[str, Any] = field(default_factory=dict)
|
|
148
|
+
conflicts_count: int = 0
|
|
149
|
+
conflicts: List[Dict[str, Any]] = field(default_factory=list)
|
|
150
|
+
new_version: str = ""
|
|
151
|
+
error: Optional[str] = None
|
|
152
|
+
|
|
153
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
154
|
+
return asdict(self)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
@dataclass
|
|
158
|
+
class ChatResult:
|
|
159
|
+
"""Result of ontology_chat_ask tool."""
|
|
160
|
+
success: bool
|
|
161
|
+
answer: str = ""
|
|
162
|
+
suggested_questions: List[str] = field(default_factory=list)
|
|
163
|
+
error: Optional[str] = None
|
|
164
|
+
|
|
165
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
166
|
+
return asdict(self)
|