You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@s2graph.apache.org by "Daewon Jeong (JIRA)" <ji...@apache.org> on 2018/04/03 01:47:00 UTC
[jira] [Comment Edited] (S2GRAPH-199) Changing query more
intuitively by using `columnName` instead of `from/to` in label field name
[ https://issues.apache.org/jira/browse/S2GRAPH-199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16423363#comment-16423363 ]
Daewon Jeong edited comment on S2GRAPH-199 at 4/3/18 1:46 AM:
--------------------------------------------------------------
[~steamshon] I have found some problems that can occur during implementation.
If the name of the property name in the `ServiceColumn` is the same as `Label`, There may be a problem with the query.
ex)
{noformat}
Service: { Name: Kakao }
ServiceColumn: { Name: User, Service: Kakao, Props: [age: Int, like: String] }
Label: { Name: like, SourceServiceColumn: User, TargetServiceColumn: User }
{noformat}
As above, if the name of property used in ServiceColumn is `like` and the name of Label is same, the field name conflicts in the query below.
{noformat}
query {
kakao {
user {
like # The properties of the vertex and label are not available using the same name.
}
}
}
{noformat}
I will summarize the above and create a new issue.
was (Author: daewon):
[~steamshon] I have found some problems that can occur during implementation.
If the name of the property name in the `ServiceColumn` is the same as `Label`, There may be a problem with the query.
ex)
{noformat}
Service: \{ Name: Kakao }
ServiceColumn: \{ Name: User, Service: Kakao, Props: [age: Int, like: String] }
Label: \{ Name: like, SourceServiceColumn: User, TargetServiceColumn: User }
{noformat}
As above, if the name of property used in ServiceColumn is `like` and the name of Label is same, the field name conflicts in the query below.
{noformat}
query {
kakao {
user {
like # The properties of the vertex and label are not available using the same name.
}
}
}
{noformat}
I will summarize the above and create a new issue.
> 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)