tinkerpop3

Gremlin: “The provided traverser does not map to a value” when using project

我的梦境 提交于 2019-12-23 09:31:43
问题 In the Modern graph, I want to get for each person the name and the list of names of software he created. So I tried the following query g.V().hasLabel('person').project('personName','softwareNames'). by(values('name')). by(out('created').values('name').aggregate('a').select('a')) but I get the error The provided traverser does not map to a value: v[2]->[VertexStep(OUT,[created],vertex), PropertiesStep([name],value), AggregateStep(a), SelectOneStep(last,a)] The problem seems to be that vertex

How to get a subgraph consisting of all vertices, that satisfy specific condition

妖精的绣舞 提交于 2019-12-21 21:24:51
问题 The Document and the Revision are two objects that reside in our domain logic specific layer. The Document represents an abstraction around any material piece of paper that you could think of. That is - every contract, invoice or drawing could be called a Document . On the other hand, the material representation of the Document is the Revision : the list of paper, that construction engineer receives on site, represents a Revision of the Document that designer has created. If something in a

Why do you need to fold/unfold using coalesce for a conditional insert?

天涯浪子 提交于 2019-12-18 21:51:11
问题 I'm trying to understand how this pattern for a conditional insert works: g.V() .hasLabel('person').has('name', 'John') .fold() .coalesce( __.unfold(), g.addV('person').property('name', 'John') ).next(); What is the purpose of the fold/unfold? Why are these necessary, and why does this not work: g.V() .coalesce( __.hasLabel('person').has('name', 'John'), g.addV('person').property('name', 'John') ).next(); The fold-then-unfold pattern seems redundant to me and yet the above does not yield the

Graph/Gremlin for social media use case

耗尽温柔 提交于 2019-12-17 21:17:43
问题 Consider instagram feed scenario. I want to get all the posts 'posted' by the people I follow. For each of these posts I want to know whether I have liked it or not and also know which of the other people I follow have liked it (if any). What is the best solution to get this in gremlin (possibly avoiding duplication)? Image for clarity The following just gives the posts 'posted' by USER 2. How to get other information in the same query? g.V().has('ID','USER 2').out('posted') 回答1: When you ask

Unable to print node properties in DSE graph

我只是一个虾纸丫 提交于 2019-12-14 03:29:08
问题 Apologies as this might be very basic question on the topic but I am new to Gremlin/DSE Graph and i tried many ways to extract data i am inserting to my graph but somehow i am unable to make it work. Here is what i have: 1. Graph with allow_scans set to true 2. Schema with propertyKey and vertexes defined and materialized index on NodeID of all Vertexes. There are no relationships right now, just vertexes with data points. I wrote a program to insert all my nodes to DSE Graph which is working

gremlin python - add multiple but an unknown number of properties to a vertex

时间秒杀一切 提交于 2019-12-13 16:43:32
问题 I want to add more than one property to a vertex, but from the outset do not explicitly know what those properties might be. For example, say for one person to be added as vertex to the graph, we have the following property dictionary: Person 1 { "id": 1, "first_name": "bob", "age": 25, "height": 177 } Maybe for another vertex to be added, a person has the following properties: Person 2 { "id": 2, "first_name": "joe", "surname": "bloggs", "occupation": "lawyer", "birthday": "12 September" }

Tinkerpop: Set Label After Creating Vertex

六月ゝ 毕业季﹏ 提交于 2019-12-13 00:53:45
问题 Is there a way to set the T.label after the vertex has been created. I have tried the following: Vertex v = graph.addVertex(); v.property(T.label.name(), "test"); But when I try the following traversal: graph.traversal().V().hasLabel("test").next I get org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException Is there something special about T.label that limits it to being set at the step of constructing the vertex ? 回答1: No, labels cannot be changed. If you need this

Gremlin group by vertex property and get sum other properties in the same vertex

你。 提交于 2019-12-12 18:27:46
问题 We have vertex which will store various jobs and their types and counts as properties. I have to group by the status and their counts. I tried the following query which works for one property(receiveCount) g.V().hasLabel("Jobs").has("Type",within("A","B","C")).group().by("Type").by(fold().match(__.as("p").unfold().values("receiveCount").sum().as("totalRec")).select("totalRec")).next() I wanted to give 10 more properties like successCount, FailedCount etc.. Is there a better way to give that?

Can I customize a Jackson ObjectMapper by adding a module?

我们两清 提交于 2019-12-12 17:18:47
问题 I am using a library that creates an ObjectMapper and adds some Module s of its own to this mapper. I would like the serializers in these modules to pretty print. However, my only access to configure this mapper is via a builder that lets me add my own modules. Can I use my ability to add modules to the ObjectMapper to configure it to pretty print? I'm not seeing any methods or properties of SimpleModule suggesting that I can. 回答1: Yes, if you can register a Module with an ObjectMapper , you

Gremlin, How to add edge to existing vertex in gremlin-python

ぐ巨炮叔叔 提交于 2019-12-12 05:26:52
问题 I am trying to add edge to an existing node in gremlin-python. But graph traversal(g) object do not have addE method and vertex do not have addEdge method. 回答1: You can do it with a mid-traversal V() : >>> vFrom = g.V(1).next() >>> vTo = g.V(6).next() >>> g.V(vTo).as_('t').V(vFrom).addE("knows").to("t").toList() [e[13][1-knows->6]] I did learn that there is a bug that prevents this approach that uses withSideEffect() in TinkerPop 3.2.4: >>> g.withSideEffect("t",vTo).V(vFrom).addE("knows").to(