GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - JanusGraph/janusgraph-python: JanusGraph Python Gremlin Language Variant (GLV)

BranchesTags
Open more actions menu

Latest commit

 

History

64 Commits
64 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
janusgraph_python
janusgraph_python
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
APACHE-2.0.txt
APACHE-2.0.txt
 
 
AUTHORS.txt
AUTHORS.txt
 
 
BUILDING.md
BUILDING.md
 
 
CC-BY-4.0.txt
CC-BY-4.0.txt
 
 
CONTRIBUTORS.txt
CONTRIBUTORS.txt
 
 
DCO.txt
DCO.txt
 
 
LICENSE.txt
LICENSE.txt
 
 
README.md
README.md
 
 
requirements.txt
requirements.txt
 
 
setup.py
setup.py
 
 

Repository files navigation

JanusGraph-Python

JanusGraph-Python extends Apache TinkerPop™'s Gremlin-Python with support for JanusGraph-specific types.

Usage

To connect to JanusGraph Server, a DriverRemoteConnection instance needs to be created and configured with a message serializer that adds support for JanusGraph specific types.

This can be done like this for GraphSON 3:

from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
from janusgraph_python.driver.serializer import JanusGraphSONSerializersV3d0

connection = DriverRemoteConnection(
  'ws://localhost:8182/gremlin', 'g',
  message_serializer=JanusGraphSONSerializersV3d0())

This can be done like this for GraphBinary:

from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
from janusgraph_python.driver.serializer import JanusGraphBinarySerializersV1

connection = DriverRemoteConnection(
 'ws://localhost:8182/gremlin', 'g',
 message_serializer=JanusGraphBinarySerializersV1())

Note that the client should be disposed on shut down to release resources and to close open connections with connection.close(). The connection can then be used to configure a GraphTraversalSource:

from gremlin_python.process.anonymous_traversal import traversal

g = traversal().with_remote(connection)
# Reuse 'g' across the application

The GraphTraversalSource g can now be used to spawn Gremlin traversals:

hercules_age = g.V().has("demigod", "name", "hercules").values("age").next()
print(f"Hercules is {hercules_age} years old.")

Refer to the chapter Gremlin Query Language in the JanusGraph docs for an introduction to Gremlin and pointers to further resources. The main syntactical difference for Gremlin-Python is that it follows Python naming conventions, e.g., method names use snake_case instead of camelCase. Other difference is that when Python reserved words (e.g. "is") overlap with Gremlin steps or tokens, those gets underscore suffix (e.g. "is_").

Text Predicates

The Text class provides methods for full-text and string searches:

from janusgraph_python.process.traversal import Text

g.V().has("demigod", "name", Text.text_prefix("herc")).to_list()

The other text predicates can be used the same way.

Version Compatibility

The lowest supported JanusGraph version is 1.0.0. The following table shows the supported JanusGraph versions for each version of JanusGraph-Python:

JanusGraph-Python JanusGraph
1.0.z 1.0.z
1.1.z (1.0.z,) 1.1.z

While it should also be possible to use JanusGraph-Python with other versions of JanusGraph than mentioned here, compatibility is not tested and some functionality (like added Gremlin steps) will not work as it is not supported yet in case of an older JanusGraph version or was removed in a newer JanusGraph version.

Serialization Formats

JanusGraph-Python supports GraphSON 3 as well as GraphBinary.

Not all of the JanusGraph-specific types are already supported by the formats:

Format RelationIdentifier Text predicates Geoshapes Geo predicates
GraphSON3 x x - -
GraphBinary x x - -

Community

JanusGraph-Python uses the same communication channels as JanusGraph in general. So, please refer to the Community section in JanusGraph's main repository for more information about these various channels.

Please use GitHub issues only to report bugs or request features.

Contributing

Please see CONTRIBUTING.md in JanusGraph's main repository for more information, including CLAs and best practices for working with GitHub.

License

JanusGraph-Python code is provided under the Apache 2.0 license and documentation is provided under the CC-BY-4.0 license. For details about this dual-license structure, please see LICENSE.txt.

About

JanusGraph Python Gremlin Language Variant (GLV)

Topics

glvgremlinjanusgraphpython

Resources

Readme
License
Activity
Custom properties

Stars

22 stars

Watchers

19 watching

Forks

8 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.