[ 
https://issues.apache.org/jira/browse/S2GRAPH-199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16425052#comment-16425052
 ] 

Daewon Jeong edited comment on S2GRAPH-199 at 4/5/18 7:41 AM:
--------------------------------------------------------------

GitHub user daewon opened a pull request:

[https://github.com/apache/incubator-s2graph/pull/153]

S2GRAPH-199 Changing query more intuitively by using `columnName` instead of 
`from/to` in label field name

As suggested in Jira, I changed the `ServiceColumn` field name in the `Label` 
level to match the Target/Source column name on `Label` schema.
 I have added a `props` field to resolve name conflicts that can occur at this 
time.

Therefore, you can access the property of `ServiceColumn` or `Label` by 
sub-selecting the `props` field as shown below.
 (There is also a property name field as it is.)
{noformat}
{
  kakao {
    user(id: "daewon") {
      id
      friends(direction: out) {
        props {
          score
        }
        score
        user {
          id
          age
          friends(direction: in) {
            user {
              id
              age
            }
            direction
          }
        }
      }
    }
  }
}
{noformat}
 

You can merge this pull request into a Git repository by running:

$ git pull [https://github.com/daewon/incubator-s2graph] S2GRAPH-199

Alternatively you can review and apply these changes as the patch at:

[https://github.com/apache/incubator-s2graph/pull/153.patch]

To close this pull request, make a commit to your master/trunk branch
 with (at least) the following in the commit message:

This closes #153
----
commit afc22d7ef56d1d79d4ce22f77303d57ea46fe36d
 Author: daewon <daewon@...>
 Date: 2018-04-02T09:39:03Z

first try, make conencted label recursive

commit da15232cf151a89184f9be498db31e2f3877edf8
 Author: daewon <daewon@...>
 Date: 2018-04-03T06:27:58Z

Changing query more intuitively by using `columnName` instead of `from/to` in 
label field name

commit a68e194717bc2483a4349a973eb3cb17fe1af2e6
 Author: daewon <daewon@...>
 Date: 2018-04-04T05:46:59Z

add query limit
----


was (Author: githubbot):
GitHub user daewon opened a pull request:

    https://github.com/apache/incubator-s2graph/pull/153

    [S2GRAPH-199] Changing query more intuitively by using `columnName` instead 
of `from/to` in label field name

    As suggested in Jira, I changed the `ServiceColumn` field name in the 
`Label` level to match the Target/Source column name  on `Label` schema.
    I have added a `props` field to resolve name conflicts that can occur at 
this time.
    
    Therefore, you can access the property of `ServiceColumn` or `Label` by 
sub-selecting the `props` field as shown below.
    (There is also a property name field as it is.)
    
    ```graphql
    query {
      kakao {
        user(id: "daewon") {
          id
          friends(direction: out) {
            props {
              score
            }
            score # shorcut score props
            user {
              id
              age
              friends(direction: in) {
                user {
                  id
                  age
                }
                direction
              }
            }
          }
        }
      }
    }
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/daewon/incubator-s2graph S2GRAPH-199

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-s2graph/pull/153.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #153
    
----
commit afc22d7ef56d1d79d4ce22f77303d57ea46fe36d
Author: daewon <daewon@...>
Date:   2018-04-02T09:39:03Z

    first try, make conencted label recursive

commit da15232cf151a89184f9be498db31e2f3877edf8
Author: daewon <daewon@...>
Date:   2018-04-03T06:27:58Z

    Changing query more intuitively by using `columnName` instead of `from/to` 
in label field name

commit a68e194717bc2483a4349a973eb3cb17fe1af2e6
Author: daewon <daewon@...>
Date:   2018-04-04T05:46:59Z

    add query limit

----


> Changing query more intuitively by using `columnName` instead of `from/to` in 
> label field name
> ----------------------------------------------------------------------------------------------
>
>                 Key: S2GRAPH-199
>                 URL: https://issues.apache.org/jira/browse/S2GRAPH-199
>             Project: S2Graph
>          Issue Type: Improvement
>          Components: s2graphql
>            Reporter: Daewon Jeong
>            Assignee: Daewon Jeong
>            Priority: Major
>              Labels: usability
>
> h1. Changing query more intuitively by using `columnName` instead of 
> `from/to` in label field name
> When fetching a Label Associated with a ServiceColumn, `from/to` Is used as 
> the Label field. 
>  This indirectly represents the `source/target Column` in the Label.
> You can also query the next step based on the corresponding `from/to`.
> ColumnName defined in the Label schema to create a more intuitive query than 
> using `from/to`.
> For example, suppose you have the following Services, ServiceColumns, and 
> Label.
> {noformat}
> service = Service(name: kakao)
> userColumn = ServiceColumn(serviceName: kakao, name: user)
> movieColumn = ServiceColumn(serviceName: kakao, name: movie)
> Label(name: like, sourceServiceColumn: userColumn, targetServiceColumn: 
> movieColumn)
> {noformat}
> h2. Let's take an example of a query that comes from a user who likes movies 
> that user 'daewon' likes.
> As is
> {noformat}
> query {
>   kakao {
>     user(id: "daewon") {
>       like(direction: out) { # By Label(like) shcmea, direction is fixed in 
> `out`
>         score
>         to { # `to` Represents the targetServiceColumn (movie) of `like` 
> label.
>           id
>           like(direction: in) { # By Label(like) shcmea, direction is fixed 
> in `in`
>             score
>             from { # In the case of the in direction, it is confused because 
> the directions `from` and `to` are relatively determined.
>               id
>               age
>             }
>           }
>         }
>       }
>     }
>   }
> }
> {noformat}
> To be
> {noformat}
> query {
>   kakao {  
>     user(id: "daewon") {      
>       like { # For a Label(like) started with serviceColumn(user), the 
> direction is fixed to `out`.
>         score            
>         movie { 
>           id         
>           like { # For a Label(like) started with serviceColumn(movie), the 
> direction is fixed to `in`.
>             score              
>             user { 
>               id
>               age
>             }      
>           }  
>         }
>       }
>     }
>   }
> }
> {noformat}
> As you can see in the example above, we can know in advance how to query 
> `like` label according to the starting column(user/movie), and also use field 
> name instead of `from/to` to use columnName.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to