We have an edge between two vertices in datastax graph.
How can I remove the edge from the schema itself?
I tried this:
schema.edgeLabel("belongswithin").connection("poi", "region").drop()
but there is no drop method to delete an edge like this.
I can't run:
schema.edgeLabel("belongswithin").drop()
as I am having the same edge being used between the other two vertices which I don't want to drop?
In DSE Graph, an EdgeLabel can be dropped, but not selectively for a particular connection between two VertexLabels. You don't say which version of DSE you are using, but I'm pretty certain you'll need to drop and rewrite the schema, then load your data again. If you are a DataStax customer, you might want to contact Support to see if there is any assistance they can provide.
Related
After drawing a knowledge graph with hundreds of nodes and thousands of edges on arrows.app, I want to search the graph for a node by its name to add an additional node with an edge to that node on the graph manually.
Does the site support such a feature? If so, how can I manage to search? If not, any workarounds?
What I have tried: I switched to Gephi, but I need to download an application and I can only search for the node in the data laboratory and then locate the node in the overview.
100s of nodes and 1000s of edges in arrows.app? I like it a lot, but I don't think it was meant as a tool to do what you are doing, and for that reason does not have those search capabilities.
Whatever you are doing. Did you consider moving to a graph database altogether?
I have a scenario where I may need to update the from/to vertex of an already existing edge. I dont think there is any mechanism in gremlin to do so. So, what would be an ideal approach to achieve such functionality? What I can think of is -
Assuming To Vertex changes over time in an edge, Make sure the Edge ID is unique something like "From-Relationshipname"
While adding new edges check if Edge is already present then drop old Edge using the EdgeId and create a new one
Is it an efficient way?
Check the following recipe published in Gremlin docs for moving an edge.
The "marko" vertex contains a "knows" edge to the "vadas" vertex. The following code shows how to "move" that edge to the "peter" vertex in a single traversal:
g.V().has('name','marko').as('a').
outE('knows').as('e1').filter(inV().has('name','vadas')).
V().has('name','peter').
addE('knows').from('a').as('e2').
sideEffect(select('e1').properties().
unfold().as('p').
select('e2').
property(select('p').key(), select('p').value())).
select('e1').drop()
Source: https://tinkerpop.apache.org/docs/current/recipes/#edge-move
I want to delete a node from a graph in JanusGraph but I don't know what will happen to its edges? Will they be orphaned? or will be deleted?
The low level details depend on which backend you using. I think most end-up deleting the edges all together.
For the Cassandra backend edges will be tombstoned and will later get cleaned up (more info here). This means that at first the edges will be hidden for a while and later the data records will be removed.
Either way you won't be able to see those edges.
I am not 100% sure for all the other backends.
I created an edge without attribute and guess what? it was created but still can not query it but then i created the same edge again and now they both are having same rid>?
I suggest you to start using OrientDB from the tutorial. This is an extract:
Starting from OrientDB v1.4.x edges, by default, are managed as lightweight edges: they don't have own identities as record, but are physically stored as links inside vertices. OrientDB automatically uses Lightweight edges only when edges have no properties, otherwise regular edges are used. From the logic point of view, lightweight edges are edges at all the effects, so all the graph functions work correctly. This is to improve performance and reduce the space on disk. But as a consequence, since lightweight edges don't exist as separate records in the database, the following query will not return the lightweight edges:
SELECT FROM E
In most of the cases Edges are used from Vertices, so this doesn't cause any particular problem. In case you need to query Edges directly, even those with no properties, disable lightweight edge feature by executing this command once:
ALTER DATABASE CUSTOM useLightweightEdges=false
This will only take effect for new edges. For more information look at Troubleshooting.
You can query for a list of names of edges with:
select name from ( select expand(classes) from metadata:schema ) where superClass="E"
I am new to Neo4j.
For a given node (say, node 'n'), I am trying to find all other nodes in the graph that are in some way dependent on it. In other words, find nodes in graph who have edges directed towards node 'n'. I am getting correct nodes(lets call them c,d,e) using the following query:
MATCH (depNode)-[r]->(n:AttributeNode)
WHERE n.name='testnode'
RETURN depNode
In the original graph, the nodes c and d are connected as well using a relationship. In the result of the above query, I am also receiving that relationship (edge between c and d). How do I get rid of that edge in my output?
If I get your question correctly, I think you're already getting the correct answer in tabular form but in the visualization form Neo4j shows the "extra edges". You should check out the tabular form and confirm whether it's correctly showing the desired output or not (which it would be).
What's happening here is the default way how the Neo4j browser works. Whenever you try to retrieve some nodes, it shows all the relationships between the nodes as well. If you want to just visualize the nodes, you cannot do that in the current version of the Neo4j browser. You will have to use visualization tools like Gephi on your database and filter your results accordingly.
As of Neo4j 2.2.0.RC1 you can disable the extra relationships being used by setting Autocomplete to Off. The toggle appears at the bottom-right of your result graph and seems to be remembered for future requests.