mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 16:36:21 +02:00
Add Neo4j support (#9)
- Add triples-write-neo4j and triples-query-neo4j to interact with neo4j - Add docker-compose-openai-neo4j to demo Neo4j working
This commit is contained in:
parent
2f72fceaa2
commit
d3e213f194
27 changed files with 1008 additions and 230 deletions
|
|
@ -1,22 +1,23 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
"""
|
||||
Connects to the trustgraph graph hosts and dumps all graph edges.
|
||||
Connects to the graph query service and dumps all graph edges.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import time
|
||||
import os
|
||||
from trustgraph.triples_query_client import TriplesQueryClient
|
||||
|
||||
from trustgraph.direct.cassandra import TrustGraph
|
||||
default_pulsar_host = os.getenv("PULSAR_HOST", 'pulsar://pulsar:6650')
|
||||
|
||||
def show_graph(graph_hosts):
|
||||
def show_graph(pulsar):
|
||||
|
||||
t = TrustGraph(hosts=graph_hosts)
|
||||
tq = TriplesQueryClient(pulsar_host="pulsar://localhost:6650")
|
||||
|
||||
rows = t.get_all(limit=100_000_000)
|
||||
for s, p, o in rows:
|
||||
print(s, p, o)
|
||||
rows = tq.request(None, None, None, limit=10_000_000)
|
||||
|
||||
for row in rows:
|
||||
print(row.s.value, row.p.value, row.o.value)
|
||||
|
||||
def main():
|
||||
|
||||
|
|
@ -26,16 +27,16 @@ def main():
|
|||
)
|
||||
|
||||
parser.add_argument(
|
||||
'-g', '--graph-hosts',
|
||||
default="localhost",
|
||||
help=f'Graph host (default: localhost)',
|
||||
'-p', '--pulsar-host',
|
||||
default=default_pulsar_host,
|
||||
help=f'Pulsar host (default: {default_pulsar_host})',
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
|
||||
show_graph(graph_hosts=args.graph_hosts.split(","))
|
||||
show_graph(args.pulsar_host)
|
||||
|
||||
except Exception as e:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue