graph-databases

OrientDB Query by edge property

家住魔仙堡 提交于 2019-12-31 05:06:07
问题 I have two vertex classes: Location and User and I have two edges also: Friend and GoingTo. A User can be 'Friend' with another User and a User can also 'GoingTo' a Location. The edge GoingTo has a datetime property called going_date with the date the user is going to the Location. I want to return every ‘Location’ that has a in(“GoingTo”) edge from an ‘User’ that is a (“Friend”) of a specific starting ‘User’ (#12:11 as example). What I have here is all locations but without the date property

How does Titan achieve constant time lookup using HBase / Cassandra?

陌路散爱 提交于 2019-12-30 19:29:47
问题 In the O'Reilly book "Graph Databases" in chapter 6, which is about how Neo4j stores a graph database it says: To understand why native graph processing is so much more efficient than graphs based on heavy indexing, consider the following. Depending on the implementation, index lookups could be O(log n) in algorithmic complexity versus O(1) for looking up immediate relationships. To traverse a network of m steps, the cost of the indexed approach, at O(m log n), dwarfs the cost of O(m) for an

How does Titan achieve constant time lookup using HBase / Cassandra?

跟風遠走 提交于 2019-12-30 19:28:12
问题 In the O'Reilly book "Graph Databases" in chapter 6, which is about how Neo4j stores a graph database it says: To understand why native graph processing is so much more efficient than graphs based on heavy indexing, consider the following. Depending on the implementation, index lookups could be O(log n) in algorithmic complexity versus O(1) for looking up immediate relationships. To traverse a network of m steps, the cost of the indexed approach, at O(m log n), dwarfs the cost of O(m) for an

I need to count the number of connection between two nodes with a certain property

烂漫一生 提交于 2019-12-25 08:28:50
问题 My database contains informations about the nominations for the accademy awards. I want to know how many directors have won an oscar for "best director" more than one time. I can't quite get to the result that i want, a list of nominees. The closest I've been is with this query: MATCH (n:Nominee)-[n1:NOMINATED]->(c:Category) WHERE c.name="Best Director" AND n1.win=true RETURN count(n1.win), n.name ORDER BY n.name; wich returns the directors names and the number of times they won an oscar. I

How do I write a sub-query?

两盒软妹~` 提交于 2019-12-25 06:54:16
问题 I want to retrieve all vertexes and for each one I want to count the number of 'Like' edges pointing at it. How do I write this kind of query in Gremlin? In SQL it could be something like.... SELECT *, (SELECT Count(*) FROM tbl_like l WHERE l.id = b.id) AS LikeCount FROM tbl_blah b 回答1: E.g. use sideEffect to put the counts in a map ( m ) m=[:];g.V.sideEffect{m[it]=it.inE.has('label','like').count()} An alternative which omits vertices with 0 likes: m=[:];g.V.inE('like').groupCount(m){it.inV

hierarchy property in graph database

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-25 03:14:01
问题 I'm starting to use neo4j. In my graph database I've the nodes Person (look at "John" below), with the labels: Name (string), Food (positive integer). Each Person is connected with other Person through the relationship isFriendTo , that has a value. I use the graph DB only to find the shortest weighted path between two person. Also, every day I check every node in the graph, and if the food go under value of 100, I take some actions. Now, after some improvements, the property Food is no more

Presence / absence of an outgoing edge from a vertex in OrientDb

妖精的绣舞 提交于 2019-12-25 01:56:16
问题 I have seen some similar questions on SO but none of the answers have worked for me yet, so I am hoping to get a new answer with the new features that have been added to recent versions of OrientDb since the other questions were asked. I am trying to query all vertices which have an outgoing edge of a particular type but no outgoing edge of another type. As an example in a simple relationship of Person ---- Friend ---> Person Person ---- Owns ---> Car I am trying to find all the persons who

What are the methods to migrate millions of nodes and edges from 0.44 to 0.5?

谁都会走 提交于 2019-12-24 21:29:02
问题 I'm migrating the entire Titan graph database from 0.44 to 0.5. There are about 120 million nodes and 90 million edges that's gigabytes of data. I tried the GraphML format, but it didn't work. Can you suggest methods to do the migration? 回答1: At the size you are describing you would probably execute the most efficient migration by using Titan-Hadoop/Faunus. The general process would be to: Use Faunus 0.4.x to extract the data from your graph as GraphSON and store that in HDFS Use Titan-Hadoop

Gremlin query like SQL IN operator?

怎甘沉沦 提交于 2019-12-24 12:20:04
问题 Im stuck with gremlin. I have emails like array and I need to make query to find all user with those emails. In SQL I have SELECT email(s) FROM user WHERE email IN (xxx, yyy...) How can I do this in Gremlin query language? 回答1: What you wanna do here is: g.V().has('anyProperty', within('possibleValue1', 'possibleValue2')) 回答2: If it is acceptable for you to do a linear scan of all vertices, then you could do something like: gremlin> g = TinkerGraphFactory.createTinkerGraph() ==>tinkergraph

Issue with creating edge in OrientDb with Blueprints / Tinkerpop

馋奶兔 提交于 2019-12-24 11:34:11
问题 I am recently trying to learn OrientDb and now that I am somewhat familiar with the OrientDb console itself I am moving on to using Blueprints to write a simple java program to create a graph. I am trying to create a few vertices and edges between them, but although my vertices are created successfully, I am unable to see my edges unless I call the method for creation twice. If I comment out one of the calls, none of the edges are being created. I tried checking for any timing issues by