In my use case, I use the Live Import feature to upsert data in batches every day.
My Schema looks like this
enum Platform {
P1
P2
}
enum PlayType {
PT1
PT2
SNG
}
interface GameMetadata {
xid: String! @id @dgraph(pred: "xid")
platform: Platform
game: String!
play_type: PlayType!
}
type Situation {
xid: String! @id @dgraph(pred: "xid")
game_metadata: GameMetadata!
num_active_players: Int!
action_history: String!
Decisions: [Decision!]!
}
interface RunStats {
mean: Float!
variance: Float!
}
type Decision {
xid: String! @id @dgraph(pred: "xid")
action: String!
outcome: RunStats!
}
When I write my RDFs for this, I use the following format (showin example for Situation and Decision, but same logic applies for all):
<_:metadata1> <dgraph.type> "GameMetadata"
<_:metadata1> <GameMetadata.platform> ... # You get the idea..
...
<_:metadata1> <xid> "metadata1"
<_:situation1> <dgraph.type> "Situation"
... # all the attributres
<_:situation1> <xid> "situation1"
<_:situation1> <Situation.game_metadata> <_:metadata1>
And so forth.
Now when I run the live loader I use dgraph live -f "/my/file.rdf" --format "rdf" -x "/path/to/xid_dir" -U xid
and I always use the same xid_dir
.
But as a result, I get multiple Decision
and Situation
objects, with exact same xid
, exact same attributes but different uid
.
What am I doing wrong? How can I make sure that between live import calls the same mapping between xid and UID will remain the same?