graph-databases

Gremlin : GroupBy vertices , having count > 1

五迷三道 提交于 2019-12-11 03:17:44
问题 I am using TITAN 0.4, and gremlin for traversals. My requirement is to identify duplicate vertices in graph, and to merge those. There are > 15 M vertices in graph. gremlin> g.V.has('domain').groupBy{it.domain}{it.id}.cap ==>{google.com=[4], yahoo.com=[16, 24, 20]} I am able to group the vertices, but I need only those domains(vertices) which exists more than once. In the above example, I need to return only ==>{yahoo.com=[16, 24, 20]} The key "domain" is indexed, if that makes any difference

Query writing performance on neo4j with py2neo

心已入冬 提交于 2019-12-11 03:14:58
问题 Currently im struggle on finding a performant way, running multiple queries with py2neo. My problem is a have a big list of write queries in python that need to be written to neo4j. I tried multiple ways to solve the issue right now. The best working approach for me was the following one: from py2neo import Graph queries = ["create (n) return id(n)","create (n) return id(n)",...] ## list of queries g = Graph() t = graph.begin(autocommit=False) for idx, q in enumerate(queries): t.run(q) if idx

Syntax to query for optional relationships in Microsoft SQL Server 2017 Graph Database?

冷暖自知 提交于 2019-12-11 02:02:48
问题 I want to select optional relationships in sql-server-2017-graph. Similar to optional in sparql e.g.: PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?mbox WHERE { ?x foaf:name ?name . OPTIONAL { ?x foaf:mbox ?mbox } } from https://www.w3.org/2001/sw/DataAccess/rq23/#OptionalMatching. And similar to LEFT JOIN in normal sql; e.g.: SELECT name, mbox FROM Persons LEFT JOIN PersonMailBoxLink ON Persons.$node_id = PersonMailBoxLink.$from_id LEFT JOIN MailBoxes ON PersonMailBoxLink.$to_id =

Neo4j: Sum relationship properties where node properties equal Value A and Value B (intersection)

断了今生、忘了曾经 提交于 2019-12-11 01:38:23
问题 Basically my question is: how do I sum relationship properties where there is a related nodes that have properties equal to Value A and Value B? For example: I have a simple DB has the following relationship: (site)-[:HAS_MEMBER]->(user)-[:POSTED]->(status)-[:TAGGED_WITH]->(tag) On [:TAGGED_WITH] I have a property called "TimeSpent". I can easily SUM up all the time spent for a particular day and user by using the following query: MATCH (user)-[:POSTED]->(updates)-[r:TAGGED_WITH]->(tags)

Mass / Group Delete OrientDB / Java

爷,独闯天下 提交于 2019-12-11 01:26:50
问题 I am trying to prototype performance results of orientdb mass delete of vertexes. I need to prototype trying to delete more than 10000 upto million. Firstly, I am using the light weight edges property to be false while creating my vertices and edges following this Issue with creating edge in OrientDb with Blueprints / Tinkerpop When I try deleting (Please see below the code) private static OrientGraph graph = new OrientGraph( "remote:localhost/WorkDBMassDelete2", "admin", "admin"); private

Mapping from OWL ontology to OrientDB Graph Database

送分小仙女□ 提交于 2019-12-11 00:58:49
问题 I am working with OWL ontology and I have to import an owl ontology into OrientDB graph database. Is there a solution implemented to parse OWL ontology and map it to a OrientDB Graph or convert owl ontology to labeled property graph and import it into OrientDB? I know there are similar solutions for Neo4J graph database. https://github.com/flekschas/owl2neo4j https://neo4j.com/blog/using-owl-with-neo4j/ For OrientDB? 来源: https://stackoverflow.com/questions/46581663/mapping-from-owl-ontology

Neo4j Merge and Atomic Transaction

。_饼干妹妹 提交于 2019-12-10 23:49:24
问题 I am running the below MERGE query against my Neo4j server from a client application in 10 parallel threads, the newFoo and id parameters are the same on all 10 runs: MERGE (foo:Foo { id: {id} }) ON MATCH SET foo = {newFoo} After running this, I run the below query to expect 1 but I instead get 10 : match (f:Foo) return count(f) I thought that MERGE runs in an atomic transaction but apparently not. Am I doing something wrong here? Update Below is the code that I used to reproduce the issue:

Is it better to make one MERGE request for multiple nodes / edges creation in Neo4J Cypher 2.0 or to split it into transactions?

旧城冷巷雨未停 提交于 2019-12-10 19:09:58
问题 I have a long Cypher query (the new Neo4J 2.0 version), which creates multiple nodes and connections using the MERGE command. The question is: do you think I'm better off splitting it into different parts and submitting it as a transaction (for robustness) or should I keep the long single one (for speed)? Here's the query: MATCH (u:User {name: "User"}) MERGE (tag1:Hashtag {name:"tag1"}) MERGE (tag2:Hashtag {name:"tag2"}) MERGE (tag3:Hashtag {name:"tag3"}) MERGE (tag4:Hashtag {name:"tag4"})

How can I specify which relationship type to use as a function of the current node at every step of a traversal with neo4j?

纵饮孤独 提交于 2019-12-10 19:04:36
问题 I'd like to traverse my graph using the neo4j traversal API, but I need to be able to specify which relationship type to use at every step, and the relationship type to use needs to be a function of the current node. Is there a way to do this? 回答1: in the current Traverser API you can't choose the exact relationship to traverse. Instead, you take the more granular approach of node.getRelationships(), chose the one you want and the end onde on it, and so on. The algo gets a bit more verbose

How to delete multiple nodes in neo4j

[亡魂溺海] 提交于 2019-12-10 16:45:49
问题 How to delete multiple nodes, (NOT ALL) in neo4j? I have this query MATCH (n) where n.name IS NULL delete n It returns more than one node, I want to delete all those nodes(All nodes, which are mistakenly created thats why become null). The error, I am facing is javax.transaction.HeuristicRollbackException: Failed to commit transaction Transaction(11, owner:"qtp16626756-84")[STATUS_NO_TRANSACTION,Resources=1], transaction rolled back ---> javax.transaction.xa.XAException CASE 2: What to do in