OrientDB how to move a vertex and maintain relations - orientdb

The title pretty much says all. I want to move a record in OrientDB from the 'Asset' class to a new class (that keeps the old version of the class 'Asset'). This is possible with MOVE VERTEX x to y. However this creates a new #RID for the node and I don't want to update all relations of the old RID to the new #RID, because this is too expensive.
Is there a solution for this?
Any help is greatly appreciated, if you need more info, please do ask.

MOVE VERTEX takes care of updating all the edges to the new #RID.

Related

Use of collections to describe pedestrians location at PedSource

Benjamin, thanks for your reply. I really appreciate your answer because you know how desperate one gets when one has no idea what to try.
I did it using the suggestion to select the nodes and right-click, create collection. I must be forgetting something because it didn't work for me.
COLLECTION DEFINITION
Let's see if I'm understanding, in the Anylogic example, they use it to create pedestrians on the train platform, at the 32 doors.
I want to use that tool to avoid having to make a programming line for each room (cr) to evacuate pedestrians to a safe point.
I include the screenshot of the PedSource. I'm looking at what the light bulb has... so I should start with self or ped. But, the Anylogic model has no self and no ped. Any additional ideas?
New PedSource
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
I have been studying several of Anylogic's examples. In this case, the "Subway Platform".
SUBWAY PLATFORM LOGIC
Anylogic uses a collection of doors to simulate the train doors where pedestrians will appear, using target lines. In the PedSource, they describe it as Target Line: doors1.get(index)
SP PEDSOURCE
I want to achieve the same thing using nodes. My collection is called cr_Ele and I have written in the Ped Source > Node: cr_Ele.get(index).
My COLLECTION OF NODES
MY PEDSOURCE
Running it gives me the following error, "index cannot be resolved to a variable". Does anyone have any idea what might be causing the error?
This is my first question on this platform, I hope I did it right!
great question, well done :)
The problem is that your collection is defined as a group of Object elements, see your "Element class" entry. Compare to what AnyLogic did: Their element class is set to "Other" specifying the actual type:
You can do the same thing. Easiest is to select several of your nodes, right-click, select "Create collection". This will give you this collection:
Alternatively, you can use code-complete and learn the object types from the API.
Now, you can access individual PolygonalNode elements from your collection using `myCollection.get(0)´ (or any other index)

Easy way to view what objects depend on an object in psql?

I'm forever going in to update tables/views/procedures/functions, but need to actually drop and re-add them due to changes in complexity. Then I have to deal with the child views one at a time.
Can anyone recommend an easy/fast way of viewing all the dependencies on a postgres object?
pg_depend table is what you need. Doc here.
It is actually graph where each node is modelled using 3 attributes, each row represents edge in dependency graph. There are some pitfalls (rule-view edges are not intuitive at first sight) but it depends on what you exactly need. Recursive queries are handy to get hierarchy.

How to remove an edge connection to a vertex in OrientDB?

I created an HasAddress edge between an User and an Address vertex.
If I remove the HasAddress edge, the User vertex still shows the HasAddress connection, just empty.
Any way of removing it? Is this just a GUI thing?
this doesn't seem to work UPDATE User REMOVE HasAddress
It's not properly a GUI thing, but you can ignore it.
When you create an edge and connect it to a vertex, OrientDB creates a collection of links (a RIDBAG) as a property of the vertex. When you delete edges, the edge pointer is removed from the collection, but the collection itself is not removed.
If you really don't like that, you can run an
UPDATE User REMOVE in_HasAddress
/* or out_HasAddress if you want to remove the outgoing edges collection */
but PLEASE, make sure that the collections are EMPTY, otherwise you will break the graph consistency (you are using a document API to manipulate the graph).
My advice is to avoid it in general.

How OrientDB links physically work (to give O(1) relationship complexity and reference update)

How OrientDB links physically work?
For example, if two nodes are connected they know each other physical position (given by the cluster id and node id in the cluster), what happens to the physical references when I move one of them elsewhere? Everything is updated automatically? There is some source of information about that?
Same thing about the O(1) relationship complexity, I don't find nothing about that (only "OrientDB handles relationships as physical links to the records and assigns them only once, when the edge is created. That is, O(1)").
The only information I found are and nothing more
http://orientdb.com/docs/last/Tutorial-Relationships.html#the-problem-with-joins
I need more specific information about that.
UPDATE: found the information I needed thanks to Luca Garulli
Physical position update: MOVE VERTEX SQL command
O(1) complexity: http://www.slideshare.net/lvca/how-graph-databases-started-the-multi-model-revolution (key point at 33)
I do not know how much detail you want to get down, but other information about RID and Computational Complexity, you can find them at these links:
2.1 tutorial
[Design question] Record IDs

OrientDB shortest path with dynamic weight?

I am trying to create a graph in OrientDB where the weight of edges has to be calculated on demand using data from another database. I would like to know if there is a way to do this, since all example I´ve seen use static weight properties, none of which is dynamic by nature.
If I could use a stored function as a property and have it evaluate each time I call shortestPath then it would solve my problem, but I haven´t found any documentation on this topic.
Help would be greatly appreciated!
This isn't supported by OrientDB out of the box, even if it would be something nice to have. Could you open a new issue?
About the solution I suggest to clone the OSQLFunctionDijkstra class, do your changes and plug into OrientDB engine with a different name.