linkml-store 0.3.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.
Files changed (101) hide show
  1. linkml_store/__init__.py +7 -0
  2. linkml_store/api/__init__.py +8 -0
  3. linkml_store/api/client.py +414 -0
  4. linkml_store/api/collection.py +1280 -0
  5. linkml_store/api/config.py +187 -0
  6. linkml_store/api/database.py +862 -0
  7. linkml_store/api/queries.py +69 -0
  8. linkml_store/api/stores/__init__.py +0 -0
  9. linkml_store/api/stores/chromadb/__init__.py +7 -0
  10. linkml_store/api/stores/chromadb/chromadb_collection.py +121 -0
  11. linkml_store/api/stores/chromadb/chromadb_database.py +89 -0
  12. linkml_store/api/stores/dremio/__init__.py +10 -0
  13. linkml_store/api/stores/dremio/dremio_collection.py +555 -0
  14. linkml_store/api/stores/dremio/dremio_database.py +1052 -0
  15. linkml_store/api/stores/dremio/mappings.py +105 -0
  16. linkml_store/api/stores/dremio_rest/__init__.py +11 -0
  17. linkml_store/api/stores/dremio_rest/dremio_rest_collection.py +502 -0
  18. linkml_store/api/stores/dremio_rest/dremio_rest_database.py +1023 -0
  19. linkml_store/api/stores/duckdb/__init__.py +16 -0
  20. linkml_store/api/stores/duckdb/duckdb_collection.py +339 -0
  21. linkml_store/api/stores/duckdb/duckdb_database.py +283 -0
  22. linkml_store/api/stores/duckdb/mappings.py +8 -0
  23. linkml_store/api/stores/filesystem/__init__.py +15 -0
  24. linkml_store/api/stores/filesystem/filesystem_collection.py +186 -0
  25. linkml_store/api/stores/filesystem/filesystem_database.py +81 -0
  26. linkml_store/api/stores/hdf5/__init__.py +7 -0
  27. linkml_store/api/stores/hdf5/hdf5_collection.py +104 -0
  28. linkml_store/api/stores/hdf5/hdf5_database.py +79 -0
  29. linkml_store/api/stores/ibis/__init__.py +5 -0
  30. linkml_store/api/stores/ibis/ibis_collection.py +488 -0
  31. linkml_store/api/stores/ibis/ibis_database.py +328 -0
  32. linkml_store/api/stores/mongodb/__init__.py +25 -0
  33. linkml_store/api/stores/mongodb/mongodb_collection.py +379 -0
  34. linkml_store/api/stores/mongodb/mongodb_database.py +114 -0
  35. linkml_store/api/stores/neo4j/__init__.py +0 -0
  36. linkml_store/api/stores/neo4j/neo4j_collection.py +429 -0
  37. linkml_store/api/stores/neo4j/neo4j_database.py +154 -0
  38. linkml_store/api/stores/solr/__init__.py +3 -0
  39. linkml_store/api/stores/solr/solr_collection.py +224 -0
  40. linkml_store/api/stores/solr/solr_database.py +83 -0
  41. linkml_store/api/stores/solr/solr_utils.py +0 -0
  42. linkml_store/api/types.py +4 -0
  43. linkml_store/cli.py +1147 -0
  44. linkml_store/constants.py +7 -0
  45. linkml_store/graphs/__init__.py +0 -0
  46. linkml_store/graphs/graph_map.py +24 -0
  47. linkml_store/index/__init__.py +53 -0
  48. linkml_store/index/implementations/__init__.py +0 -0
  49. linkml_store/index/implementations/llm_indexer.py +174 -0
  50. linkml_store/index/implementations/simple_indexer.py +43 -0
  51. linkml_store/index/indexer.py +211 -0
  52. linkml_store/inference/__init__.py +13 -0
  53. linkml_store/inference/evaluation.py +195 -0
  54. linkml_store/inference/implementations/__init__.py +0 -0
  55. linkml_store/inference/implementations/llm_inference_engine.py +154 -0
  56. linkml_store/inference/implementations/rag_inference_engine.py +276 -0
  57. linkml_store/inference/implementations/rule_based_inference_engine.py +169 -0
  58. linkml_store/inference/implementations/sklearn_inference_engine.py +314 -0
  59. linkml_store/inference/inference_config.py +66 -0
  60. linkml_store/inference/inference_engine.py +209 -0
  61. linkml_store/inference/inference_engine_registry.py +74 -0
  62. linkml_store/plotting/__init__.py +5 -0
  63. linkml_store/plotting/cli.py +826 -0
  64. linkml_store/plotting/dimensionality_reduction.py +453 -0
  65. linkml_store/plotting/embedding_plot.py +489 -0
  66. linkml_store/plotting/facet_chart.py +73 -0
  67. linkml_store/plotting/heatmap.py +383 -0
  68. linkml_store/utils/__init__.py +0 -0
  69. linkml_store/utils/change_utils.py +17 -0
  70. linkml_store/utils/dat_parser.py +95 -0
  71. linkml_store/utils/embedding_matcher.py +424 -0
  72. linkml_store/utils/embedding_utils.py +299 -0
  73. linkml_store/utils/enrichment_analyzer.py +217 -0
  74. linkml_store/utils/file_utils.py +37 -0
  75. linkml_store/utils/format_utils.py +550 -0
  76. linkml_store/utils/io.py +38 -0
  77. linkml_store/utils/llm_utils.py +122 -0
  78. linkml_store/utils/mongodb_utils.py +145 -0
  79. linkml_store/utils/neo4j_utils.py +42 -0
  80. linkml_store/utils/object_utils.py +190 -0
  81. linkml_store/utils/pandas_utils.py +93 -0
  82. linkml_store/utils/patch_utils.py +126 -0
  83. linkml_store/utils/query_utils.py +89 -0
  84. linkml_store/utils/schema_utils.py +23 -0
  85. linkml_store/utils/sklearn_utils.py +193 -0
  86. linkml_store/utils/sql_utils.py +177 -0
  87. linkml_store/utils/stats_utils.py +53 -0
  88. linkml_store/utils/vector_utils.py +158 -0
  89. linkml_store/webapi/__init__.py +0 -0
  90. linkml_store/webapi/html/__init__.py +3 -0
  91. linkml_store/webapi/html/base.html.j2 +24 -0
  92. linkml_store/webapi/html/collection_details.html.j2 +15 -0
  93. linkml_store/webapi/html/database_details.html.j2 +16 -0
  94. linkml_store/webapi/html/databases.html.j2 +14 -0
  95. linkml_store/webapi/html/generic.html.j2 +43 -0
  96. linkml_store/webapi/main.py +855 -0
  97. linkml_store-0.3.0.dist-info/METADATA +226 -0
  98. linkml_store-0.3.0.dist-info/RECORD +101 -0
  99. linkml_store-0.3.0.dist-info/WHEEL +4 -0
  100. linkml_store-0.3.0.dist-info/entry_points.txt +3 -0
  101. linkml_store-0.3.0.dist-info/licenses/LICENSE +22 -0
@@ -0,0 +1,187 @@
1
+ from typing import Any, Dict, List, Optional, Union
2
+
3
+ from pydantic import BaseModel, Field
4
+
5
+ from linkml_store.graphs.graph_map import EdgeProjection, NodeProjection
6
+
7
+
8
+ class ConfiguredBaseModel(BaseModel, extra="forbid"):
9
+ """
10
+ Base class for all configuration models.
11
+ """
12
+
13
+ pass
14
+
15
+
16
+ class DerivationConfiguration(ConfiguredBaseModel):
17
+ """
18
+ Configuration for a derivation
19
+ """
20
+
21
+ database: Optional[str] = None
22
+ collection: Optional[str] = None
23
+ mappings: Optional[Dict[str, Any]] = None
24
+ where: Optional[Dict[str, Any]] = None
25
+
26
+
27
+ class CollectionSource(ConfiguredBaseModel):
28
+ """
29
+ Metadata about a source
30
+ """
31
+
32
+ url: Optional[str] = None
33
+ """Remote URL to fetch data from"""
34
+
35
+ local_path: Optional[str] = None
36
+ """Local path to fetch data from"""
37
+
38
+ source_location: Optional[str] = None
39
+
40
+ refresh_interval_days: Optional[float] = None
41
+ """How often to refresh the data, in days"""
42
+
43
+ expected_type: Optional[str] = None
44
+ """The expected type of the data, e.g list"""
45
+
46
+ format: Optional[str] = None
47
+ """The format of the data, e.g., json, yaml, csv"""
48
+
49
+ compression: Optional[str] = None
50
+ """The compression of the data, e.g., tgz, gzip, zip"""
51
+
52
+ select_query: Optional[str] = None
53
+ """A jsonpath query to preprocess the objects with"""
54
+
55
+ arguments: Optional[Dict[str, Any]] = None
56
+ """Optional arguments to pass to the source"""
57
+
58
+
59
+ class CollectionConfig(ConfiguredBaseModel):
60
+ """
61
+ Configuration for a collection
62
+ """
63
+
64
+ alias: Optional[str] = Field(
65
+ default=None,
66
+ description="An optional alias for the collection",
67
+ )
68
+ type: Optional[str] = Field(
69
+ default=None,
70
+ description="The type of object in the collection. TODO; use this instead of name",
71
+ )
72
+ additional_properties: Optional[Dict] = Field(
73
+ default=None,
74
+ description="Optional metadata for the collection",
75
+ )
76
+ attributes: Optional[Dict[str, Dict]] = Field(
77
+ default=None,
78
+ description="Optional attributes for the collection, following LinkML schema",
79
+ )
80
+ indexers: Optional[Dict[str, Dict]] = Field(
81
+ default=None,
82
+ description="Optional configuration for indexers",
83
+ )
84
+ hidden: Optional[bool] = Field(
85
+ default=False,
86
+ description="Whether the collection is hidden",
87
+ )
88
+ is_prepopulated: Optional[bool] = Field(
89
+ default=False,
90
+ description="Whether the collection is prepopulated",
91
+ )
92
+ source: Optional[CollectionSource] = Field(
93
+ default=None,
94
+ description="Source for the collection",
95
+ )
96
+ derived_from: Optional[List[DerivationConfiguration]] = Field(
97
+ default=None,
98
+ description="LinkML-Map derivations",
99
+ )
100
+ page_size: Optional[int] = Field(default=None, description="Suggested page size (items per page) in apps and APIs")
101
+ graph_projection: Optional[Union[EdgeProjection, NodeProjection]] = Field(
102
+ default=None,
103
+ description="Optional graph projection configuration",
104
+ )
105
+ validate_modifications: Optional[bool] = Field(
106
+ default=False,
107
+ description="Whether to validate inserts, updates, and deletes",
108
+ )
109
+
110
+
111
+ class DatabaseConfig(ConfiguredBaseModel):
112
+ """
113
+ Configuration for a database
114
+ """
115
+
116
+ handle: str = Field(
117
+ default="duckdb:///:memory:",
118
+ description="The database handle, e.g., 'duckdb:///:memory:' or 'mongodb://localhost:27017'",
119
+ )
120
+ alias: Optional[str] = Field(
121
+ default=None,
122
+ description="An optional alias for the database",
123
+ )
124
+ schema_location: Optional[str] = Field(
125
+ default=None,
126
+ description="The location of the schema file, either a path on disk or URL",
127
+ )
128
+ schema_dict: Optional[Dict[str, Any]] = Field(
129
+ default=None,
130
+ description="The LinkML schema as a dictionary",
131
+ )
132
+ collections: Optional[Dict[str, CollectionConfig]] = Field(
133
+ default={},
134
+ description="A dictionary of collection configurations",
135
+ )
136
+ recreate_if_exists: bool = Field(
137
+ default=False,
138
+ description="Whether to recreate the database if it already exists",
139
+ )
140
+ collection_type_slot: Optional[str] = Field(
141
+ default=None,
142
+ description=(
143
+ "For databases that combine multiple collections into a single space, this field"
144
+ "specifies the field that contains the collection type. An example of this is a Solr"
145
+ "index that does not use cores for collections, and instead uses a single global"
146
+ "document space; if this has a field 'document_type', then this field should be set"
147
+ ),
148
+ )
149
+ searchable_slots: Optional[List[str]] = Field(
150
+ default=None,
151
+ description="Optional configuration for search fields",
152
+ )
153
+ ensure_referential_integrity: bool = Field(
154
+ default=False,
155
+ description="Whether to ensure referential integrity",
156
+ )
157
+ source: Optional[CollectionSource] = Field(
158
+ default=None,
159
+ description="Source for the database",
160
+ )
161
+
162
+
163
+ class ClientConfig(ConfiguredBaseModel):
164
+ """
165
+ Configuration for a client
166
+ """
167
+
168
+ handle: Optional[str] = Field(
169
+ default=None,
170
+ description="The client handle",
171
+ )
172
+ databases: Dict[str, DatabaseConfig] = Field(
173
+ default={},
174
+ description="A dictionary of database configurations",
175
+ )
176
+ default_database: Optional[str] = Field(
177
+ default=None,
178
+ description="The default database",
179
+ )
180
+ schema_path: Optional[str] = Field(
181
+ default=None,
182
+ description="The path to the LinkML schema file",
183
+ )
184
+ base_dir: Optional[str] = Field(
185
+ default=None,
186
+ description="The base directory for the client",
187
+ )