polly-python 4.6.0__tar.gz → 4.7.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.
- {polly_python-4.6.0/polly_python.egg-info → polly_python-4.7.0}/PKG-INFO +1 -1
- polly_python-4.7.0/polly/__init__.py +1 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/help.py +5 -2
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/polly_kg.py +29 -43
- {polly_python-4.6.0 → polly_python-4.7.0/polly_python.egg-info}/PKG-INFO +1 -1
- polly_python-4.6.0/polly/__init__.py +0 -1
- {polly_python-4.6.0 → polly_python-4.7.0}/LICENSE.md +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/MANIFEST.in +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/README.md +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/analyze.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/application_error_info.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/atlas.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/auth.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/constants.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/curation.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/data_management.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/errors.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/helpers.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/http_response_codes.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/index_schema_level_conversion_const.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/jobs.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/omixatlas.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/omixatlas_hlpr.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/pipelines.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/s3_utils.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/session.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/threading_utils.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/tracking.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/validation.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/validation_hlpr.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly/workspaces.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_interfaces/IFiles.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_interfaces/IReporting.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_interfaces/ISchema.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_interfaces/__init__.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_python.egg-info/SOURCES.txt +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_python.egg-info/dependency_links.txt +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_python.egg-info/requires.txt +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_python.egg-info/top_level.txt +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/__init__.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/dataset.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/files/__init__.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/files/files.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/files/files_hlpr.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/polly_services_hlpr.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/reporting/__init__.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/reporting/reporting.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/reporting/reporting_hlpr.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/schema/__init__.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/schema/schema.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/schema/schema_const.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/schema/schema_hlpr.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/schema/validate_schema_hlpr.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/pyproject.toml +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/setup.cfg +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/setup.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_atlas.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_constants.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_curation.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_data_management.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_help.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_helpers.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_jobs.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_kg.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_omixatlas.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_pipelines.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_s3_utils.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_schema_ux.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_threading_utils.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_validation.py +0 -0
- {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_workspaces.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "4.7.0"
|
|
@@ -273,8 +273,11 @@ def get_txt(
|
|
|
273
273
|
and (not function_name or function_name == fun.split(".")[-1])
|
|
274
274
|
and should_show_fun
|
|
275
275
|
):
|
|
276
|
-
|
|
277
|
-
|
|
276
|
+
try:
|
|
277
|
+
import rst2txt
|
|
278
|
+
from docutils.core import publish_string
|
|
279
|
+
except ImportError:
|
|
280
|
+
return None
|
|
278
281
|
|
|
279
282
|
# converting rst to txt
|
|
280
283
|
txt = publish_string(
|
|
@@ -221,21 +221,15 @@ class PollyKG:
|
|
|
221
221
|
"""
|
|
222
222
|
if not query or query == "":
|
|
223
223
|
raise InvalidParameterException("query")
|
|
224
|
-
|
|
225
|
-
# Validate query_type - only CYPHER is supported
|
|
224
|
+
query_url = f"{self.polly_kg_neo4j_endpoint}/kg/{self.kg_id}/versions/{self.version_id}/queries/"
|
|
226
225
|
if query_type != "CYPHER":
|
|
227
226
|
raise InvalidParameterException(
|
|
228
227
|
f"Invalid query_type: '{query_type}'. Only 'CYPHER' query type is supported."
|
|
229
228
|
)
|
|
230
|
-
|
|
231
|
-
query_url = f"{self.polly_kg_neo4j_endpoint}/kg/{self.kg_id}/versions/{self.version_id}/queries/"
|
|
232
229
|
payload = {
|
|
233
230
|
"data": {
|
|
234
231
|
"type": "kg_query",
|
|
235
|
-
"attributes": {
|
|
236
|
-
"query_string": query,
|
|
237
|
-
"query_type": query_type,
|
|
238
|
-
},
|
|
232
|
+
"attributes": {"query_string": query, "query_type": query_type},
|
|
239
233
|
}
|
|
240
234
|
}
|
|
241
235
|
try:
|
|
@@ -328,14 +322,11 @@ class PollyKG:
|
|
|
328
322
|
"""
|
|
329
323
|
if not query or query == "":
|
|
330
324
|
raise InvalidParameterException("query")
|
|
331
|
-
|
|
332
|
-
# Validate query_type - only CYPHER is supported
|
|
325
|
+
query_url = f"{self.polly_kg_neo4j_endpoint}/kg/{self.kg_id}/versions/{self.version_id}/queries/"
|
|
333
326
|
if query_type != "CYPHER":
|
|
334
327
|
raise InvalidParameterException(
|
|
335
328
|
f"Invalid query_type: '{query_type}'. Only 'CYPHER' query type is supported."
|
|
336
329
|
)
|
|
337
|
-
|
|
338
|
-
query_url = f"{self.polly_kg_neo4j_endpoint}/kg/{self.kg_id}/versions/{self.version_id}/queries/"
|
|
339
330
|
is_async = True
|
|
340
331
|
payload = {
|
|
341
332
|
"data": {
|
|
@@ -517,9 +508,10 @@ class PollyKG:
|
|
|
517
508
|
print(e)
|
|
518
509
|
raise
|
|
519
510
|
|
|
520
|
-
def get_summary(self) -> dict:
|
|
511
|
+
def get_summary(self, stats: bool = False) -> dict:
|
|
521
512
|
"""Retrieve a summary of the Polly Knowledge Graph.
|
|
522
|
-
|
|
513
|
+
Params:
|
|
514
|
+
stats: A boolean flag to retrieve the detailed counts edges.
|
|
523
515
|
Returns:
|
|
524
516
|
dict: A dictionary containing summary information about the graph,
|
|
525
517
|
such as node counts, edge counts, and other metadata.
|
|
@@ -530,9 +522,14 @@ class PollyKG:
|
|
|
530
522
|
RequestFailureException: Raised when the request fails due to an unexpected error.
|
|
531
523
|
"""
|
|
532
524
|
try:
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
525
|
+
if stats:
|
|
526
|
+
response = self.session.get(
|
|
527
|
+
f"{self.polly_kg_neo4j_endpoint}/kg/{self.kg_id}/versions/{self.version_id}/summary?stats=true"
|
|
528
|
+
)
|
|
529
|
+
else:
|
|
530
|
+
response = self.session.get(
|
|
531
|
+
f"{self.polly_kg_neo4j_endpoint}/kg/{self.kg_id}/versions/{self.version_id}/summary"
|
|
532
|
+
)
|
|
536
533
|
return handle_success_and_error_response(response)
|
|
537
534
|
except Exception as e:
|
|
538
535
|
print(e)
|
|
@@ -683,6 +680,7 @@ class PollyKG:
|
|
|
683
680
|
data = new_schema.get("data", {})
|
|
684
681
|
attributes = data.get("attributes", {})
|
|
685
682
|
schema = attributes.get("schema", {})
|
|
683
|
+
custom_attributes = attributes.get("custom_attributes", {})
|
|
686
684
|
|
|
687
685
|
# Extract basic information
|
|
688
686
|
node_types = schema.get("node_types", [])
|
|
@@ -761,19 +759,24 @@ class PollyKG:
|
|
|
761
759
|
# Build legacy format response
|
|
762
760
|
from datetime import datetime
|
|
763
761
|
|
|
762
|
+
# Build metadata with standard fields
|
|
763
|
+
metadata = {
|
|
764
|
+
"name": "schema",
|
|
765
|
+
"kg_id": str(kg_id),
|
|
766
|
+
"kg_version": str(version_id),
|
|
767
|
+
"last_updated": datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"),
|
|
768
|
+
"computed_at": datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"),
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
data_source = custom_attributes.get("data_source")
|
|
772
|
+
if data_source is not None:
|
|
773
|
+
metadata["data_source"] = data_source
|
|
774
|
+
|
|
764
775
|
legacy_format = {
|
|
765
776
|
"data": {
|
|
766
777
|
"type": "kg_schema",
|
|
767
778
|
"attributes": {
|
|
768
|
-
"metadata":
|
|
769
|
-
"name": "schema",
|
|
770
|
-
"kg_id": str(kg_id),
|
|
771
|
-
"kg_version": str(version_id),
|
|
772
|
-
"last_updated": datetime.utcnow().strftime(
|
|
773
|
-
"%Y-%m-%dT%H:%M:%SZ"
|
|
774
|
-
),
|
|
775
|
-
"computed_at": datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"),
|
|
776
|
-
},
|
|
779
|
+
"metadata": metadata,
|
|
777
780
|
"node_types": node_types,
|
|
778
781
|
"edge_types": edge_types,
|
|
779
782
|
"nodes": transformed_nodes,
|
|
@@ -829,23 +832,6 @@ class PollyKG:
|
|
|
829
832
|
ResourceNotFoundError: Raised when no knowledge graphs are found.
|
|
830
833
|
AccessDeniedError: Raised when the user does not have permission to access the KGs.
|
|
831
834
|
RequestFailureException: Raised when the request fails due to an unexpected error.
|
|
832
|
-
|
|
833
|
-
Example:
|
|
834
|
-
>>> kg = PollyKG()
|
|
835
|
-
>>> # Get only published KGs
|
|
836
|
-
>>> kgs = kg.get_all_kgs()
|
|
837
|
-
>>> for kg_info in kgs:
|
|
838
|
-
... print(f"{kg_info['kg_name']} (ID: {kg_info['kg_id']})")
|
|
839
|
-
base kg v3 (ID: 14_base_kg_v3)
|
|
840
|
-
|
|
841
|
-
>>> # Get all KGs including unpublished ones with instance details
|
|
842
|
-
>>> kgs_with_instances = kg.get_all_kgs(
|
|
843
|
-
... include_unpublished=True,
|
|
844
|
-
... include_instances=True,
|
|
845
|
-
... include_terminated=True
|
|
846
|
-
... )
|
|
847
|
-
>>> for kg_info in kgs_with_instances:
|
|
848
|
-
... print(f"{kg_info['kg_name']} - {len(kg_info.get('instances', []))} instances")
|
|
849
835
|
"""
|
|
850
836
|
try:
|
|
851
837
|
kg_url = f"{self.polly_kg_neo4j_endpoint}/kg"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "4.6.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|