I have a csv file containing producers and consumers of some topics. e.g
Producer,Topic,Consumer
PRODUCER-1,TOPIC-A,CONSUMER-1
PRODUCER-2,TOPIC-B,CONSUMER-2
CONSUMER-2,TOPIC-F,CONSUMER-5
It's loaded in zeppelin notebook as a dataframe and accessed via neo4j context via neo4j interpreter.
val pubSubDf = spark.read.option("header", "true") // Use first line of all files as header
.format("com.databricks.spark.csv")
.schema(topicSchema)
.load("/data/pubsub.tsv")
val consumer = ("Consumer", Seq("Consumer")) // Consumer node, with Consumer property
val consumes = ("Consumes", Seq.empty)
val topic = ("Topic", Seq("Topic")) // Topic node, with Topic property
val producer = ("Producer", Seq("Producer"))
val produces = ("Produces", Seq.empty)
Neo4jDataFrame.mergeEdgeList(sc, pubSubDf, consumer, consumes, topic)
Neo4jDataFrame.mergeEdgeList(sc, pubSubDf, producer, produces, topic)
MATCH (consumer:Consumer{Consumer: '${Consumer}'})-[consumes:Consumes]->(topic:Topic), (producer:Producer)-[produces:Produces]->(topic) RETURN consumer, consumes, topic, producer, produces
How do I capture a relationship where a consumer is also a producer to another topic pls? I want one graph that includes all nodes including TOPIC-B<--CONSUMER-2--->TOPIC-F
. At the moment, CONSUMER-2
is dangling.
Thanks