Coder Social home page Coder Social logo

antiquity-with-docs's Introduction

Antiquity

Antiquity - A versioned graph.

Antiquity is a versioned graph with full history support for graph elements.

Antiquity is not tight to any specific graph database, this is achieved by using Tinkerpop Blueprints project (http://blueprints.tinkerpop.com) which provides an abstraction layer for graph underlines.

Creating a versioned graph

Creating a versioned graph basically cosntructed from two main items:

  1. The underline blueprint graph implementation (for simplicity, in memory TinkerGraph graph is used below)
  2. The versioned graph that wraps the underline graph (for simplicty a non transactional versioned graph is used).
//A blueprint graph
TinkerGraph baseGraph = new TinkerGraph();
//Create a non transactional versioned graph with long version identifier
NonTransactionalVersionedGraph<TinkerGraph, Long> graph = new NonTransactionalVersionedGraph<TinkerGraph, Long>(
  			baseGraph, new LongGraphIdentifierBehavior());

Writing/Reading the graph

Here is an example how to create a vertex with few updates where each update is stored as a version.

Vertex v = graph.addVertex("versioned_vertex");
Long version1 = graph.getLatestGraphVersion();
v.setProperty("key", "foo");
Long version2 = graph.getLatestGraphVersion();
v.setProperty("key", "bar");
Long version3 = graph.getLatestGraphVersion();
//prints null
System.out.println(graph.getVertexForVersion(v, version1).getProperty("key"));
//prints foo
System.out.println(graph.getVertexForVersion(v, version2).getProperty("key"));
//prints bar
System.out.println(graph.getVertexForVersion(v, version3).getProperty("key"));

Working with the graph is simply done by the standard BluePrint's Graph interface. The method graph.getVertexForVersion(Vertex v, Long ver) loads a vertex state for a specific version allowing a full view of how the vertex (with its edges) looked like back then in a previous version.

antiquity-with-docs's People

Contributors

asaf avatar

Watchers

 avatar  avatar

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.