b4lls4ck
b4lls4ck
Explore posts from servers
ATApache TinkerPop
Created by b4lls4ck on 8/1/2024 in #questions
How to find the edges of a node that have a weight of x or greater?
Thank you, this helped me fix my problem 🙂
8 replies
ATApache TinkerPop
Created by b4lls4ck on 8/1/2024 in #questions
How to find the edges of a node that have a weight of x or greater?
Also btw, I am assuming the way I am setting weights for the edges is correct:
person_A_node = g.V().has("person", "name", "A").to_list()[0] # this node represents person A

person_B_node = g.V().has("person", "name", "B").to_list()[0] # this node represents person B

person_C_node = g.V().has("person", "name", "C").to_list()[0] # this node represents person C

g.V(person_A_node).add_e("is friends with").to(person_B_node).property("weight", 0.9).iterate()
g.V(person_A_node).add_e("is friends with").to(person_C_node).property("weight", 0.7).iterate()
person_A_node = g.V().has("person", "name", "A").to_list()[0] # this node represents person A

person_B_node = g.V().has("person", "name", "B").to_list()[0] # this node represents person B

person_C_node = g.V().has("person", "name", "C").to_list()[0] # this node represents person C

g.V(person_A_node).add_e("is friends with").to(person_B_node).property("weight", 0.9).iterate()
g.V(person_A_node).add_e("is friends with").to(person_C_node).property("weight", 0.7).iterate()
8 replies
ATApache TinkerPop
Created by b4lls4ck on 8/1/2024 in #questions
How to find the edges of a node that have a weight of x or greater?
Oh yeah, I also tried that, and for some reason, it didn't work. My query was as follows:
from gremlin_python.process.traversal import P
a_friends = g.V().has("person", "name", "A").out("is friends with").has("weight", P.gt(0.75)).inV().to_list()
from gremlin_python.process.traversal import P
a_friends = g.V().has("person", "name", "A").out("is friends with").has("weight", P.gt(0.75)).inV().to_list()
And it returned an empty list even though I have that person C has a weight of 0.9 with person A
8 replies
JJanusGraph
Created by b4lls4ck on 7/18/2024 in #questions
Is there a suitable JanusGraph visualizer where you can see your created graphs?
I am leaning more towards a free visualization software
8 replies
JJanusGraph
Created by b4lls4ck on 7/18/2024 in #questions
Is there a suitable JanusGraph visualizer where you can see your created graphs?
Okay thank you! I'll take a look at these and see what they got, will come back with any questions I may have about them
8 replies
JJanusGraph
Created by b4lls4ck on 7/18/2024 in #questions
Is there a suitable JanusGraph visualizer where you can see your created graphs?
Thank you for sharing this, I am assuming after looking at pricing that it will cost $50/month to have it set up with JanusGraph?
8 replies
ATApache TinkerPop
Created by b4lls4ck on 7/9/2024 in #questions
I am unsure on how to use Python to add graphs to JanusGraph
Wow That fixed it! thank you so much! I really appreciate your help and your super detailed explanations, thank you!!!!! Will post any other questions I have on a new thread if I have
42 replies
ATApache TinkerPop
Created by b4lls4ck on 7/9/2024 in #questions
I am unsure on how to use Python to add graphs to JanusGraph
it's quite a lot to send here , but the output of my docker logs are equivalent to what gets printed when starting the Janus Graph container itself, My Python script has been modified to look like this:
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
from gremlin_python.process.anonymous_traversal import traversal
from janusgraph_python.driver.serializer import JanusGraphSONSerializersV3d0

g = traversal().with_remote(DriverRemoteConnection('ws://localhost:8182/gremlin','g',message_serializer=JanusGraphSONSerializersV3d0()))

v1 = g.add_v("person").property("name", "John").next()
print(v1)
v2 = g.add_v("person").property("name", "Mary").next()
print(v2)
e = g.V(v1).add_e("knows").to(v2).iterate()
print(g.V().has("person", "name", "John").out("knows").values("name").to_list())
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
from gremlin_python.process.anonymous_traversal import traversal
from janusgraph_python.driver.serializer import JanusGraphSONSerializersV3d0

g = traversal().with_remote(DriverRemoteConnection('ws://localhost:8182/gremlin','g',message_serializer=JanusGraphSONSerializersV3d0()))

v1 = g.add_v("person").property("name", "John").next()
print(v1)
v2 = g.add_v("person").property("name", "Mary").next()
print(v2)
e = g.V(v1).add_e("knows").to(v2).iterate()
print(g.V().has("person", "name", "John").out("knows").values("name").to_list())
What is outputted is the following, still getting similar error , but I am now able to successfully add vertices using the add_v method, create an edge between the two vertices using add_e method, and print out the name of the person that John knows (Mary):
v[4184]
v[8296]
['Mary']
Error on reading from the event loop self pipe
loop: <ProactorEventLoop running=True closed=False debug=False>
Traceback (most recent call last):
File "C:\Python312\Lib\asyncio\proactor_events.py", line802, in _loop_self_reading
.
.
.
OSError: [WinError 87] The parameter is incorrect
Error on reading from the event loop self pipe
loop: <ProactorEventLoop running=True closed=False debug=False>
v[4184]
v[8296]
['Mary']
Error on reading from the event loop self pipe
loop: <ProactorEventLoop running=True closed=False debug=False>
Traceback (most recent call last):
File "C:\Python312\Lib\asyncio\proactor_events.py", line802, in _loop_self_reading
.
.
.
OSError: [WinError 87] The parameter is incorrect
Error on reading from the event loop self pipe
loop: <ProactorEventLoop running=True closed=False debug=False>
It's just I still get the OSError WinError 87 ,
42 replies
ATApache TinkerPop
Created by b4lls4ck on 7/9/2024 in #questions
I am unsure on how to use Python to add graphs to JanusGraph
Hi @Florian Hockmann Thank you for letting me know that Janus doesn't have official Windows support, I have used the Docker container, and in this message I am replying to, I go into detail about the error I would get when using the Docker container, are there any suggestions or ways I could address this issue?
42 replies
ATApache TinkerPop
Created by b4lls4ck on 7/9/2024 in #questions
I am unsure on how to use Python to add graphs to JanusGraph
Now in JanusGraph 1.0.0. distribution, there is a gremlin-server.bat file which I can run as I am on Windows, upon running it, it says it has connected to port 8182. I run my Python script afterwards
g = traversal().with_remote(DriverRemoteConnection('ws://localhost:8182/gremlin','g'))
v1=g.add_v("person").property("name", "John").next()
g = traversal().with_remote(DriverRemoteConnection('ws://localhost:8182/gremlin','g'))
v1=g.add_v("person").property("name", "John").next()
and I get an error outputted by the Python script saying
gremlin_python.driver.protocol.GremlinServerError: 499: The traversal source [g] for alias [g] is not configured on the server. bin/gremlin-server.sh conf/gremlin-server/gremlin-server-configuration.yaml
.
.
.
OSError: [WinError 87] The parameter is incorrect
gremlin_python.driver.protocol.GremlinServerError: 499: The traversal source [g] for alias [g] is not configured on the server. bin/gremlin-server.sh conf/gremlin-server/gremlin-server-configuration.yaml
.
.
.
OSError: [WinError 87] The parameter is incorrect
Now I will try out the add on above involving serialization, but do you think this different error could be due to another reason?
42 replies
ATApache TinkerPop
Created by b4lls4ck on 7/9/2024 in #questions
I am unsure on how to use Python to add graphs to JanusGraph
Yes exactly, I am running a Janus Server in that docker container
42 replies
ATApache TinkerPop
Created by b4lls4ck on 7/9/2024 in #questions
I am unsure on how to use Python to add graphs to JanusGraph
Is there any way of starting a JanusGraph server in Windows? I cannot run the /bin/janusgraph-server.sh script as I am on Windows, and there is no /bin/janusgraph-server.bat file included in the JanusGraph distribution I downloaded (1.0.0). This is the very reason why I am using Docker instead
42 replies
ATApache TinkerPop
Created by b4lls4ck on 7/9/2024 in #questions
I am unsure on how to use Python to add graphs to JanusGraph
Thanks for sharing the Python examples, they look very helpful
42 replies
ATApache TinkerPop
Created by b4lls4ck on 7/9/2024 in #questions
I am unsure on how to use Python to add graphs to JanusGraph
I am using docker to run JanusGraph and I ran a command that is similar to the first command listed on this page: https://docs.janusgraph.org/getting-started/installation/ The exact command I run is:
docker run -it -p 8182:8182 --name janusgraph-default janusgraph/jannusgraph:latest
docker run -it -p 8182:8182 --name janusgraph-default janusgraph/jannusgraph:latest
which is similar to that first command on that page. I needed to modify it because i need to map port 8182 of the JanusGraph container to port 8182 of my machine (the host machine). Without the "-it -p 8182:8182" part I would get the following error when running the python script:
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host localhost:8182 ssl:default [The remote computer refused the network connection]
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000001FFAA7B2210>
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host localhost:8182 ssl:default [The remote computer refused the network connection]
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000001FFAA7B2210>
But since I am mapping the port of the container to the port of my machine, I am no longer getting that error, and am now facing this new error mentioned earlier So I would say that my python script is connecting to JanusGraph as opposed to the Gremlin Server
42 replies
ATApache TinkerPop
Created by b4lls4ck on 7/9/2024 in #questions
I am unsure on how to use Python to add graphs to JanusGraph
I am not too sure on why this would be occurring , I have seen it a couple of times
42 replies
ATApache TinkerPop
Created by b4lls4ck on 7/9/2024 in #questions
I am unsure on how to use Python to add graphs to JanusGraph
Which is what I had in my code, and it would yield the following error:
KeyError: <DataType.custom: 0>
Error on reading from the event loop self pipe
loop: <ProactorEventLoop running=True closed=False debug=False>
....
OSError: [WinError 87] The parameter is incorrect
KeyError: <DataType.custom: 0>
Error on reading from the event loop self pipe
loop: <ProactorEventLoop running=True closed=False debug=False>
....
OSError: [WinError 87] The parameter is incorrect
42 replies
ATApache TinkerPop
Created by b4lls4ck on 7/9/2024 in #questions
I am unsure on how to use Python to add graphs to JanusGraph
Oh yes I actually typed it wrong here on discord, I meant to write
v1 = g.addV("person").property("name", "John").next()
print(v1)
v1 = g.addV("person").property("name", "John").next()
print(v1)
42 replies
ATApache TinkerPop
Created by b4lls4ck on 7/9/2024 in #questions
I am unsure on how to use Python to add graphs to JanusGraph
hmmm Okay, so If I understood correctly, I need to do
v1 = g.addV("person").property("name", "John")
print(v1).next()
v1 = g.addV("person").property("name", "John")
print(v1).next()
or
v1 = g.addV("person").property("name", "John")
print(v1).to_list()
v1 = g.addV("person").property("name", "John")
print(v1).to_list()
I tried both of these out seperately but both times on this exact line I would get an error saying
OSError: [WinError 87] The parameter is incorrect
OSError: [WinError 87] The parameter is incorrect
42 replies
ATApache TinkerPop
Created by b4lls4ck on 7/9/2024 in #questions
I am unsure on how to use Python to add graphs to JanusGraph
Hmm okay, so following this gremlin-python docs in the 1st link, I wrote this in Python:
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
from gremlin_python.process.anonymous_traversal import traversal

g = traversal().with_remote(DriverRemoteConnection("ws://localhost:8182/gremlin", "g"))

v1 = g.addV("person").property("name", "John")
print(v1)
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
from gremlin_python.process.anonymous_traversal import traversal

g = traversal().with_remote(DriverRemoteConnection("ws://localhost:8182/gremlin", "g"))

v1 = g.addV("person").property("name", "John")
print(v1)
printing v1 outputs the following:
[['addV', 'person'], ['property','name','John']]
[['addV', 'person'], ['property','name','John']]
Is this the intended behaviour? I am assuming if I have the Cassandra backend setup with the JanusGraph, I'll then be able to view this vertex in Cassandra DB
42 replies
ATApache TinkerPop
Created by b4lls4ck on 7/9/2024 in #questions
I am unsure on how to use Python to add graphs to JanusGraph
Is Cassandra something that can be quickly picked up and installed? If I choose to use BerkelyDB in the meantime as my backend, is there Python support for BerkelyDB or it exclusively for JVM language?
42 replies