You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@s2graph.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/02/26 09:25:00 UTC

[jira] [Commented] (S2GRAPH-177) Add support for createServiceColumn/addVertex APIs on GraphQL.

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

ASF GitHub Bot commented on S2GRAPH-177:
----------------------------------------

GitHub user SteamShon opened a pull request:

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

    [S2GRAPH-177]: Add support for createServiceColumn/addVertex APIs on GraphQL.

    - add createServiceColumn.
    - add addVertex.

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

    $ git pull https://github.com/SteamShon/incubator-s2graph S2GRAPH-177

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

    https://github.com/apache/incubator-s2graph/pull/134.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 #134
    
----
commit 4aaebbf51b9d90e876b67cc7aa4cae49a0ffca56
Author: DO YUNG YOON <st...@...>
Date:   2018-02-26T09:22:31Z

    - addVertex.
    - createServiceColumn.

----


> Add support for createServiceColumn/addVertex APIs on GraphQL.
> --------------------------------------------------------------
>
>                 Key: S2GRAPH-177
>                 URL: https://issues.apache.org/jira/browse/S2GRAPH-177
>             Project: S2Graph
>          Issue Type: New Feature
>            Reporter: DOYUNG YOON
>            Priority: Major
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> S2GRAPH-172 is good to start point for supporting GraphQL, but miss few important APIs for creating vertex schema and write
> Suggest adding following APIS.
> 1. createServiceColumn
> {noformat}
> mutation {
>   createServiceColumn(
>     serviceName:wiki, 
>     columnName:"user", 
>     columnType: string, 
>     props: [
>       { name: "name", dataType:string, defaultValue: "-" },
>       { name: "age", dataType:int, defaultValue: "-1" },
>       { name: "gender", dataType:string, defaultValue: "-"} 
>     ]
>   ) {
>     
>     isSuccess
>   }
> }
> {noformat}
> the user may check if 'user' serviceColumn has been created correctly.
> {noformat}
> query {
>   Services(name: wiki) {
>     serviceColumns {
>       name,
>       props {
>         id,
>         name,
>         dataType
>       }
>     }
>   }
> }
> {noformat}
> note that serviceColumn is nested under service. also, properties on 'user' vertex can be suggested through graphiQL according to the schema.
> 2. addVertex
> {noformat}
> mutation {
>   addVertex(
>     wiki:{
>       user:{
>         id:"steamshon",
>         props:{
>           name: "aha",
>           age: 30,
>           gender: "M"
>         }
>       }
>     }
>   ) {
>     isSuccess
>   }
> }
> {noformat}
> note that props can be suggested through graphiQL. 
> 3. addVertexBulk
> {noformat}
> mutation { 
>   addVertexBulk(
>     serviceName: wiki,
>     columnName: user,
>     id: "steamshon",
>     timestamp: 1,
>     props: {
>       name: "aha",
>       age: 30,
>       gender: "M"
>     }
>   ) {
>     isSuccess
>   }
> }
> {noformat}
> Not required, but simple helper for bulk load use cases.
> Once the mutation is done, vertex query can be executed as follow.
> {noformat}
> query {
>   wiki: {
>     user(id: "steamshon") {
>       name,
>       age
>     }
>   }
> }
> {noformat}
> One thing needs more discussion is the case with vertex and edge in the query.
> {noformat}
> query {
>   wiki: {
>     user(id: "steamshon") {
>       friends {
>         to
>       }
>       name,
>       age
>     }
>   }
> }
> {noformat}
> above query means return vertex id steamshon with its name, age property on it and return all friends' id(in this case to means vertex id). this requires one getVertex and getEdges call to the backend.
> {noformat}
> query {
>   wiki: {
>     user(id: "steamshon") {
>       name,
>       age,
>       friends {
>         to {
>           id,
>           name
>         }
>         post {
>           to {
>             id
>           }
>         }
>       }
>     }
>   }
> }
> {noformat}
> the last query need to return steamshon's friends's name, age property which is vertex property. This requires one getEdges call and # of edges return times getVerex call to the backend.



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