Date   

Re: Geo Mapping. How to index/query a non-point geo property?

hadoopmarc@...
 

Hi Dmitry,

It is not clear to me whether you have problems to get any geo predicate working or that your specific example is the issue.
Can you first confirm that the following works for you (on a clean janusgraph-full-0.6.1):

$ bin/janusgraph.sh start
$ bin/gremlin.sh
    graph = JanusGraphFactory.open('conf/janusgraph-cql-es.properties')
    mgmt = graph.openManagement()
    location = mgmt.makePropertyKey('location').dataType(Geoshape.class).cardinality(Cardinality.SINGLE).make()
    mgmt.buildIndex('byLocation', Vertex.class).addKey(location, Mapping.PREFIX_TREE.asParameter()).buildMixedIndex('search')
    mgmt.commit()

    mgmt = graph.openManagement()
    mgmt.printSchema()
    mgmt.close()    

    g = graph.traversal()
    g.addV().property('location', Geoshape.point(52, 1))
    g.V().has("location", geoWithin(Geoshape.circle(51.9, 1.1, 20.0)))

Note that you may have erred on the radius units: these seem to be in kilometers (not miles, I hope, did not do the calculation...).

Best wishes,  Marc


On Wed, Mar 30, 2022 at 03:57 PM, <dmitryzezix@...> wrote:
g.V().has("location", geoWithin(Geoshape.circle({lat}, {lon}, {radius})))


Re: Integrate CustomVertexProgram to janusgraph

Nikita Pande
 

Hey Marc,

Thanks for help.
I just ran the sample vertex program and created a blog https://medium.com/@nikita15p/integrating-custom-vertex-program-with-janusgraph-33dce1deffda . Hope it helps others as well.

Regards,
Nikita


Re: Integrate CustomVertexProgram to janusgraph

hadoopmarc@...
 

Answer to your other question:

What you do is certainly allowed, but has drawbacks compared to building a separate java package:
  • building janusgraph-core takes more time (slower development cycle)
  • giving different things the same name will cause confusion sooner or later

Best wishes,    Marc


Re: Integrate CustomVertexProgram to janusgraph

hadoopmarc@...
 

Hi Nikita,

gremlin console does a lot of imports for you, but does not cover the full JanusGraph and TinkerPop APIs. So, sometimes you have to do an import yourself. In this case:

gremlin> import org.janusgraph.graphdb.olap.computer.*

Best wishes,     Marc


Re: Integrate CustomVertexProgram to janusgraph

Nikita Pande
 
Edited

Hi @hadoopmarc,

I actually added a customVertexprogram in https://github.com/JanusGraph/janusgraph/tree/master/janusgraph-core/src/main/java/org/janusgraph/graphdb/olap/computer and then built janusgraph-core jar file. I added this jar file in the lib folder of jansugraph releases https://github.com/JanusGraph/janusgraph/releases/download/v0.6.0/janusgraph-0.6.0-doc.zip . However when I try to run this VertexProgram from gremlin console, it gives error:
gremlin> ComputerResult result = graph.compute().program(CustomVertexProgram.build().name("jane").create()).submit().get();
No such property: CustomVertexProgram for class: groovysh_evaluate
Type ':help' or ':h' for help.
Display stack trace? [yN]n

Am I allowed to add the vertex program in https://github.com/JanusGraph/janusgraph/tree/master/janusgraph-core/src/main/java/org/janusgraph/graphdb/olap/computer?
 


Re: Integrate CustomVertexProgram to janusgraph

hadoopmarc@...
 

Yes, I forgot that one, VertexPrograms need to be written in java. If you are not familiar with setting up java projects, you can take a look at the examples at:

https://github.com/JanusGraph/janusgraph/tree/master/janusgraph-examples


Re: Integrate CustomVertexProgram to janusgraph

Nikita Pande
 

Hey @hadoopmarc, currently only supported language for Vertex Program is java? 


Re: Integrate CustomVertexProgram to janusgraph

hadoopmarc@...
 

The easiest way is to write your custom VertexProgram for TinkerPop. If it runs in TinkerPop, it will also run in JanusGraph.
There are other ways, though, see two examples in:
https://github.com/JanusGraph/janusgraph/tree/master/janusgraph-core/src/main/java/org/janusgraph/graphdb/olap/computer


Geo Mapping. How to index/query a non-point geo property?

dmitryzezix@...
 

Hello, guys!

I've tried to query complex geoshape, but got empty response. What am I doing wrong?

 

My query:

transaction = client.submit(
f"""
g.V().has("location", geoWithin(Geoshape.circle({lat}, {lon}, {radius})))
"""
)

 

Index creation:

transaction = client.submit(
"""
mgmt = graph.openManagement()
location = mgmt.makePropertyKey('location').dataType(Geoshape.class).cardinality(Cardinality.SINGLE).make()
mgmt.buildIndex('byLocation', Vertex.class).addKey(location, Mapping.PREFIX_TREE.asParameter()).buildMixedIndex('search')
mgmt.commit()
"""
)

 

Vertex creation:

transaction = client.submit(
f"""
g.addV("place").property("location", {graph_geoshape.to_janus_graph_property()})
"""
)

 

Schema looks like this:

[         '------------------------------------------------------------------------------------------------\n'

          'Vertex Label Name              | Partitioned | Static                                             |\n'

          '---------------------------------------------------------------------------------------------------\n'

          'place                          | false       | false                                              |\n'

          'location                       | false       | false                                              |\n'

          '---------------------------------------------------------------------------------------------------\n'

          'Edge Label Name                | Directed    | Unidirected | Multiplicity                         |\n'

          '---------------------------------------------------------------------------------------------------\n'

          '---------------------------------------------------------------------------------------------------\n'

          'Property Key Name              | Cardinality | Data Type                                          |\n'

          '---------------------------------------------------------------------------------------------------\n'

          'location                       | SINGLE      | class org.janusgraph.core.attribute.Geoshape       |\n'

          'place                          | SINGLE      | class org.janusgraph.core.attribute.Geoshape       |\n'

          '---------------------------------------------------------------------------------------------------\n'

          'Graph Index (Vertex)           | Type        | Unique    | Backing        | Key:           Status |\n'

          '---------------------------------------------------------------------------------------------------\n'

          'byLocation                     | Mixed       | false     | search         | location:     ENABLED |\n'

          '---------------------------------------------------------------------------------------------------\n'

          'Graph Index (Edge)             | Type        | Unique    | Backing        | Key:           Status |\n'

          '---------------------------------------------------------------------------------------------------\n'

          '---------------------------------------------------------------------------------------------------\n'

          'Relation Index (VCI)           | Type        | Direction | Sort Key       | Order    |     Status |\n'

          '---------------------------------------------------------------------------------------------------\n']

 
 
My Vertexes:
V: [{<T.id: 1>: 4096, <T.label: 4>: 'place', 'location': {'@type': 'janusgraph:Geoshape', '@value': {'geometry': {'type': 'LineString', 'coordinates': [[42.546782, 1.699474], [42.546422, 1.699865], [42.545915, 1.700278], [42.545598, 1.700634], [42.545173, 1.701465], [42.544649, 1.703692], [42.544446, 1.705885], [42.544222, 1.708992], [42.544067, 1.711593], [42.543972, 1.71567], [42.543751, 1.722193], [42.543764, 1.723969], [42.543877, 1.725626], [42.544064, 1.726973], [42.544383, 1.728158], [42.544966, 1.729793], [42.545616, 1.73112], [42.546221, 1.732211], [42.54678, 1.733105]]}}}}, {<T.id: 1>: 4136, <T.label: 4>: 'location', 'place': {'@type': 'janusgraph:Geoshape', '@value': {'geometry': {'type': 'LineString', 'coordinates': [[42.546782, 1.699474], [42.546422, 1.699865], [42.545915, 1.700278], [42.545598, 1.700634], [42.545173, 1.701465], [42.544649, 1.703692], [42.544446, 1.705885], [42.544222, 1.708992], [42.544067, 1.711593], [42.543972, 1.71567], [42.543751, 1.722193], [42.543764, 1.723969], [42.543877, 1.725626], [42.544064, 1.726973], [42.544383, 1.728158], [42.544966, 1.729793], [42.545616, 1.73112], [42.546221, 1.732211], [42.54678, 1.733105]]}}}}]
 
 
Recources used:
https://docs.janusgraph.org/index-backend/text-search/#geo-mapping


Integrate CustomVertexProgram to janusgraph

Nikita Pande
 
Edited

What is the current method of integrating new VertexProgram as part of janusgraph. Is it getting the code in tinker pop and then building janusgraph code. Is java only supported language?


Re: Kerberos authentication of gremlin console with Janusgraph server

hadoopmarc@...
 

Kerberos has a reputation for being complex. I would try to first get the pure TinkerPop example working, using the TInkerPop Gremlin-server and Gremlin Console distributions. Also check the log output of Gremlin Server in case of exceptions in Gremlin Console. The command graph = JanusGraphFactory.open('') is not the best example to start with in Gremlin Console. Better is g.V().limit(5).


Re: Kerberos authentication of gremlin console with Janusgraph server

Nikita Pande
 
Edited

Hi Marc,

In my case it's both, gremlin acts as client to kerberised hbase and gremlin acts as kerberised server to gremlin console/clients. Also I have already tested hbase separately along with janus, it works fine. Now I want to add kerberized authentication of janusserver on top of this. So I want gremlin console to get authenticated

Thanks,
Nikita


Re: Kerberos authentication of gremlin console with Janusgraph server

hadoopmarc@...
 

You are mixing up two procedures:
  1. Gremlin Server Krb5Authenticator is for authenticating gremlin clients towards Gremlin Server. Apparently, you do not want it, so remove it from your configs.
  2. Apparently you are trying to have Gremlin Server authenticate againts HBase. This has nothing to do with Gremlin Server's Krb5Authenticate. If the keytab for Gremlin Server is OK and a kinit was done on the Gremlin Server host with the right user, the hbase client of janusgraph-hbase, running on the Gremlin Server host, should be able to access the TGT and authenticate to HBase.

Best wishes,     Marc


Re: Kerberos authentication of gremlin console with Janusgraph server

Nikita Pande
 
Edited

Thanks for recommending this approach. However, I am getting following error:
when running gremlin> def list = client.submit("g.V()").all().get()
>>> CCacheInputStream: readFlags()
get normal credential
org.apache.tinkerpop.gremlin.driver.exception.ResponseException: Failure to initialize security context

Also similarly when earlier I was running, I am getting inconsistent response:
1.  :remote connect tinkerpop.server conf/remote.yaml
2. :remote console
3.  graph=JanusGraphFactory.open("/root/janusgraph-0.6.0/conf/janusgraph-hbase.properties"), sometimes works fine  and returns configured graph. However sometimes when I repeat 1,2. It gives error "Failure to initialize security context"
 


Re: MongoDB or ElasticSearch as storage backend?

hadoopmarc@...
 

Adding new types of storage or indexing backends to JanusGraph is not straightforward. So, unless you are a seasoned java developer and have some time to spare, you will have to use the available storage and indexing backends, as listed in https://docs.janusgraph.org/.

I am not aware of any out-of-the-box/cloud solutions to transfer data from Mongodb to JanusGraph.

Best wishes,    Marc


MongoDB or ElasticSearch as storage backend?

ucheozoemena@...
 

Hi everyone, is it possible to use mongodb or elastic search as the storage backend? I'm new to janusgraph so please bear with me and feel free to explain anything obvious that I may be missing. It appears Mongodb and janusgraph are entirely different types of databases but I’m just wondering if there’s a known way to make janusgraph work with data that’s already stored in mongodb. Elastic search is a common indexing backend for janusgraph, and is commonly used with mongodb as well. So I’m considering if it’s possible to use all 3 together. If mongodb can't be used, how about elastic search as the storage backend as well as the indexing backend?


Re: Kerberos authentication of gremlin console with Janusgraph server

hadoopmarc@...
 

Connecting gremlin console to gremlin server goes like:

cluster = Cluster.build(<hostname>).jaasEntry(<entry in gremlin-jaas.conf file>).protocol(<serverPrincipalName>).create()
and see https://tinkerpop.apache.org/docs/current/reference/#connecting-via-drivers how to use the cluster object.

Did you try this already?


Re: Kerberos authentication of gremlin console with Janusgraph server

Nikita Pande
 

" Krb5Authenticator runs inside Gremlin Server and authenticates users of gremlin clients (e.g. Gremlin Console). " this is configured as part of gremlin-server.yaml. 
When I run just "graph" alone  from gremlin-console, I get error "Authenticator is not ready to handle requests".
Whereas when I run JanusGraphFactory it passes. Not sure why do we get this. My current service keytab had 2 principals and I configured one. Will it create problem?


Re: Kerberos authentication of gremlin console with Janusgraph server

hadoopmarc@...
 

Hi Nikita,

I do not understand: Krb5Authenticator runs inside Gremlin Server and authenticates users of gremlin clients (e.g. Gremlin Console). Why would you run JanusGraphFactory in the Gremlin Console if the graph is already opened server side?

Can you also check the logs of Gremlin Server and see if they give any additinal hint about Krb5Authenticator?

Best wishes,   Marc


Kerberos authentication of gremlin console with Janusgraph server

Nikita Pande
 
Edited

Hi team,
 
Kerberos authentication of gremlin console with janusgraph version 0.6.0
 
I am facing an issue when trying to configure kerberos auth of gremlin console with with janus as per https://tinkerpop.apache.org/docs/current/reference/#krb5authenticator. Currently after kinit , I try to start gremlin console and run some traversals. So sometimes I get "Authenticator is not ready to handle requests" while sometimes it goes through while running command: graph = JanusGraphFactory.open('') Its very inconsistent. Please help me in resolving this.
 
Thanks and Regards, 
Nikita