Code Monkey home page Code Monkey logo

janusgraph-py's People

Contributors

debasishdebs avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

janusgraph-py's Issues

Add Index Builder classes

The Index builder classes needs to be designed as follows so that the following syntax can be followed to create indexes.

For Composite index:

graph = JanusGraph().connect()
mgmt = graph.openManagement()

index_builder = mgmt.buildCompositeIndex("indexName", "Vertex")
index_builder.addKey("prop1").addKey("prop2").indexOnly("label1").unique().make()

For Mixed Index:

graph = JanusGraph().connect()
mgmt = graph.openManagement()

index_builder = mgmt.buildMixedIndex("indexName", "Vertex")
index_builder.addKey("prop1", maping("TEXT"/"STRING"))..addKey("prop2", maping("TEXT"/"STRING")).indexOnly("label1").make()

For Vertex Centrix Index:

graph = JanusGraph().connect()
mgmt = graph.openManagement()

index_builder = mgmt.buildVertexCentricIndex("indexName")
index_builder.addEdge("label").direction("BOTH").order("ASC").on(["prop1", "prop2"]).make()

Add API to create Index schema elements

The Schema helpers are part of janusgraph_python.core.schema package.
Build a CompositeIndexHelper, MixedIndexHelper and VertexCentricHelper which builds stringified query which submits against server when make() is created.

Schema maker similar method structures across

Currently, in IndexBuilders, we have a base query, and based on method invoked like addKey, indexOnly etc, the corresponding query gets appended to base query.

Such structure needs to be followed as uniform across all schema element builders, like LabelBuilder, PropertyBuilder etc.

Update GeoShape equality

The GeoShape as well as RelationIdentifier implements equality method. The same currently works only if the other object in of same type, and equal.

Ex: Circle(x,y,z) == Circle(x,y,z) but Circle(x,y,z) != CIRCLE(lat: x, lon: y, r: z) (String representation)

Extend it to check for equality even if String object is passed.

Add support for GraphSON 2.0 and 1.0 for backwards Compartibility

Currently, all development is being carried out with TinkerPop 3.3.3 and GraphSON 3.0.

Once we publish candidates with various TinkerPop versions, we will then need to add GraphSON 2.0 and 1.0 support so that older versions of JanusGraph can also use the client drivers.

Update Schema queries from if else condition to getOrCreate formats

Currently, for the following:

  • Edge Label
  • Vertex Label
  • Property Key

We use a if else loop as gremlin query to first query for the element, if present retrive it or else create it as follows:

q = "if (mgmt.getEdgeLabel('{}')) {{" 
 "   {} = mgmt.getEdgeLabel('{}'); }}" 
"else {{" 
 "   {} = mgmt.makeEdgeLabel('{}').multiplicity({}).make(); }}\n".format(
self.label, self.label, self.label, self.label, self.label, self.multiplicity) 

This level of complex string formatting can be avoided by using JanusGraph's inbuilt APIs which does the same check.

Instead of we makeEdgeLabel in above example we will need to move to getOrCreateEdgeLabel and similarly for all other elements too.

RelationIdentifier for Edges

JanusGraph creates relationIdentifier object for Edge IDs. We will need to create an object for the same, Serializer and De-serializer for the same too.

Cleanup CodeBase for 0.1beta release

This involves cleaning up the code base for 0.1beta release. Issue for adding comments will be added in separate one.

Remove unused file for release. Includes:
GeoPredicates for GeoContains & GeoWithin.
GeoShape for Point and Circle.
JanusGraph Client.
Serializer.

Update Unittests for all Deserializer methods.

Currently we assert the equality with Class object once the object is deserialized. We need to update that, so that the string representation of class is asserted against. This will help us in representing the String representation of class instead of the class itself while we do valueMap thus increasing readability.

Add methods to JanusGraph class for close() and drop()

Add methods to JanusGraph client for closing connection and dropping the remote Graph.

The method signature will be close() and drop()

While close() : Closes both types of connection (Traversal and Management) to Remote server, the drop() will issue a query which drops remote Graph.

APIs for getting Management open Instances

For creating Indexes, it is very necessary that any transactions aren't open. If a Transaction is open, and we create an Index, then there is good chance that the Index will remain in INSTALLED state and might not move to REGISTERED state.

graph.tx().rollback() and Closed Transactions are needed to be in sync to create Indexes properly.

Currently, there is no way from JanusGraph Python to visualize the open Transactions, and a way to close them. We need to create Management APIs for the same.

The will follow following syntax:

graph = JanusGraph().connect()
mgmt = graph.openManagement()

mgmt.getOpenInstances()
# Returns list of IDs
mgmt.forceCloseInstance(ID)
# Returns null, closses the Instance referenced by ID

# Further Steps to create Index

Add docstrings

Docstrings needs to be added to every class and method, so that the same can be used by Spinx if needed. And, method definations needs to be defined also.

Create Index page

Create index page with reference to existing pages, except contributions.html

JanusGraphClient builder remodelling

JanusGraphClientBuilder currently accepts URL, PORT, Graph for creating remote connection and returns traversal. The same needs to be changed so that it is aligned with Gremlin.NET declaration, JanusGraph.NET declaration, as well as the way TinkerPop suggests us to create connection.

The class should take GremlinServer instance, and return updated GremlinServer instance with JanusGraph writer/reader classes updated.

Add API to create PropertyKey schema elements

The Schema helpers are part of janusgraph_python.core.schema package.
Build a PropertyKeyBuilder which builds stringified query which submits against server when make() is created.

geoWithin vs GeoWithin

Looks like the file core/attribute/GeoPredicate/geoWithin.py should be renamed GeoWithin. Doing so allows me to use: from janusgraph_python.structure.io.GraphsonReader import JanusGraphSONReader. Otherwise, I get the error: ModuleNotFoundError: No module named 'janusgraph_python.core.attribute.GeoPredicate.GeoWithin'

Clean default tasks

The default_task is split and standardizing with mode granular task control.

Changed from ['clean', 'install_dependencies', 'publish', 'pycharm_generate'] to ['clean', 'install_dependencies', 'prepare', 'compile_sources', 'pycharm_generate']

Now, pyb just compiles package, package to build tar and publish takes care of publishing.

Update TinkerPop versions, and publish separate artifacts to PyPi

TinkerPop version needs to be updated corresponding to each version of library being pushed to PyPi. For ease of use, we will keep the name of Python libraries same version no. as JanusGraph version it is supporting.

Accordingly 4 version will be released corresponding to separate TinkerPop version with active support for 2 versions (0.2.1 and 0.3.0)

Move AwaitGraphIndex and UpdateIndex out of Index builders

Now, when a Index query is build to create an Index, the set of queries being submitted to Server contains queries for

  • Creating Index.

  • Await till Graph Index is in Installed state.

  • Update Index into existing data.

We need to move the last 2 points, i.e. awaitGraphIndex and updateIndex out of Index builder so that user can invoke it based on their needs. Like UpdateIndex isn't required if the schema loading is first thing being done on graph.

The syntax to be followed would be:

graph = JanusGraph().connect()
mgmt = graph.openManagement()

index_builder = mgmt.buildCompositeIndex("indexName", "Vertex")
index_builder.addKey("prop1").addKey("prop2").indexOnly("label1").unique().make()

mgmt.awaitGraphIndex("indexName").make()

mgmt.updateIndex("indexName").make()

Add JanusGraph object under structure

A new interface to connecting to JanusGraph in Gremlin server mode needs to be defined.

The interface will have connect method which connects to JanusGraph running in Gremlin server mode.
The interface provides 2 APIs, like JanusGraph
namely traversal() to create traversal object to query data.
and openManagement() to create management object which is used to create schema elements.

It also needs to have close method to close connection.

Publish Pipeline

Push to Artifactory, in this case PyPi when we merge into Master. Also note that the push to artifactory will be done when the library is tagged with a major version number change.

We need to make use of Travis CI to push it to PyPi.

Update with CodeBase for 1.0.1

While PR is being approved for 1.0.0 release, the repo needs to be updated with CodeBase for 1.0.1.

1.0.1 version plans to add following features, but a few can be added or removed later on depending on feasibility.

1: Schema Management
-> Make Property keys.
-> Make Elements, vertex or edge label.
-> Make Composite Index.
-> Make Mixed Index.
-> Make Vertex Centric Index.

2: Single Graph object of type JanusGraph which contains 2 APIs
-> Traversal API which returns GraphTraversalSource and has JanusGraph specific requirements (1.0.0 release) serializers and deserializers registered.
-> Management API which will be used to create Schema elements.

3: Update docs whereever necessary

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.