You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@s2graph.apache.org by "Jong Wook Kim (JIRA)" <ji...@apache.org> on 2016/05/16 20:08:12 UTC

[jira] [Comment Edited] (S2GRAPH-72) Support Apache TinkerPop and Gremlin

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

Jong Wook Kim edited comment on S2GRAPH-72 at 5/16/16 8:07 PM:
---------------------------------------------------------------

This is solely my personal opinion:

AFAIK, s2graph focused on its JSON HTTP API (I don't want to call that REST, but let's put it aside now), more than the ease of use of Scala API. 

The current set of Scala methods are not designed as a programming API, and it makes the most basic thing such as inserting an edge connecting id "a" to "b" as complicated as:

{code:java}
val service: Service = Service.findByName("my_service").get
val serviceId: Int = service.id.get
val label: Label = Label.findByName("my_label").get
val labelId: Int = label.id.get  
val column: ServiceColumn = ServiceColumn.find(serviceId, "item_id").get
val columnId: Int = column.id.get
val src: Vertex = Vertex(VertexId(columnId, InnerVal.withStr("a", column.schemaVersion)))
val dest: Vertex = Vertex(VertexId(columnId, InnerVal.withStr("b", column.schemaVersion)))
val ts = System.currentTimeMillis()
val edge = Edge(
  src, dest, LabelWithDirection(labelId, 0),
  propsWithTs = Map(0.toByte -> InnerValLikeWithTs.withLong(ts, ts, column.schemaVersion)),
  op = GraphUtil.operations("insert")
)
graph.mutateEdges(Seq(edge))
{code}

This is because there is no simple, encapsulated layer that is between the internal abstractions ({{InnerValLikeWithTs}}, {{LabelWithDirection}}, etc) and the HTTP API implementation.

I strongly suggest that we should make an intermediate Scala API before developing a provider for TinkerPop, which will make it possible to refactor the internal abstractions (there are a lot of problems now as you know) while not affecting the upper layers like the Netty/Play servers or the provider for TinkerPop.

For instance, the above code should be transparent to programmers like:

{code:java}
val s2: org.apache.s2graph.core.Graph = ...
s2.addEdge("my_service", "my_label", "item_id", "a" -> "b")
{code}

tl;dr: current API is only friendly to JSON queries and our internal is so complicated; so we should make a Scala/JVM-friendly API before linking it to other layers such as a provider for TinkerPop 


was (Author: jongwook):
This is solely my personal opinion:

AFAIK, s2graph focused on its JSON HTTP API (I don't want to call that REST, but let's put it aside now), more than the ease of use of Scala API. 

The current set of Scala methods are not designed as a programming API, and it makes the most basic thing such as inserting an edge connecting id "a" to "b" as complicated as:

{code:java}
val service: Service = Service.findByName("my_service").get
val serviceId: Int = service.id.get
val label: Label = Label.findByName("my_label").get
val labelId: Int = label.id.get  
val column: ServiceColumn = ServiceColumn.find(serviceId, "item_id").get
val columnId: Int = column.id.get
val src: Vertex = Vertex(VertexId(columnId, InnerVal.withStr("a", column.schemaVersion)))
val dest: Vertex = Vertex(VertexId(columnId, InnerVal.withStr("b", column.schemaVersion)))
val ts = System.currentTimeMillis()
val edge = Edge(
  src, dest, LabelWithDirection(labelId, 0),
  propsWithTs = Map(0.toByte -> InnerValLikeWithTs.withLong(ts, ts, column.schemaVersion)),
  op = GraphUtil.operations("insert")
)
{code}

This is because there is no simple, encapsulated layer that is between the internal abstractions ({{InnerValLikeWithTs}}, {{LabelWithDirection}}, etc) and the HTTP API implementation.

I strongly suggest that we should make an intermediate Scala API before developing a provider for TinkerPop, which will make it possible to refactor the internal abstractions (there are a lot of problems now as you know) while not affecting the upper layers like the Netty/Play servers or the provider for TinkerPop.

For instance, the above code should be transparent to programmers like:

{code:java}
val s2: org.apache.s2graph.core.Graph = ...
s2.addEdge("my_service", "my_label", "item_id", "a" -> "b")
{code}

tl;dr: current API is only friendly to JSON queries and our internal is so complicated; so we should make a Scala/JVM-friendly API before linking it to other layers such as a provider for TinkerPop 

> Support Apache TinkerPop and Gremlin
> ------------------------------------
>
>                 Key: S2GRAPH-72
>                 URL: https://issues.apache.org/jira/browse/S2GRAPH-72
>             Project: S2Graph
>          Issue Type: Improvement
>            Reporter: Marko A. Rodriguez
>
> I posted a similar ticket when GitHub issues was the issue tracker for this project. In short, it would be great if S2Graph leveraged Apache TInkerPop (http://tinkerpop.apache.org). You can read the benefits here:
> http://tinkerpop.apache.org/providers.html
> One neat thing is that {{SparkGraphComputer}} would work over S2Graph and it would immediately get OLAP support.
> You can read a bit about Gremlin here.
> http://tinkerpop.apache.org/gremlin.html
> S2Graph would create a set of {{TraversalStrategies}} to make use of S2Graph specific optimizations such as global indices, local indices, multi-query (breadth query), etc. 
> If you are interested in this path and have any questions, the Apache TinkerPop team is more than happy to help.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)