rpuga
rpuga
Explore posts from servers
JJanusGraph
Created by rpuga on 5/27/2024 in #questions
Unable to load GraphSON file
Ah, got it. Given the similarity between the exported JSON and GraphSON v1.0 I though they were the same. Thanks for the clarification, @gdotv. Interestingly, the example GraphSON v1.0 from the TinkerPop documentation also does not work, though I did not think it was deprecated (maybe it's mentioned somewhere in the docs and I missed it...)
8 replies
JJanusGraph
Created by rpuga on 5/26/2024 in #questions
Gremlin statement exceeds the maximum compilation size
I see... unfortunately, it seems that this is a hard constraint. Thanks.
5 replies
JJanusGraph
Created by rpuga on 5/27/2024 in #questions
Unable to load GraphSON file
Basically, I used the G.V() IDE -- @gdotv -- to create a single node in a graph and then exported it to JSON format. Then, I'm trying to import that single node graph into JanusGraph. To my understanding, the JSON format exported by G.V() follows the GraphSON version 1.0 documented here: https://tinkerpop.apache.org/docs/3.7.2/dev/io/#graphson so, I thought that importing it should also work. Here is similar example, taken from the TinkerPop documentation (I copied only the first node from the TinkerGraph GraphSON example and reformatted it to properly close parenthesis, etc.):
{"vertices":[{"id":1,"label":"person","type":"vertex","properties":{"name":[{"id":0,"value":"marko"}]}}]}
{"vertices":[{"id":1,"label":"person","type":"vertex","properties":{"name":[{"id":0,"value":"marko"}]}}]}
I get the same Label can not be null when trying to load this in a G.V() playground as well. So it seems this is not an issue that is unique to JanusGraph. Maybe this is because GraphSON version 1.0 is not supported anymore? Or maybe there is a way to specify that the GraphSON format to use when loading the grpah is v1.0?
8 replies
JJanusGraph
Created by rpuga on 4/21/2024 in #questions
~20% write performance hit when using custom str IDs?
Hi @Boxuan Li, here is an example: Int ID: 3232243223 Str ID: "3232243223" Everything else except the ID data type is exactly the same. Each inserted vertex has 2 properties (besides a label and the custom ID): a Long and a String. I expected a bit of write performance degradation from using custom str IDs, but I was somewhat surprised to see a ~20% perfromance impact, which seems quite significant. That's why I was wondering if this is a known issue.
13 replies
ATApache TinkerPop
Created by rpuga on 3/23/2024 in #questions
mergeE(): increment counter on match
Thanks @Kelvin Lawrence, your solution works great! Adapting it to the example graph I was using, it looks like this:
g.mergeE([(T.label):'called', (from):p1, (to):p2]).
option(Merge.onCreate, ['num_calls': 1]).
option(Merge.onMatch, property('num_calls', union(values('num_calls'), constant(1)).sum()).constant([:]))
g.mergeE([(T.label):'called', (from):p1, (to):p2]).
option(Merge.onCreate, ['num_calls': 1]).
option(Merge.onMatch, property('num_calls', union(values('num_calls'), constant(1)).sum()).constant([:]))
16 replies
ATApache TinkerPop
Created by dracule_redrose on 3/22/2024 in #questions
Serialization Issue
I have faced a similar issue in the past (but mostly related to gremlin-python) and @Boxuan Li suggested a solution in the JanusGraph discord server. It was something like along these lines:
private static MessageSerializer createGraphBinaryMessageSerializerV1() {
final GraphBinaryMessageSerializerV1 serializer = new GraphBinaryMessageSerializerV1();
final Map<String, Object> config = new HashMap<>();
config.put(GraphBinaryMessageSerializerV1.TOKEN_IO_REGISTRIES, Collections.singletonList(JanusGraphIoRegistry.class.getName()));
serializer.configure(config, Collections.emptyMap());
return serializer;
}
private static MessageSerializer createGraphBinaryMessageSerializerV1() {
final GraphBinaryMessageSerializerV1 serializer = new GraphBinaryMessageSerializerV1();
final Map<String, Object> config = new HashMap<>();
config.put(GraphBinaryMessageSerializerV1.TOKEN_IO_REGISTRIES, Collections.singletonList(JanusGraphIoRegistry.class.getName()));
serializer.configure(config, Collections.emptyMap());
return serializer;
}
and
Cluster cluster = Cluster.build()
.addContactPoint(gremlinServer)
.port(gremlinServerPort)
// .serializer(new GraphBinaryMessageSerializerV1(typeSerializerRegistry))
.serializer(createGraphBinaryMessageSerializerV1())
.create();
Cluster cluster = Cluster.build()
.addContactPoint(gremlinServer)
.port(gremlinServerPort)
// .serializer(new GraphBinaryMessageSerializerV1(typeSerializerRegistry))
.serializer(createGraphBinaryMessageSerializerV1())
.create();
Also, here is how he suggested to setup the serializers in the JanusGraph config file: https://github.com/Citegraph/citegraph/blob/main/backend/src/main/resources/gremlin-server-cql.yaml I hope this leads you closer to a solution.
5 replies
ATApache TinkerPop
Created by rpuga on 3/23/2024 in #questions
mergeE(): increment counter on match
BTW, I was able to obtain the result I need with a query that looks like this:
p1 = g.addV('person').property('name', 'marko').next()
p2 = g.addV('person').property('name', 'maria').next()
g.V(p1).as("v1").
V(p2).as("v2").
coalesce(
select("v1").outE("called").where(inV().has(id, select("v2").id())),
addE("called").from("v1").to("v2").property("num_calls", 0)).
as("e").
property(
"num_calls",
union(select("e").values("num_calls").unfold(), constant(1)).sum())
p1 = g.addV('person').property('name', 'marko').next()
p2 = g.addV('person').property('name', 'maria').next()
g.V(p1).as("v1").
V(p2).as("v2").
coalesce(
select("v1").outE("called").where(inV().has(id, select("v2").id())),
addE("called").from("v1").to("v2").property("num_calls", 0)).
as("e").
property(
"num_calls",
union(select("e").values("num_calls").unfold(), constant(1)).sum())
but I'm wondering how something similar can be done with mergeE()
16 replies
JJanusGraph
Created by rpuga on 1/21/2024 in #questions
Changing default ES index name prefix
I was able to submit a pull request with the documentation fix (#4225)
10 replies
JJanusGraph
Created by rpuga on 1/21/2024 in #questions
Changing default ES index name prefix
Sure, I'd be happy to contribute. I have not done this before, so I'll first need to read the related info and guidelines for contributing to the documentation (I found the janusgraph/CONTRIBUTING.md guide on GitHub).
10 replies
JJanusGraph
Created by rpuga on 1/21/2024 in #questions
Changing default ES index name prefix
It worked, thank you so much! Does this mean that this page in the JanusGraph docs is incorrect? https://docs.janusgraph.org/index-backend/elasticsearch/ It explicitly mentions index.[X].elasticsearch.index-name as the option name, whereas the following page correctly indicates index.[X].index-name as the option to use. https://docs.janusgraph.org/configs/configuration-reference/
10 replies
JJanusGraph
Created by rpuga on 1/21/2024 in #questions
Changing default ES index name prefix
@Oleksandr Porunov, thank you for your answer. I tried to start from a completely new instance of JanusGraph, Cassandra, and Elastisearch (a single node cluster setting from both the server and storage/index backends). Although I set the index-name to a different name, JanusGraph still used janusgraph as the prefix for the ES indices. I think there is something wrong I'm doing in the configuration file. Here is what I currently have:
gremlin.graph = org.janusgraph.core.JanusGraphFactory

storage.backend = cql
storage.hostname = cassandra1
storage.cql.keyspace = jgidxtest
cache.db-cache = true
cache.db-cache-clean-wait = 20
cache.db-cache-time = 180000
cache.db-cache-size = 0.25

index.search.backend = elasticsearch
index.search.hostname = elasticsearch1
index.search.elasticsearch.index-name = jgidxtest
gremlin.graph = org.janusgraph.core.JanusGraphFactory

storage.backend = cql
storage.hostname = cassandra1
storage.cql.keyspace = jgidxtest
cache.db-cache = true
cache.db-cache-clean-wait = 20
cache.db-cache-time = 180000
cache.db-cache-size = 0.25

index.search.backend = elasticsearch
index.search.hostname = elasticsearch1
index.search.elasticsearch.index-name = jgidxtest
Dispite changing the name, ES created these indices:
$ curl -XGET http://localhost:9200/_cat/indices/
yellow open janusgraph_lastseenemixedindex VOTTeC_5T9-UqcpUIKCKww 1 1 0 0 227b 227b 227b
yellow open janusgraph_namevmixedindex sfqlgiy4QY66T_vnUI1gsw 1 1 0 0 227b 227b 227b
yellow open janusgraph_firstseenemixedindex zkD21PZjRRSvuPtC5gy74A 1 1 0 0 227b 227b 227b
$ curl -XGET http://localhost:9200/_cat/indices/
yellow open janusgraph_lastseenemixedindex VOTTeC_5T9-UqcpUIKCKww 1 1 0 0 227b 227b 227b
yellow open janusgraph_namevmixedindex sfqlgiy4QY66T_vnUI1gsw 1 1 0 0 227b 227b 227b
yellow open janusgraph_firstseenemixedindex zkD21PZjRRSvuPtC5gy74A 1 1 0 0 227b 227b 227b
whereas I was expecteing indices that start with jgidxtest_. I feel that I'm doing something wrong when setting index.{yourIndex}.index-name. Specifically, I'm not entirely sure about what {yourIndex} should be. In the JanusGraph docs, it mentions index.[X].elasticsearch.index-name but again, I'm not sure what [X] should be in my case. I've seen some examples online where [X] is simply replaced with search, which is what I did, but that does not seem to work. Any thoughts on what the correct configuration line should be?
10 replies