Coverage for lode / viewer / owl_viewer.py: 0%
14 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-03-25 15:05 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2026-03-25 15:05 +0000
1# viewer/owl_viewer.py
2from typing import Dict, Optional
3from lode.viewer.base_viewer import BaseViewer
5class OwlViewer(BaseViewer):
6 """Viewer OWL"""
8 def get_view_data(self, resource_uri: Optional[str] = None, language: Optional[str] = None) -> Dict:
9 all_instances = self.get_all_instances()
10 metadata_dict = self._find_and_format_metadata(all_instances)
12 # 1. Handle single resource (Standard Base logic)
13 if resource_uri:
14 data = super().get_view_data(resource_uri, language)
15 data['metadata'] = metadata_dict
16 return data
18 # 2. Define the Table of Contents structure
19 # Tuple Format: (Reader_Key, HTML_ID, Display_Title)
20 toc_config = [
21 ('Annotation', 'annotations', 'Annotations'),
22 ('Concept', 'concepts', 'Concepts'),
23 ('Relation', 'relations', 'Relations'),
24 ('Attribute', 'attributes', 'Attributes'),
25 ('Individual', 'individual', 'Individuals')
26 ]
28 # 3. Build the grouped view
29 data = self._build_grouped_view(toc_config, language)
30 data['metadata'] = metadata_dict
31 return data