-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontroller.py
More file actions
53 lines (43 loc) · 2.24 KB
/
controller.py
File metadata and controls
53 lines (43 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from agents import RDFGeneratorAgent, ValidatorAgent, CritiqueAgent, OntologyMapperAgent, CorrectionAgent, OntologyMatcherAgent
from helpers import is_syntax_error, extract_core_error
class SemanticPipelineAgent:
def __init__(self, model_info, max_optimization=3, max_correction=3):
self.generator = RDFGeneratorAgent(model_info)
self.validator = ValidatorAgent()
self.critic = CritiqueAgent(model_info)
self.ontology_mapper = OntologyMapperAgent(model_info)
self.corrector = CorrectionAgent(model_info)
self.ontology_matcher = OntologyMatcherAgent()
self.max_optimization = max_optimization
self.max_correction = max_correction
def run_pipeline(self, user_input):
"""
Run the full semantic pipeline with the given user input.
Args:
user_input (str): The input from the user to generate RDF and SHACL.
Returns:
Tuple of (rdf_code, shacl_code, conforms, report, ontology_mappings, ontology_matches)
"""
# Step 1: Initial generation
rdf_code, shacl_code = self.generator.run(user_input)
# Step 2: Optimization loop
#Remove the codes to make the app Private
# Step 3: Validation loop
#Remove the codes to make the app Private
# Step 4: Ontology term suggestion
#Remove the codes to make the app Private
# Step 5: Ontology matching analysis (NEW)
#Remove the codes to make the app Private
return rdf_code, shacl_code, conforms, report, ontology_mappings, ontology_matches
def apply_ontology_replacements(self, rdf_code: str, shacl_code: str, similarity_threshold: float = 1.0) -> tuple[str, str, str, dict]:
"""
Apply ontology term replacements with enhanced debugging and validation
Args:
rdf_code: Original RDF code
shacl_code: Original SHACL code
similarity_threshold: Similarity threshold (default 1.0 for exact matches only)
Returns:
Tuple of (replaced_rdf, replaced_shacl, replacement_report, validation_results)
"""
#Remove the codes to make the app Private
return rdf_code, shacl_code, error_report, error_validation