Help human encounters

Hello,

not sure if this is right forum to ask. I’m new into graph DBs.
I have task when I will receive records about people encounters:

  • peopleID1, peopleID2, time

My use case is to get all people with who was in touch specified user in some range interval (say last 14 days). It has to be transition closure.
So lets say Person1 was in touch with Person2 and Person2 with Person3. I want to query Person1, it shouldd return Person2 and Person3.

My first idea was to try GraphDB, but I don’t have any experience and I’m not sure if this is right approach.

I was looking into dgraph… For my usecase I can use @reverse edges. And to edge by using facelet add time attribute?

I would really appreciate how to insert these records.
I found something like this

{
   "set":{
      "name":"Alice",
      "encounter":{
         "name":"Betty",
         "encounter":{
            "name":"Cecilie"
         }
      }
   }
}

But is’s not really what I want. I want to add just edges and if node doesn’t exist, just creates them.

And how to query it afterwards? I found this Flattening to get unique nodes within n steps it looks similar issue like mine.
Some scoring would be great. Eg. how many times he encounters the other one, or how “deep” is the connection.

I know I got a lot of newbie questions and I don’t want from you to solve my task (it would be great :D) just point me to right direction?

I tried this

{
  "set": {
  	"uid": "0x02",
  	"encounter": [
  		{
  			"uid": "0x03",
  			"encounter|time": "2020-06-01T11:59:00+00:00"
			},
      {
  			"name": "XXX",
  			"encounter|time": "2020-05-15T01:01:01+00:00"
			}]
	}
}
{
  people(func: uid(0x1))@recurse(loop: false) {
    uid
    name
    
    G as  encounter @facets(ge(time,"2020-05-25T00:00:00+00:00"))@facets(time)
  }
   test(func: uid(G), orderasc: name) {
    uid
    name
  }
}

But not sure about performance and how to do some sorting (how many encounters during specified time). Also it would be good, first and last time of encounter. (Encounter may be bad word for this? maybe interaction? idk :smiley: )

That’s the right place.

Do you mean via what? conversation? geolocation?

Go it.

it doesn’t seem necessary here in this scenario at first.

Do you mean mutate? You have to use a Client or Ratel UI. Not sure if that was the question.

That’s an upsert block. https://dgraph.io/docs/mutations/#upsert-block

Humm, that’s a bit complex. I can work on some examples. But it will take time. I think there are similar questions around here in the forum. But anyway, I can do it from the top of my mind.

Np, just wait.

Have you used our tour? A Tour of Dgraph it is a good way to get comfortable.

Cheers.