- Added triple query using triples-query-cassandra

- Added triples_query_client.py and a test
This commit is contained in:
Cyber MacGeddon 2024-08-12 20:12:13 +01:00
parent 6de72d7567
commit ee89a5d8e6
11 changed files with 350 additions and 8 deletions

View file

@ -20,4 +20,3 @@ print("Response...")
for val in resp:
print(val.value)

70
tests/test-triples Executable file
View file

@ -0,0 +1,70 @@
#!/usr/bin/env python3
import pulsar
from trustgraph.triples_query_client import TriplesQueryClient
tq = TriplesQueryClient(pulsar_host="pulsar://localhost:6650")
e = "http://trustgraph.ai/e/shuttle"
limit=3
def dump(resp):
print("Response...")
for t in resp:
print(t.s.value, t.p.value, t.o.value)
print("-- * ---------------------------")
resp = tq.request(None, None, None, limit)
dump(resp)
print("-- s ---------------------------")
resp = tq.request("http://trustgraph.ai/e/shuttle", None, None, limit)
dump(resp)
print("-- p ---------------------------")
resp = tq.request(None, "http://trustgraph.ai/e/landed", None, limit)
dump(resp)
print("-- p ---------------------------")
resp = tq.request(None, None, "President", limit)
dump(resp)
print("-- sp ---------------------------")
resp = tq.request(
"http://trustgraph.ai/e/shuttle", "http://trustgraph.ai/e/landed", None,
limit
)
dump(resp)
print("-- so ---------------------------")
resp = tq.request(
"http://trustgraph.ai/e/shuttle", None, "the tower",
limit
)
dump(resp)
print("-- po ---------------------------")
resp = tq.request(
"http://trustgraph.ai/e/shuttle", "http://trustgraph.ai/e/landed",
None,
limit
)
dump(resp)
print("-- spo ---------------------------")
resp = tq.request(
"http://trustgraph.ai/e/shuttle", "http://trustgraph.ai/e/landed",
"on the concrete runway at Kennedy Space Center",
limit
)
dump(resp)