Loading data using pydgraph

Yes, as you mentioned earlier too, I tried loading all at once and defined a schema too. But edges aren’t formed between Movie and Person nodes.
I cannot upload a lot of data here, so attaching a small portion of it (I’ve changed the format of the RDF files slightly):

movies.rdf (321.4 KB)
persons.rdf (1.7 MB)
relationships.rdf (739.2 KB)

Here is my schema file:
data.schema (270 Bytes)

I’ll attach a screenshot showing how I’ve executed live loader and how edges aren’t forming:

I’ve just checked the code. Looks like --upsertPredicate" just works to guarantee the uniqueness of the entity itself. Not its connections.

Use --xidmap "~/pathTo/dgraphData/XIDs" instead.

I’ll test your data in 8+ hours.

1 Like

Still doesn’t work …

Looks like it is working

You have to use the right predicates

{
      nodeCount(func: has(<ACTED_BY>), first:10)  {
        person_name
        dgraph.type
        ACTED_BY {
          title
          budget
          revenue
          genres
          <dgraph.type>
        }
      }
    }

BTW, you need to do a cleanup in this RDFs.

For example the line

_:k_457307 <title> "Don't call him "Dimon"" .

is wrong. It should be parsed to JSON scaping method. Like bellow

_:k_457307 <title> "Don't call him \"Dimon\"" .
1 Like

Thanks a ton. Yes, it was definitely a silly mistake there. And yes, I’ve done the cleanups now.

Also,
There isn’t any documentation talking about how I can have edge attributes which would be similar to edge weights. Suppose I would want to calculate strength of nodes. Initially, the value of this strength attribute would be 0.5, and as that particular edge is found again in the updates data, I would like to increment the strength using some formula, let’s just say for now, I would like to add 0.5 to the existing strength value.

strength = strength + 0.5

How would I be able to do this in dgraph?

Have you tried Facets?
https://dgraph.io/docs/query-language/facets/#sidebar

This is not currently possible with Facets.

But when it come it would be with https://dgraph.io/docs/mutations/upsert-block/#example-of-val-function

1 Like

Sure, I’ll look into it. Thanks.