educelab-hercdb 0.1.0.dev1__tar.gz → 0.1.0.dev2__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.
- {educelab_hercdb-0.1.0.dev1 → educelab_hercdb-0.1.0.dev2}/PKG-INFO +1 -1
- {educelab_hercdb-0.1.0.dev1 → educelab_hercdb-0.1.0.dev2}/pyproject.toml +1 -1
- educelab_hercdb-0.1.0.dev2/src/educelab/hercdb/__init__.py +3 -0
- {educelab_hercdb-0.1.0.dev1 → educelab_hercdb-0.1.0.dev2}/src/educelab/hercdb/api.py +15 -61
- {educelab_hercdb-0.1.0.dev1 → educelab_hercdb-0.1.0.dev2}/src/educelab_hercdb.egg-info/PKG-INFO +1 -1
- educelab_hercdb-0.1.0.dev1/src/educelab/hercdb/__init__.py +0 -6
- {educelab_hercdb-0.1.0.dev1 → educelab_hercdb-0.1.0.dev2}/README.md +0 -0
- {educelab_hercdb-0.1.0.dev1 → educelab_hercdb-0.1.0.dev2}/setup.cfg +0 -0
- {educelab_hercdb-0.1.0.dev1 → educelab_hercdb-0.1.0.dev2}/src/educelab/hercdb/config.py +0 -0
- {educelab_hercdb-0.1.0.dev1 → educelab_hercdb-0.1.0.dev2}/src/educelab_hercdb.egg-info/SOURCES.txt +0 -0
- {educelab_hercdb-0.1.0.dev1 → educelab_hercdb-0.1.0.dev2}/src/educelab_hercdb.egg-info/dependency_links.txt +0 -0
- {educelab_hercdb-0.1.0.dev1 → educelab_hercdb-0.1.0.dev2}/src/educelab_hercdb.egg-info/entry_points.txt +0 -0
- {educelab_hercdb-0.1.0.dev1 → educelab_hercdb-0.1.0.dev2}/src/educelab_hercdb.egg-info/requires.txt +0 -0
- {educelab_hercdb-0.1.0.dev1 → educelab_hercdb-0.1.0.dev2}/src/educelab_hercdb.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: educelab-hercdb
|
|
3
|
-
Version: 0.1.0.
|
|
3
|
+
Version: 0.1.0.dev2
|
|
4
4
|
Summary: Graph database API for Herculaneum data
|
|
5
5
|
Author-email: Mami Hayashida <mami.hayashida@uky.edu>, Seth Parker <c.seth.parker@uky.edu>
|
|
6
6
|
Project-URL: Repository, https://gitlab.com/educelab/herculaneum-graph-db
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
from typing import Optional
|
|
3
2
|
from enum import Enum
|
|
4
3
|
|
|
5
4
|
from neo4j import GraphDatabase
|
|
@@ -19,7 +18,7 @@ PGSRawType = DatasetType.PGSRaw
|
|
|
19
18
|
SpectralRawType = DatasetType.SpectralRaw
|
|
20
19
|
|
|
21
20
|
|
|
22
|
-
class
|
|
21
|
+
class GraphDBConnection:
|
|
23
22
|
logger = logging.getLogger('hercdb.connector')
|
|
24
23
|
uri: str = None
|
|
25
24
|
user: str = None
|
|
@@ -35,11 +34,15 @@ class _GraphConnector:
|
|
|
35
34
|
def close(self):
|
|
36
35
|
self.driver.close()
|
|
37
36
|
|
|
38
|
-
def
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
def verify_connection(self):
|
|
38
|
+
try:
|
|
39
|
+
self.driver.verify_connectivity()
|
|
40
|
+
return True
|
|
41
|
+
except Exception as e:
|
|
42
|
+
self.logger.debug('failed to connect', exc_info=e)
|
|
43
|
+
return False
|
|
41
44
|
|
|
42
|
-
def
|
|
45
|
+
def _delete_all(self):
|
|
43
46
|
records, summary, keys = self.driver.execute_query(
|
|
44
47
|
"""
|
|
45
48
|
MATCH (n)
|
|
@@ -48,7 +51,7 @@ class _GraphConnector:
|
|
|
48
51
|
database_="neo4j",
|
|
49
52
|
)
|
|
50
53
|
|
|
51
|
-
def
|
|
54
|
+
def _return_all(self):
|
|
52
55
|
records, summary, keys = self.driver.execute_query(
|
|
53
56
|
"""
|
|
54
57
|
MATCH (n)
|
|
@@ -60,7 +63,7 @@ class _GraphConnector:
|
|
|
60
63
|
self.logger.debug(summary)
|
|
61
64
|
self.logger.debug(keys)
|
|
62
65
|
|
|
63
|
-
def
|
|
66
|
+
def _node_count(self) -> int:
|
|
64
67
|
record, keys, summary = self.driver.execute_query(
|
|
65
68
|
"""
|
|
66
69
|
MATCH (n)
|
|
@@ -90,7 +93,7 @@ class _GraphConnector:
|
|
|
90
93
|
pherc_n = records[0]["ph.human_name"]
|
|
91
94
|
corn_n = records[0]["c.human_name"]
|
|
92
95
|
|
|
93
|
-
if pezzo:
|
|
96
|
+
if pezzo is not None:
|
|
94
97
|
# Currently this is irrelevant since there are no pezzo with "names"
|
|
95
98
|
records, summary, keys = self.driver.execute_query(
|
|
96
99
|
"""
|
|
@@ -168,11 +171,7 @@ class _GraphConnector:
|
|
|
168
171
|
return properties
|
|
169
172
|
|
|
170
173
|
|
|
171
|
-
|
|
172
|
-
_connector: Optional[_GraphConnector] = None
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
def connect(uri=None, user=None, password=None) -> bool:
|
|
174
|
+
def connect(uri=None, user=None, password=None) -> GraphDBConnection:
|
|
176
175
|
# use system config values if not provided
|
|
177
176
|
from educelab.hercdb import config
|
|
178
177
|
if uri is None:
|
|
@@ -182,51 +181,6 @@ def connect(uri=None, user=None, password=None) -> bool:
|
|
|
182
181
|
if password is None:
|
|
183
182
|
password = config.password
|
|
184
183
|
|
|
185
|
-
# close existing connection
|
|
186
|
-
global _connector
|
|
187
|
-
if _connector is not None:
|
|
188
|
-
disconnect()
|
|
189
|
-
|
|
190
184
|
# open new connection
|
|
191
|
-
|
|
192
|
-
return
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
def disconnect():
|
|
196
|
-
global _connector
|
|
197
|
-
if _connector is not None:
|
|
198
|
-
_connector.close()
|
|
199
|
-
_connector = None
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
def verify_connection() -> bool:
|
|
203
|
-
if _connector is None:
|
|
204
|
-
return False
|
|
205
|
-
try:
|
|
206
|
-
_connector.verify_conn()
|
|
207
|
-
return True
|
|
208
|
-
except Exception as e:
|
|
209
|
-
logging.getLogger(__name__).debug('failed to connect', exc_info=e)
|
|
210
|
-
return False
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
def node_count() -> int:
|
|
214
|
-
if _connector is None:
|
|
215
|
-
return -1
|
|
216
|
-
else:
|
|
217
|
-
return _connector.node_count()
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
def get_display_name(*args, **kwargs):
|
|
221
|
-
if _connector is not None:
|
|
222
|
-
return _connector.get_human_readable_name(*args, **kwargs)
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
def list_cornici_pezzi(*args, **kwargs):
|
|
226
|
-
if _connector is not None:
|
|
227
|
-
return _connector.list_cornici_pezzi(*args, **kwargs)
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
def find_datasets(*args, **kwargs):
|
|
231
|
-
if _connector is not None:
|
|
232
|
-
return _connector.find_datasets(*args, **kwargs)
|
|
185
|
+
db = GraphDBConnection(uri, user, password)
|
|
186
|
+
return db
|
{educelab_hercdb-0.1.0.dev1 → educelab_hercdb-0.1.0.dev2}/src/educelab_hercdb.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: educelab-hercdb
|
|
3
|
-
Version: 0.1.0.
|
|
3
|
+
Version: 0.1.0.dev2
|
|
4
4
|
Summary: Graph database API for Herculaneum data
|
|
5
5
|
Author-email: Mami Hayashida <mami.hayashida@uky.edu>, Seth Parker <c.seth.parker@uky.edu>
|
|
6
6
|
Project-URL: Repository, https://gitlab.com/educelab/herculaneum-graph-db
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{educelab_hercdb-0.1.0.dev1 → educelab_hercdb-0.1.0.dev2}/src/educelab_hercdb.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{educelab_hercdb-0.1.0.dev1 → educelab_hercdb-0.1.0.dev2}/src/educelab_hercdb.egg-info/requires.txt
RENAMED
|
File without changes
|
{educelab_hercdb-0.1.0.dev1 → educelab_hercdb-0.1.0.dev2}/src/educelab_hercdb.egg-info/top_level.txt
RENAMED
|
File without changes
|