-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON mutation, Support facets for value edge lists #4581
Comments
The old way of doing facets between edges still works. So there are no changes to it. Just in the List Type. For list-type facets I think it is pretty okay to be like this:
{
q(func: has(nickname)) @filter(eq(name,"Julian")) {
nickname @facets
}
} Result: {
"q": [
{
"nickname|kind": {
"0": "first",
"1": "official",
"2": "CS-GO"
},
"nickname": [
"Jay-Jay",
"Jules",
"JB"
]
}
]
} The JSON mutation executed {
"set": [
{
"uid": "_:Julian",
"name": "Julian",
"nickname|kind": "first",
"nickname": "Jay-Jay"
},
{
"uid": "_:Julian",
"nickname|kind": "official",
"nickname": "Jules"
},
{
"uid": "_:Julian",
"nickname|kind": "CS-GO",
"nickname": "JB"
}
]
} In RDF {
set {
_:Blank <nickname> "Cesc" (kind="friends") .
_:Blank <nickname> "Francesc" (kind="official") .
_:Blank <nickname> "Tete" .
}
} |
Docs added, waiting for review. #4582 |
I haven't thought about reusing the same blanknode multiple times. Concerning the benefits of the JSON mutation format in the docs (Source: https://docs.dgraph.io/mutations/#json-mutation-format)
This is not true because, at least for edge value lists, the serialization/deserialization format aren't the same. |
Hey @emile-tawfik , Thanks for reporting this issue, only an avid Dgraph user could notice such tricky inconsistencies :) |
Hi all, we have discussed facets format internally and prepared one document with different possible formats. Please checks below discuss post and provide your feedback. |
Fixes: #4798, #4581, #4907 DGRAPH-1109, DGRAPH-1062, DGRAPH-1143 This is PR changes facets format as discussed in the post: https://discuss.dgraph.io/t/facets-format-in-mutation-requests-and-query-responses/6416 After this PR is merged response/requests formats will look like as below: Current UID predicate facets query response: { "data": { "q": [ { "name": "San Francisco", "state": { "name": "California" }, "state|capital": false } ] } } New UID predicate facets query response: { "data": { "q": [ { "name": "San Francisco", "state": { "name": "California", "state|capital": false } } ] } } Current UID list predicate facets query response: { "data": { "q": [ { "name": "Alice", "speaks": [ { "name": "Spanish" }, { "name": "Chinese" } ], "speaks|fluent": { "0": true, "1": false } } ] } } New UID list predicate facets query response: { "data": { "q": [ { "name": "Alice", "speaks": [ { "name": "Spanish", "speaks|fluent": true }, { "name": "Chinese", "speaks|fluent": false } ] } ] } } Current scalar list predicate facets mutation request: { "set": [ { "uid": "_:1", "nickname": "Joshua", "nickname|kind": "official" }, { "uid": "_:1", "nickname": "David" }, { "uid": "_:1", "nickname": "Josh", "nickname|kind": "friends" } ] } New scalar list predicate facets mutation request: { "set": { "uid": "_:1", "nickname": ["Joshua", "David", "Josh"], "nickname|kind": { "0": "official", "2": "friends" } } } NOTE: there is no change in the request/response facets format for scalar predicate type.
Fixed in #5424 |
Fixes: hypermodeinc#4798, hypermodeinc#4581, hypermodeinc#4907 DGRAPH-1109, DGRAPH-1062, DGRAPH-1143 This is PR changes facets format as discussed in the post: https://discuss.dgraph.io/t/facets-format-in-mutation-requests-and-query-responses/6416 After this PR is merged response/requests formats will look like as below: Current UID predicate facets query response: { "data": { "q": [ { "name": "San Francisco", "state": { "name": "California" }, "state|capital": false } ] } } New UID predicate facets query response: { "data": { "q": [ { "name": "San Francisco", "state": { "name": "California", "state|capital": false } } ] } } Current UID list predicate facets query response: { "data": { "q": [ { "name": "Alice", "speaks": [ { "name": "Spanish" }, { "name": "Chinese" } ], "speaks|fluent": { "0": true, "1": false } } ] } } New UID list predicate facets query response: { "data": { "q": [ { "name": "Alice", "speaks": [ { "name": "Spanish", "speaks|fluent": true }, { "name": "Chinese", "speaks|fluent": false } ] } ] } } Current scalar list predicate facets mutation request: { "set": [ { "uid": "_:1", "nickname": "Joshua", "nickname|kind": "official" }, { "uid": "_:1", "nickname": "David" }, { "uid": "_:1", "nickname": "Josh", "nickname|kind": "friends" } ] } New scalar list predicate facets mutation request: { "set": { "uid": "_:1", "nickname": ["Joshua", "David", "Josh"], "nickname|kind": { "0": "official", "2": "friends" } } } NOTE: there is no change in the request/response facets format for scalar predicate type.
Hi,
This issue follows this one #4081 and this PR #4267.
#4267 changes the output format, but does not reflect thoses changes for the input JSON mutation format.
This cause 2 issues:
I think the JSON mutation format should be modified accordingly to the output format.
Below are some examples of the modified JSON input : (coming from #4081 (comment))
Facets on a singular value predicate
Schema:
<name>: string .
Old-Data:
Data:
Query:
Result:
Facets on lists of value predicates
Schema:
<nickname>: [string] .
Old-Data:
Impossible to write
Data:
Query:
Result:
Facets on a singular object predicate
Schema:
Old-Data:
Data:
Query:
Result:
Facets on a list of object predicates
Schema:
Old-Data:
Data:
Query:
Result:
The text was updated successfully, but these errors were encountered: