[05/20] incubator-s2graph git commit: merge S2GRAPH-249
merge S2GRAPH-249 Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/f41ab569 Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/f41ab569 Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/f41ab569 Branch: refs/heads/master Commit: f41ab569345e9180e8f66355422bbeb7548f0670 Parents: 1dda954 Author: daewon Authored: Thu Nov 29 18:55:39 2018 +0900 Committer: daewon Committed: Thu Nov 29 18:55:39 2018 +0900 -- .../apache/s2graph/http/PlayJsonSupport.scala | 42 - .../apache/s2graph/http/S2GraphAdminRoute.scala | 95 ++-- .../s2graph/http/S2GraphMutateRoute.scala | 55 .../apache/s2graph/http/AdminRouteSpec.scala| 4 +- .../apache/s2graph/http/MutateRouteSpec.scala | 8 +- 5 files changed, 91 insertions(+), 113 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f41ab569/s2http/src/main/scala/org/apache/s2graph/http/PlayJsonSupport.scala -- diff --git a/s2http/src/main/scala/org/apache/s2graph/http/PlayJsonSupport.scala b/s2http/src/main/scala/org/apache/s2graph/http/PlayJsonSupport.scala index 8b4e91c..244e588 100644 --- a/s2http/src/main/scala/org/apache/s2graph/http/PlayJsonSupport.scala +++ b/s2http/src/main/scala/org/apache/s2graph/http/PlayJsonSupport.scala @@ -6,7 +6,7 @@ import akka.http.scaladsl.marshalling.{Marshaller, ToEntityMarshaller} import akka.http.scaladsl.model._ import akka.http.scaladsl.unmarshalling.{FromEntityUnmarshaller, Unmarshaller} import akka.util.ByteString -import play.api.libs.json.{JsValue, Json} +import play.api.libs.json._ trait PlayJsonSupport { @@ -31,4 +31,44 @@ trait PlayJsonSupport { case data => Json.parse(data.decodeString(Charset.forName("UTF-8"))) } } + + trait ToPlayJson[T] { +def toJson(msg: T): JsValue + } + + import scala.language.reflectiveCalls + + object ToPlayJson { +type ToPlayJsonReflective = { + def toJson: JsValue +} + +implicit def forToJson[A <: ToPlayJsonReflective] = new ToPlayJson[A] { + def toJson(js: A) = js.toJson +} + +implicit def forPlayJson[A <: JsValue] = new ToPlayJson[A] { + def toJson(js: A) = js +} + } + + implicit object JsErrorJsonWriter extends Writes[JsError] { +def writes(o: JsError): JsValue = Json.obj( + "errors" -> JsArray( +o.errors.map { + case (path, validationErrors) => Json.obj( +"path" -> Json.toJson(path.toString()), +"validationErrors" -> JsArray(validationErrors.map(validationError => Json.obj( + "message" -> JsString(validationError.message), + "args" -> JsArray(validationError.args.map { +case x: Int => JsNumber(x) +case x => JsString(x.toString) + }) +))) + ) +} + ) +) + } + } http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f41ab569/s2http/src/main/scala/org/apache/s2graph/http/S2GraphAdminRoute.scala -- diff --git a/s2http/src/main/scala/org/apache/s2graph/http/S2GraphAdminRoute.scala b/s2http/src/main/scala/org/apache/s2graph/http/S2GraphAdminRoute.scala index 9bf7eb4..47ac86a 100644 --- a/s2http/src/main/scala/org/apache/s2graph/http/S2GraphAdminRoute.scala +++ b/s2http/src/main/scala/org/apache/s2graph/http/S2GraphAdminRoute.scala @@ -12,30 +12,9 @@ import play.api.libs.json._ import scala.util._ -object S2GraphAdminRoute { - - trait AdminMessageFormatter[T] { -def toJson(msg: T): JsValue - } - - import scala.language.reflectiveCalls - - object AdminMessageFormatter { -type ToPlayJson = { - def toJson: JsValue -} - -implicit def toPlayJson[A <: ToPlayJson] = new AdminMessageFormatter[A] { - def toJson(js: A) = js.toJson -} - -implicit def fromPlayJson[T <: JsValue] = new AdminMessageFormatter[T] { - def toJson(js: T) = js -} - } - - def toHttpEntity[A: AdminMessageFormatter](opt: Option[A], status: StatusCode = StatusCodes.OK, message: String = ""): HttpResponse = { -val ev = implicitly[AdminMessageFormatter[A]] +object S2GraphAdminRoute extends PlayJsonSupport { + def toHttpEntity[A: ToPlayJson](opt: Option[A], status: StatusCode = StatusCodes.OK, message: String = ""): HttpResponse = { +val ev = implicitly[ToPlayJson[A]] val res = opt.map(ev.toJson).getOrElse(Json.obj("message" -> message)) HttpResponse( @@ -44,9 +23,9 @@ object S2GraphAdminRoute { ) } - def toHttpEntity[A: AdminMessageFormatter](opt: Try[A]): HttpResponse = { -val ev = implicitly[AdminMessageFormatter[A]] -val (status,
[12/20] incubator-s2graph git commit: add vertex manage
add vertex manage Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/6414cb77 Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/6414cb77 Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/6414cb77 Branch: refs/heads/master Commit: 6414cb777cc951c049843a0032fa100abdc21f2a Parents: 0a2707d Author: daewon Authored: Thu Dec 27 16:00:08 2018 +0900 Committer: daewon Committed: Thu Dec 27 16:00:08 2018 +0900 -- doc/source/api/index.rst | 5 +- doc/source/api/management.rst | 444 - doc/source/api/read.rst | 0 doc/source/api/write.rst | 0 4 files changed, 2 insertions(+), 447 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/6414cb77/doc/source/api/index.rst -- diff --git a/doc/source/api/index.rst b/doc/source/api/index.rst index 63276bc..df495ab 100644 --- a/doc/source/api/index.rst +++ b/doc/source/api/index.rst @@ -13,6 +13,5 @@ Contents: .. toctree:: :maxdepth: 2 - management - write - read + management/index + mutate/index http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/6414cb77/doc/source/api/management.rst -- diff --git a/doc/source/api/management.rst b/doc/source/api/management.rst deleted file mode 100644 index 516651c..000 --- a/doc/source/api/management.rst +++ /dev/null @@ -1,444 +0,0 @@ -Management APIs -== -Admin Apis for Management Service, Label, Index .. - - -Create a Service - - -``Service`` is the top level abstraction in S2Graph which could be considered as a database in MySQL. - -.. code:: bash - - POST /admin/createService - -Service Fields - -In order to create a Service, the following fields should be specified in the request. - -.. csv-table:: Option - :header: "Field Name", "Definition", "Data Type", "Example", "Note" - :widths: 15, 30, 30, 30, 30 - - "serviceName", "User defined namespace", "String", "talk_friendship", "Required" - "cluster", "Zookeeper quorum address", "String", "abc.com:2181,abd.com:2181", "Optional" - "hTableName", "HBase table name", "String", "test", "Optional" - "hTableTTL","Time to live setting for data","Integer", "86000", "Optional" - "preSplitSize", "Factor for the table pre-split size", "Integer", "1", "Optional" - -.. list - - By default, S2Graph looks for "hbase.zookeeper.quorum" in your application.conf. If "hbase.zookeeper.quorum" is undefined, this value is set as "localhost". - - -Basic Service Operations --- - -You can create a service using the following API: - -.. code:: bash - - curl -XPOST localhost:9000/admin/createService -H 'Content-Type: Application/json' -d ' - { - "serviceName": "s2graph", - "cluster": "address for zookeeper", - "hTableName": "hbase table name", - "hTableTTL": 86000, - "preSplitSize": 2 - }' - - - -Create a Label - - -A ``Label`` represents a relation between two serviceColumns. Labels are to S2Graph what tables are to RDBMS since they contain the schema information, i.e. descriptive information of the data being managed or indices used for efficient retrieval. -In most scenarios, defining an edge schema (in other words, label) requires a little more care compared to a vertex schema (which is pretty straightforward). -First, think about the kind of queries you will be using, then, model user actions or relations into ``edges`` and design a label accordingly. - -.. code:: bash - - POST /admin/createLabel - -Label Fields - -A Label creation request includes the following information. - -.. csv-table:: Option - :header: "Field Name", "Definition", "Data Type", "Example", "Note" - :widths: 15, 30, 30, 30, 30 - - "label","Name of the relation", "String", "talk_friendship", "Required" - "srcServiceName", "Source column's service","String", "kakaotalk", "Required" - "srcColumnName", "Source column's name","String", "user_id", "Required" - "srcColumnType", "Source column's data type","Long/Integer/String", "string", "Required" - "tgtServiceName", "Target column's service","String", "kakaotalk/kakaomusic", "Optional" - "tgtColumnName", "Target column's name","String", "item_id", "Required" - "tgtColumnType", "Target column's data type", "Long/Integer/String", "string", "Required" - "isDirected", "Wether the label is directed or undirected", "True/False", "true/false",
[02/20] incubator-s2graph git commit: add PlayJsonSupport
add PlayJsonSupport Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/4154bbe1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/4154bbe1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/4154bbe1 Branch: refs/heads/master Commit: 4154bbe1605a1fc7f4b8cae6fda71ecf8b317319 Parents: a16ecb0 Author: daewon Authored: Wed Nov 28 13:51:43 2018 +0900 Committer: daewon Committed: Wed Nov 28 14:28:53 2018 +0900 -- build.sbt | 2 +- .../apache/s2graph/http/PlayJsonSupport.scala | 34 .../apache/s2graph/http/S2GraphAdminRoute.scala | 17 -- .../s2graph/http/S2GraphTraversalRoute.scala| 19 +-- .../apache/s2graph/http/AdminRouteSpec.scala| 14 5 files changed, 57 insertions(+), 29 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/4154bbe1/build.sbt -- diff --git a/build.sbt b/build.sbt index c4d2c35..1052ac6 100755 --- a/build.sbt +++ b/build.sbt @@ -47,7 +47,7 @@ lazy val s2rest_play = project.enablePlugins(PlayScala).disablePlugins(PlayLogba .enablePlugins(sbtdocker.DockerPlugin, JavaAppPackaging) lazy val s2http = project - .dependsOn(s2core) + .dependsOn(s2core, s2graphql) .settings(commonSettings: _*) .settings(dockerSettings: _*) .enablePlugins(sbtdocker.DockerPlugin, JavaAppPackaging) http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/4154bbe1/s2http/src/main/scala/org/apache/s2graph/http/PlayJsonSupport.scala -- diff --git a/s2http/src/main/scala/org/apache/s2graph/http/PlayJsonSupport.scala b/s2http/src/main/scala/org/apache/s2graph/http/PlayJsonSupport.scala new file mode 100644 index 000..8b4e91c --- /dev/null +++ b/s2http/src/main/scala/org/apache/s2graph/http/PlayJsonSupport.scala @@ -0,0 +1,34 @@ +package org.apache.s2graph.http + +import java.nio.charset.Charset + +import akka.http.scaladsl.marshalling.{Marshaller, ToEntityMarshaller} +import akka.http.scaladsl.model._ +import akka.http.scaladsl.unmarshalling.{FromEntityUnmarshaller, Unmarshaller} +import akka.util.ByteString +import play.api.libs.json.{JsValue, Json} + +trait PlayJsonSupport { + + val mediaTypes: Seq[MediaType.WithFixedCharset] = +Seq(MediaType.applicationWithFixedCharset("json", HttpCharsets.`UTF-8`, "js")) + + val unmarshallerContentTypes: Seq[ContentTypeRange] = mediaTypes.map(ContentTypeRange.apply) + + implicit val playJsonMarshaller: ToEntityMarshaller[JsValue] = { +Marshaller.oneOf(mediaTypes: _*) { mediaType => + Marshaller.withFixedContentType(ContentType(mediaType)) { +json => HttpEntity(mediaType, json.toString) + } +} + } + + implicit val playJsonUnmarshaller: FromEntityUnmarshaller[JsValue] = { +Unmarshaller.byteStringUnmarshaller + .forContentTypes(unmarshallerContentTypes: _*) + .map { +case ByteString.empty => throw Unmarshaller.NoContentException +case data => Json.parse(data.decodeString(Charset.forName("UTF-8"))) + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/4154bbe1/s2http/src/main/scala/org/apache/s2graph/http/S2GraphAdminRoute.scala -- diff --git a/s2http/src/main/scala/org/apache/s2graph/http/S2GraphAdminRoute.scala b/s2http/src/main/scala/org/apache/s2graph/http/S2GraphAdminRoute.scala index c2b832e..8efd2ab 100644 --- a/s2http/src/main/scala/org/apache/s2graph/http/S2GraphAdminRoute.scala +++ b/s2http/src/main/scala/org/apache/s2graph/http/S2GraphAdminRoute.scala @@ -10,21 +10,20 @@ import akka.http.scaladsl.server.Directives._ import org.slf4j.LoggerFactory import play.api.libs.json._ -import scala.util.Try +import scala.util._ object S2GraphAdminRoute { - import scala.util._ - trait AdminMessageFormatter[T] { def toJson(msg: T): JsValue } import scala.language.reflectiveCalls - type ToPlayJson = {def toJson: JsValue} - object AdminMessageFormatter { +type ToPlayJson = { + def toJson: JsValue +} implicit def toPlayJson[A <: ToPlayJson] = new AdminMessageFormatter[A] { def toJson(js: A) = js.toJson @@ -56,7 +55,7 @@ object S2GraphAdminRoute { } } -trait S2GraphAdminRoute { +trait S2GraphAdminRoute extends PlayJsonSupport { import S2GraphAdminRoute._ @@ -80,8 +79,7 @@ trait S2GraphAdminRoute { } lazy val createService = path("createService") { -entity(as[String]) { body => - val params = Json.parse(body) +entity(as[JsValue]) { params => val parseTry =
[09/20] incubator-s2graph git commit: update document for new api route
update document for new api route Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/455e1551 Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/455e1551 Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/455e1551 Branch: refs/heads/master Commit: 455e1551ce95dc6754ffbdf1c9311f09f16c2685 Parents: 955e21d Author: daewon Authored: Wed Dec 26 16:18:22 2018 +0900 Committer: daewon Committed: Wed Dec 26 16:18:22 2018 +0900 -- doc/source/getting_started/your_first_graph.rst | 14 .../apache/s2graph/http/S2GraphAdminRoute.scala | 34 ++-- .../scala/org/apache/s2graph/http/Server.scala | 6 ++-- 3 files changed, 28 insertions(+), 26 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/455e1551/doc/source/getting_started/your_first_graph.rst -- diff --git a/doc/source/getting_started/your_first_graph.rst b/doc/source/getting_started/your_first_graph.rst index 72d6e08..916cf53 100644 --- a/doc/source/getting_started/your_first_graph.rst +++ b/doc/source/getting_started/your_first_graph.rst @@ -11,7 +11,7 @@ The following POST query will create a service named ``KakaoFavorites`` .. code:: bash - curl -XPOST localhost:9000/graphs/createService -H 'Content-Type: Application/json' -d ' + curl -XPOST localhost:9000/admin/createService -H 'Content-Type: Application/json' -d ' { "serviceName": "KakaoFavorites", "compressionAlgorithm" : "gz" @@ -21,7 +21,7 @@ To make sure the service is created correctly, check out the following .. code:: bash - curl -XGET localhost:9000/graphs/getService/KakaoFavorites + curl -XGET localhost:9000/admin/getService/KakaoFavorites Next, we will need some friends. - @@ -29,7 +29,7 @@ In S2Graph, relationships are organized as labels. Create a ``friends`` label wi .. code:: bash - curl -XPOST localhost:9000/graphs/createLabel -H 'Content-Type: Application/json' -d ' + curl -XPOST localhost:9000/admin/createLabel -H 'Content-Type: Application/json' -d ' { "label": "friends", "srcServiceName": "KakaoFavorites", @@ -48,13 +48,13 @@ Check if the label has been created correctly: .. code:: bash - curl -XGET localhost:9000/graphs/getLabel/friends + curl -XGET localhost:9000/admin/getLabel/friends Now that the label ``friends`` is ready, we can store the friendship data. Entries of a label are called edges, and you can add edges with ``edges/insert`` API: .. code:: bash - curl -XPOST localhost:9000/graphs/edges/insert -H 'Content-Type: Application/json' -d ' + curl -XPOST localhost:9000/mutate/edge/insert -H 'Content-Type: Application/json' -d ' [ {"from":"Elmo","to":"Big Bird","label":"friends","props":{},"timestamp":1444360152477}, {"from":"Elmo","to":"Ernie","label":"friends","props":{},"timestamp":1444360152478}, @@ -95,7 +95,7 @@ We will need a new label ``post`` for this data: .. code:: bash - curl -XPOST localhost:9000/graphs/createLabel -H 'Content-Type: Application/json' -d ' + curl -XPOST localhost:9000/admin/createLabel -H 'Content-Type: Application/json' -d ' { "label": "post", "srcServiceName": "KakaoFavorites", @@ -114,7 +114,7 @@ Now, insert some posts of the users: .. code:: bash - curl -XPOST localhost:9000/graphs/edges/insert -H 'Content-Type: Application/json' -d ' + curl -XPOST localhost:9000/mutate/edge/insert -H 'Content-Type: Application/json' -d ' [ {"from":"Big Bird","to":"www.kakaocorp.com/en/main","label":"post","props":{},"timestamp":1444360152477}, {"from":"Big Bird","to":"github.com/kakao/s2graph","label":"post","props":{},"timestamp":1444360152478}, http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/455e1551/s2http/src/main/scala/org/apache/s2graph/http/S2GraphAdminRoute.scala -- diff --git a/s2http/src/main/scala/org/apache/s2graph/http/S2GraphAdminRoute.scala b/s2http/src/main/scala/org/apache/s2graph/http/S2GraphAdminRoute.scala index 47ac86a..1219968 100644 --- a/s2http/src/main/scala/org/apache/s2graph/http/S2GraphAdminRoute.scala +++ b/s2http/src/main/scala/org/apache/s2graph/http/S2GraphAdminRoute.scala @@ -56,27 +56,27 @@ trait S2GraphAdminRoute extends PlayJsonSupport { // routes impl /* GET */ - // GET /graphs/getService/:serviceName + // GET /admin/getService/:serviceName lazy val getService = path("getService" / Segment) { serviceName => val serviceOpt = Management.findService(serviceName) complete(toHttpEntity(serviceOpt, message = s"Service not found: ${serviceName}")) }
[13/20] incubator-s2graph git commit: fix csv-table warning
fix csv-table warning Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/c131990e Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/c131990e Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/c131990e Branch: refs/heads/master Commit: c131990e6d5c0a4b342d0c46f7d17727600f0f36 Parents: 6414cb7 Author: daewon Authored: Thu Dec 27 16:18:48 2018 +0900 Committer: daewon Committed: Thu Dec 27 16:18:48 2018 +0900 -- doc/source/api/management/index.rst | 444 +++ doc/source/api/mutate/index.rst | 10 + doc/source/api/mutate/mutate_edge.rst | 314 +++ doc/source/api/mutate/mutate_vertex.rst | 139 + 4 files changed, 907 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/c131990e/doc/source/api/management/index.rst -- diff --git a/doc/source/api/management/index.rst b/doc/source/api/management/index.rst new file mode 100644 index 000..17061b0 --- /dev/null +++ b/doc/source/api/management/index.rst @@ -0,0 +1,444 @@ +Management APIs +== +Admin Apis for Management Service, Label, Index .. + + +Create a Service + + +``Service`` is the top level abstraction in S2Graph which could be considered as a database in MySQL. + +.. code:: bash + + POST /admin/createService + +Service Fields +--- + +In order to create a Service, the following fields should be specified in the request. + +.. csv-table:: Option + :header: "Field Name", "Definition", "Data Type", "Example", "Note" + :widths: 15, 30, 30, 30, 30 + + "serviceName", "User defined namespace", "String", "talk_friendship", "Required" + "cluster", "Zookeeper quorum address", "String", "abc.com:2181,abd.com:2181", "Optional" + "hTableName", "HBase table name", "String", "test", "Optional" + "hTableTTL","Time to live setting for data","Integer", "86000", "Optional" + "preSplitSize", "Factor for the table pre-split size", "Integer", "1", "Optional" + +.. list + - By default, S2Graph looks for "hbase.zookeeper.quorum" in your application.conf. If "hbase.zookeeper.quorum" is undefined, this value is set as "localhost". + + +Basic Service Operations +-- + +You can create a service using the following API: + +.. code:: bash + + curl -XPOST localhost:9000/admin/createService -H 'Content-Type: Application/json' -d ' + { + "serviceName": "s2graph", + "cluster": "address for zookeeper", + "hTableName": "hbase table name", + "hTableTTL": 86000, + "preSplitSize": 2 + }' + + + +Create a Label + + +A ``Label`` represents a relation between two serviceColumns. Labels are to S2Graph what tables are to RDBMS since they contain the schema information, i.e. descriptive information of the data being managed or indices used for efficient retrieval. +In most scenarios, defining an edge schema (in other words, label) requires a little more care compared to a vertex schema (which is pretty straightforward). +First, think about the kind of queries you will be using, then, model user actions or relations into ``edges`` and design a label accordingly. + +.. code:: bash + + POST /admin/createLabel + +Label Fields +--- + +A Label creation request includes the following information. + +.. csv-table:: Option + :header: "Field Name", "Definition", "Data Type", "Example", "Note" + :widths: 15, 30, 30, 30, 30 + + "label","Name of the relation", "String", "talk_friendship", "Required" + "srcServiceName", "Source column's service","String", "kakaotalk", "Required" + "srcColumnName", "Source column's name","String", "user_id", "Required" + "srcColumnType", "Source column's data type","Long/Integer/String", "string", "Required" + "tgtServiceName", "Target column's service","String", "kakaotalk/kakaomusic", "Optional" + "tgtColumnName", "Target column's name","String", "item_id", "Required" + "tgtColumnType", "Target column's data type", "Long/Integer/String", "string", "Required" + "isDirected", "Wether the label is directed or undirected", "True/False", "true/false", "Optional. default is true" + "serviceName", "Which service the label belongs to","String", "kakaotalk", "Optional. tgtServiceName is used by default" + "hTableName", "A dedicated HBase table to your Label", "String", "s2graph-batch", "Optional. Service hTableName is used by default" + "hTableTTL", "Data time to live setting", "Integer", "86000", "Optional.
[01/20] incubator-s2graph git commit: s2http initial commit [Forced Update!]
Repository: incubator-s2graph Updated Branches: refs/heads/master ef0b6e51a -> 19254301d (forced update) s2http initial commit Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/a16ecb08 Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/a16ecb08 Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/a16ecb08 Branch: refs/heads/master Commit: a16ecb08819ea01f4498dfdd371717de56387a72 Parents: 66b656f Author: daewon Authored: Mon Nov 26 17:11:36 2018 +0900 Committer: daewon Committed: Mon Nov 26 17:32:33 2018 +0900 -- build.sbt | 8 +- s2core/src/main/resources/reference.conf| 10 +- s2http/README.md| 47 +++ s2http/build.sbt| 41 +++ s2http/src/main/resources/application.conf | 27 + s2http/src/main/resources/log4j.properties | 26 .../apache/s2graph/http/S2GraphAdminRoute.scala | 121 +++ .../s2graph/http/S2GraphTraversalRoute.scala| 65 ++ .../scala/org/apache/s2graph/http/Server.scala | 70 +++ .../apache/s2graph/http/AdminRouteSpec.scala| 61 ++ 10 files changed, 467 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/a16ecb08/build.sbt -- diff --git a/build.sbt b/build.sbt index 03e9bd0..c4d2c35 100755 --- a/build.sbt +++ b/build.sbt @@ -46,7 +46,7 @@ lazy val s2rest_play = project.enablePlugins(PlayScala).disablePlugins(PlayLogba .settings(dockerSettings: _*) .enablePlugins(sbtdocker.DockerPlugin, JavaAppPackaging) -lazy val s2rest_netty = project +lazy val s2http = project .dependsOn(s2core) .settings(commonSettings: _*) .settings(dockerSettings: _*) @@ -78,8 +78,8 @@ lazy val s2graph_gremlin = project.dependsOn(s2core) .settings(commonSettings: _*) lazy val root = (project in file(".")) - .aggregate(s2core, s2rest_play, s2jobs) - .dependsOn(s2rest_play, s2rest_netty, s2jobs, s2counter_loader, s2graphql) // this enables packaging on the root project + .aggregate(s2core, s2rest_play, s2jobs, s2http) + .dependsOn(s2rest_play, s2http, s2jobs, s2counter_loader, s2graphql) // this enables packaging on the root project .settings(commonSettings: _*) lazy val dockerSettings = Seq( @@ -124,7 +124,7 @@ Packager.defaultSettings publishSigned := { (publishSigned in s2rest_play).value - (publishSigned in s2rest_netty).value + (publishSigned in s2http).value (publishSigned in s2core).value (publishSigned in spark).value (publishSigned in s2jobs).value http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/a16ecb08/s2core/src/main/resources/reference.conf -- diff --git a/s2core/src/main/resources/reference.conf b/s2core/src/main/resources/reference.conf index 73c949a..e0681dc 100644 --- a/s2core/src/main/resources/reference.conf +++ b/s2core/src/main/resources/reference.conf @@ -53,9 +53,9 @@ db.default.url = "jdbc:h2:file:./var/metastore;MODE=MYSQL" db.default.user = "sa" db.default.password = "sa" - -akka { - loggers = ["akka.event.slf4j.Slf4jLogger"] - loglevel = "DEBUG" -} +// +//akka { +// loggers = ["akka.event.slf4j.Slf4jLogger"] +// loglevel = "DEBUG" +//} http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/a16ecb08/s2http/README.md -- diff --git a/s2http/README.md b/s2http/README.md new file mode 100644 index 000..18f43a2 --- /dev/null +++ b/s2http/README.md @@ -0,0 +1,47 @@ + +# S2Graph HTTP Layer + +## Development Setup + +### Run Server +Let's run http server. + +```bash +sbt 'project s2http' '~reStart' +``` + +When the server is running, connect to `http://localhost:8000`. If it works normally, you can see the following screen. + +```json +{ + "port": 8000, + "started_at": 1543218853354 +} +``` + +### API testing +```test +sbt 'project s2http' "test-only *s2graph.http*" +``` + +### API List + - link to S2GraphDocument http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/a16ecb08/s2http/build.sbt -- diff --git a/s2http/build.sbt b/s2http/build.sbt new file mode 100644 index 000..944493c --- /dev/null +++ b/s2http/build.sbt @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version
[18/20] incubator-s2graph git commit: fix the bug: broken test
fix the bug: broken test Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/8c3f4a28 Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/8c3f4a28 Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/8c3f4a28 Branch: refs/heads/master Commit: 8c3f4a28d4681999b04575eec250d02102d3bbd6 Parents: 4bcf9d9 Author: daewon Authored: Thu Jan 24 20:59:10 2019 +0900 Committer: daewon Committed: Thu Jan 24 20:59:10 2019 +0900 -- .../scala/org/apache/s2graph/graphql/TestGraph.scala | 2 +- .../scala/org/apache/s2graph/http/AdminRouteSpec.scala | 10 +++--- .../org/apache/s2graph/http/MutateRouteSpec.scala | 13 ++--- 3 files changed, 18 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8c3f4a28/s2graphql/src/test/scala/org/apache/s2graph/graphql/TestGraph.scala -- diff --git a/s2graphql/src/test/scala/org/apache/s2graph/graphql/TestGraph.scala b/s2graphql/src/test/scala/org/apache/s2graph/graphql/TestGraph.scala index ef01d52..dc578bb 100644 --- a/s2graphql/src/test/scala/org/apache/s2graph/graphql/TestGraph.scala +++ b/s2graphql/src/test/scala/org/apache/s2graph/graphql/TestGraph.scala @@ -85,7 +85,7 @@ class EmptyGraph(config: Config) extends TestGraph { override def cleanup(): Unit = graph.shutdown(true) - override def schema: Schema[GraphRepository, Any] = new SchemaDef(s2Repository).S2GraphSchema + override def schema: Schema[GraphRepository, Any] = new SchemaDef(s2Repository).schema override def showSchema: String = SchemaRenderer.renderSchema(schema) http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8c3f4a28/s2http/src/test/scala/org/apache/s2graph/http/AdminRouteSpec.scala -- diff --git a/s2http/src/test/scala/org/apache/s2graph/http/AdminRouteSpec.scala b/s2http/src/test/scala/org/apache/s2graph/http/AdminRouteSpec.scala index 26a7045..42ddda0 100644 --- a/s2http/src/test/scala/org/apache/s2graph/http/AdminRouteSpec.scala +++ b/s2http/src/test/scala/org/apache/s2graph/http/AdminRouteSpec.scala @@ -12,12 +12,16 @@ import org.slf4j.LoggerFactory import play.api.libs.json.{JsString, JsValue, Json} class AdminRoutesSpec extends WordSpec with Matchers with ScalaFutures with ScalatestRouteTest with S2GraphAdminRoute with BeforeAndAfterAll { - val config = ConfigFactory.load() - val s2graph = new S2Graph(config) + import scala.collection.JavaConverters._ + + val dbUrl = "jdbc:h2:file:./var/metastore_admin_route;MODE=MYSQL;AUTO_SERVER=true" + val config = +ConfigFactory.parseMap(Map("db.default.url" -> dbUrl).asJava) + lazy val s2graph = new S2Graph(config.withFallback(ConfigFactory.load())) override val logger = LoggerFactory.getLogger(this.getClass) override def afterAll(): Unit = { -s2graph.shutdown() +s2graph.shutdown(true) } lazy val routes = adminRoute http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8c3f4a28/s2http/src/test/scala/org/apache/s2graph/http/MutateRouteSpec.scala -- diff --git a/s2http/src/test/scala/org/apache/s2graph/http/MutateRouteSpec.scala b/s2http/src/test/scala/org/apache/s2graph/http/MutateRouteSpec.scala index 943db98..7a3d2ab 100644 --- a/s2http/src/test/scala/org/apache/s2graph/http/MutateRouteSpec.scala +++ b/s2http/src/test/scala/org/apache/s2graph/http/MutateRouteSpec.scala @@ -4,6 +4,7 @@ import akka.http.scaladsl.marshalling.Marshal import akka.http.scaladsl.model._ import akka.http.scaladsl.testkit.ScalatestRouteTest import com.typesafe.config.ConfigFactory +import org.apache.s2graph.core.Management.JsonModel.Prop import org.apache.s2graph.core.S2Graph import org.scalatest.concurrent.ScalaFutures import org.scalatest.{BeforeAndAfterAll, Matchers, WordSpec} @@ -11,12 +12,17 @@ import org.slf4j.LoggerFactory import play.api.libs.json.{JsValue, Json} class MutateRouteSpec extends WordSpec with Matchers with PlayJsonSupport with ScalaFutures with ScalatestRouteTest with S2GraphMutateRoute with BeforeAndAfterAll { - val config = ConfigFactory.load() - val s2graph = new S2Graph(config) + + import scala.collection.JavaConverters._ + + val dbUrl = "jdbc:h2:file:./var/metastore_mutate_route;MODE=MYSQL;AUTO_SERVER=true" + val config = +ConfigFactory.parseMap(Map("db.default.url" -> dbUrl).asJava) + lazy val s2graph = new S2Graph(config.withFallback(ConfigFactory.load())) override val logger = LoggerFactory.getLogger(this.getClass) override def afterAll(): Unit = { -s2graph.shutdown() +s2graph.shutdown(true) } lazy val routes =
[14/20] incubator-s2graph git commit: update edge mutate
update edge mutate Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/aa309b22 Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/aa309b22 Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/aa309b22 Branch: refs/heads/master Commit: aa309b220844280429841784a61e06cccafcd89d Parents: c131990 Author: daewon Authored: Thu Dec 27 17:39:13 2018 +0900 Committer: daewon Committed: Thu Dec 27 17:39:13 2018 +0900 -- doc/source/api/index.rst | 2 +- doc/source/api/mutate/mutate_edge.rst | 54 +++--- 2 files changed, 35 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/aa309b22/doc/source/api/index.rst -- diff --git a/doc/source/api/index.rst b/doc/source/api/index.rst index df495ab..e74650a 100644 --- a/doc/source/api/index.rst +++ b/doc/source/api/index.rst @@ -3,7 +3,7 @@ You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -API Glossary +HTTP API Glossary == The following is a non-exhaustive list of commonly used S2Graph APIs and their examples http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/aa309b22/doc/source/api/mutate/mutate_edge.rst -- diff --git a/doc/source/api/mutate/mutate_edge.rst b/doc/source/api/mutate/mutate_edge.rst index 1e21079..553c8a1 100644 --- a/doc/source/api/mutate/mutate_edge.rst +++ b/doc/source/api/mutate/mutate_edge.rst @@ -13,19 +13,20 @@ The following fields need to be specified when inserting an edge, and are return :header: "Field Name", "Definition", "Data Type", "Example", "Note" :widths: 15, 30, 30, 30, 30 - "timestamp","Issue time of request", "Long", "1430116731156", "Required. Unix Epoch time in milliseconds. S2Graph TTL and timestamp unit is milliseconds." + "**timestamp**","Issue time of request", "Long", "1430116731156", "Required. Unix Epoch time in milliseconds. S2Graph TTL and timestamp unit is **milliseconds**" "operation", "One of insert, delete, update, or increment", "String", "'i', 'insert'", "Required only for bulk operations. Aliases are also available: i (insert), d (delete), u (update), in (increment). Default is insert" - "from", "Id of source vertex", "Long/String", "1", "Required. Use long if possible. Maximum string byte-size is 249" - "to", "Id of target vertex", "Long/String", "101", "Required. Use long if possible. Maximum string byte-size is 249" + "from", "Id of source vertex", "Long/String", "1", "Required. Use long if possible. **Maximum string byte-size is 249**" + "to", "Id of target vertex", "Long/String", "101", "Required. Use long if possible. **Maximum string byte-size is 249**" "label","Label name", "String", "graph_test", "Required" - "direction","Direction of the edge. Should be one of out/ in/ undirected", "String", "out", "Required. Alias are also available: o (out), i (in), u (undirected)" - "props","Additional properties of the edge", "JSON (dictionary)", "{""timestamp"": 1417616431, ""affinity_score"":10, ""is_hidden"": false, ""is_valid"": true}", "Required. If in indexed properties isn't given, default values will be added" + "direction","Direction of the edge. Should be one of **out/ in/ undirected**", "String", "out", "Required. Alias are also available: o (out), i (in), u (undirected)" + "props","Additional properties of the edge", "JSON (dictionary)", "{""timestamp"": 1417616431, ""affinity_score"":10, ""is_hidden"": false, ""is_valid"": true}", "Required. **If in indexed properties isn't given, default values will be added**" Basic Edge Operations -- In S2Graph, an Edge supports five different operations. + - ``insert``: Create new edge. - ``delete``: Delete existing edge. - ``update``: Update existing edge`s state. @@ -33,6 +34,7 @@ In S2Graph, an Edge supports five different operations. - ``deleteAll``: Delete all adjacent edges from certain source vertex. (Available for strong consistency only) Edge operations work differently depending on the target label`s consistency level. + For a better understanding, please take a look at the following test cases. Create 2 different labels, one of each consistencyLevels. @@ -56,7 +58,6 @@ Then insert a same set of edges to each labels and query them as follows. Note that only one edge exist between (101, 10, s2graph_label_test, out). - .. code:: json { @@ -176,10 +177,15 @@ This time there
[10/20] incubator-s2graph git commit: add api document
add api document Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/7e4f6c81 Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/7e4f6c81 Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/7e4f6c81 Branch: refs/heads/master Commit: 7e4f6c81f61f6c718a5e8bdb4b53cb534c21c1b5 Parents: 455e155 Author: daewon Authored: Wed Dec 26 19:19:35 2018 +0900 Committer: daewon Committed: Wed Dec 26 19:19:35 2018 +0900 -- doc/source/conf.py| 2 ++ doc/source/index.rst | 1 + .../src/main/scala/org/apache/s2graph/http/Server.scala | 10 -- 3 files changed, 11 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/7e4f6c81/doc/source/conf.py -- diff --git a/doc/source/conf.py b/doc/source/conf.py index afa4c10..5736d04 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -46,6 +46,8 @@ extensions = [ 'sphinx.ext.githubpages', ] +html_style = 'css/s2graph_style.css' + # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/7e4f6c81/doc/source/index.rst -- diff --git a/doc/source/index.rst b/doc/source/index.rst index 83bf8d5..fd4e755 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -20,6 +20,7 @@ d...@s2graph.incubator.apache.org is for people who want to contribute to S2Graph getting_started/index getting_started/your_first_graph + api/index .. Indices and tables http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/7e4f6c81/s2http/src/main/scala/org/apache/s2graph/http/Server.scala -- diff --git a/s2http/src/main/scala/org/apache/s2graph/http/Server.scala b/s2http/src/main/scala/org/apache/s2graph/http/Server.scala index 03802ed..e70a182 100644 --- a/s2http/src/main/scala/org/apache/s2graph/http/Server.scala +++ b/s2http/src/main/scala/org/apache/s2graph/http/Server.scala @@ -19,6 +19,8 @@ package org.apache.s2graph.http +import java.time.Instant + import scala.language.postfixOps import scala.concurrent.{Await, ExecutionContext, Future} import scala.concurrent.duration.Duration @@ -51,9 +53,13 @@ object Server extends App val port = sys.props.get("http.port").fold(8000)(_.toInt) val interface = sys.props.get("http.interface").fold("0.0.0.0")(identity) - val serverStatus = s""" { "port": ${port}, "interface": ${interface}, "started_at": ${System.currentTimeMillis()} }""" + val startAt = System.currentTimeMillis() + + def uptime = System.currentTimeMillis() - startAt + + def serverHealth = s"""{ "port": ${port}, "interface": "${interface}", "started_at": ${Instant.ofEpochMilli(startAt)}, "uptime": "${uptime} millis" """ - val health = HttpResponse(status = StatusCodes.OK, entity = HttpEntity(ContentTypes.`application/json`, serverStatus)) + def health = HttpResponse(status = StatusCodes.OK, entity = HttpEntity(ContentTypes.`application/json`, serverHealth)) // Allows you to determine routes to expose according to external settings. lazy val routes: Route = concat(
[20/20] incubator-s2graph git commit: [S2GRAPH-248] HTTP interface integration.
[S2GRAPH-248] HTTP interface integration. JIRA: [S2GRAPH-248] https://issues.apache.org/jira/browse/S2GRAPH-248 Pull Request: Closes #193 Author daewon Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/19254301 Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/19254301 Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/19254301 Branch: refs/heads/master Commit: 19254301d4cea7e976754fe1b1f6491144b51173 Parents: 53ff5cd Author: DO YUNG YOON Authored: Sat Jan 26 07:48:00 2019 +0900 Committer: DO YUNG YOON Committed: Sat Jan 26 07:48:00 2019 +0900 -- CHANGES | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/19254301/CHANGES -- diff --git a/CHANGES b/CHANGES index 26388ab..6b7d679 100644 --- a/CHANGES +++ b/CHANGES @@ -115,6 +115,7 @@ Release Notes - S2Graph - Version 0.2.0 * [S2GRAPH-229] - 'Step' abstraction for combinable queries * [S2GRAPH-245] - Remove install hbase step on travis CI. * [S2GRAPH-246] - Integration of documents into the S2Graph project. +* [S2GRAPH-248] - HTTP interface integration. Release 0.1.0 - Released
[08/20] incubator-s2graph git commit: update akka http version
update akka http version Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/955e21d7 Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/955e21d7 Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/955e21d7 Branch: refs/heads/master Commit: 955e21d7c9ae45f9fd9d79dafefe233ae557d17b Parents: ac630bf Author: daewon Authored: Wed Dec 26 13:48:22 2018 +0900 Committer: daewon Committed: Wed Dec 26 13:48:22 2018 +0900 -- s2http/build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/955e21d7/s2http/build.sbt -- diff --git a/s2http/build.sbt b/s2http/build.sbt index 944493c..ef020cd 100644 --- a/s2http/build.sbt +++ b/s2http/build.sbt @@ -16,8 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -lazy val akkaHttpVersion = "10.1.5" -lazy val akkaVersion = "2.5.18" +lazy val akkaHttpVersion = "10.1.6" +lazy val akkaVersion = "2.5.19" name := "s2http"
[16/20] incubator-s2graph git commit: add data model
add data model Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/bbdc6618 Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/bbdc6618 Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/bbdc6618 Branch: refs/heads/master Commit: bbdc6618553a42dafba7d227ae31edc78a8c2b01 Parents: 3bb9f02 Author: daewon Authored: Thu Dec 27 19:03:16 2018 +0900 Committer: daewon Committed: Thu Dec 27 19:03:16 2018 +0900 -- doc/source/api/index.rst | 6 +- doc/source/api/query/index.rst| 4 +--- doc/source/api/query/query_edge.rst | 8 ++-- doc/source/api/query/query_vertex.rst | 13 + doc/source/index.rst | 6 +- 5 files changed, 18 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/bbdc6618/doc/source/api/index.rst -- diff --git a/doc/source/api/index.rst b/doc/source/api/index.rst index e74650a..ed45c97 100644 --- a/doc/source/api/index.rst +++ b/doc/source/api/index.rst @@ -1,8 +1,3 @@ -.. Sphinx API Example documentation master file, created by - sphinx-quickstart on Wed May 2 12:55:56 2012. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - HTTP API Glossary == @@ -15,3 +10,4 @@ Contents: management/index mutate/index + query/index http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/bbdc6618/doc/source/api/query/index.rst -- diff --git a/doc/source/api/query/index.rst b/doc/source/api/query/index.rst index 26e2b01..6d5b3fb 100644 --- a/doc/source/api/query/index.rst +++ b/doc/source/api/query/index.rst @@ -12,6 +12,4 @@ Contents: query_options query_edge - - .. - query_vertex + query_vertex http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/bbdc6618/doc/source/api/query/query_edge.rst -- diff --git a/doc/source/api/query/query_edge.rst b/doc/source/api/query/query_edge.rst index 2b74daf..b7bfb21 100644 --- a/doc/source/api/query/query_edge.rst +++ b/doc/source/api/query/query_edge.rst @@ -15,12 +15,8 @@ Another tip is to not be shy to ask! Ask any questions on our `mailing list`_. l .. _github: https://github.com/apache/incubator-s2graph -APIs -- - - checkEdges - ``POST /graphs/checkEdges`` -~~~ +-- return edge for given vertex pair only if edge exist. This is more ``general`` way to check edge existence between any given vertex pairs comparing using ``_to`` on query parameter @@ -36,7 +32,7 @@ This is more ``general`` way to check edge existence between any given vertex pa getEdges - ``POST /graphs/getEdges`` -~~~ +- Select edges with query. http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/bbdc6618/doc/source/api/query/query_vertex.rst -- diff --git a/doc/source/api/query/query_vertex.rst b/doc/source/api/query/query_vertex.rst index 15f5e3e..1ff0b2d 100644 --- a/doc/source/api/query/query_vertex.rst +++ b/doc/source/api/query/query_vertex.rst @@ -2,3 +2,16 @@ Query Vertices + +POST - ``/graphs/getVertices`` + + +Selecting all vertices from serviceColumn account_id of a service s2graph. + +.. code:: bash + +curl -XPOST localhost:9000/graphs/getVertices -H 'Content-Type: Application/json' -d ' +[ +{"serviceName": "s2graph", "columnName": "account_id", "ids": [1, 2, 3]}, +{"serviceName": "agit", "columnName": "user_id", "ids": [1, 2, 3]} +]' http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/bbdc6618/doc/source/index.rst -- diff --git a/doc/source/index.rst b/doc/source/index.rst index fd4e755..7f4455e 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -1,8 +1,3 @@ -.. S2Graph documentation master file, created by - sphinx-quickstart on Mon Nov 12 15:53:14 2018. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - Introduction === @@ -20,6 +15,7 @@ d...@s2graph.incubator.apache.org is for people who want to contribute to S2Graph getting_started/index
[07/20] incubator-s2graph git commit: Change startup script project to s2http
Change startup script project to s2http Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/ac630bf6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/ac630bf6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/ac630bf6 Branch: refs/heads/master Commit: ac630bf68c777fe963f1beaba90d7989fe755e4f Parents: dcaa1f3 Author: daewon Authored: Wed Dec 12 19:47:31 2018 +0900 Committer: daewon Committed: Wed Dec 12 19:47:31 2018 +0900 -- README.md | 193 ++--- bin/s2graph-daemon.sh | 9 +-- bin/s2graph.sh| 2 +- bin/start-s2graph.sh | 2 +- bin/stop-s2graph.sh | 2 +- build.sbt | 14 +--- dev_support/README.md | 40 -- 7 files changed, 121 insertions(+), 141 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/ac630bf6/README.md -- diff --git a/README.md b/README.md index f873611..537c397 100644 --- a/README.md +++ b/README.md @@ -1,90 +1,87 @@ + - - -S2Graph [![Build Status](https://travis-ci.org/apache/incubator-s2graph.svg?branch=master)](https://travis-ci.org/apache/incubator-s2graph) -=== - -[**S2Graph**](http://s2graph.apache.org/) is a **graph database** designed to handle transactional graph processing at scale. Its REST API allows you to store, manage and query relational information using **edge** and **vertex** representations in a **fully asynchronous** and **non-blocking** manner. - -S2Graph is a implementation of [**Apache TinkerPop**](https://tinkerpop.apache.org/) on [**Apache HBASE**](https://hbase.apache.org/). - -This document covers some basic concepts and terms of S2Graph as well as help you get a feel for the S2Graph API. - -Building from the source - - -To build S2Graph from the source, install the JDK 8 and [SBT](http://www.scala-sbt.org/), and run the following command in the project root: - - sbt package -This will create a distribution of S2Graph that is ready to be deployed. - -One can find distribution on `target/apache-s2graph-$version-incubating-bin`. - -Quick Start -=== - -Once extracted the downloaded binary release of S2Graph or built from the source as described above, the following files and directories should be found in the directory. - -``` -DISCLAIMER -LICENCE # the Apache License 2.0 -NOTICE -bin # scripts to manage the lifecycle of S2Graph -conf # configuration files -lib # contains the binary -logs # application logs -var # application data -``` - -This directory layout contains all binary and scripts required to launch S2Graph. The directories `logs` and `var` may not be present initially, and are created once S2Graph is launched. - -The following will launch S2Graph, using [HBase](https://hbase.apache.org/) in the standalone mode for data storage and [H2](http://www.h2database.com/html/main.html) as the metadata storage. - - sh bin/start-s2graph.sh -To connect to a remote HBase cluster or use MySQL as the metastore, refer to the instructions in [`conf/application.conf`](conf/application.conf). -S2Graph is tested on HBase versions 0.98, 1.0, 1.1, and 1.2 (https://hub.docker.com/r/harisekhon/hbase/tags/). - -Project Layout -== - -Here is what you can find in each subproject. - -1. `s2core`: The core library, containing the data abstractions for graph entities, storage adapters and utilities. -2. `s2rest_play`: The REST server built with [Play framework](https://www.playframework.com/), providing the write and query API. -3. `s2rest_netty`: The REST server built directly using Netty, implementing only the query API. -4. [`s2graphql`](s2graphql/README.md): The GraphQL server, providing standard web interface for S2Graph. -~~4. `loader`: A collection of Spark jobs for bulk loading streaming data into S2Graph.~~ -~~5. `spark`: Spark utilities for `loader` and `s2counter_loader`.~~ -5. [`s2jobs`](s2jobs/README.md): A collection of Spark jobs to support OLAP on S2Graph. -6. `s2counter_core`: The core library providing data structures and logics for `s2counter_loader`. -7. `s2counter_loader`: Spark streaming jobs that consume Kafka WAL logs and calculate various top-*K* results on-the-fly. -8. `s2graph_gremlin`: Gremlin plugin for tinkerpop users. - -The first four projects are for OLTP-style workloads, currently the main target of S2Graph. -The remaining projects are for OLAP-style workloads, especially for integrating S2Graph
[19/20] incubator-s2graph git commit: Merge branch 'S2GRAPH-248' of https://github.com/daewon/incubator-s2graph into daewon-S2GRAPH-248
Merge branch 'S2GRAPH-248' of https://github.com/daewon/incubator-s2graph into daewon-S2GRAPH-248 Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/53ff5cd8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/53ff5cd8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/53ff5cd8 Branch: refs/heads/master Commit: 53ff5cd89d6df64f44656c662768d8598806e268 Parents: f77a152 8c3f4a2 Author: DO YUNG YOON Authored: Thu Jan 24 21:14:49 2019 +0900 Committer: DO YUNG YOON Committed: Thu Jan 24 21:14:49 2019 +0900 -- README.md | 193 ++-- bin/s2graph-daemon.sh | 9 +- bin/s2graph.sh | 2 +- bin/start-s2graph.sh| 2 +- bin/stop-s2graph.sh | 2 +- build.sbt | 20 +- dev_support/README.md | 40 +- doc/source/_static/css/s2graph_style.css| 1 + doc/source/api/index.rst| 13 + doc/source/api/management/index.rst | 444 + doc/source/api/mutate/index.rst | 10 + doc/source/api/mutate/mutate_edge.rst | 328 +++ doc/source/api/mutate/mutate_vertex.rst | 139 +++ doc/source/api/query/index.rst | 15 + doc/source/api/query/query_edge.rst | 954 +++ doc/source/api/query/query_options.rst | 27 + doc/source/api/query/query_vertex.rst | 17 + doc/source/conf.py | 2 + doc/source/getting_started/your_first_graph.rst | 14 +- doc/source/index.rst| 7 +- s2core/src/main/resources/reference.conf| 10 +- .../org/apache/s2graph/core/Management.scala| 44 + .../org/apache/s2graph/core/schema/Label.scala | 38 +- s2graphql/build.sbt | 12 +- s2graphql/src/main/resources/application.conf | 11 +- s2graphql/src/main/resources/assets/.gitignore | 1 - .../src/main/resources/assets/graphiql.html | 151 +++ .../apache/s2graph/graphql/GraphQLServer.scala | 81 +- .../org/apache/s2graph/graphql/HttpServer.scala | 154 --- s2graphql/src/test/resources/application.conf | 11 +- .../org/apache/s2graph/graphql/TestGraph.scala | 2 +- s2http/README.md| 47 + s2http/build.sbt| 41 + s2http/src/main/resources/application.conf | 27 + s2http/src/main/resources/log4j.properties | 26 + .../apache/s2graph/http/PlayJsonSupport.scala | 74 ++ .../apache/s2graph/http/S2GraphAdminRoute.scala | 281 ++ .../s2graph/http/S2GraphMutateRoute.scala | 97 ++ .../apache/s2graph/http/S2GraphQLRoute.scala| 105 ++ .../s2graph/http/S2GraphTraversalRoute.scala| 62 ++ .../s2graph/http/SangriaGraphQLSupport.scala| 38 + .../scala/org/apache/s2graph/http/Server.scala | 86 ++ .../apache/s2graph/http/AdminRouteSpec.scala| 94 ++ .../apache/s2graph/http/MutateRouteSpec.scala | 63 ++ .../rest/play/controllers/AdminController.scala | 32 +- 45 files changed, 3393 insertions(+), 434 deletions(-) --
[06/20] incubator-s2graph git commit: add graphql route in s2http
add graphql route in s2http Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/dcaa1f34 Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/dcaa1f34 Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/dcaa1f34 Branch: refs/heads/master Commit: dcaa1f34c4dd9bba863d5e532b9b0893e6b9a287 Parents: f41ab56 Author: daewon Authored: Fri Nov 30 16:46:03 2018 +0900 Committer: daewon Committed: Fri Nov 30 16:46:03 2018 +0900 -- s2graphql/build.sbt | 12 +- s2graphql/src/main/resources/application.conf | 11 +- s2graphql/src/main/resources/assets/.gitignore | 1 - .../src/main/resources/assets/graphiql.html | 151 ++ .../apache/s2graph/graphql/GraphQLServer.scala | 81 -- .../org/apache/s2graph/graphql/HttpServer.scala | 154 --- s2graphql/src/test/resources/application.conf | 11 +- .../apache/s2graph/http/PlayJsonSupport.scala | 4 +- .../s2graph/http/S2GraphMutateRoute.scala | 1 - .../apache/s2graph/http/S2GraphQLRoute.scala| 105 + .../s2graph/http/SangriaGraphQLSupport.scala| 38 + .../scala/org/apache/s2graph/http/Server.scala | 14 +- 12 files changed, 351 insertions(+), 232 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/dcaa1f34/s2graphql/build.sbt -- diff --git a/s2graphql/build.sbt b/s2graphql/build.sbt index bc71f98..dbf38c3 100644 --- a/s2graphql/build.sbt +++ b/s2graphql/build.sbt @@ -29,15 +29,11 @@ libraryDependencies ++= Seq( "org.scala-lang" % "scala-compiler" % scalaVersion.value, "org.scala-lang" % "scala-reflect" % scalaVersion.value, - "org.sangria-graphql" %% "sangria" % "1.4.0", - "org.sangria-graphql" %% "sangria-spray-json" % "1.0.0", - "org.sangria-graphql" %% "sangria-play-json" % "1.0.1" % Test, + "org.sangria-graphql" %% "sangria" % "1.4.2", + "org.sangria-graphql" %% "sangria-spray-json" % "1.0.1", + "org.sangria-graphql" %% "sangria-play-json" % "1.0.5" % Test, - "com.typesafe.akka" %% "akka-http" % "10.0.10", - "com.typesafe.akka" %% "akka-http-spray-json" % "10.0.10", - "com.typesafe.akka" %% "akka-slf4j" % "2.4.6", - - "org.scalatest" %% "scalatest" % "3.0.4" % Test + "org.scalatest" %% "scalatest" % "3.0.5" % Test ) Revolver.settings http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/dcaa1f34/s2graphql/src/main/resources/application.conf -- diff --git a/s2graphql/src/main/resources/application.conf b/s2graphql/src/main/resources/application.conf index aac21d1..b956031 100644 --- a/s2graphql/src/main/resources/application.conf +++ b/s2graphql/src/main/resources/application.conf @@ -16,11 +16,12 @@ # specific language governing permissions and limitations # under the License. # -akka { - loggers = ["akka.event.slf4j.Slf4jLogger"] - event-handlers = ["akka.event.slf4j.Slf4jEventHandler"] - loglevel = "INFO" -} + +//akka { +// loggers = ["akka.event.slf4j.Slf4jLogger"] +// event-handlers = ["akka.event.slf4j.Slf4jEventHandler"] +// loglevel = "INFO" +//} //db.default.url="jdbc:h2:file:./var/metastore;MODE=MYSQL", //db.default.password = sa http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/dcaa1f34/s2graphql/src/main/resources/assets/.gitignore -- diff --git a/s2graphql/src/main/resources/assets/.gitignore b/s2graphql/src/main/resources/assets/.gitignore deleted file mode 100644 index 8b13789..000 --- a/s2graphql/src/main/resources/assets/.gitignore +++ /dev/null @@ -1 +0,0 @@ - http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/dcaa1f34/s2graphql/src/main/resources/assets/graphiql.html -- diff --git a/s2graphql/src/main/resources/assets/graphiql.html b/s2graphql/src/main/resources/assets/graphiql.html new file mode 100644 index 000..3fe0083 --- /dev/null +++ b/s2graphql/src/main/resources/assets/graphiql.html @@ -0,0 +1,151 @@ + + + + + + body { +height: 100%; +margin: 0; +width: 100%; +overflow: hidden; + } + + #graphiql { +height: 100vh; + } + + + + + + + + + + +Loading... + + + + /** + * This GraphiQL example illustrates how to use some of GraphiQL's props + * in order to enable reading and updating the URL parameters, making + * link sharing of queries a little bit easier. + * + * This is only one example of this kind of feature, GraphiQL exposes + * various React params
[15/20] incubator-s2graph git commit: add edge query
add edge query Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/3bb9f029 Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/3bb9f029 Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/3bb9f029 Branch: refs/heads/master Commit: 3bb9f0294478568c86b66461d11df2f13e3daa36 Parents: aa309b2 Author: daewon Authored: Thu Dec 27 18:42:41 2018 +0900 Committer: daewon Committed: Thu Dec 27 18:42:41 2018 +0900 -- doc/source/api/query/index.rst | 17 + doc/source/api/query/query_edge.rst| 958 doc/source/api/query/query_options.rst | 27 + doc/source/api/query/query_vertex.rst | 4 + 4 files changed, 1006 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/3bb9f029/doc/source/api/query/index.rst -- diff --git a/doc/source/api/query/index.rst b/doc/source/api/query/index.rst new file mode 100644 index 000..26e2b01 --- /dev/null +++ b/doc/source/api/query/index.rst @@ -0,0 +1,17 @@ +Query APIs +== + +Once you have your graph data uploaded to S2Graph, you can traverse your graph using our query APIs. +S2Graph query DSL define ``breadth first search(BFS)`` and various options for ``ranking`` subgraph that BFS return. +Query DSL has many options for ranking and filtering. + +Contents: + +.. toctree:: + :maxdepth: 2 + + query_options + query_edge + + .. + query_vertex http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/3bb9f029/doc/source/api/query/query_edge.rst -- diff --git a/doc/source/api/query/query_edge.rst b/doc/source/api/query/query_edge.rst new file mode 100644 index 000..2b74daf --- /dev/null +++ b/doc/source/api/query/query_edge.rst @@ -0,0 +1,958 @@ + +Edge Queries + + +S2Graph provides a query DSL which has been reported to have a pretty steep learning curve. +One tip is to try to understand each features by projecting it to that of a RDBMS such MySQL. +This doesn't work all the time, but there are many similarities between S2Graph and a conventional RDBMS. +For example, S2Graphs "getEdges" is used to fetch data and traverse multiple steps. This is very similar to the "SELECT" query in MySQL. + +Traversing each step is similar to ``join`` operation in RDBMS. One thing to note here is that users must start their traverse from smaller set to terminate BFS early as soon as possible. +Another tip is to not be shy to ask! Ask any questions on our `mailing list`_. list or open an issue at our `github`_ with the problems that you're having with S2Graph. + +.. _mailing list: https://groups.google.com/forum/#!forum/s2graph + +.. _github: https://github.com/apache/incubator-s2graph + + +APIs +- + + +checkEdges - ``POST /graphs/checkEdges`` +~~~ + +return edge for given vertex pair only if edge exist. +This is more ``general`` way to check edge existence between any given vertex pairs comparing using ``_to`` on query parameter + + +.. code:: bashn + + curl -XPOST localhost:9000/graphs/checkEdges -H 'Content-Type: Application/json' -d ' + [ + {"label": "talk_friend", "direction": "out", "from": 1, "to": 100}, + {"label": "talk_friend", "direction": "out", "from": 1, "to": 101} + ]' + + +getEdges - ``POST /graphs/getEdges`` +~~~ + +Select edges with query. + +**Duplicate Policy** + +Here is a very basic query to fetch all edges that start from source vertex "101". + +.. code:: bash + + curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d ' + { + + "srcVertices": [ + { + "serviceName": "s2graph", + "columnName": "user_id_test", + "id": 101 + } + ], + "steps": [ + { + "step": [ + { + "label": "s2graph_label_test_weak", + "direction": "out", + "offset": 0, + "limit": 10, + "duplicate": "raw" + } + ] + } + ] + }' + + +``Notice the "duplicate" field``. If a target label's consistency level is ``weak`` and multiple edges exist with the same (from, to, label, direction) id, then the query is expect to have a policy for handling edge duplicates. S2Graph provides four duplicate policies on edges. + + +.. note:: + - raw: Allow duplicates and return all edges. + - first: Return only
[03/20] incubator-s2graph git commit: merge S2GRAPH-249
merge S2GRAPH-249 Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/b8ab86dd Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/b8ab86dd Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/b8ab86dd Branch: refs/heads/master Commit: b8ab86dd39fd3810afcf44160324fa2dc6f5ee3f Parents: 4154bbe Author: DO YUNG YOON Authored: Thu Nov 29 10:51:20 2018 +0900 Committer: DO YUNG YOON Committed: Thu Nov 29 10:51:20 2018 +0900 -- .../org/apache/s2graph/core/Management.scala| 44 .../org/apache/s2graph/core/schema/Label.scala | 38 ++-- .../apache/s2graph/http/S2GraphAdminRoute.scala | 224 ++- .../s2graph/http/S2GraphMutateRoute.scala | 119 ++ .../scala/org/apache/s2graph/http/Server.scala | 4 +- .../apache/s2graph/http/AdminRouteSpec.scala| 41 +++- .../apache/s2graph/http/MutateRouteSpec.scala | 52 + .../rest/play/controllers/AdminController.scala | 32 +-- 8 files changed, 492 insertions(+), 62 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/b8ab86dd/s2core/src/main/scala/org/apache/s2graph/core/Management.scala -- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/Management.scala b/s2core/src/main/scala/org/apache/s2graph/core/Management.scala index 0c41ee3..78edf80 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/Management.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/Management.scala @@ -66,18 +66,56 @@ object Management { } object JsonModel { +import play.api.libs.functional.syntax._ case class Prop(name: String, defaultValue: String, dataType: String, storeInGlobalIndex: Boolean = false) object Prop extends ((String, String, String, Boolean) => Prop) case class Index(name: String, propNames: Seq[String], direction: Option[Int] = None, options: Option[String] = None) + +case class HTableParams(cluster: String, hTableName: String, +preSplitSize: Int, hTableTTL: Option[Int], compressionAlgorithm: Option[String]) { + + override def toString(): String = { +s"""HtableParams + |-- cluster : $cluster + |-- hTableName : $hTableName + |-- preSplitSize : $preSplitSize + |-- hTableTTL : $hTableTTL + |-- compressionAlgorithm : $compressionAlgorithm + |""".stripMargin + } +} + +implicit object HTableParamsJsonConverter extends Format[HTableParams] { + def reads(json: JsValue): JsResult[HTableParams] = ( +(__ \ "cluster").read[String] and + (__ \ "hTableName").read[String] and + (__ \ "preSplitSize").read[Int] and + (__ \ "hTableTTL").readNullable[Int] and + (__ \ "compressionAlgorithm").readNullable[String])(HTableParams.apply _).reads(json) + + def writes(o: HTableParams): JsValue = Json.obj( +"cluster" -> o.cluster, +"hTableName" -> o.hTableName, +"preSplitSize" -> o.preSplitSize, +"hTableTTL" -> o.hTableTTL, +"compressionAlgorithm" -> o.compressionAlgorithm + ) +} } def findService(serviceName: String) = { Service.findByName(serviceName, useCache = false) } + def findServiceColumn(serviceName: String, columnName: String): Option[ServiceColumn] = { +Service.findByName(serviceName, useCache = false).flatMap { service => + ServiceColumn.find(service.id.get, columnName, useCache = false) +} + } + def deleteService(serviceName: String) = { Service.findByName(serviceName).foreach { service => // service.deleteAll() @@ -133,6 +171,12 @@ object Management { Label.findByName(labelName, useCache = useCache) } + def findLabels(serviceName: String, useCache: Boolean = false): Seq[Label] = { +Service.findByName(serviceName, useCache = useCache).map { service => + Label.findBySrcServiceId(service.id.get, useCache = useCache) +}.getOrElse(Nil) + } + def deleteLabel(labelName: String): Try[Label] = { Schema withTx { implicit session => val label = Label.findByName(labelName, useCache = false).getOrElse(throw GraphExceptions.LabelNotExistException(labelName)) http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/b8ab86dd/s2core/src/main/scala/org/apache/s2graph/core/schema/Label.scala -- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/schema/Label.scala b/s2core/src/main/scala/org/apache/s2graph/core/schema/Label.scala index a359958..2780475 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/schema/Label.scala +++
[17/20] incubator-s2graph git commit: add
add Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/4bcf9d96 Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/4bcf9d96 Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/4bcf9d96 Branch: refs/heads/master Commit: 4bcf9d96625ba700f122b959c063cb34f60fcd7e Parents: bbdc661 Author: daewon Authored: Sat Dec 29 11:51:09 2018 +0900 Committer: daewon Committed: Sat Dec 29 11:51:09 2018 +0900 -- doc/source/api/management/index.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/4bcf9d96/doc/source/api/management/index.rst -- diff --git a/doc/source/api/management/index.rst b/doc/source/api/management/index.rst index 17061b0..be18a36 100644 --- a/doc/source/api/management/index.rst +++ b/doc/source/api/management/index.rst @@ -345,11 +345,11 @@ The following is an example of adding index ``play_count`` to a label ``graph_te .. code:: bash - // add prop first + # add prop first curl -XPOST localhost:9000/admin/addProp/graph_test -H 'Content-Type: Application/json' -d ' { "name": "play_count", "defaultValue": 0, "dataType": "integer" }' - // then add index + # then add index curl -XPOST localhost:9000/admin/addIndex -H 'Content-Type: Application/json' -d ' { "label": "graph_test",
[04/20] incubator-s2graph git commit: Merge pull request #3 from SteamShon/S2GRAPH-248
Merge pull request #3 from SteamShon/S2GRAPH-248 @SteamShon Thanks for your work.! merge [S2GRAPH-249] Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/1dda954d Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/1dda954d Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/1dda954d Branch: refs/heads/master Commit: 1dda954d3c07ddb0966546501c3078c67e2cbc04 Parents: 4154bbe b8ab86d Author: daewon Authored: Thu Nov 29 17:16:24 2018 +0900 Committer: GitHub Committed: Thu Nov 29 17:16:24 2018 +0900 -- .../org/apache/s2graph/core/Management.scala| 44 .../org/apache/s2graph/core/schema/Label.scala | 38 ++-- .../apache/s2graph/http/S2GraphAdminRoute.scala | 224 ++- .../s2graph/http/S2GraphMutateRoute.scala | 119 ++ .../scala/org/apache/s2graph/http/Server.scala | 4 +- .../apache/s2graph/http/AdminRouteSpec.scala| 41 +++- .../apache/s2graph/http/MutateRouteSpec.scala | 52 + .../rest/play/controllers/AdminController.scala | 32 +-- 8 files changed, 492 insertions(+), 62 deletions(-) --