OrientDB

OrientDB get Edges with shortestPath()

北战南征 提交于 2019-12-05 14:37:36
I have a Question about the shortestPath() Function of OrientDB. If I Query select shortestPath('#9:1', '#15:1', 'BOTH') against a OrientDB I just get the Vertex of the Path. But I also want the Edges between them. How can I SELECT both, the Vertex and the Edges? You can use a javascript function. I used these records I used this code var g=orient.getGraph(); var b=g.command("sql","select expand(shortestPath(" + start + "," + end + ", 'BOTH'))"); var list=[]; for(i=0;i<b.length-1;i++){ var rid1=b[i].getId(); var rid2=b[i+1].getId(); var query="select from e where out = " + rid1 + " and in = "

How do you make in Orientdb the edge to be unique

你离开我真会死。 提交于 2019-12-05 10:10:41
How do I make a Edge unique in Orientdb. The solution that I came up with: delete the edge create it again but it's not nice. Edge is without any properties. Example: create edge is_friend from #12:0 to #12:3 and if I call it again, there should be an error like when you make a unique index. Thank you Create a constraint on Edge out and in fields. For more information: http://www.orientechnologies.com/docs/last/orientdb.wiki/Graph-Schema.html#constraints In your case try this: CREATE INDEX UniqueEdges ON is_friend (out, in) unique 来源: https://stackoverflow.com/questions/27768489/how-do-you

Check if class exists or not in orientdb

放肆的年华 提交于 2019-12-05 08:38:33
How to check if a class exists or not in orient db if it is not exiting in the database i need to create it and insert a record if exists i need to insert the record . I need to do the same using JAVA You can retrieve schema information via SQL with the following statement: select expand(classes) from metadata:schema In particular, to retrieve a single class: select from ( select expand(classes) from metadata:schema ) where name = 'YourClassName' From Java: ODatabaseDocumentTx db = ... if(db.getMetadata().getSchema().existsClass("ClassName")){ ... } If you have an OrientGraph, you can get the

How to use OrientDB ETL to create edges only

半世苍凉 提交于 2019-12-05 07:52:28
I have two CSV files: First containing ~ 500M records in the following format id,name 10000023432,Tom User 13943423235,Blah Person Second containing ~ 1.5B friend relationships in the following format fromId,toId 10000023432,13943423235 I used OrientDB ETL tool to create vertices from the first CSV file. Now, I just need to create edges to establish friendship connection between them. I have tried multiple configuration of the ETL json file so far, the latest being this one: { "config": {"parallel": true}, "source": { "file": { "path": "path_to_file" } }, "extractor": { "csv": {} },

How to write a select query or server-side function that will generate a neat time-flow graph from many data points?

跟風遠走 提交于 2019-12-05 05:32:08
NOTE: I am using a graph database (OrientDB to be specific). This gives me the freedom to write a server-side function in javascript or groovy rather than limit myself to SQL for this issue.* NOTE 2: Since this is a graph database, the arrows below are simply describing the flow of data. I do not literally need the arrows to be returned in the query. The arrows represent relationships.* I have data that is represented in a time-flow manner; i.e. EventC occurs after EventB which occurs after EventA, etc. This data is coming from multiple sources, so it is not completely linear. It needs to be

Showing node labels in OrientDB Studio

不打扰是莪最后的温柔 提交于 2019-12-04 22:21:28
I'm trying to make OrientDB Studio display a string as a label for each node, like in this screenshot from Susheel Kumar But when I run Susheel's code (posted below for posterity), the nodes all appear labelled by their @rid fields instead, like this screenshot: Question: Is there an automated way to display all these labels? I can tell an individual node to display its "name" field as a label by clicking (1) the node, (2) the "eye" symbol, (3) the settings symbol, and selecting "name" from the dropdown menu, but this will be impossible to do when I have a large number of nodes. This seems

SELECT and UPDATE multiple records in oriento / orientjs and transaction in waterline

六月ゝ 毕业季﹏ 提交于 2019-12-04 22:11:42
How can I select or update multiple records in oriento? Like in waterline we can offersModel.update({id:items_ids,status:INACTIVE},{status:ACTIVE}) But in waterline transaction is not available. So I want to use : var db = offersModel.getDB(); var trans = db.begin(); trans.update('offers') .set({status:INACTIVE}) .where({id:items_ids,status:ENM.SELLING_STATUS.ACTIVE})//.exec() .then(function(offers){ if (offers.length != items_ids.length) {trans.rollback(); /* send error here*/} else trans.commit(); }) Thanks. Try this db.update(id).set({status:INACTIVE}).scalar() Have you tried following? db

How Gremlin query same sql like for search feature

做~自己de王妃 提交于 2019-12-04 20:10:18
问题 Im using OrientDB type graph. I need syntax of Gremlin for search same SQL LIKE operator LIKE 'search%' or LIKE '%search%' I've check with has and filter (in http://gremlindocs.com/). However it's must determine exact value is passed with type property. I think this is incorrect with logic of search. Thanks for anything. 回答1: Try: g.V().filter({ it.getProperty("foo").startsWith("search") }) or g.V().filter({ it.getProperty("foo").contains("search") }) 回答2: You can use filter with a bit of

Create schema for graph database with Java in OrientDB

梦想的初衷 提交于 2019-12-04 19:20:02
I'm trying to create schema for graph database in OrientDB with Java but I have two problems I can't solve. I'm using this example http://orientdb.com/docs/last/Graph-Schema.html When I use this code OServerAdmin serverAdmin = new OServerAdmin("remote:localhost").connect("root", "1234"); serverAdmin.createDatabase("mydb", "graph", "plocal"); serverAdmin.close(); I get the following error: java.lang.NoSuchMethodError: com.orientechnologies.common.concur.resource.OResourcePool.getAllResources()Ljava/util/Collection; at com.orientechnologies.orient.client.r It creates the database but nothing