I think this is a modeling problem, not a Dgraph problem.
I’m assuming you have something like this:
_:car <parts> _:tire .
and you want to do something like:
_:car <parts> _:tire (position="Left-Front" ) .
_:car <parts> _:tire (location="Right-Front") .
_:car <parts> _:tire (location="Left-Rear") .
_:car <parts> _:tire (location="Right-Rear") .
which is not possible because the last triple would overwrite the first being that it is the same edge.
I think the original intent is that it is the same part number, so you want it to be a singular part using the part number for the xid of the node.
And herein is where I realized what you were trying to do.
This is why NASA and other engineering teams use property graphs. It can easily be seen what all a single change to a single part affects to the whole. If there is a failure of a bolt it can be found quickly every place that uses that same bolt. So as you stated:
Which I think if you step back you see that you answered the question yourself . Model the location as a node, then your parts don’t have to be duplicate nodes.
type Part {
partNumber
connectsTo
}
type Connection {
reference
}
partNumber: string @index(hash) @xid .
connectsTo: [uid] @reverse .
reference: string @index(hash)
And data could be:
_:rimX <partNumber> "RIM" .
_:boltY <partNumber> "BOLT" .
_:location_1 <reference> "Location 1" .
_:location_2 <reference> "Location 2" .
_:location_3 <reference> "Location 3" .
_:location_4 <reference> "Location 4" .
_:rimX <connectsTo> _:location_1 .
_:rimX <connectsTo> _:location_2 .
_:rimX <connectsTo> _:location_3 .
_:rimX <connectsTo> _:location_4 .
_:boltY <connectsTo> _:location_1 .
_:boltY <connectsTo> _:location_2 .
_:boltY <connectsTo> _:location_3 .
_:boltY <connectsTo> _:location_4 .
Using this model you could query to get all parts that are connected with said bolt:
query {
var(func: eq(partNumber,"BOLT")) {
connectsTo {
linkedParts as ~connectsTo
}
}
affectedParts(func: uid(linkedParts)) {
uid
partNumber
}
}
And you can still query how many of the same part are needed when replacing a connecting part.