Tag: neo4j

Rails Neo4j如何在现有数据库中添加新字段

class Invitation include Neo4j::ActiveNode property :email end 这是Neo node Invitation节点我可以在图形数据库中看到它。 – 如果我在其中添加一些新字段,对于现有节点,它将不会反映在图形数据库中 – 如果我创建一个新节点,我可以在图形数据库中看到它 所以问题是我是否必须添加一个字段 property :valid, type: Boolean, default: true 我如何添加这个以便我可以在图数据库中的现有节点中看到它,就像我们在活动记录迁移中一样 我在Node中添加了字段 property :vish, type: Boolean, default: true 所以当查询 Invitation.where(vish: true).count ==>结果0 如果我添加新节点Invitation.create(email:’urvishh@gmail.com’) 然后运行查询 Invitation.where(vish: true).count ==>结果1 这是我得到的确切问题

Neo4j gem – 采集多个节点/关系

这可能是不可能的,因为它现在,但我有这样的查询 events = Event.as(:e).where(“(( e.date_start – {current_time} )/{one_day_p}) < 1 ").users(:u, :rel).where("rel.reminded = {reminded_p}" ).params(reminded_p: false, one_day_p: one_day, current_time: time).pluck(:e,:u, :rel) 目标是获取start_date少于一天的events 。 假设我试图采取事件,用户和关系。 我需要对每个人采取不同的行动。 我需要为每个event获取所有users并为每个用户执行电子邮件操作。 在该操作中,电子邮件需要能够访问该event 。 接下来,我需要将rel.reminded属性更新为true 。 有没有办法同时采取所有这些能够组织和执行这些任务? 我开始单独做这个,但我必须进行额外的查询才能实现。 例如 events = Event.as(:e).where(“(( e.date_start – {current_time} )/{one_day_p}) < 1 ").users(:u, :rel).where("rel.reminded = {reminded_p}" ).params(reminded_p: false, one_day_p: one_day, current_time: time).pluck(:e) 然后我必须 events.each do […]

neo4j自动索引REST服务器

我试图使用自动索引与neo4j REST服务器(社区 – 1.4.M04)。 这是在Rails项目中,所以即时使用neography包装器。 我无法在线找到合并的教程,我可以从多个博客中找到,这就是我所做的: 在conf / neo4j.properties中: node_keys_indexable=title,bucket_type node_auto_indexing=true relationship_auto_indexing=true 之后,使用rails控制台: neo = Neography::Rest.new neo.create_node_index(“node_auto_index”, “fulltext”, “lucene”) 我可以在webadmin中查看索引,但查询数据: localhost:7474/db/data/index/node/node_auto_index/name/test_name 不会返回任何数据。 任何帮助将非常感激。

Neo4Jgem – 拯救未申报的关系

我正在尝试在两个节点之间创建一个实现,如下所述https://github.com/neo4jrb/neo4j/wiki/Neo4j-v3-Declared-Relationships from_node.create_rel(“FRIENDS”, to_node) 我得到一个未定义的create_rel方法 我究竟做错了什么? 我正在尝试在另一个模型中创建一个Q + A系统。 因此,问题和答案现在都被视为模型。 我正在为#获取一个undefined method create_rel’ event.rb has_many :out, :event_questions event_question.rb has_one :in, :events has_many :out, :event_answers def create_questions_of(from_node,to_node) from_node.create_rel(“questions_of”, to_node) end event_answer.rb has_one :in, :event_questions event_questions_controller.rb def new #is this needed end def create @event_question = EventQuestion.new(event_question_params) if @event_question.save @event = Event.find(params[:id]) @event_question.update(admin: current_user.facebook_id) @event_question.create_questions_of(self,@event) redirect_to @event else […]

Neo4j gem – 处理管理关系的首选方法

这主要是一个设计/效率问题,但我想看看是否有一种首选方法来处理neo4j,而不是我在sql db中如何处理它。 现在我有2个模型 – user和event 。 我还有user和event之间的关系来表示他们将参加活动。 我想找出代表活动管理员的最佳方式。 换句话说,我希望能够查询用户所关注的事件。 一种方法是在用户和event之间创建一个名为admin_of的新关系。 另一种方法是创建参与关系的管理属性。 admin: true admin_of查询看起来很简单,但又增加了与db的关系。 它也可以在以后处理多个管理员。 后一种方式可以通过类似的东西来查询:(来自文档) EnrolledIn.where(since: 2002)所以我的搜索将包括admin: true 。 但是我不知道如何链接这个,因为我希望它只是朋友活动。 另一个查询通常基于节点而不是关系的属性。 后一种方法似乎是一种首选的方法,但查询它的正确方法是什么? 或者是第一种更简单的方法,即使它增加了额外的关系? 更新:我想出了类似的东西 result = Event.query_as(:event).match(“event<-[invite: INVITED]-(user: User)<-[:FRIENDS_WITH]-(user)").where(invite: {admin: /true/}).pluck(:event) 基于详细的查询 https://github.com/neo4jrb/neo4j/wiki/Search-and-Match 更新2 我现在有这个,但没有得到匹配。 什么是开始解决我的查询错误的最佳方法? current_user.friends.events.query_as(:event).match(“event<-[invite]-(user: User)<-[friends_with]-(user)").where(invite: {admin: true}, event: {detail: 'property'}).pluck(:event) 我的用户模型有 has_many :both, :events, model_class: ‘Event’, rel_class: ‘Invite’ 我的活动模型有 has_many :both, […]

Neo4j.rb中的方法“rel_length”不起作用。

我需要得到用户的“朋友的朋友”。 所以, friend(rel_length: 2)不起作用(忽略方法),返回朋友。 class User include Neo4j::ActiveNode … has_many :out, :friend, rel_class: Friend … end class Friend include Neo4j::ActiveRel from_class User to_class User type ‘friend’ property :activity, type: String property :relation, type: String property :token, type: String end

无法使用Neo4j db启动rails服务器,响应coed 401而不是200

有任何线索如何解决这个问题? rails s -d => Booting WEBrick => Rails 4.2.1 application starting in development on http://localhost:3000 => Run `rails server -h` for more startup options /Users/levi/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/neo4j-core-4.0.5/lib/neo4j-server/resource.rb:33:in `handle_response_error’: Expected response code 200 Error for request http://localhost:7474/db/data/, 401, 401 (Neo4j::Server::Resource::ServerException) from /Users/levi/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/neo4j-core-4.0.5/lib/neo4j-server/resource.rb:37:in `expect_response_code’

如何使用dBpedia在ruby-on-rails应用程序上设置neo4j?

我试图使用dBpedia与neo4j ruby on rails的ruby on rails ontop。 假设我已经安装了neo4j并下载了一个dBpedia数据集 。 如何将dbpedia数据集导入neo4j ?

Rails 3和图形数据库

在Postgresql上运行的Rails 3应用程序需要切换到图形数据库才能够成长。 其中有很多,它们都提供不同类型的API,主要是REST。 NeoTechnologies首席执行官Emil Eifrem谈到了Neo4j可以实现的目标,我深受启发。 我必须承认,我玩过它,这件事绝对是我们需要的,但有几个障碍。 REST API不是事务性的。 Rails 3应用程序在ruby 1.9.2上运行,但不是jRuby 1.5.3或1.6以实现本机API。 有些数据库也是由Java驱动并提供REST API,所以不要改变它们。 由于许可证或成本或缺乏团队支持,我们不能选择其他选项。 我认为我错过了一些东西,所以我会很感激任何关于我们的选择以及什么对我们有益的提示,见解或建议。 谢谢。

如何从现有的Rails 4应用程序中删除ActiveRecord?

我开始使用Ruby on Rails项目,其中包括一个带有ActiveRecord和Neography的简单推荐系统。 现在我发现了neo4j.rb ,它将大大简化我的生活。 🙂 我现在才知道,我可以创建一个没有ActiveRecord的新应用程序,如下所示: rails new xyz -O 我可以这样做,并将我的大部分文件/代码粘贴到该新项目中。 或者有更简单的方法吗? 我还在考虑是否有必要采取这一步骤。 是否可以并行使用neo4j.rb和ActiveRecord? 我正在考虑使用ActiveRecord和我在neo4j中的推荐系统运行身份validation系统(例如Devise)。 有没有人有这种方法的经验?