question stringlengths 11 28.2k | answer stringlengths 26 27.7k | tag stringclasses 130
values | question_id int64 935 78.4M | score int64 10 5.49k |
|---|---|---|---|---|
I am new to Cassandra. I am reading about the num_tokens parameter for virtual nodes in the cassandra.yml file. I don't think I quite understand what this is doing or how tokens/partitions are assigned. What is really going on here?
The default value of 256 does not make any sense if we are really talking about number... | 4) Partition ranges are determined by granting each node the range from their available tokens up until the next specified token.
2)Data is exchanged through gossip detailing which nodes have which tokens. This meta-data allows every node to know which nodes are responsible for which ranges. Keyspace/Replication settin... | Cassandra | 19,995,342 | 12 |
I am trying to set up a completely basic Titan Rexster Cassandra instance, but I can't seem to break the code. I have tried a whole lot of things now to get it to work but I just can't seem to get it to work. No matter how much I read about it I am not able to set it up properly.
What I want is a Titan-rexster-cassandr... | As a first note, embeddedcassandra is no longer what you want in Titan 0.4.0. You can read more about that here. In the Titan Server distribution for 0.4.0 cassandra and rexster run in separate JVMs and should generally run out-of-the-box from the distribution.
Also note, that I would say it is recommended to creat... | Cassandra | 19,712,610 | 12 |
As there are two ways to support wide rows in CQL3..One is to use composite keys and another is to use collections like Map, List and Set. The composite keys method can have millions of columns (transposed to rows).. This is solving some of our use cases.
However, if we use collections, I want to know if there is a l... | It is strongly recommended to store only a limited amount of data in collections & maps.
The reasons:
Collections and maps are fetched as a whole, entirely. You can not
"slice" on collections so putting lots of data in collections/maps
will have impact on perf when reading them
The CQL3 implementation of Lists is not ... | Cassandra | 18,573,507 | 12 |
I am using datastax as a client for connecting to cassandra. I have successfully connected to cassandra cluster/keyspace/column families through Java. I am trying, firing some queries on cassandra column family thriugh java. For me it is working for simple queries like
ResultSet results = session.execute("select * from... | Here is a code example of inserting data about an image using a prepared statements.
PreparedStatement statement = getSession().prepare(
"INSERT INTO pixelstore.image " +
"(image_name, " +
" upload_time, " +
... | Cassandra | 17,419,142 | 12 |
What is the command to update a column family and alter its gc_grace_seconds value using cassandra-cli?
| For CQLSH
alter table <table_name> with GC_GRACE_SECONDS = <timeout>;
e.g:
alter table yawn with GC_GRACE_SECONDS = 3600;
where yawn is our table name and 3600 is an hour;
| Cassandra | 15,526,379 | 12 |
What is the maximum number of keyspaces allowed in a Cassandra cluster? The wiki page on limitations doesn't mention one. Is there such a limit?
| A keyspace is basically just a Map entry to Cassandra... you can have as many as you have memory for. Millions, easily.
ColumnFamilies are more expensive, since Cassandra will reserve a minimum of 1MB for each CF's memtable: http://www.datastax.com/dev/blog/whats-new-in-cassandra-1-0-performance
| Cassandra | 11,256,881 | 12 |
In the below cassandra, "get result"..we can able to retrieve the column name and values. But how to retrieve the timestamp..Is there any better idea to get the values by using timestamp
[default@sample]get user[bob];
=> (column=name, value=bobdroid, timestamp=1335361733545850)
=... | Just ran across this thread, and found that the answer is out of date. CQL now exposes the internal timestamps using the writetime() function:
select key,columnfoo,writetime(columnfoo) from tablebar;
| Cassandra | 10,346,839 | 12 |
I'm planning a side project where I will be dealing with Time Series like data and would like to give one of those shiny new NoSQL DBs a try and am looking for a recommendation.
For a (growing) set of symbols I will have a list of (time,value) tuples (increasing over time).
Not all symbols will be updated; some symbols... | I believe literally all the major NoSQL databases will support that requirement, especially if you don't actually have a large volume of data (which begs the question, why NoSQL?).
That said, I've had to recently design and work with a NoSQL database for time series data so can give some input on that design, which can... | Cassandra | 10,157,931 | 12 |
I'm studying the Apache Cassandra version 0.7.6 with Java and Hector, and I tried to create a cluster, a keyspace and insert a column in this keyspace created.
By looking examples I understood that keyspace is equivalent to the database in SQL databases, and the Column Family's is equivalent with the tables. Knowing t... | The createKeyspace() call in HFactory is meant for creating a hector Keyspace object for local use, but it does not actually create a keyspace in Cassandra. For that you want to use the 'addKeyspace()' and 'addColumnFamily' methods on the actual cluster object.
https://github.com/rantav/hector/blob/master/core/src/main... | Cassandra | 9,168,538 | 12 |
I'm trying to do some research to find the best option for sessions management in a multi-server environment and was wondering what people have found successful and why. Pros and cons.
RDBMS - Slower. Better used for other data.
Memcached - You can't take down a memcached server without losing sessions
Redis - Fixes t... | Personally, I use Cassandra to persist php session data. It stores it in a single column on a single row with session_id:{session_data_as_json} and I set the TTL on the column so that it does garbage cleanup automatically. Works a treat.
I went with cassandra as it has all other user data already ... For caching, I... | Cassandra | 8,570,659 | 12 |
I am looking for if cassandra has limitations of node hardware spec like what could be the max storage per node if there is any such limitation.
I intend to use couple of nodes with 48TB storage (2TB X 24 hard drives 7200rpm) per node with some good dual xeon processor.
I have looked up for such limitations if exists a... | Cassandra distributes its data by row, so the only hard limitation is that a row must be able to fit on a single node.
So the short answer is no.
The longer answer is that you'll want to make sure that you're setting up a separate storage area for your permanent data and your commit logs.
One other thing to keep in min... | Cassandra | 7,190,573 | 12 |
I have used Relational DB's a lot and decided to venture out on other types available.
This particular product looks good and promising: http://neo4j.org/
Has anyone used graph-based databases? What are the pros and cons from a usability prespective?
Have you used these in a production environment? What was the require... | I used a graph database in a previous job. We weren't using neo4j, it was an in-house thing built on top of Berkeley DB, but it was similar. It was used in production (it still is).
The reason we used a graph database was that the data being stored by the system and the operations the system was doing with the data wer... | Neo4j | 1,000,162 | 136 |
I'm starting to develop with Neo4j using the REST API.
I saw that there are two options for performing complex queries - Cypher (Neo4j's query language) and Gremlin (the general purpose graph query/traversal language).
Here's what I want to know - is there any query or operation that can be done by using Gremlin and ca... | For general querying, Cypher is enough and is probably faster. The advantage of Gremlin over Cypher is when you get into high level traversing. In Gremlin, you can better define the exact traversal pattern (or your own algorithms) whereas in Cypher the engine tries to find the best traversing solution itself.
I person... | Neo4j | 13,824,962 | 130 |
We can delete all nodes and relationships by following query.
MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r
But newly created node get internal id as ({last node internal id} + 1) . It doesn't reset to zero.
How can we reset neo4j database such as newly created node will get id as 0?
From 2.3, we can delete all nodes... | Shut down your Neo4j server, do a rm -rf data/graph.db and start up the server again. This procedure completely wipes your data, so handle with care.
| Neo4j | 23,310,114 | 118 |
I am using neo4j for one of my project, there's a node which only has a single property as name, I want to get that node using ID, it already has a ID but when I use this code
MATCH (s:SKILLS{ID:65110}) return s
It returns nothing, heres my node
If the query is wrong then how do I query it using the number
| MATCH (s)
WHERE ID(s) = 65110
RETURN s
The ID function gets you the id of a node or relationship. This is different from any property called id or ID that you create.
| Neo4j | 22,369,520 | 111 |
I'm trying to create a query using cypher that will "Find" missing ingredients that a chef might have, My graph is set up like so:
(ingredient_value)-[:is_part_of]->(ingredient)
(ingredient) would have a key/value of name="dye colors". (ingredient_value) could have a key/value of value="red" and "is part of" the (ing... | Update 01/10/2013:
Came across this in the Neo4j 2.0 reference:
Try not to use optional relationships.
Above all,
don’t use them like this:
MATCH a-[r?:LOVES]->() WHERE r IS NULL where you just make sure that they don’t exist.
Instead do this like so:
MATCH (a) WHERE NOT (a)-[:LOVES]->()
Using cypher for checking if ... | Neo4j | 10,952,332 | 110 |
Is it possible to create/delete different databases in the graph database Neo4j like in MySQL? Or, at least, how to delete all nodes and relationships of an existing graph to get a clean setup for tests, e.g., using shell commands similar to rmrel or rm?
| You can just remove the entire graph directory with rm -rf, because Neo4j is not storing anything outside that:
rm -rf data/*
Also, you can of course iterate through all nodes and delete their relationships and the nodes themselves, but that might be too costly just for testing ...
| Neo4j | 4,498,523 | 109 |
I know this question is asked by many people already
for my research, here's some questions asked before
How to delete all relationships in neo4j graph?
https://groups.google.com/forum/#!topic/neo4j/lgIaESPgUgE
But after all, still can't solve our problems,
we just want to delete "ALL" nodes and "ALL" relationships
... | As of 2.3.0 and up to 3.3.0
MATCH (n)
DETACH DELETE n
Docs
Pre 2.3.0
MATCH (n)
OPTIONAL MATCH (n)-[r]-()
DELETE n,r
Docs
| Neo4j | 14,252,591 | 102 |
I can't find how to return a node labels with Cypher.
Anybody knows the syntax for this operation?
| To get all distinct node labels:
MATCH (n) RETURN distinct labels(n)
To get the node count for each label:
MATCH (n) RETURN distinct labels(n), count(*)
| Neo4j | 18,398,576 | 82 |
I know that there are similar questions around on Stackoverflow but I don't feel they answer the following.
Graph Databases to my understanding store data following mostly this schema:
Table/Collection 1: store nodes with UID
Table/Collection 2: store relations referencing nodes via UID
This allows storing arbitrary t... | The main difference between graph databases and triple stores is how they model the graph. In a triple store (or quad store), the data tends to be very atomic. What I mean is that the "nodes" in the graph tend to be primitive data types like string, integer, date, etc. Relationships link primitives together, and so ... | Neo4j | 30,166,007 | 81 |
Currently ulimit -n shows 10000. I want to increase it to 40000. I've edited "/etc/sysctl.conf" and put fs.file-max=40000. I've also edited /etc/security/limits.conf and updated hard and soft values. But still ulimit shows 10000. After making all these changes I rebooted my laptop. I've access to root password.
usr_nam... | What you are doing will not work for root user. Maybe you are running your services as root and hence you don't get to see the change.
To increase the ulimit for root user you should replace the * by root. * does not apply for root user. Rest is the same as you did. I will re-quote it here.
Add the following lines to t... | Neo4j | 21,515,463 | 79 |
I would like to do a search, and I would like to start traversing from 2 labels (OR condition). For example, I need to find out all the nodes which have labels either 'Male' or 'Female' and whose property, name =~ '.ail.'.
| You can put this condition in the WHERE clause:
MATCH (n)
WHERE n:Male OR n:Female
RETURN n
EDIT
As @tbaum points out this performs an AllNodesScan. I wrote the answer when labels were fairly new and expected the query planner to eventually implement it with a NodeByLabelScan for each label, as it does for the single ... | Neo4j | 20,003,769 | 66 |
It appears that LIKE is not supported in Cypher queries.
Is there any other construct that would perform the same task?
For instance:
start n = node(*) where n.Name LIKE('%SUBSTRING%') return n.Name, n;
| using regular expressions:
http://neo4j.com/docs/developer-manual/current/#query-where-regex
start n = node(*) where n.Name =~ '.*SUBSTRING.*' return n.Name, n;
| Neo4j | 13,828,953 | 66 |
How can I add a label to an existing node using a Cypher query?
| That's in the reference docs, see http://docs.neo4j.org/chunked/stable/query-set.html#set-set-a-label-on-a-node, you need to use set to a add a label to a existing node:
match (n {id:desired-id})
set n :newLabel
return n
| Neo4j | 21,625,081 | 58 |
I'm new to Neo4j - just started playing with it yesterday evening.
I've notice all nodes are identified by an auto-incremented integer that is generated during node creation - is this always the case?
My dataset has natural string keys so I'd like to avoid having to map between the Neo4j assigned ids and my own. Is it ... | Think of the node-id as an implementation detail (like the rowid of relational databases, can be used to identify nodes but should not be relied on to be never reused).
You would add your natural keys as properties to the node and then index your nodes with the natural key (or enable auto-indexing for them).
E..g in th... | Neo4j | 9,051,442 | 56 |
Any rule of thumb on where to use label vs node property vs relationship + node.
Let's have an example, say I have a store and I want to put my products in neo4j. Their identifier is the product sku, and I also want to have a categorization on them like this one is for clothes, food, electronics, and you get the idea.... | Whether you should use a property, a label or a node for the category depends on how you will be querying the data.
(I'll assume here that you have a fairly small, fairly fixed set of categories.)
Use a property if you won't be querying by category, but just need to return the category of a node that has been found by ... | Neo4j | 22,340,475 | 55 |
I will make an application with a lot of similar items (millions), and I would like to store them in a MySQL database, because I would like to do a lot of statistics and search on specific values for specific columns.
But at the same time, I will store relations between all the items, that are related in many connected... | Few thoughts on this:
I would try modelling your Neo4j domain model to include the attributes of each node in the graph. By separating your data into two different data stores you might limit some operations that you might want to do.
I guess it comes down to what you will be doing with your graph. If, for example, you... | Neo4j | 2,541,891 | 54 |
I'm trying out Neo4j for the first time. I'm using the 2.0-RC1 community edition.
I've created some nodes:
MERGE (u:User{username:'admin',password:'admin'})
MERGE (r1:Role{name:'ROLE_ADMIN'})
MERGE (r2:Role{name:'ROLE_WEB_USER'})
MERGE (r3:Role{name:'ROLE_REST_USER'})
and now I want to add relationships between the no... | In Neo4j 2.0 you can create schema indexes for your labels and the properties you use for lookup:
CREATE INDEX ON :User(username)
CREATE INDEX ON :Role(name)
To create relationships you might use:
MATCH (u:User {username:'admin'}), (r:Role {name:'ROLE_WEB_USER'})
CREATE (u)-[:HAS_ROLE]->(r)
The MATCH will use an inde... | Neo4j | 20,456,002 | 52 |
Using Cypher how can I get all nodes in a graph? I am running some testing against the graph and I have some nodes without relationships so am having trouble crafting a query.
The reason I want to get them all is that I want to delete all the nodes in the graph at the start of every test.
| So, this gives you all nodes:
MATCH (n)
RETURN n;
If you want to delete everything from a graph, you can do something like this:
MATCH (n)
OPTIONAL MATCH (n)-[r]-()
DELETE n, r;
Updated for 2.0+
Edit:
Now in 2.3 they have DETACH DELETE, so you can do something like:
MATCH (n)
DETACH DELETE n;
| Neo4j | 12,903,873 | 52 |
What is the difference between graph-based databases (http://neo4j.org/) and object-oriented databases (http://www.db4o.com/)?
| I'd answer this differently: object and graph databases operate on two different levels of abstraction.
An object database's main data elements are objects, the way we know them from an object-oriented programming language.
A graph database's main data elements are nodes and edges.
An object database does not have the... | Neo4j | 2,218,118 | 52 |
I'm looking for something similar to the MySQL ( SHOW INDEXES ). I was able to get a list of indexes using py2neo in Python
graphDB = neo4j.GraphDatabaseService()
indexes = graphDB.get_indexes(neo4j.Node)
print(format(indexes))
but I wanted to know if there's a way to do something similar in Cypher.
| neo4j 3.1 now supports this as a built-in procedure that you can CALL from Cypher:
CALL db.indexes();
http://neo4j.com/docs/operations-manual/3.1/reference/procedures/
| Neo4j | 19,801,599 | 51 |
I am currently on design phase of a MMO browser game, game will include tilemaps for some real time locations (so tile data for each cell) and a general world map. Game engine I prefer uses MongoDB for persistent data world.
I will also implement a shipping simulation (which I will explain more below) which is basicall... | Disclaimer: I am the author and owner of OrientDB.
As developer, in general, I don't like companies that hide costs and let you play with their technology for a while and as soon as you're tight with it, start asking for money. Actually once you invested months to develop your application that use a non standard langua... | Neo4j | 26,704,134 | 49 |
How do you create multiple databases on one server using neo4j?
I have multiple clients, and I want to separate all client information into different database to avoid data leaks.
| You need to have multiple Neo4j installations with a different port configurations in conf/neo4j.properties and conf/neo4j-server.properties.
Alternatively you might use some virtualization or container tool like http//docker.io for a more sophisticated approach.
| Neo4j | 25,659,378 | 49 |
How can I show all nodes and relationships in Data Browser tab?
What are sample index queries that I can type in in search field?
| You may also want to try a cypher query such as:
START n=node(*) RETURN n;
It's very obvious, and it will return all the existing nodes in the database.
EDIT : the following displays the nodes and the relationships :
START n=node(*) MATCH (n)-[r]->(m) RETURN n,r,m;
| Neo4j | 8,372,788 | 48 |
Is it possible to run a case-insensitive cypher query on neo4j?
Try that: http://console.neo4j.org/
When I type into this:
start n=node(*)
match n-[]->m
where (m.name="Neo")
return m
it returns one row. But when I type into this:
start n=node(*)
match n-[]->m
where (m.name="neo")
return m
it does not return any... | Yes, by using case insensitive regular expressions:
WHERE m.name =~ '(?i)neo'
https://neo4j.com/docs/cypher-manual/current/clauses/where/#case-insensitive-regular-expressions
| Neo4j | 13,439,278 | 46 |
Greetings,
Is there any open source graph database available other than Neo4J??
NOTE: Why not Neo4J?
Neo4J is opensource, but counts primitives (number of nodes,relationships & properties). If you are using it for commercial use. And does not have any straight forward information of pricing on official website. so the... | OrientDB (old link) appears to support graph storage in much the same was as Neo4j
| Neo4j | 1,754,628 | 44 |
In SQL:
Delete From Person Where ID = 1;
In Cypher, what's the script to delete a node by ID?
(Edited: ID = Neo4j's internal Node ID)
| (Answer updated for 2024!)
Assuming you're referring to Neo4j's internal element id:
MATCH (p:Person) where elementId(p)=1
DETACH DELETE p
Assuming you're referring to Neo4j's (legacy) internal id:
MATCH (p:Person) where ID(p)=1
DETACH DELETE p
If you're referring to your own property 'id' on the node:
MATCH (p:Pers... | Neo4j | 28,144,751 | 43 |
Hi I created a neo4j database with custom java application and tried to change path in configuration file in order to connect to created database.
While trying to check the data in webadmin console only node 0 is visible (seems that the database is empty). I tried to import the same database to Gephi and it's not empty... | You first need confirm that the database you are connecting to was properly shut down (means you should not take the image of a running database).
Set the location of the database if you are in server mode from the file
conf/neo4j-server.properties
by editing the below line.
org.neo4j.server.database.location=data/gra... | Neo4j | 10,888,280 | 42 |
Is there a way to create bidirectional relationship in Neo4j using Cypher? I would like the relationship to be bidirectional rather than making two unidirectional relationships in both directions For eg:
(A)<-[FRIEND]->(B)
Rather than:
(A)-[FRIEND]->(B)
(A)<-[FRIEND]-(B)
Thanks in advance :)
| No, there isn't. All relationships in neo4j have a direction, starting and ending at a given node.
There are a small number of workarounds.
Firstly, as you've suggested, we can either have two relationships, one going from A to B and the other from B to A.
Alternatively, when writing our MATCH query, we can specif... | Neo4j | 24,010,932 | 40 |
Using Cypher, how can I find a node where a property doesn't exist?
For example, I have two nodes:
A = {foo: true, name: 'A'}, B = { name: 'B'}
Now I'd like to find B, selecting it on the basis of not having the foo property set. How can I do this?
| As Michael Hunger mentioned
MATCH (n) WHERE NOT EXISTS(n.foo) RETURN n
On older versions of Neo4j you can use HAS:
# Causes error with later versions of Neo4j
MATCH (n) WHERE NOT HAS(n.foo) RETURN n
| Neo4j | 35,400,674 | 39 |
Is there a GUI tool which allows you to look at the contents of the Neo4j database visually.
| The easiest is to start the neo4j server and view your graph via the webadmin: http://docs.neo4j.org/chunked/stable/tools-webadmin.html
| Neo4j | 10,814,336 | 39 |
I want to match between entities by multiple relationship types.
Is it possible to say the following query:
match (Yoav:Person{name:"Yoav"})-[:liked & watched & ... ]->(movie:Movie) return movie
I need "and" between all the relation types; Yova liked and watched and .. a movie.
| Yes, you can do something like:
match (gal:Person{name:"Yoav"})-[:liked|:watched|:other]->(movie:Movie)
return movie
Take a look in the docs: Match on multiple relationship types
EDIT:
From the comments:
I need "and" between the relation types.. you gave me an "or"
In this case, you can do:
match (Yoav:Person{name:... | Neo4j | 46,132,345 | 38 |
I would like to find out all the incoming and outgoing relationships for a node. I tried couple of queries suggested in other questions but not having much luck. These are the two I tried
MATCH (a:User {username: "user6"})-[r*]-(b)
RETURN a, r, b
I only have 500 nodes and it runs forever. I gave up after an hour.
I tr... | The simplest way to get all relationships for a single node is like this:
MATCH (:User {username: 'user6'})-[r]-()
RETURN r
| Neo4j | 38,423,683 | 37 |
The version I use is neo4j-enterprise-2.2.0-M02
My question is :
How can I configure a user (like add a new user, change the password ,etc) in backend or browser, instead of REST API? Can I do it via neo4j-shell? imagine that I am a DBA, it is not very convenient to do this by REST API.
Any help will be greatly appreci... | You can use the browser instead of the API. Just go to http://localhost:7474 (or whatever IP to which the web console is bound) and you will be prompted to change the password. Once authenticated, use the command :server change-password to change the password again.
It is not yet possible to create multiple user accoun... | Neo4j | 27,645,951 | 37 |
I am trying to make a database where every time a node doesn't exist it will create a new one and set a relationship between this node and another. If the node exists, both nodes get a relationship.
My problem is that, if I try to connect 2 existing nodes, the 2nd node will be recreated. I tried with MERGE and CREATE U... | When using MERGE on full patterns, the behavior is that either the whole pattern matches, or the whole pattern is created. MERGE will not partially use existing patterns — it’s all or nothing. If partial matches are needed, this can be accomplished by splitting a pattern up into multiple MERGE clauses. http://docs.neo4... | Neo4j | 24,015,854 | 37 |
I know how to remove a vertex by id in Gremlin.
But now I'm need to cleanup the database.
How do I delete multiple vertices?
Deleting 1 v is like this:
ver = g.v(1)
g.removeVertex(ver)
I mean something like SQL TRUNCATE. How do you remove the vertices / vertexes without removing the class?
| In more recent terms as of Gremlin 2.3.0, removal of all vertices would be best accomplished with:
g.V.remove()
UPDATE: For version Gremlin 3.x you would use drop():
gremlin> graph = TinkerFactory.createModern()
==>tinkergraph[vertices:6 edges:6]
gremlin> g = graph.traversal()
==>graphtraversalsource[tinkergraph[verti... | Neo4j | 12,814,305 | 36 |
Recently I have been looking into graph databases like Neo4j and into logic programming in Prolog and miniKanren. From what I have learned so far, both allow specifying facts and relations between them, and also querying the resulting system for some selections. So, actually I cannot see much difference between them in... | No, logic programming as embodied by those things and neo4j are quite different.
On one level, you're right that they conceptually both amount to graph storage and graph query. But for logic programming, it's only conceptually graph query, there's no guarantee that it's actually stored that way (where with neo4j, it i... | Neo4j | 29,192,927 | 35 |
Looking at Neo4j, and the 32 billion relationship limit has me worried (imagine 40 million users who upload 500 photos, have 500 friends, make 500 comments etc and before you know it you are past 32 billion).. So I have some concerns and have to make sure I'm making the best choice on which database to use.
Not lookin... | Disclaimer: I work for/with Neo4j
Just talking about the maturity here (not technicalities) - Neo Technology as a company with more than 50 employees, $25M funding and a thriving user-base with half a million downloads, 30k new databases running each month and an active community won't go away. You can also check the S... | Neo4j | 15,623,384 | 35 |
I'm defining the relationship between two entities, Gene and Chromosome, in what I think is the simple and normal way, after importing the data from CSV:
MATCH (g:Gene),(c:Chromosome)
WHERE g.chromosomeID = c.chromosomeID
CREATE (g)-[:PART_OF]->(c);
Yet, when I do so, neo4j (browser UI) complains:
This query builds a ... | The browser is telling you that:
It is handling your query by doing a comparison between every Gene instance and every Chromosome instance. If your DB has G genes and C chromosomes, then the complexity of the query is O(GC). For instance, if we are working with the human genome, there are 46 chromosomes and maybe 2500... | Neo4j | 33,352,673 | 34 |
Usually I can find everything I need already on SO but not this time. I'm looking for a very simple way to exclude labels, for example (pseudo code):
match (n) where n not in (Label1, Label2) return n
Sorry about crappy query. In short I have labels x,y,z and I want to return all of them apart from z.
Thnx!
| This should do it:
MATCH (n)
WHERE NOT n:Label1 AND NOT n:Label2
RETURN n;
| Neo4j | 32,817,075 | 34 |
I know I can create a unique constraint on a single property with Cypher like CREATE CONSTRAINT ON (p:Person) ASSERT p.name IS UNIQUE. But I was wondering whether it is possible to create a unique constraint which involves multiple properties. If so, how?
| neo4j (2.0.1) does not currently support a uniqueness constraint that covers multiple properties simultaneously.
However, I can think of a workaround that might be acceptable, depending on your use cases. Let's say you want properties a, b, and c to be unique as a group. You can add an extra property, d, that concatena... | Neo4j | 22,498,054 | 34 |
I understand it is possible to use the wildcard (*) symbol to return all references in a Cypher query, such as:
MATCH p:Product WHERE p.price='1950' RETURN *;
==> +----------------------------------------------------------------+
==> | p |
==> +-------... | You can't do this in Cypher yet. I think it would be a nice feature though, if you want to request it.
Edit (thanks for comment pointing it out):
You can now do this as of 2.2:
MATCH (p:Product) WHERE p.price='1950' RETURN keys(p);
| Neo4j | 17,735,005 | 34 |
I can't find a way to change a relationship type in Cypher. Is this operation possible at all? If not: what's the best way achieve this result?
| Unfortunately there is no direct change of rel-type possible at the moment.
You can do:
MATCH (n:User {name:"foo"})-[r:REL]->(m:User {name:"bar"})
CREATE (n)-[r2:NEWREL]->(m)
// copy properties, if necessary
SET r2 = r
WITH r
DELETE r
| Neo4j | 22,670,369 | 33 |
I have created a node with a wrong label.
Is there any way to change node label or relationship type without re-creating it?
I have tried something like
MATCH n WHERE Id(n)=14 SET n.Labels = 'Person'
but it is fault...
| MATCH (n:OLD_LABEL {id:14})
REMOVE n:OLD_LABEL
SET n:NEW_LABEL
Guess this query explains itself.
| Neo4j | 22,542,802 | 33 |
I have two nodes user and files with a relationship :contains, the relationship has a property idwhich is an array, represented as
(:user)-[:contains{id:[12345]}]->(:files)
However I want to populate the property array id with values 1111 and 14567 sequentially using Cypher queries, I dont find any method to push valu... | Adding values to an array is analogous to incrementing an integer or concatenating a string and is signified the same way, in your case (let c be your [c:contains {id:[12345]}])
c.id = c.id + 1111 // [12345,1111]
c.id = c.id + 14567 // [12345,1111,14567]
or
c.id = c.id + [1111,14567] // [... | Neo4j | 21,979,782 | 33 |
I am looking at integrating Neo4j into a Clojure system I am building. The first question I was asked was why I didn't use Datomic. Does anyone have a good answer for this? I have heard of and seen videos on Datomic, but I don't know enough about Graph Databases to know the difference between Neo4j and Datomic, and wha... | There are a few fundamental difference between them:
Data Model
Both Neo4j and Datomic can model arbitrary relationships. They both use, effectively, an EAV (entity-attribute-value) schema so they both can model many of the same problem domains except Datomic's EAV schema also embeds a time dimension (i.e. EAVT) which ... | Neo4j | 17,895,129 | 33 |
I am trying to run queries from the neo4j browser to reproduce results from my neo4j-javascript-driver client.
What is the syntax for defining query parameters in the neo4j b
I recently attended a neo4j training session in NYC where the trainer (David Fauth) did this, unfortunately, I did not take notes on it, since I ... | In neo4j-browser you need type for example:
:params {nodes: [{name: "John", age: 18}, {name: "Phill", age: 23}]}
Then you can use params as usual:
UNWIND {nodes} as node
MERGE (A:User {name: node.name, age: node.age})
RETURN A
For clear params in neo4j-browser type :params {}.
For additional help type :help params.
| Neo4j | 42,397,773 | 32 |
i have created a new node labeled User
CREATE (n:User)
i want to add a name property to my User node i tried it by
MATCH (n { label: 'User' })
SET n.surname = 'Taylor'
RETURN n
but seems it is not affecting .
how can i add properties to a already created node .
Thank you very much.
| Your matching by label is incorrect, the query should be:
MATCH (n:User)
SET n.surname = 'Taylor'
RETURN n
What you wrote is: "match a user whose label property is User".
Label isn't a property, this is a notion apart.
As Michael mentioned, if you want to match a node with a specific property, you've got two alternati... | Neo4j | 24,407,716 | 32 |
I've deleted all my nodes and relationships (Delete all nodes and relationships in neo4j 1.8), but I see that in Neo4j Browser the "property keys" that existed before the deletion remain.
See the picture below:
How can I make all the "Property Keys" go away too, so I can end up with a fresh new database? I understand ... | You should be able to clear everything out by:
stopping your Neo4j database
deleting everything matching data/graph.db/* (look inside the graph.db folder)
starting up again.
| Neo4j | 33,982,639 | 31 |
I'm using neo4j and making executing this query:
MATCH (n:Person) RETURN n.name LIMIT 5
I'm getting the names but i need the ids too.
Please help!
| Since ID isn't a property, it's returned using the ID function.
MATCH (n:Person) RETURN ID(n) LIMIT 5
| Neo4j | 26,203,538 | 31 |
I'm trying to figure out what is the difference between MERGE and CREATE UNIQUE. I know these features:
#MERGE#
I'm able to create node, if doesn't exist pattern.
MERGE (n { name:"X" }) RETURN n;
This create node "n" with property name, empty node "m" and relationship RELATED.
MERGE (n { name:"X" })-[:RELATED]->(m) RE... | CREATE UNIQUE has slightly more obscure semantics than MERGE. MERGE was developed as an alternative with more intuitive behavior than CREATE UNIQUE; if in doubt, MERGE is usually the right choice.
The easiest way to think of MERGE is as a MATCH-or-create. That is, if something in the database would MATCH the pattern yo... | Neo4j | 22,773,562 | 31 |
I'm using Linux 16.04 OS. I have installed fresh neo4j. I get referenced exegetic and digitalocean sites.
By default there's graph.db database.
My question is how to create a new database and create nodes and
relation ship between nodes?
As I show in picture default DB name is graph.db.
| Since you're using Neo 3.x, to create a new database without removing your existing one, you can simply edit the neo4j.conf file in your conf directory of your $NEO4J_HOME.
Search for dbms.active_database=, which should have the default value of graph.db. Replace it with some other name and start neo4j again. Now, a ne... | Neo4j | 45,784,232 | 29 |
I am trying to get the relationship type of a very simple Cypher query, like the following
MATCH (n)-[r]-(m) RETURN n, r, m;
Unfortunately this return an empty object for r. This is troublesome since I can't distinguish between the different types of relationships. I can monkey patch this by adding a property like [r:... | Use the type() function.
MATCH (n)-[r]-(m) RETURN type(r);
| Neo4j | 31,485,802 | 28 |
I'm new to the Graph Database scene, looking into Neo4j and learning Cypher, we're trying to model a graph database, it's a fairly simple one, we got users, and we got movies, users can VIEW movies, RATE movies, create playlists and playlists can HAVE movies.
The question is regarding the Super Node performance issue. ... | UPDATE - October 2020. This article is the best source on this topic, covering all aspects of super nodes
(my original answer below)
It's a good question. This isn't really an answer, but why shouldn't we be able to discuss this here? Technically I think I'm supposed to flag your question as "primarily opinion based... | Neo4j | 27,568,265 | 28 |
If I have the cypher query
MATCH (a)-[r]->(b)
I can get the labels of a and b fine line so
MATCH (a)-[r]->(b)
RETURN labels(a), labels(b)
But when I want the label of r using the same syntax
MATCH (a)-[r]->(b)
RETURN labels(r)
I get
Type mismatch: expected Node but was Relationship
How do I return the label of r... | In Neo4j, relationships don't have labels - they have a single type, so it would be:
MATCH (a)-[r]->(b)
RETURN TYPE(r)
| Neo4j | 23,999,044 | 28 |
Is there a cypher command to drop all constraints?
I know I can drop specific constraints.
DROP CONSTRAINT ON (book:Book) ASSERT book.isbn IS UNIQUE
However I want to clear all constraints as part of teardown after testing. Can't find anything in the docs, but something like:
DROP CONSTRAINT *
Update: My testing se... | Note using APOC you can drop all indexes and constraints via CALL apoc.schema.assert({}, {}).
| Neo4j | 22,357,379 | 28 |
I was looking on the scalability of Neo4j, and read a document written by David Montag in January 2013.
Concerning the sharding aspect, he said the 1st release of 2014 would come with a first solution.
Does anyone know if it was done or its status if not?
Thanks!
| Disclosure: I'm working as VP Product for Neo Technology, the sponsor of the Neo4j open source graph database.
Now that we've just released Neo4j 2.0 (actually 2.0.1 today!) we are embarking on a 2.1 release that is mostly oriented around (even more) performance & scalability. This will increase the upper limits of the... | Neo4j | 21,558,589 | 28 |
I would like to predefine some graph data for neo4j and be able to load it, maybe via a console tool. I'd like it to be precisely the same as MySQL CLI and .sql files. Does anyone know if there exists a file format like .neo or .neo4j? I couldn't find such thing in the docs...
| We usually do .cql or .cypher for script files. You can pipe it to the shell to run it, like so:
./neo4j-shell -c < MY_FILE.cypher
Michael Hunger was doing some great work on this feature, also, just recently. He got performance up and noise down from the console. I hope it gets into 1.9 release.
| Neo4j | 15,161,221 | 28 |
I was trying to save directed graphs into databases for further processing and query. And neo4j seems to fit my needs. However, I don't seem to find a good tutorial regarding the following:
Creating the database and put data in.
Making queries.
I want to be able to do them both manually and automatically (i.e. using ... | For getting started just download the Neo4j Server and start it. Then go to http://localhost:7474 for the integrated web-admin UI which allows you to enter data visually and browser/visualize and query it.
Please have a look at the Neo4j Koans by Jim Webber and Ian Robinson which are material that are used in real-worl... | Neo4j | 8,623,080 | 28 |
Is there a GUI-builder for neo4j? I want to be able to quickly add new nodes, set labels, set properties and relationships all in a gui-environment by clicking on nodes in a visualisation. I have searched, but have found nothing. Thanks.
| @Zuriar
Two years after your original post :) but nevertheless ..
Now there is also Graphileon InterActor (http://www.graphileon.com) , an enhanced user-interface for Neo4j. Multi-panel, create / update nodes and relations without writing a single line of code.
UPDATE August 15th, 2018
We have replaced the Sandbox and ... | Neo4j | 32,462,505 | 27 |
Neo4j is a great tool for mapping relational data, but I am curious what under what conditions it would not be a good tool to use.
In which use cases would using neo4j be a bad idea?
| You might want to check out this slide deck and in particular slides 18-22.
Your question could have a lot of details to it, but let me try to focus on the big pieces. Graph databases are naturally indexed by relationships. So graph databases will be good when you need to traverse a lot of relationships. Graphs them... | Neo4j | 30,133,924 | 27 |
How to delete labels in neo4j? Actually I deleted all nodes and relationships, then I recreated the movie database and still the labels I created before appeared on the webinterface. I also tried to use a different location for the database and even after an uninstall and reinstall the labels still appeared. Why? Where... | There isn't at the moment (Neo4j 2.0.1) a way to explicitly delete a label once it has been created. Neo4j Browser will display all labels which are reported by the REST endpoint at:
http://localhost:7474/db/data/labels
Separately, the Neo4j Browser sidebar which displays labels doesn't properly refresh the listing wh... | Neo4j | 21,983,425 | 27 |
I am quite new for zookeeper port through which I am coming across from past few days.
I introduced with zookeeper port keyword at two occasion:
while configuring neo4j db cluster (link) and
while running compiled voltdb catalog (link) (See Network Configuration Arguments)
Then, I came across Apache Zookeeper, (which... | Zookeeper is used in distributed applications mainly for configuration management and high availability operations. Zookeeper does this by a Master-Slave architecture. Neo4j and VoltDb might be using zookeeper for this purpose
Coming to the ports understanding :
suppose u have 3 servers for zookeepers ... You need to m... | Neo4j | 18,168,541 | 27 |
When I run this query:
START n1=node(7727), n2=node(7730)
MATCH n1-[r:SKILL]->n2 RETURN r
it gives me a list of duplicate relationships that I have between the two nodes. what do I add to the cypher query to iterate over the relationship to keep one relationship and delete the rest?
| To do this for two known nodes:
start n=node(1), m=node(2) match (n)-[r]->(m)
with n,m,type(r) as t, tail(collect(r)) as coll
foreach(x in coll | delete x)
To do this globally for all relationships (be warned this operation might be very expensive depending on the size of your graph):
start r=relationship(*)
match ... | Neo4j | 18,202,197 | 26 |
Is it possible to have cypher query paginated. For instance, a list of products, but I don't want to display/retrieve/cache all the results as i can have a lot of results.
I'm looking for something similar to the offset / limit in SQL.
Is cypher skip + limit + orderby a good option ? http://docs.neo4j.org/chunked/stabl... | SKIP and LIMIT combined is indeed the way to go. Using ORDER BY inevitably makes cypher scan every node that is relevant to your query. Same thing for using a WHERE clause. Performance should not be that bad though.
| Neo4j | 16,338,670 | 26 |
What is the pros and cons of MongoDB (document-based), HBase (column-based) and Neo4j (objects graph)?
I'm particularly interested to know some of the typical use cases for each one.
What are good examples of problems that graphs can solve better than the alternative?
Maybe any Slideshare or Scribd worthy prese... | MongoDB
Scalability: Highly available and consistent but sucks at relations and many distributed writes. It's primary benefit is storing and indexing schemaless documents. Document size is capped at 4mb and indexing only makes sense for limited depth. See http://www.paperplanes.de/2010/2/25/notes_on_mongodb.html
Best ... | Neo4j | 3,735,784 | 26 |
I'm trying to find all the nodes with more than one incoming relationship. Given this data:
a-[has]->b
a-[has]->c
d-[has]->b
So, I'm looking for a query that returns 'b', because it has more that one incoming.
This query is close. It returns 'a' and 'b', because they both have 2 relations:
match (n)--()
with n,count(... | Does this work for you?
MATCH ()-[r:has]->(n)
WITH n, count(r) as rel_cnt
WHERE rel_cnt > 1
RETURN n;
I am assuming, perhaps incorrectly, that 'has' is the appropriate relationship type. If not, then try:
MATCH ()-[r]->(n)
WITH n, count(r) as rel_cnt
WHERE rel_cnt > 1
RETURN n;
| Neo4j | 22,998,090 | 25 |
I am creating a new Neo4j database. I have a type of node called User and I would like an index on the properties of user Identifier and EmailAddress. How does one go setting up an index when the database is new? I have noticed in the neo4j.properties file there looks to be support for creating indexes. However when I ... | Add the following to the neo4j.properties file
# Autoindexing
# Enable auto-indexing for nodes, default is false
node_auto_indexing=true
# The node property keys to be auto-indexed, if enabled
node_keys_indexable=EmailAddress,Identifier
Create the auto index for nodes
neo4j-sh (0)$ index --create node_auto_index -t ... | Neo4j | 12,877,678 | 25 |
What is the difference between a Graph Database (e.g. Neo4J) and a Network Database (e.g. IDS, CODASYL)? In principle are they the same thing?
| The network databases like CODSASYL are still more or less based on a hierarchical data model, thinking in terms of parent-child (or owner-member in CODASYL terminology) relationships. This also means that in network database you can't relate arbitrary records to each other, which makes it hard to work with graph-orien... | Neo4j | 5,040,617 | 25 |
I want to get list of all connected nodes starting from node 0 as shown in the diagram
| Based on your comment:
I want to get a list of all the connected nodes. For example in the
above case when I search for connected nodes for 0, it should return
nodes- 1,2,3
This query will do what you want:
MATCH ({id : 0})-[*]-(connected)
RETURN connected
The above query will return all nodes connected with a n... | Neo4j | 45,032,283 | 24 |
Suppose you're Twitter, and:
You have (:User) and (:Tweet) nodes;
Tweets can get flagged; and
You want to query the list of flagged tweets currently awaiting moderation.
You can either add a label for those tweets, e.g. :AwaitingModeration, or add and index a property, e.g. isAwaitingModeration = true|false.
Is one o... | UPDATE: Follow up blog post published.
This is a common question when we model datasets for customers and a typical use case for Active/NonActive entities.
This is a little feedback about what I've experienced valid for Neo4j2.1.6 :
Point 1. You will not have difference in db accesses between matching on a label or on ... | Neo4j | 27,956,367 | 24 |
My question is from the view of developer (not specifically respect to User) and may be bit messy.
I want to know that how the structure of Nodes and Relationships is get stored in database logically. Like, when I say that I have bla bla information. Where? - then the answer is, in BOOK, either in form of Grid or lines... | http://www.slideshare.net/thobe/an-overview-of-neo4j-internals is very outdated but this gives you a good overview of Neo4j logical representation.
A node references:
its first label (my guess is that labels are stored as a singly linked list)
its first property (properties are organized as a singly linked list)
its s... | Neo4j | 24,366,078 | 24 |
I need to make a string contain filter in Neo4J. The idea is simple.
A good example is that I need to retrieve from a database of persons all the people that contain in his name the car substring.
How can I do this?
| As an additional update, from neo4j 3.0 it may be more readable to use:
MATCH(n)
WHERE n.name CONTAINS 'car'
RETURN n
(Edited to include Maciej fix to my response, thank you!)
| Neo4j | 24,094,882 | 24 |
I am using Neo4j 2.0 and using the following query to find out the count of number of a particular relationship from a particular node.
I have to check the number of relationships named "LIVES" from a particular node PERSON.
My query is:
match (p:PERSON)-[r:LIVES]->(u:CITY) where count(r)>1
return count(p);
The erro... | What you want is a version of having? People living in more than one city?
MATCH (p:PERSON)-[:LIVES]->(c:CITY)
WITH p,count(c) as rels, collect(c) as cities
WHERE rels > 1
RETURN p,cities, rels
| Neo4j | 22,346,526 | 24 |
Does http://localhost:7474/browser/ not support multiple unrelated queries?
This code:
MATCH (a {cond:'1'}), (b {cond:'x'}) CREATE a-[:rel]->b
MATCH (a {cond:'2'}), (b {cond:'y'}) CREATE a-[:rel]->b
MATCH (a {cond:'3'}), (b {cond:'z'}) CREATE a-[:rel]->b
causes an error:
WITH is required between CREATE and MATCH
Bu... | As a work around you can do:
MATCH (a {cond:'1'}), (b {cond:'x'}) CREATE a-[:rel]->b
WITH 1 as dummy
MATCH (a {cond:'2'}), (b {cond:'y'}) CREATE a-[:rel]->b
WITH 1 as dummy
MATCH (a {cond:'3'}), (b {cond:'z'}) CREATE a-[:rel]->b
See also the import blog post: http://blog.neo4j.org/2014/01/importing-data-to-neo4j-sprea... | Neo4j | 21,778,435 | 24 |
Lets say, I have an user:
CREATE (n { name: 'Tamil' })
and 2 roles:
CREATE (n { name: 'developer' } )
CREATE (n { name: 'tester' } )
Then, I make relationship between the user & each of the 2 roles.
CYPHER 1.9 START a = node(*), b = node(*)
WHERE a.name = 'Tamil' AND b.name = 'developer'
CREATE (a)-[r:HAS_ROLE]->... | I deleted the relationship on your original graph with this query:
START n=node(*)
MATCH (n)-[rel:HAS_ROLE]->(r)
WHERE n.name='Tamil' AND r.name='tester'
DELETE rel
| Neo4j | 19,016,947 | 24 |
I would like to retrieve a specific number of random nodes. The graph consists of 3 000 000 nodes where some of them are sources, some are target and some are both.
The aim is to retrieve random sources and as I don't know how to select random, the program generates k random numbers from 1 to 3 000 000 which represent ... | You can use such construction:
MATCH (a)-[:LEADS_TO]->(t)
RETURN a, rand() as r
ORDER BY r
It should return you random set of object.
Tested with Neo4j 2.1.3
| Neo4j | 12,510,696 | 24 |
I'm new in Neo4j and I have a weird requirement.
I have some node
CREATE (a:node {title:1})
CREATE (b:node {title:2})
CREATE (c:node {title:3})
CREATE (d:node {title:4})
and multiple relationships between them:
CREATE (a)-[:RELATES{jump:[1]}]->(b)
CREATE (b)-[:RELATES{jump:[1]}]->(c)
CREATE (c)-[:RELATES{jump:[1]}]... | In neo4j 3.2.1 this feature has been relocated to the bottom left corner, under the gear icon: "Connect result nodes" (checked by default, thus returning all relationships between nodes included in the result).
| Neo4j | 37,603,618 | 23 |
I want to execute several queries at the same time on the browser console, here are my requests :
CREATE (newNode1:NEW_NODE)
CREATE (newNode2:NEW_NODE)
MATCH (n1:LABEL_1 {id: "node1"}) CREATE (newNode1)-[:LINKED_TO]->(n1)
MATCH (n2:LABEL_2 {id: "node2"}) CREATE (newNode2)-[:LINKED_TO]->(n2)
When I execute them one by ... | Add a couple of WITHs?
CREATE (newNode1:NEW_NODE)
CREATE (newNode2:NEW_NODE)
WITH newNode1, newNode2
MATCH (n1:LABEL_1 {id: "node1"})
CREATE (newNode1)-[:LINKED_TO]->(n1)
WITH newNode1, newNode2
MATCH (n2:LABEL_2 {id: "node2"})
CREATE (newNode2)-[:LINKED_TO]->(n2)
Alternatively, you could do it in a different order ... | Neo4j | 21,297,679 | 23 |
I need to delete all relationships between all nodes. Is there any way to delete all relationships in the neo4j graph? Note that I am using ruby bindings - the neography gem.
There is no info about that in the wiki of the gem. I've also tried to find a way to do it in the neo4j documentation without any result.
Neo4j v... | in cypher:
deleting all relationships:
start r=relationship(*) delete r;
creating all relationships between all nodes, i'd assume:
start n=node(*),m=node(*) create unique n-[r:RELTYPE]-m;
but you rather dont want to have too many vertices, since it collapse on low memory (at least in my case i got 1mil vertices and 1... | Neo4j | 12,899,538 | 23 |
Using Neo4J v2.2.3 community version.
From inside web admin console does anyone know of any way to log out?
| type this in tnto the browser's input line:
:server disconnect
| Neo4j | 31,189,719 | 22 |
I just got started on Neo & tried to look for prior questions on this topic. I need help to rename one of the property keys.
I created the following node:
CREATE (Commerce:Category {title:' Commerce', Property:'Category', Owner:'Magic Pie', Manager:'Simple Simon'})
Now want to rename title to name. Is there a way to d... | Yes, you want to SET a new property name with the value of the old property title. And then REMOVE the old property title. Something like this...
MATCH (c:Category)
WHERE c.name IS NULL
SET c.name = c.title
REMOVE c.title
If you have MANY nodes, it is advisable to perform the operation in smaller batches. Here is an e... | Neo4j | 28,618,410 | 22 |
I have a neo4j db with the following:
a:Foo
b:Bar
about 10% of db have (a)-[:has]->(b)
I need to get only the nodes that do NOT have that relationship!
previously doing ()-[r?]-() would've been perfect! However it is no longer supported :( instead, doing as they suggest a
OPTIONAL MATCH (a:Foo)-[r:has]->(b:Bar) WHERE... | That would be
MATCH (a:Foo) WHERE not ((a)-[:has]->(:Bar)) RETURN a;
| Neo4j | 25,673,223 | 22 |
I'm storing some nodes in Neo4j graph database and each node has property values that can be localized to various language. Is there any best practice for storing multi-language property values?
| There are couple of ways to model this. Which one is the best, depends on your use case and the way you want to use i18n-ized properties. I'm sketching some examples below assuming n is a node that should have it's productName and color property translated in various languages. Gonna use Cypher-like notation below.
1) ... | Neo4j | 19,924,253 | 21 |
How do I return all the labels for a node using a Cypher query?
Note that I don't know the node id in advance, I do some sort of index match to get it.
| You can get labels by using the labels() method.
Example (Neo4j 2.0):
Lets say you have the "name" property indexed and would like to search on that basis, the following query would give you all nodes and their labels which have name = "some_name"
MATCH (r) WHERE r.name="some_name" RETURN ID(r), labels(r);
If you know... | Neo4j | 19,125,442 | 21 |
If someone builds a database on top of another database, such as twitter has done, does that database inherit the limitations and inefficiencies of the underlying database?
I'm specifically interested in titan db (http://thinkaurelius.com) because of their claim to support splitting the dataset efficiently across nodes... | Titan determines the key sort order of the underlying storage backend (BOP for Cassandra, default for HBase) and then assigns ids to vertices such that vertices which are assigned to the same partition block have ids that are assigned to the same physical machine. In other words, Titan "understands" how the underlying ... | Neo4j | 17,811,472 | 21 |
I realized only after importing a ton of nodes that I had created relationships called START, which is a reserved keyword. Querying the DB through the Cypher console hence always complains about the reserved keywords:
SyntaxException: reserved keyword "start n=node(0) match n<-[:START]-r
return count(r)"
The only w... | To do the equivalent of a rename, you can create a new one and delete the old one like so:
match (n1)-[old:`Start`]->(n2)
create (n1)-[new:StartDate]->(n2)
delete old
n.b. use backticks like those around `Start` to escape reserved keywords
| Neo4j | 13,816,712 | 21 |
There is some hype around graph databases. I'm wondering why.
What are the possible problems that one can be confronted with in today's web environment that can be solved using graph databases? And are graph databases suitable for classical applications, i.e. can one be used as a drop-in replacement for a Relational D... | Many relational representations of graphs aren't particularly efficient for all operations you might want to perform.
For example, if one wants the connected set of all nodes where edges satisfy a given predicate, starting from a given node, there's no natural way in SQL to express that. Likely you'll either do a query... | Neo4j | 1,159,190 | 21 |
I am starting a new project and I am looking at using MongoDB as the document storage facility and Neo4j as the mechanism to map relationships between documents and then I want to expose the results of my queries via rest API.
What would one say are the advantages and disadvantages of doing it this manner?
Are there an... | I have been thinking about using these two together for a while because my data is already in mongodb. But I don't want to add one more DB top of the existing architecture, because addition of neo4j will require more resources e.g. memory, diskspace and not to mention time invested in maintaining 2 DBs.
Another problem... | Neo4j | 15,114,997 | 20 |
I am a CS Research student at UW, and my group is at the point of trying to visualize specific network traffic that is put into a neo4j graph DB in real time.
I have read about many different tools such as gephi, cytoscape, rickshaw (based on D3.js), some others, and D3.js.
We are so far going forward with D3.js, but ... | There's not a silver bullet solution for this kind of problem and most depends from what you have in mind to do, the team and the budget (of money and time) you have.
I wouldn't recommend you D3, unless you have to met one of the following:
you want to create a brand new way to visualize your data
you have skilled... | Neo4j | 14,867,132 | 20 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.