Search This Blog

Showing posts with label nosql. Show all posts
Showing posts with label nosql. Show all posts

Monday, 3 February 2020

Neo4j - create multiple nodes and connect with graph

In the last post I worked on creating a single node using cypher. There are other things that can be achieved using cypher when it comes to creation.
Consider that I want to add a Movie and its lead actors to the database.

Neo4j - Create a node with Cypher

I decided to use Cypher to create a simple record. Here I tried to create a Movie instance

Saturday, 5 May 2018

Neo4j - extracting some schema information using Cypher queries

Since schema is not a compulsion with Neo4j, I was looking at ways to get information on the type of nodes and relationships in the database.
These below are not my own queries. I came across a good link and decided to use it here.
The below java code when executed against a database collect information on the type of nodes, relations and combinations seen in the database.

Neo4j - Extracting relationship properties

Neo4j relations can also have their own properties. In the sample movie database, the ACTED_IN relationship has a roles property, which can take multiple values (An actor may play multiple roles in a Movie).
Here I take a look at accessing these values from Java.

Neo4j - Identifying a Nodes Label and a Relations Type

I wanted to find out which all person nodes are associated to a given Movie and in what roles. Consider that my Movie database has several relations -
Person acted in a movie
Person directed a movie
Person reviewed a movie
Person followed a movie ......... and many more.

Monday, 27 March 2017

Neo4j - Traversing along the directions of a Relation

Neo4j Relationships are what connect any two nodes in the graph.  To copy paste from the Neo4j guide:
Relationships organize nodes into arbitrary structures, allowing a graph to resemble a list, a tree, a map, or a compound entity — any of which can be combined into yet more complex, richly inter-connected structures.

Friday, 3 June 2016

Neo4j - Retrieve records via Cypher

I had the chance to do a project in big data using Graph databases. Then we had used Neo4j and managed to learn quite some stuff - through hack techniques. Nevertheless our short stint with Graph databases was quite enjoyable and I decided to explore Neo4j once more.

Tuesday, 29 December 2015

Neo4j - Select with parameters

In the previous post we worked on executing a simple select query - one that selected all the Person records in our database. In this post  I decided to work on parameterized retrieval. I decided to
execute the below query:
MATCH (a:Person{name: "Keanu Reeves"})-[:ACTED_IN]->(m:Movie) RETURN a,m
Only instead of hardcoding 'Keanu Reeves', I would like my method to work for different actors.

Wednesday, 11 February 2015

Indexes and MongoDB

I have never given too  much thought to database indexing. Its a concept that works silently in the background of database tables and views. Most databases provide indexes by default for the primary key and unique keys.

Friday, 19 September 2014

DBCursor - size,length and count

Consider the below method:
public static String DB_NAME = "fruits";
   public static String COLLECTION_NAME = "fruits";

Wednesday, 27 August 2014

More querying in MongoDB

In the last post we started running queries on MongoDB. To continue on the operators, I decided to do a find on the auto generated id:

Sunday, 10 August 2014

Using query language with MongoDB

In the previous posts we have seen how to insert and read data from the MongoDB client and from the Java API. Now to fetch documents by executing queries on the collection.

Monday, 16 June 2014

Read-Write to MongoDB via java

In the last post I used the java driver to connect to the MongoDB. Now to read the documents from the collection:

UD - The Update and Delete in CRUD

We have already seen Create and Read operations with MongoDB. We were able to create collections in the database and add documents to them. Now to try updating and deletion of documents.

Sunday, 15 June 2014

Talking to MongoDB via java

In our last post we got started on creating a database and adding docs to a collection. Being a java guy, I wanted to try and use the database connectivity driver provided by MongoDB for use with java applications.

Thursday, 29 May 2014

Talking to MongoDB

In our previous post we saw how to set up MongoDB for running. The application we started was the MongoDB server. It is not a client. To perform any operations, what we need is a way to connect to the server. For this I decided to initially use the mongo shell:

Wednesday, 21 May 2014

Baby steps at understanding MongoDB

I have never ventured outside the world of relational databases. So when an opportunity to peak into Big Data arrived, I couldn't let the opportunity go. I decided to start with a no sql database first.
After careful thought and deep analysis over a long long period of  5 minutes, I settled on MongoDB. (ovation please !!)