Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

architect4r

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

architect4r

  • 0.4.3.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Architect4r

Architect4r is intended as an easy ruby wrapper for the neo4j graph db REST API. There are other solutions such as neo4j.rb if you are working in a java environment or neography which provides another working wrapper for the REST API. Both solutions are far more feature complete and allow you to do pretty advanced queries on the graph.

Architect4r is trying to go another route. Instead of using the native graph traversal engine it requires you to write your queries in recently implemented cypher query language. The language is well documented at the official neo4j documentation (http://docs.neo4j.org/chunked/milestone/). Just that you know what you are dealing with… a little example:

start s=node(1) match s-[:friends]-d return d order by d.name skip 0 limit 20

But please read the docs for more info.

Requirements

You need a running neo4j installation.

Installation

In oder to work with architect4r you have to install the gem by using gem install architect4r or in case that you are using bundler, you can add the following line to your Gemfile: gem "architect4r".

Quick Start

# Class definition
class Instrument < Architect4r::Model::Node
  # Properties
  property :name, :cast_to => String, :localize => true
  property :name, :cast_to => String, :localize => :de
  timestamps!
  
  # Validations
  validates :name, :presence => true
end

# Interfacing with the I18n class
I18n.locale = :en

# Working with a record
instrument = Instrument.new
instrument.name = "Piano"
instrument.name(:de) = "Klavier"
instrument.valid?
instrument.save

# Updating attributes
instrument.update_attributes(params[:instrument])

# Finding records
Instrument.find_by_id(123)

class Fanship < Architect4r::Model::Relationship
  # Properties
  property :created_at, :cast_to => DateTime
  property :reason, :cast_to => String
end

# Init a class based relationship
Fanship.new(@user, @instrument, { :reason => 'Because I like you' })

Logging

In order to log the debug output from architect4r to a logfile, just override the default logger instance. If you are using rails, you might wanna add this to an initializer:

# Create a logger instance
file = File.open('log/output.log', File::WRONLY | File::APPEND)
logger = Logger.new(file, 'daily')
logger.level = Logger::DEBUG

# Set architect4r logger
Architect4r.logger = logger

Development

# Clone the repo and cd into it, then:
bundle install
bundle exec rake server:install
bundle exec rspec spec/

You can also use guard to run the specs continuously during development: bundle exec guard.

License

Architect4r is copyright (c) 2011 Maximilian Schulz. It is free software, and may be redistributed under the terms of the MIT License.

FAQs

Package last updated on 03 Mar 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc