Skip to content
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

Allow deletion of specific language. #3242

Merged
merged 3 commits into from Apr 4, 2019

Conversation

@martinmr
Copy link
Member

commented Apr 1, 2019

This change introduces the syntax "<s> <p@lang> * ." to allow users to
delete a specific language tagged value without having to specify the
current value.

Closes #3237


This change is Reviewable

This change introduces the syntax "<s> <p@lang> * ." to allow users to
delete a specific language tagged value without having to specify the
current value.
@martinmr martinmr requested a review from dgraph-io/team Apr 1, 2019
@srfrog
srfrog approved these changes Apr 1, 2019
Copy link
Contributor

left a comment

Reviewed 4 of 4 files at r1.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@srfrog
srfrog approved these changes Apr 1, 2019
Copy link
Contributor

left a comment

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@martinmr martinmr requested a review from manishrjain Apr 1, 2019
Copy link
Member

left a comment

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @manishrjain and @martinmr)

a discussion (no related file):
Can we extend this to JSON? e.g:

  {
      "delete": [
        {
          "uid": "0x12345",
         "name@es": null
        }
      ]
    }

equivalent to:

<0x12345> <name@es> * .


Copy link
Member Author

left a comment

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @manishrjain and @MichelDiz)

a discussion (no related file):

Previously, MichelDiz (Michel Conrado) wrote…

Can we extend this to JSON? e.g:

  {
      "delete": [
        {
          "uid": "0x12345",
         "name@es": null
        }
      ]
    }

equivalent to:

<0x12345> <name@es> * .

it should already work for JSON if the two representations are identical (produce the same DirectedEdge object when parsed). I'll add a test to the json parser to verify this is the case.


Copy link
Member Author

left a comment

Reviewable status: 4 of 5 files reviewed, 1 unresolved discussion (waiting on @manishrjain and @MichelDiz)

a discussion (no related file):

Previously, martinmr (Martin Martinez Rivera) wrote…

it should already work for JSON if the two representations are identical (produce the same DirectedEdge object when parsed). I'll add a test to the json parser to verify this is the case.

Added tests but this is the right syntax.

{
      "delete": [
        {
          "uid": "0x12345",
         "name@es": ""
        }
      ]
 }

Copy link
Member Author

left a comment

Reviewable status: 4 of 5 files reviewed, 1 unresolved discussion (waiting on @manishrjain and @MichelDiz)

a discussion (no related file):

Previously, martinmr (Martin Martinez Rivera) wrote…

Added tests but this is the right syntax.

{
      "delete": [
        {
          "uid": "0x12345",
         "name@es": ""
        }
      ]
 }

Done.


Copy link
Member

left a comment

Reviewable status: 4 of 5 files reviewed, 1 unresolved discussion (waiting on @manishrjain and @martinmr)

a discussion (no related file):

Previously, martinmr (Martin Martinez Rivera) wrote…

Done.

I see, the empty string works indeed. But Docs says that "rating": null is a S P * operation syntax. https://docs.dgraph.io/mutations/#deleting-edges - If empty strings are to be considered, for me it's okay.


Copy link
Member

left a comment

:lgtm:

Reviewable status: 4 of 5 files reviewed, all discussions resolved (waiting on @manishrjain)

Copy link
Member Author

left a comment

Reviewable status: 4 of 5 files reviewed, all discussions resolved (waiting on @manishrjain)

a discussion (no related file):

Previously, MichelDiz (Michel Conrado) wrote…

I see, the empty string works indeed. But Docs says that "rating": null is a S P * operation syntax. https://docs.dgraph.io/mutations/#deleting-edges - If empty strings are to be considered, for me it's okay.

This seems like a bug. The language tag is not being parsed properly. I'll revert these test changes and open a new PR to fix the bug. But otherwise, JSON support should work out of the box.


Copy link
Member

left a comment

And how would this deletion work in JSON?

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @manishrjain)

Copy link
Member Author

left a comment

I had to submit #3243 to make this work but it should work in the following way:

{
 "uid":"0xa",
"name@en":null
}

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@martinmr martinmr merged commit ad8927f into master Apr 4, 2019
5 checks passed
5 checks passed
Blockade (dgraph) TeamCity build finished
Details
CI (dgraph) TeamCity build finished
Details
GolangCI No issues found!
Details
code-review/reviewable 4 files reviewed
Details
license/cla Contributor License Agreement is signed.
Details
@martinmr martinmr deleted the martinmr/delete-lang-val branch Apr 4, 2019
dna2github added a commit to dna2fork/dgraph that referenced this pull request Jul 19, 2019
This change introduces the syntax "<s> <p@lang> * ." to allow users to
delete a specific language tagged value without having to specify the
current value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.