SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Downloaden Sie, um offline zu lesen
Metadata and Access Control
Using Ruby on Rails and Neo4j
September 2015
Agenda
Demo
• Asset Portal UI
• The code
Overview
• Neo4j.rb
• The asset portal
■ Asset management
■ Access control
Neo4j.rb
● Consists primarily of the neo4j-core, neo4j gems
● neo4j-core allows you to query at a low level
○ Raw Cypher queries: query("MATCH n RETURN n")
○ Query class API: query.match(:n).return(:n)
● neo4j provides the ActiveNode and ActiveRel modules for object
modeling of nodes and relationships
Neo4j.rb
Won “Best Community Contribution”
at GraphConnect San Francisco 2014
Neo4j.rb - Querying
Cypher
MATCH (user:User)<-[:written_by]-(:Post)<-[:comments_on]-(c:Comment)-[:written_by]->(user2:User)
WHERE user.id = 123
RETURN user2.name, count(c)
neo4j-core gem: Query API
session.query
.match('(user:User)<-[:written_by]-(:Post)<-[:comments_on]-(c:Comment)-[:written_by]->(user2:User)')
.where(user: {id: 123})
.return('user2.name', 'count(c)')
Neo4j.rb - Querying
Cypher
MATCH (user:User)<-[:written_by]-(:Post)<-[:comments_on]-(c:Comment)-[:written_by]->(user2:User)
WHERE user.id = 123
RETURN user2.name, count(c)
neo4j gem: ActiveNode
user.find_by(id: 123)
user.posts.comments(:c).author(:u2).pluck('u2.name, count(c)')
Neo4j.rb - Querying
class Post
has_one :out, :author, type: :written_by, model_class: 'User'
has_many :in, :comments, type: :comments_on
end
class Comment
has_one :out, :author, type: :written_by, model_class: 'User'
end
class User
has_many :in, :posts, origin: :author
end
user.posts.comments(:c).author(:u2).pluck('u2.name, count(c)')
Many ways to get help
Active on StackOverflow
stackoverflow.com/questions/ask?tags=neo4j.rb+neo4j+ruby
Gitter chat room
gitter.im/neo4jrb/neo4j
Twitter
twitter.com/neo4jrb
The Asset Portal
We wanted to:
• Rewrite our existing GraphGist portal
• Create a learning resource for Neo4j and Ruby
• Make a Neo4j.rb screencast series
• Write articles: "Why You Should Use Neo4j in Your Next Ruby App"
• Host a webinar
• Make something useful
Quick aside: GraphGists
● Interactive Neo4j-backed documents for demonstrating graph use-
cases and solutions
Website:
graphgist.neo4j.com
GraphConnect Presentation:
From Zero to GraphGists
DEMO
GitHub:
github/neo4j-examples/asset_portal
Heroku demo:
asset-portal-demo.herokuapp.com
The Asset Portal
The Asset Portal - What’s Related and How
Assets are connected to Model
indirectly via the Asset’s label and
the Model’s name property
The Asset Portal - Creating Assets and Metadata
class Book < Asset
property :isbn13, type: String
property :author, type: String
property :publish_date, type: String
end
This automatically generates a user interface for managing books and
their properties.
The Asset Portal - Access Control
● Access can be given
○ directly: User to Asset
○ indirectly: via a Group
○ indirectly: via a series of
Subgroups
● CAN_ACCESS relationships
have a “level” property to
determine “read” vs ”write”
The Asset Portal - Access Control
This sort of access control is
useful and easy to understand,
but is much more difficult to
implement in other databases.
The Asset Portal - Access Control
● Access can be given to:
○ A category which gives
them access to all assets in
that category
○ A type of asset (in this case
Book) which gives access to
all assets of that type
○ A property on an asset
type (in this case
“total_sales” on books)
The Asset Portal - Challenges
● Can we make an asset portal which is easy for people to get going
but which allows them to customize as they like?
● Can we make a generic asset portal which also works as a GraphGist
portal?
● Can we make a GraphGist portal which other people can host?
● How can we make an asset / GraphGist portal which is generic and
useful for everybody but which we can style to the neo4j.com
website?
The Asset Portal
Built using:
● Ruby on Rails
● Neo4j.rb
● Semantic UI
● Ember.js
Best practices:
● RSpec
● Rubocop
● Slim
● Devise
● Paperclip
The Asset Portal - Idea: As a Rails Engine
Rails Application
Your app with custom code Asset Portal Engine
● Asset CRUD UI
● Asset administration
○ Access
○ Approval
The Asset Portal - Idea: GraphGist application
GraphGist Application
Hosts your own GraphGists locally Asset Portal Engine
● Asset CRUD UI
● Asset administration
○ Access
○ Approval
Demo
● Asset portal UI
○ Viewing and editing assets
○ Setting permissions on assets, properties, categories
● Code
○ Book model
○ Asset.authorized_for
○ Asset.authorized_properties_query
Outroduction
Brian Underwood
Developer Advocate for Neo4j
Web: www.brian-underwood.codes
E-Mail: public@brian-underwood.codes
Twitter: @cheerfulstoic
Metadata and Access Control
Using Ruby on Rails and Neo4j
End of Presentation

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (13)

The Holy Grail of continuous delivery in distributed teams environment
The Holy Grail of continuous delivery in distributed teams environmentThe Holy Grail of continuous delivery in distributed teams environment
The Holy Grail of continuous delivery in distributed teams environment
 
Modern APIs with GraphQL
Modern APIs with GraphQLModern APIs with GraphQL
Modern APIs with GraphQL
 
A complementary currency toolkit in Clojure - Aspasia Beneti - Codemotion Ams...
A complementary currency toolkit in Clojure - Aspasia Beneti - Codemotion Ams...A complementary currency toolkit in Clojure - Aspasia Beneti - Codemotion Ams...
A complementary currency toolkit in Clojure - Aspasia Beneti - Codemotion Ams...
 
Shaping serverless architecture with domain driven design patterns
Shaping serverless architecture with domain driven design patternsShaping serverless architecture with domain driven design patterns
Shaping serverless architecture with domain driven design patterns
 
JSON API Specificiation
JSON API SpecificiationJSON API Specificiation
JSON API Specificiation
 
Power of Elastic Search - nLocate
Power of Elastic Search - nLocatePower of Elastic Search - nLocate
Power of Elastic Search - nLocate
 
Drupal day Roma 2017 - Zaratan
Drupal day Roma 2017 - Zaratan Drupal day Roma 2017 - Zaratan
Drupal day Roma 2017 - Zaratan
 
[drupalday2017] - DevOps: strumenti di automazione per Drupal8
[drupalday2017] - DevOps: strumenti di automazione per Drupal8[drupalday2017] - DevOps: strumenti di automazione per Drupal8
[drupalday2017] - DevOps: strumenti di automazione per Drupal8
 
Careerdays dev ops
Careerdays   dev opsCareerdays   dev ops
Careerdays dev ops
 
Attain Clean Code in Sitecore Solutions using Design Patterns
Attain Clean Code in Sitecore Solutions using Design PatternsAttain Clean Code in Sitecore Solutions using Design Patterns
Attain Clean Code in Sitecore Solutions using Design Patterns
 
Tools for building your identity application
Tools for building your identity applicationTools for building your identity application
Tools for building your identity application
 
Jumbo the Hadoop cluster bootstrapper
Jumbo the Hadoop cluster bootstrapperJumbo the Hadoop cluster bootstrapper
Jumbo the Hadoop cluster bootstrapper
 
Front-end for Java developers Devoxx France 2018
Front-end for Java developers Devoxx France 2018Front-end for Java developers Devoxx France 2018
Front-end for Java developers Devoxx France 2018
 

Ähnlich wie Metadata and Access Control

Training Week: Build APIs with Neo4j GraphQL Library
Training Week: Build APIs with Neo4j GraphQL LibraryTraining Week: Build APIs with Neo4j GraphQL Library
Training Week: Build APIs with Neo4j GraphQL Library
Neo4j
 
Training Series: Build APIs with Neo4j GraphQL Library
Training Series: Build APIs with Neo4j GraphQL LibraryTraining Series: Build APIs with Neo4j GraphQL Library
Training Series: Build APIs with Neo4j GraphQL Library
Neo4j
 
Who needs containers in a serverless world
Who needs containers in a serverless worldWho needs containers in a serverless world
Who needs containers in a serverless world
Matthias Luebken
 
[Srijan Wednesday Webinar] Decoupled Demystified: The Present & Future of Dr...
 [Srijan Wednesday Webinar] Decoupled Demystified: The Present & Future of Dr... [Srijan Wednesday Webinar] Decoupled Demystified: The Present & Future of Dr...
[Srijan Wednesday Webinar] Decoupled Demystified: The Present & Future of Dr...
Srijan Technologies
 

Ähnlich wie Metadata and Access Control (20)

Getting started with Graph Databases & Neo4j
Getting started with Graph Databases & Neo4jGetting started with Graph Databases & Neo4j
Getting started with Graph Databases & Neo4j
 
Training Week: GraphQL 2022
Training Week: GraphQL 2022Training Week: GraphQL 2022
Training Week: GraphQL 2022
 
MongoDB Basics
MongoDB BasicsMongoDB Basics
MongoDB Basics
 
Training Week: Build APIs with Neo4j GraphQL Library
Training Week: Build APIs with Neo4j GraphQL LibraryTraining Week: Build APIs with Neo4j GraphQL Library
Training Week: Build APIs with Neo4j GraphQL Library
 
Training Series: Build APIs with Neo4j GraphQL Library
Training Series: Build APIs with Neo4j GraphQL LibraryTraining Series: Build APIs with Neo4j GraphQL Library
Training Series: Build APIs with Neo4j GraphQL Library
 
GraphQL - The new "Lingua Franca" for API-Development
GraphQL - The new "Lingua Franca" for API-DevelopmentGraphQL - The new "Lingua Franca" for API-Development
GraphQL - The new "Lingua Franca" for API-Development
 
GraphQL in an Age of REST
GraphQL in an Age of RESTGraphQL in an Age of REST
GraphQL in an Age of REST
 
Revealing ALLSTOCKER
Revealing ALLSTOCKERRevealing ALLSTOCKER
Revealing ALLSTOCKER
 
A general introduction to Spring Data / Neo4J
A general introduction to Spring Data / Neo4JA general introduction to Spring Data / Neo4J
A general introduction to Spring Data / Neo4J
 
Graphql usage
Graphql usageGraphql usage
Graphql usage
 
Who needs containers in a serverless world
Who needs containers in a serverless worldWho needs containers in a serverless world
Who needs containers in a serverless world
 
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...
 
Tutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHPTutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHP
 
Day 2 - Intro to Rails
Day 2 - Intro to RailsDay 2 - Intro to Rails
Day 2 - Intro to Rails
 
Visual, scalable, and manageable data loading to and from Neo4j with Apache Hop
Visual, scalable, and manageable data loading to and from Neo4j with Apache Hop Visual, scalable, and manageable data loading to and from Neo4j with Apache Hop
Visual, scalable, and manageable data loading to and from Neo4j with Apache Hop
 
Building a GraphQL API in PHP
Building a GraphQL API in PHPBuilding a GraphQL API in PHP
Building a GraphQL API in PHP
 
web2py:Web development like a boss
web2py:Web development like a bossweb2py:Web development like a boss
web2py:Web development like a boss
 
[Srijan Wednesday Webinar] Decoupled Demystified: The Present & Future of Dr...
 [Srijan Wednesday Webinar] Decoupled Demystified: The Present & Future of Dr... [Srijan Wednesday Webinar] Decoupled Demystified: The Present & Future of Dr...
[Srijan Wednesday Webinar] Decoupled Demystified: The Present & Future of Dr...
 
Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
 Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ... Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
 
Design Summit - Technology Vision - Oleg Barenboim and Jason Frey
Design Summit - Technology Vision - Oleg Barenboim and Jason FreyDesign Summit - Technology Vision - Oleg Barenboim and Jason Frey
Design Summit - Technology Vision - Oleg Barenboim and Jason Frey
 

Mehr von Neo4j

Mehr von Neo4j (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansQIAGEN: Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...
 
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafos
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafosBBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafos
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafos
 
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdf
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdfNeo4j_Exploring the Impact of Graph Technology on Financial Services.pdf
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdf
 
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdf
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdfRabobank_Exploring the Impact of Graph Technology on Financial Services.pdf
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdf
 
Webinar - IA generativa e grafi Neo4j: RAG time!
Webinar - IA generativa e grafi Neo4j: RAG time!Webinar - IA generativa e grafi Neo4j: RAG time!
Webinar - IA generativa e grafi Neo4j: RAG time!
 
IA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeIA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG time
 
Neo4j: Data Engineering for RAG (retrieval augmented generation)
Neo4j: Data Engineering for RAG (retrieval augmented generation)Neo4j: Data Engineering for RAG (retrieval augmented generation)
Neo4j: Data Engineering for RAG (retrieval augmented generation)
 
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdf
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdfNeo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdf
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdf
 
Enabling GenAI Breakthroughs with Knowledge Graphs
Enabling GenAI Breakthroughs with Knowledge GraphsEnabling GenAI Breakthroughs with Knowledge Graphs
Enabling GenAI Breakthroughs with Knowledge Graphs
 
Neo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdf
Neo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdfNeo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdf
Neo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdf
 
Neo4j Jesus Barrasa The Art of the Possible with Graph
Neo4j Jesus Barrasa The Art of the Possible with GraphNeo4j Jesus Barrasa The Art of the Possible with Graph
Neo4j Jesus Barrasa The Art of the Possible with Graph
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Metadata and Access Control

  • 1. Metadata and Access Control Using Ruby on Rails and Neo4j September 2015
  • 2. Agenda Demo • Asset Portal UI • The code Overview • Neo4j.rb • The asset portal ■ Asset management ■ Access control
  • 3. Neo4j.rb ● Consists primarily of the neo4j-core, neo4j gems ● neo4j-core allows you to query at a low level ○ Raw Cypher queries: query("MATCH n RETURN n") ○ Query class API: query.match(:n).return(:n) ● neo4j provides the ActiveNode and ActiveRel modules for object modeling of nodes and relationships
  • 4. Neo4j.rb Won “Best Community Contribution” at GraphConnect San Francisco 2014
  • 5. Neo4j.rb - Querying Cypher MATCH (user:User)<-[:written_by]-(:Post)<-[:comments_on]-(c:Comment)-[:written_by]->(user2:User) WHERE user.id = 123 RETURN user2.name, count(c) neo4j-core gem: Query API session.query .match('(user:User)<-[:written_by]-(:Post)<-[:comments_on]-(c:Comment)-[:written_by]->(user2:User)') .where(user: {id: 123}) .return('user2.name', 'count(c)')
  • 6. Neo4j.rb - Querying Cypher MATCH (user:User)<-[:written_by]-(:Post)<-[:comments_on]-(c:Comment)-[:written_by]->(user2:User) WHERE user.id = 123 RETURN user2.name, count(c) neo4j gem: ActiveNode user.find_by(id: 123) user.posts.comments(:c).author(:u2).pluck('u2.name, count(c)')
  • 7. Neo4j.rb - Querying class Post has_one :out, :author, type: :written_by, model_class: 'User' has_many :in, :comments, type: :comments_on end class Comment has_one :out, :author, type: :written_by, model_class: 'User' end class User has_many :in, :posts, origin: :author end user.posts.comments(:c).author(:u2).pluck('u2.name, count(c)')
  • 8. Many ways to get help Active on StackOverflow stackoverflow.com/questions/ask?tags=neo4j.rb+neo4j+ruby Gitter chat room gitter.im/neo4jrb/neo4j Twitter twitter.com/neo4jrb
  • 9. The Asset Portal We wanted to: • Rewrite our existing GraphGist portal • Create a learning resource for Neo4j and Ruby • Make a Neo4j.rb screencast series • Write articles: "Why You Should Use Neo4j in Your Next Ruby App" • Host a webinar • Make something useful
  • 10. Quick aside: GraphGists ● Interactive Neo4j-backed documents for demonstrating graph use- cases and solutions Website: graphgist.neo4j.com GraphConnect Presentation: From Zero to GraphGists DEMO
  • 12. The Asset Portal - What’s Related and How Assets are connected to Model indirectly via the Asset’s label and the Model’s name property
  • 13. The Asset Portal - Creating Assets and Metadata class Book < Asset property :isbn13, type: String property :author, type: String property :publish_date, type: String end This automatically generates a user interface for managing books and their properties.
  • 14. The Asset Portal - Access Control ● Access can be given ○ directly: User to Asset ○ indirectly: via a Group ○ indirectly: via a series of Subgroups ● CAN_ACCESS relationships have a “level” property to determine “read” vs ”write”
  • 15. The Asset Portal - Access Control This sort of access control is useful and easy to understand, but is much more difficult to implement in other databases.
  • 16. The Asset Portal - Access Control ● Access can be given to: ○ A category which gives them access to all assets in that category ○ A type of asset (in this case Book) which gives access to all assets of that type ○ A property on an asset type (in this case “total_sales” on books)
  • 17. The Asset Portal - Challenges ● Can we make an asset portal which is easy for people to get going but which allows them to customize as they like? ● Can we make a generic asset portal which also works as a GraphGist portal? ● Can we make a GraphGist portal which other people can host? ● How can we make an asset / GraphGist portal which is generic and useful for everybody but which we can style to the neo4j.com website?
  • 18. The Asset Portal Built using: ● Ruby on Rails ● Neo4j.rb ● Semantic UI ● Ember.js Best practices: ● RSpec ● Rubocop ● Slim ● Devise ● Paperclip
  • 19. The Asset Portal - Idea: As a Rails Engine Rails Application Your app with custom code Asset Portal Engine ● Asset CRUD UI ● Asset administration ○ Access ○ Approval
  • 20. The Asset Portal - Idea: GraphGist application GraphGist Application Hosts your own GraphGists locally Asset Portal Engine ● Asset CRUD UI ● Asset administration ○ Access ○ Approval
  • 21. Demo ● Asset portal UI ○ Viewing and editing assets ○ Setting permissions on assets, properties, categories ● Code ○ Book model ○ Asset.authorized_for ○ Asset.authorized_properties_query
  • 22. Outroduction Brian Underwood Developer Advocate for Neo4j Web: www.brian-underwood.codes E-Mail: public@brian-underwood.codes Twitter: @cheerfulstoic
  • 23. Metadata and Access Control Using Ruby on Rails and Neo4j End of Presentation