Giter Site home page Giter Site logo

pacer-titan's Introduction

Titan Graph Database Adapter for Pacer

Pacer is a JRuby graph traversal framework built on the Tinkerpop stack.

This is an alpha-version pacer adapter with basic support for a Titan graph in Pacer.

Installation

As always: gem 'pacer-titan'.

Backends

This gem includes Titan 0.5.4 with the Cassandra backend and ElasticSearch.

Usage

Opening a Titan graph in Pacer:

require 'pacer'
require 'pacer-titan'

g = Pacer.titan 'path/to/titan_config.properties'

The graph settings are specified in an Apache Configuration .properties file.

Titan-specific routes

You can use Titan's indexing predicates in pacer routes.

g.query{ has('text', Text::CONTAINS, 'lorem') }.out(:author)

Be sure to import com.thinkaurelius.titan.core.attribute.Text for the above example.

You can also use Titan's indexQuery() method to send queries in Lucene syntax to external indices:

g.index_query(:text, '(lorem ipsum*)', index_name: 'search').out(:author)

The index_query route can take an array of indices as the first parameter, you can also pass an options hash as the third parameter to specify the index name if it is something other than 'search' as used in most of the Titan configuration examples.

License

Based on Derrick Wiebe's pacer-dex and pacer-neo4j gems, as well as code by Steven McCraw and others on the pacer-users list. This gem is released under the liberal MIT license.

pacer-titan's People

Contributors

ilyakard avatar dstuebe avatar

Stargazers

Bao Bo avatar  avatar Brando avatar Thomas Efer avatar Darrick Wiebe avatar

Watchers

Darrick Wiebe avatar Thomas Efer avatar  avatar James Cloos avatar  avatar

Forkers

swipely

pacer-titan's Issues

Does this work with Titan 1.0.0

Hello!

I'm trying this gem with pacer and titan db version 1.0.0 and I'm having some issues, I don't know if I'm doing it properly, here is my code:

Dir["/home/user/titan-1.0.0/lib/*.jar"].each {|file| require file }

require 'pacer'
require 'pacer-titan'

graph = Pacer.titan("/home/user/titan-1.0.0/conf/titan-cassandra-es.properties")
puts graph.query{ has('name', 'Keanu Reeves') }.out(:ACTED_IN).inspect

And that error I receive:

com/tinkerpop/pipes/transform/VerticesVerticesPipe.java:45:in `processNextStart': java.lang.ClassCastException: com.thinkaurelius.titan.graphdb.vertices.CacheVertex cannot be cast to com.tinkerpop.blueprints.Vertex
    from com/tinkerpop/pipes/transform/VerticesVerticesPipe.java:14:in `processNextStart'
    from com/tinkerpop/pipes/AbstractPipe.java:89:in `next'
    from java/lang/reflect/Method.java:498:in `invoke'
    from /home/user/.rvm/gems/jruby-1.7.24/gems/pacer-2.0.24-java/lib/pacer/pipe/wrapping_pipe.rb:42:in `processNextStart'
    from /home/user/.rvm/gems/jruby-1.7.24/gems/pacer-2.0.24-java/lib/pacer/pipe/wrapping_pipe.rb:42:in `processNextStart'
    from com/tinkerpop/pipes/AbstractPipe.java:89:in `next'
    from java/lang/reflect/Method.java:498:in `invoke'
    from /home/user/.rvm/gems/jruby-1.7.24/gems/pacer-2.0.24-java/lib/pacer/core/route.rb:130:in `each'
    from /home/user/.rvm/gems/jruby-1.7.24/gems/pacer-2.0.24-java/lib/pacer/core/route.rb:130:in `each'
    from /home/user/.rvm/gems/jruby-1.7.24/gems/pacer-2.0.24-java/lib/pacer/core/route.rb:315:in `inspect'
    from /home/user/.rvm/gems/jruby-1.7.24/gems/pacer-2.0.24-java/lib/pacer/core/route.rb:315:in `inspect'
    from /home/user/.rvm/gems/jruby-1.7.24/gems/pacer-2.0.24-java/lib/pacer.rb:123:in `hide_route_elements'
    from /home/user/.rvm/gems/jruby-1.7.24/gems/pacer-2.0.24-java/lib/pacer.rb:123:in `hide_route_elements'
    from /home/user/.rvm/gems/jruby-1.7.24/gems/pacer-2.0.24-java/lib/pacer/core/route.rb:312:in `inspect'
    from /home/user/.rvm/gems/jruby-1.7.24/gems/pacer-2.0.24-java/lib/pacer/core/route.rb:312:in `inspect'
    from /home/user/.rvm/gems/jruby-1.7.24/gems/pacer-2.0.24-java/lib/pacer/graph/graph_transactions_mixin.rb:69:in `read_transaction'
    from /home/user/.rvm/gems/jruby-1.7.24/gems/pacer-2.0.24-java/lib/pacer/graph/graph_transactions_mixin.rb:69:in `read_transaction'
    from /home/user/.rvm/gems/jruby-1.7.24/gems/pacer-2.0.24-java/lib/pacer/core/route.rb:633:in `graph_read_transaction'
    from /home/user/.rvm/gems/jruby-1.7.24/gems/pacer-2.0.24-java/lib/pacer/core/route.rb:633:in `graph_read_transaction'
    from /home/user/.rvm/gems/jruby-1.7.24/gems/pacer-2.0.24-java/lib/pacer/core/route.rb:311:in `inspect'
    from /home/user/.rvm/gems/jruby-1.7.24/gems/pacer-2.0.24-java/lib/pacer/core/route.rb:311:in `inspect'
    from titan.rb:9:in `(root)'
    from titan.rb:9:in `(root)'
    from titan.rb:9:in `(root)'
    from titan.rb:9:in `(root)'

Am I doing something wrong?
Thanks!

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.