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
Merged

Conversation

martinmr
Copy link
Contributor

@martinmr martinmr 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 a team April 1, 2019 21:51
Copy link
Contributor

@srfrog srfrog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

@srfrog srfrog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

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

@martinmr martinmr requested a review from manishrjain April 1, 2019 21:56
Copy link
Contributor

@MichelDiz MichelDiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Contributor Author

@martinmr martinmr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Contributor Author

@martinmr martinmr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Contributor Author

@martinmr martinmr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Contributor

@MichelDiz MichelDiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Contributor

@MichelDiz MichelDiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

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

Copy link
Contributor Author

@martinmr martinmr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And how would this deletion work in JSON?

:lgtm:

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

Copy link
Contributor Author

@martinmr martinmr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@martinmr martinmr deleted the martinmr/delete-lang-val branch April 4, 2019 00:56
dna2github pushed 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
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants