royalsolution-ontosight 0.2.0__tar.gz

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.
Files changed (51) hide show
  1. royalsolution_ontosight-0.2.0/.gitignore +173 -0
  2. royalsolution_ontosight-0.2.0/PKG-INFO +45 -0
  3. royalsolution_ontosight-0.2.0/README.md +22 -0
  4. royalsolution_ontosight-0.2.0/ontosight/__init__.py +42 -0
  5. royalsolution_ontosight-0.2.0/ontosight/core/__init__.py +30 -0
  6. royalsolution_ontosight-0.2.0/ontosight/core/storage/__init__.py +13 -0
  7. royalsolution_ontosight-0.2.0/ontosight/core/storage/base.py +55 -0
  8. royalsolution_ontosight-0.2.0/ontosight/core/storage/graph.py +386 -0
  9. royalsolution_ontosight-0.2.0/ontosight/core/storage/hypergraph.py +401 -0
  10. royalsolution_ontosight-0.2.0/ontosight/core/storage/node.py +179 -0
  11. royalsolution_ontosight-0.2.0/ontosight/core/views/__init__.py +17 -0
  12. royalsolution_ontosight-0.2.0/ontosight/core/views/graph.py +148 -0
  13. royalsolution_ontosight-0.2.0/ontosight/core/views/hypergraph.py +111 -0
  14. royalsolution_ontosight-0.2.0/ontosight/core/views/node.py +119 -0
  15. royalsolution_ontosight-0.2.0/ontosight/logging_config.py +237 -0
  16. royalsolution_ontosight-0.2.0/ontosight/server/__init__.py +5 -0
  17. royalsolution_ontosight-0.2.0/ontosight/server/app.py +61 -0
  18. royalsolution_ontosight-0.2.0/ontosight/server/models/__init__.py +1 -0
  19. royalsolution_ontosight-0.2.0/ontosight/server/models/api.py +151 -0
  20. royalsolution_ontosight-0.2.0/ontosight/server/routes/__init__.py +1 -0
  21. royalsolution_ontosight-0.2.0/ontosight/server/routes/chat.py +117 -0
  22. royalsolution_ontosight-0.2.0/ontosight/server/routes/codegraph.py +62 -0
  23. royalsolution_ontosight-0.2.0/ontosight/server/routes/data.py +203 -0
  24. royalsolution_ontosight-0.2.0/ontosight/server/routes/meta.py +88 -0
  25. royalsolution_ontosight-0.2.0/ontosight/server/routes/rankings.py +26 -0
  26. royalsolution_ontosight-0.2.0/ontosight/server/routes/search.py +105 -0
  27. royalsolution_ontosight-0.2.0/ontosight/server/state.py +296 -0
  28. royalsolution_ontosight-0.2.0/ontosight/static/assets/GraphView-BAsvQRbE.js +2 -0
  29. royalsolution_ontosight-0.2.0/ontosight/static/assets/GraphView-BAsvQRbE.js.map +1 -0
  30. royalsolution_ontosight-0.2.0/ontosight/static/assets/HypergraphView-BeKyuFX9.js +2 -0
  31. royalsolution_ontosight-0.2.0/ontosight/static/assets/HypergraphView-BeKyuFX9.js.map +1 -0
  32. royalsolution_ontosight-0.2.0/ontosight/static/assets/NodeView-CT1Q_Qn-.js +2 -0
  33. royalsolution_ontosight-0.2.0/ontosight/static/assets/NodeView-CT1Q_Qn-.js.map +1 -0
  34. royalsolution_ontosight-0.2.0/ontosight/static/assets/PaginatedGridView-LOV9NPu5.js +12 -0
  35. royalsolution_ontosight-0.2.0/ontosight/static/assets/PaginatedGridView-LOV9NPu5.js.map +1 -0
  36. royalsolution_ontosight-0.2.0/ontosight/static/assets/index-BIj2skbt.js +181 -0
  37. royalsolution_ontosight-0.2.0/ontosight/static/assets/index-BIj2skbt.js.map +1 -0
  38. royalsolution_ontosight-0.2.0/ontosight/static/assets/index-C5nwEVeJ.css +1 -0
  39. royalsolution_ontosight-0.2.0/ontosight/static/assets/preset-CO_q375h.js +190 -0
  40. royalsolution_ontosight-0.2.0/ontosight/static/assets/preset-CO_q375h.js.map +1 -0
  41. royalsolution_ontosight-0.2.0/ontosight/static/assets/worker-DNPIT6vh.js +14 -0
  42. royalsolution_ontosight-0.2.0/ontosight/static/assets/worker-DNPIT6vh.js.map +1 -0
  43. royalsolution_ontosight-0.2.0/ontosight/static/codegraph-panel.css +376 -0
  44. royalsolution_ontosight-0.2.0/ontosight/static/codegraph-panel.js +554 -0
  45. royalsolution_ontosight-0.2.0/ontosight/static/critical-nodes-panel.css +362 -0
  46. royalsolution_ontosight-0.2.0/ontosight/static/critical-nodes-panel.js +337 -0
  47. royalsolution_ontosight-0.2.0/ontosight/static/g6.min.js +89 -0
  48. royalsolution_ontosight-0.2.0/ontosight/static/index.html +19 -0
  49. royalsolution_ontosight-0.2.0/ontosight/static/logo.svg +29 -0
  50. royalsolution_ontosight-0.2.0/ontosight/utils.py +160 -0
  51. royalsolution_ontosight-0.2.0/pyproject.toml +38 -0
@@ -0,0 +1,173 @@
1
+ temp/
2
+ logs/
3
+ .trae/
4
+ .github/agents/
5
+ .claude/
6
+
7
+ # Byte-compiled / optimized / DLL files
8
+ __pycache__/
9
+ *.py[cod]
10
+ *$py.class
11
+
12
+ # C extensions
13
+ *.so
14
+
15
+ # Distribution / packaging
16
+ .Python
17
+ build/
18
+ develop-eggs/
19
+ dist/
20
+ downloads/
21
+ eggs/
22
+ .eggs/
23
+ lib/
24
+ lib64/
25
+ parts/
26
+ sdist/
27
+ var/
28
+ wheels/
29
+ share/python-wheels/
30
+ *.egg-info/
31
+ .installed.cfg
32
+ *.egg
33
+ MANIFEST
34
+
35
+ # PyInstaller
36
+ # Usually these files are written by a python script from a template
37
+ # before PyInstaller builds the exe, so may be deleted later.
38
+ *.manifest
39
+ *.spec
40
+
41
+ # Installer logs
42
+ pip-log.txt
43
+ pip-delete-this-directory.txt
44
+
45
+ # Unit test / coverage reports
46
+ htmlcov/
47
+ .tox/
48
+ .nosuch/
49
+ .nosuch/
50
+ .pytest_cache/
51
+ v/
52
+ .v/
53
+ nosetests.xml
54
+ coverage.xml
55
+ *.cover
56
+ *.py,cover
57
+ .tracker
58
+ .hypothesis/
59
+ .pytest_cache/
60
+ cover/
61
+
62
+ # Translations
63
+ *.mo
64
+ *.pot
65
+
66
+ # Django stuff:
67
+ *.log
68
+ local_settings.py
69
+ db.sqlite3
70
+ db.sqlite3-journal
71
+
72
+ # Flask stuff:
73
+ instance/
74
+ .webassets-cache
75
+
76
+ # Scrapy stuff:
77
+ .scrapy
78
+
79
+ # Sphinx documentation
80
+ docs/_build/
81
+
82
+ # PyBuilder
83
+ .pybuilder/
84
+ target/
85
+
86
+ # Jupyter Notebook
87
+ .ipynb_checkpoints
88
+
89
+ # IPython
90
+ profile_default/
91
+ ipython_config.py
92
+
93
+ # pyenv
94
+ # For a library or package, you might want to ignore these files since the Python version is
95
+ # usually managed by the user. However, for a specific project, it might be useful to check them in.
96
+ # .python-version
97
+
98
+ # pipenv
99
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
100
+ # However, in case of collaboration, if you want to keep your dependencies next to your project code:
101
+ # Pipfile.lock
102
+
103
+ # poetry
104
+ # Similar to Pipenv, poetry.lock is generally recommended to be committed.
105
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
106
+ # poetry.lock
107
+
108
+ # pdm
109
+ # Similar to Pipenv, pdm.lock is generally recommended to be committed.
110
+ # .pdm-python
111
+ # .pdm-build/
112
+
113
+ # PEP 582; used by e.g. github.com/fannheyward/coc-pyright
114
+ __pypackages__/
115
+
116
+ # Celery stuff
117
+ celerybeat-schedule
118
+ celerybeat.pid
119
+
120
+ # SageMath parsed files
121
+ *.sage.py
122
+
123
+ # Environments
124
+ .env
125
+ .venv
126
+ env/
127
+ venv/
128
+ ENV/
129
+ env.bak/
130
+ venv.bak/
131
+
132
+ # Spyder project settings
133
+ .spyderproject
134
+ .spyproject
135
+
136
+ # Rope project settings
137
+ .ropeproject
138
+
139
+ # mkdocs documentation
140
+ /site
141
+
142
+ # mypy
143
+ .mypy_cache/
144
+ .dmypy.json
145
+ dmypy.json
146
+
147
+ # Pyre type checker
148
+ .pyre/
149
+
150
+ # pytype static type analyzer
151
+ .pytype/
152
+
153
+ # Cython debug symbols
154
+ cython_debug/
155
+
156
+ # PyCharm
157
+ .idea/
158
+
159
+ # VS Code
160
+ .vscode/
161
+ .history/
162
+
163
+ # OS
164
+ .DS_Store
165
+ Thumbs.db
166
+ .bg-shell/
167
+ .gsd/
168
+ kb/
169
+ .graphify-out/
170
+
171
+ # Claude superpowers plans (keep repo docs clean)
172
+ docs/superpowers/
173
+ .codegraph/
@@ -0,0 +1,45 @@
1
+ Metadata-Version: 2.4
2
+ Name: royalsolution-ontosight
3
+ Version: 0.2.0
4
+ Summary: Interactive visualization engine for knowledge graphs with CodeGraph panel support
5
+ Project-URL: Homepage, https://github.com/yifanfeng97/hyper-extract
6
+ Project-URL: Repository, https://github.com/yifanfeng97/hyper-extract
7
+ Project-URL: Documentation, https://github.com/yifanfeng97/hyper-extract/tree/main/vendor/ontosight
8
+ Author-email: Yifan Feng <evanfeng97@gmail.com>
9
+ License: Apache-2.0
10
+ Keywords: codegraph,graph,knowledge-graph,visualization
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Scientific/Engineering :: Visualization
18
+ Requires-Python: >=3.11
19
+ Requires-Dist: fastapi>=0.115.0
20
+ Requires-Dist: pydantic>=2.0
21
+ Requires-Dist: uvicorn>=0.32.0
22
+ Description-Content-Type: text/markdown
23
+
24
+ # OntoSight (vendored)
25
+
26
+ Vendored fork of [OntoSight](https://github.com/yifanfeng97/ontosight) with critical-node topology panel and CodeGraph viewer support for Hyper-Extract.
27
+
28
+ Version **0.2.0** adds:
29
+
30
+ - `/api/rankings` endpoint
31
+ - `/api/codegraph/query` endpoint for live subgraph reload
32
+ - Node `degree`, `importance`, and `tier` enrichment in graph storage
33
+ - Critical-node sidebar panel (`static/critical-nodes-panel.js`)
34
+ - CodeGraph query panel (`static/codegraph-panel.js`)
35
+
36
+ ## PyPI
37
+
38
+ Publish instructions: [PUBLISH.md](PUBLISH.md)
39
+
40
+ Standalone CodeGraph visualization (no Hyper-Extract install):
41
+
42
+ ```bash
43
+ npx @colbymchenry/codegraph init -i
44
+ npx @royalsolution/ontosight .
45
+ ```
@@ -0,0 +1,22 @@
1
+ # OntoSight (vendored)
2
+
3
+ Vendored fork of [OntoSight](https://github.com/yifanfeng97/ontosight) with critical-node topology panel and CodeGraph viewer support for Hyper-Extract.
4
+
5
+ Version **0.2.0** adds:
6
+
7
+ - `/api/rankings` endpoint
8
+ - `/api/codegraph/query` endpoint for live subgraph reload
9
+ - Node `degree`, `importance`, and `tier` enrichment in graph storage
10
+ - Critical-node sidebar panel (`static/critical-nodes-panel.js`)
11
+ - CodeGraph query panel (`static/codegraph-panel.js`)
12
+
13
+ ## PyPI
14
+
15
+ Publish instructions: [PUBLISH.md](PUBLISH.md)
16
+
17
+ Standalone CodeGraph visualization (no Hyper-Extract install):
18
+
19
+ ```bash
20
+ npx @colbymchenry/codegraph init -i
21
+ npx @royalsolution/ontosight .
22
+ ```
@@ -0,0 +1,42 @@
1
+ """OnToSight - Interactive visualization library for knowledge graphs and structured data.
2
+
3
+ A simple, powerful library for creating interactive visualizations of graphs,
4
+ trees, lists, and other structured data with Python.
5
+
6
+ Logging Configuration:
7
+ OnToSight provides automatic logging configuration. By default, it uses a
8
+ user-friendly log format that minimizes output for end users.
9
+
10
+ Environment Variables:
11
+ ONTOSIGHT_LOG_LEVEL: Log level (DEBUG, INFO, WARNING, ERROR)
12
+ ONTOSIGHT_LOG_FORMAT: Log format ("user_friendly" or "detailed")
13
+ ONTOSIGHT_QUIET: Set to "true" to disable all log output
14
+
15
+ Example:
16
+ import os
17
+ os.environ["ONTOSIGHT_LOG_LEVEL"] = "DEBUG"
18
+ os.environ["ONTOSIGHT_LOG_FORMAT"] = "detailed"
19
+
20
+ from ontosight import view_graph
21
+ # Now view_graph will output detailed debug logs
22
+ """
23
+
24
+ # 导入日志配置(在任何其他导入之前)
25
+ from ontosight import logging_config
26
+
27
+ from ontosight.core import (
28
+ view_graph,
29
+ view_hypergraph,
30
+ view_nodes,
31
+ )
32
+
33
+ __version__ = "0.2.0"
34
+ __author__ = "Yifan Feng"
35
+ __email__ = "evanfeng97@gmail.com"
36
+
37
+ __all__ = [
38
+ "view_graph",
39
+ "view_hypergraph",
40
+ "view_nodes",
41
+ "logging_config",
42
+ ]
@@ -0,0 +1,30 @@
1
+ """OntoSight Core - High-level API for visualization management.
2
+
3
+ This module provides simple, intuitive functions for creating and managing
4
+ interactive visualizations of knowledge graphs and structured data.
5
+
6
+ Example:
7
+ >>> from ontosight.core import view_graph, view_hypergraph
8
+ >>>
9
+ >>> # Create a graph visualization
10
+ >>> nodes = [{"name": "Node 1"}, {"name": "Node 2"}]
11
+ >>> edges = [{"source": nodes[0], "target": nodes[1]}]
12
+ >>> view_graph(node_list=nodes, edge_list=edges)
13
+ """
14
+
15
+ from ontosight.core.views import (
16
+ view_nodes,
17
+ view_graph,
18
+ view_hypergraph,
19
+ )
20
+
21
+ from .storage import BaseStorage, GraphStorage, HypergraphStorage
22
+
23
+ __all__ = [
24
+ "view_nodes",
25
+ "view_graph",
26
+ "view_hypergraph",
27
+ "BaseStorage",
28
+ "GraphStorage",
29
+ "HypergraphStorage",
30
+ ]
@@ -0,0 +1,13 @@
1
+ """Storage engines for graph, hypergraph, and node-only visualizations."""
2
+
3
+ from .base import BaseStorage
4
+ from .graph import GraphStorage
5
+ from .hypergraph import HypergraphStorage
6
+ from .node import NodeStorage
7
+
8
+ __all__ = [
9
+ "BaseStorage",
10
+ "GraphStorage",
11
+ "HypergraphStorage",
12
+ "NodeStorage",
13
+ ]
@@ -0,0 +1,55 @@
1
+ """Base storage class for all storage engines."""
2
+
3
+ from typing import Any, Dict, List, Optional
4
+
5
+
6
+ class BaseStorage:
7
+ """Abstract base class for storage engines."""
8
+
9
+ def get_element(self, element_id: str) -> Optional[Dict[str, Any]]:
10
+ """Get a single element by ID."""
11
+ raise NotImplementedError
12
+
13
+ def get_details(self, element_id: str) -> Optional[Dict[str, Any]]:
14
+ """Get full details of an element."""
15
+ raise NotImplementedError
16
+
17
+ def get_stats(self) -> Dict[str, Any]:
18
+ """Get statistics about the storage."""
19
+ raise NotImplementedError
20
+
21
+ def get_sample(
22
+ self,
23
+ center_ids: Optional[List[str]] = None,
24
+ hops: int = 2,
25
+ highlight_center: bool = False,
26
+ min_nodes: int = 10,
27
+ max_attempts: int = 5,
28
+ ) -> Dict[str, Any]:
29
+ """Get sample around given nodes.
30
+
31
+ Args:
32
+ center_ids: List of center node/element IDs
33
+ hops: Number of hops to expand (graph/hypergraph specific)
34
+ highlight_center: If True, mark center elements with highlighted=True
35
+ min_nodes: Minimum number of nodes to include in the sample
36
+ max_attempts: Maximum number of attempts to find a suitable center
37
+ """
38
+ raise NotImplementedError
39
+
40
+ def get_sample_from_data(self, *args, highlight_center: bool = False, **kwargs) -> Dict[str, Any]:
41
+ """Get sample based on raw data objects (ItemSchema/NodeSchema/EdgeSchema).
42
+
43
+ For list visualization: get_sample_from_data(item_list, highlight_center=False)
44
+ For graph visualization: get_sample_from_data(node_list, edge_list, highlight_center=False)
45
+ For hypergraph visualization: get_sample_from_data(node_list, hyperedge_list, highlight_center=False)
46
+
47
+ Args:
48
+ *args: Raw data objects to extract IDs from
49
+ highlight_center: If True, mark matching elements with highlighted=True
50
+ **kwargs: Additional keyword arguments
51
+
52
+ Returns:
53
+ Sample data around the provided elements
54
+ """
55
+ raise NotImplementedError