|
573 | 573 | </li> |
574 | 574 |
|
575 | 575 | <li class="md-nav__item"> |
576 | | - <a href="#janusgraph-specific-types-and-predicates" class="md-nav__link"> |
577 | | - JanusGraph Specific Types and Predicates |
| 576 | + <a href="#janusgraph-python-for-janusgraph-specific-types-and-predicates" class="md-nav__link"> |
| 577 | + JanusGraph-Python for JanusGraph Specific Types and Predicates |
578 | 578 | </a> |
579 | 579 |
|
580 | 580 | </li> |
|
2014 | 2014 | </li> |
2015 | 2015 |
|
2016 | 2016 | <li class="md-nav__item"> |
2017 | | - <a href="#janusgraph-specific-types-and-predicates" class="md-nav__link"> |
2018 | | - JanusGraph Specific Types and Predicates |
| 2017 | + <a href="#janusgraph-python-for-janusgraph-specific-types-and-predicates" class="md-nav__link"> |
| 2018 | + JanusGraph-Python for JanusGraph Specific Types and Predicates |
2019 | 2019 | </a> |
2020 | 2020 |
|
2021 | 2021 | </li> |
@@ -2085,10 +2085,33 @@ <h2 id="getting-started-with-janusgraph-and-gremlin-python">Getting Started with |
2085 | 2085 | Gremlin Server and returns a single result.</p> |
2086 | 2086 | </li> |
2087 | 2087 | </ol> |
2088 | | -<h2 id="janusgraph-specific-types-and-predicates">JanusGraph Specific Types and Predicates</h2> |
| 2088 | +<h2 id="janusgraph-python-for-janusgraph-specific-types-and-predicates">JanusGraph-Python for JanusGraph Specific Types and Predicates</h2> |
2089 | 2089 | <p>JanusGraph contains some types and <a href="../../search-predicates/">predicates</a> that |
2090 | 2090 | are not part of Apache TinkerPop and are therefore also not supported by |
2091 | | -Gremlin-Python.</p> |
| 2091 | +Gremlin-Python. |
| 2092 | +<a href="https://github.com/JanusGraph/janusgraph-python">JanusGraph-Python</a> is a Python |
| 2093 | +package that adds support for some of these types and predicates to Gremlin-Python.</p> |
| 2094 | +<p>After installing the package, a message serializer needs to be configured for |
| 2095 | +JanusGraph which can be done like this for GraphSON 3:</p> |
| 2096 | +<div class="highlight"><pre><span></span><code><span class="kn">from</span> <span class="nn">gremlin_python.driver.driver_remote_connection</span> <span class="kn">import</span> <span class="n">DriverRemoteConnection</span> |
| 2097 | +<span class="kn">from</span> <span class="nn">janusgraph_python.driver.serializer</span> <span class="kn">import</span> <span class="n">JanusGraphSONSerializersV3d0</span> |
| 2098 | + |
| 2099 | +<span class="n">connection</span> <span class="o">=</span> <span class="n">DriverRemoteConnection</span><span class="p">(</span> |
| 2100 | + <span class="s1">'ws://localhost:8182/gremlin'</span><span class="p">,</span> <span class="s1">'g'</span><span class="p">,</span> |
| 2101 | + <span class="n">message_serializer</span><span class="o">=</span><span class="n">JanusGraphSONSerializersV3d0</span><span class="p">())</span> |
| 2102 | +</code></pre></div> |
| 2103 | +<p>or like this for GraphBinary:</p> |
| 2104 | +<div class="highlight"><pre><span></span><code><span class="kn">from</span> <span class="nn">gremlin_python.driver.driver_remote_connection</span> <span class="kn">import</span> <span class="n">DriverRemoteConnection</span> |
| 2105 | +<span class="kn">from</span> <span class="nn">janusgraph_python.driver.serializer</span> <span class="kn">import</span> <span class="n">JanusGraphBinarySerializersV1</span> |
| 2106 | + |
| 2107 | +<span class="n">connection</span> <span class="o">=</span> <span class="n">DriverRemoteConnection</span><span class="p">(</span> |
| 2108 | + <span class="s1">'ws://localhost:8182/gremlin'</span><span class="p">,</span> <span class="s1">'g'</span><span class="p">,</span> |
| 2109 | + <span class="n">message_serializer</span><span class="o">=</span><span class="n">JanusGraphBinarySerializersV1</span><span class="p">())</span> |
| 2110 | +</code></pre></div> |
| 2111 | +<p>Refer to <a href="https://github.com/JanusGraph/janusgraph-python#janusgraph-python">the documentation of JanusGraph-Python</a> |
| 2112 | +for more information about the package, including its <a href="https://github.com/JanusGraph/janusgraph-python#version-compatibility">compatibility with |
| 2113 | +different JanusGraph versions</a> |
| 2114 | +and differences in support between the different <a href="https://github.com/JanusGraph/janusgraph-python#serialization-formats">serialization formats</a>.</p> |
2092 | 2115 |
|
2093 | 2116 |
|
2094 | 2117 |
|
|
0 commit comments