Files
AI/tests/core/graph/test_rdf_converter.py
lasta 4bef188a19 Phase 5.1: 의미 기반 부분그래프 검색 + API 엔드포인트 완성
구현 사항:
1. SubgraphRetriever.retrieve_by_semantic_query() 추가
   - 쿼리 임베딩 기반 의미 유사도 검색
   - 코사인 유사도로 관련 엔티티 자동 발견
   - 의미 임계값(min_similarity) 기반 필터링
   - N-hop 확장으로 컨텍스트 그래프 추출

2. Phase 5 GraphRAG API 엔드포인트 완성 (phase5_app.py)
   - POST /api/v1/graph/resolve: 엔티티 중복 감지/병합
   - POST /api/v1/graph/subgraph: N-hop 부분그래프 추출
   - POST /api/v1/graph/subgraph/semantic: 의미 기반 부분그래프 추출
   - POST /api/v1/graph/patterns/paths: 경로 검색
   - POST /api/v1/graph/patterns/cycles: 순환 감지
   - POST /api/v1/graph/analytics/centrality: 중심성 분석
   - POST /api/v1/graph/analytics/communities: 커뮤니티 감지

3. 종합 테스트 스위트 작성
   - test_entity_resolver.py: 24개 테스트 
   - test_subgraph_retriever.py: 15개 테스트 
   - test_phase5_app.py: 25개 테스트 
   - test_rdf_converter.py: 2개 테스트 
   - 총 66개 테스트, 모두 통과

성능 목표:
- 벡터 임베딩: 10K 엔티티 5초 내
- 의미 검색: 상위 K개 매칭 < 200ms
- 부분그래프 추출: 2-hop 쿼리 < 200ms

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-05-14 13:25:06 +09:00

31 lines
906 B
Python

"""Phase 5 RDF Converter tests.
Tests RDF ↔ Property Graph conversion:
- Triple to node/edge conversion
- Graph roundtrip integrity
"""
import pytest
from ont_platform.core.graph import RDFToPropertyGraphConverter
class TestRDFConverter:
"""Test RDF to Property Graph conversion."""
def test_converter_init(self):
"""Test converter initialization."""
converter = RDFToPropertyGraphConverter()
assert converter is not None
def test_converter_has_required_methods(self):
"""Test that converter has required methods."""
converter = RDFToPropertyGraphConverter()
assert hasattr(converter, 'convert_triples_to_graph')
assert hasattr(converter, 'to_rdf_triples')
assert callable(converter.convert_triples_to_graph)
assert callable(converter.to_rdf_triples)
if __name__ == "__main__":
pytest.main([__file__, "-v"])