From 89ecd5c0e8bccc94810283342947db14328efe0d Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Wed, 27 Sep 2017 16:24:38 +0300 Subject: [PATCH] more updates --- docs/api-reference.md | 16 +++++++--------- docs/client-libraries.md | 31 ++++++++++++++++++------------- docs/getting-started.md | 20 ++++++++------------ docs/input-definition.md | 14 +++++--------- docs/webui.md | 6 +++--- 5 files changed, 41 insertions(+), 46 deletions(-) diff --git a/docs/api-reference.md b/docs/api-reference.md index bf599fafe..c11f2609f 100644 --- a/docs/api-reference.md +++ b/docs/api-reference.md @@ -47,13 +47,13 @@ Creates an index with the given name. The request payload is in JSON, and may contain the `options` field. The `options` field is a JSON object which may contain the following fields: -* `columnLabel` (string): column label of the index. +* `timeQuantum` (string): time quantum of the index. Request: ``` curl localhost:10101/index/user \ -X POST \ - -d '{"options": {"columnLabel": "user_id"}}' + -d '{"options": {"timeQuantum": "YMDH"}}' ``` Response: @@ -87,7 +87,7 @@ Request: ``` curl localhost:10101/index/user/query \ -X POST \ - -d 'Bitmap(frame="language", id=5)' + -d 'Bitmap(frame="language", rowID=5)' ``` Response: @@ -105,7 +105,7 @@ Request: ``` curl "localhost:10101/index/user/query?columnAttrs=true&slices=0,1" \ -X POST \ - -d 'Bitmap(frame="language", id=5)' + -d 'Bitmap(frame="language", rowID=5)' ``` Response: ``` @@ -157,7 +157,6 @@ Creates a frame in the given index with the given name. The request payload is in JSON, and may contain the `options` field. The `options` field is a JSON object which may contain the following fields: -* `rowLabel` (string): Row label of the frame. * `timeQuantum` (string): [Time Quantum]({{< ref "data-model.md#time-quantum" >}}) for this frame. * `inverseEnabled` (boolean): Enables [the inverted view]({{< ref "data-model.md#inverse" >}}) for this frame if `true`. * `cacheType` (string): [ranked]({{< ref "data-model.md#ranked" >}}) or [LRU]({{< ref "data-model.md#lru" >}}) caching on this frame. Default is `lru`. @@ -167,7 +166,7 @@ Request: ``` curl localhost:10101/index/user/frame/language \ -X POST \ - -d '{"options": {"rowLabel": "language_id"}}' + -d '{"options": {"inverseEnabled": true}}' ``` Response: @@ -231,7 +230,6 @@ Creates an input definition in the given index with the given name. The request payload is JSON, and it must contain the fields `frames` and `fields`. `frames` is an array of frames used within this input definition. Each frame must contain a `name` and may contain the following options: -* `rowLabel` (string): Row label of the frame. * `timeQuantum` (string): [Time Quantum]({{< ref "data-model.md#time-quantum" >}}) for this frame. * `inverseEnabled` (boolean): Enables [the inverted view]({{< ref "data-model.md#inverse" >}}) for this frame if `true`. * `cacheType` (string): [ranked]({{< ref "data-model.md#ranked" >}}) or [LRU]({{< ref "data-model.md#lru" >}}) caching on this frame. Default is `lru`. @@ -260,7 +258,7 @@ curl localhost:10101/index/user/input-definition/stargazer-input \ "frames":[ { "name": "language", - "options": {"rowLabel": "language_id"} + "options": {"inverseEnabled": true} } ], "fields":[ @@ -304,7 +302,7 @@ curl -XGET localhost:10101/index/user/input-definition/stargazer-input Response: ``` -{"frames":[{"name":"language","options":{"rowLabel":"language_id"}}],"fields":[{"name":"repo_id","primaryKey":true},{"name":"language_id","actions":[{"frame":"language","valueDestination":"mapping","valueMap":{"Go":5,"Python":17,"C++":10}}]}]} +{"frames":[{"name":"language","options":{"inverseEnabled":true}}],"fields":[{"name":"repo_id","primaryKey":true},{"name":"language_id","actions":[{"frame":"language","valueDestination":"mapping","valueMap":{"Go":5,"Python":17,"C++":10}}]}]} ``` ### Remove input definition diff --git a/docs/client-libraries.md b/docs/client-libraries.md index e896fbab4..4c776a04a 100644 --- a/docs/client-libraries.md +++ b/docs/client-libraries.md @@ -31,13 +31,17 @@ import ( func main() { // Let's create Index and Frame objects, which will contain the settings // for the corresponding indexes and frames. - repositoryOptions, := &pilosa.ColumnOptions{ColumnLabel: "repo_id"} - repository, _ := pilosa.NewIndex("repository", repositoryOptions) + repository, _ := pilosa.NewIndex("repository", nil) - stargazerOptions := &pilosa.RowOptions{RowLabel: "stargazer_id"} + stargazerOptions := &pilosa.RowOptions{ + TimeQuantum: pilosa.TimeQuantumYearMonthDay, + InverseEnabled: true, + } stargazer, _ := repository.Frame("stargazer", stargazerOptions) - languageOptions := &pilosa.RowOptions{RowLabel: "language_id"} + languageOptions := &pilosa.RowOptions{ + InverseEnabled: true, + } language, _ := repository.Frame("language", languageOptions) // We will just use the default client which assumes the server is at http://localhost:10101 @@ -99,13 +103,15 @@ We are going to use the index you have created in the [Getting Started](../getti Error handling has been omitted in the example below for brevity. ```python -from pilosa import Index, Client, PilosaError +from pilosa import Index, Client, PilosaError, TimeQuantum # Let's create Index and Frame objects, which will contain the settings # for the corresponding indexes and frames. -repository = Index("repository", column_label="repo_id") -stargazer = repository.frame("stargazer", row_label="stargazer_id") -language = repository.frame("language", row_label="language_id") +repository = Index("repository") +stargazer = repository.frame("stargazer", + time_quantum=TimeQuantum.YEAR_MONTH_DAY, + inverse_enabled=True) +language = repository.frame("language", inverse_enabled=True) # We will just use the default client which assumes the server is at http://localhost:10101 client = Client() @@ -161,18 +167,17 @@ public class StarTrace { public static void main(String[] args) { // Let's create Index and Frame objects, which will contain the settings // for the corresponding indexes and frames. - IndexOptions repositoryOptions = IndexOptions.builder() - .setColumnLabel("repo_id") - .build(); + IndexOptions repositoryOptions = IndexOptions.withDefaults(); Index repository = Index.withName("repository", repositoryOptions); FrameOptions stargazerOptions = FrameOptions.builder() - .setRowLabel("stargazer_id") + .setTimeQuantum(TimeQuantum.YEAR_MONTH_DAY) + .setInverseEnabled(true) .build(); Frame stargazer = repository.frame("stargazer", stargazerOptions); FrameOptions languageOptions = FrameOptions.builder() - .setRowLabel("language_id") + .setInverseEnabled(true) .build(); Frame language = repository.frame("language", languageOptions); diff --git a/docs/getting-started.md b/docs/getting-started.md index 534e733b4..c1eef3c08 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -54,9 +54,7 @@ curl localhost:10101/schema Before we can import data or run queries, we need to create our indexes and the frames within them. Let's create the repository index first: ``` -curl localhost:10101/index/repository \ - -X POST \ - -d '{"options": {"columnLabel": "repo_id"}}' +curl localhost:10101/index/repository -X POST ``` Repository IDs are the main focus of the `repository` index, so we chose `repo_id` as the column label. @@ -65,8 +63,7 @@ Let's create the `stargazer` frame which has user IDs of stargazers as its rows: ``` curl localhost:10101/index/repository/frame/stargazer \ -X POST \ - -d '{"options": {"rowLabel": "stargazer_id", - "timeQuantum": "YMD", + -d '{"options": {"timeQuantum": "YMD", "inverseEnabled": true}}' ``` @@ -78,8 +75,7 @@ Next up is the `language` frame, which will contain IDs for programming language ``` curl localhost:10101/index/repository/frame/language \ -X POST \ - -d '{"options": {"rowLabel": "language_id", - "inverseEnabled": true}}' + -d '{"options": {"inverseEnabled": true}}' ``` #### Import Data From CSV Files @@ -121,7 +117,7 @@ Which repositories did user 14 star: ``` curl localhost:10101/index/repository/query \ -X POST \ - -d 'Bitmap(frame="stargazer", stargazer_id=14)' + -d 'Bitmap(frame="stargazer", rowID=14)' ``` What are the top 5 languages in the sample data: @@ -135,28 +131,28 @@ Which repositories were starred by user 14 and 19: ``` curl localhost:10101/index/repository/query \ -X POST \ - -d 'Intersect(Bitmap(frame="stargazer", stargazer_id=14), Bitmap(frame="stargazer", stargazer_id=19))' + -d 'Intersect(Bitmap(frame="stargazer", rowID=14), Bitmap(frame="stargazer", rowID=19))' ``` Which repositories were starred by user 14 or 19: ``` curl localhost:10101/index/repository/query \ -X POST \ - -d 'Union(Bitmap(frame="stargazer", stargazer_id=14), Bitmap(frame="stargazer", stargazer_id=19))' + -d 'Union(Bitmap(frame="stargazer", rowID=14), Bitmap(frame="stargazer", rowID=19))' ``` Which repositories were starred by user 14 and 19 and also were written in language 1: ``` curl localhost:10101/index/repository/query \ -X POST \ - -d 'Intersect(Bitmap(frame="stargazer", stargazer_id=14), Bitmap(frame="stargazer", stargazer_id=19), Bitmap(frame="language", language_id=1))' + -d 'Intersect(Bitmap(frame="stargazer", rowID=14), Bitmap(frame="stargazer", rowID=19), Bitmap(frame="language", rowID=1))' ``` Set user 99999 as a stargazer for repository 77777: ``` curl localhost:10101/index/repository/query \ -X POST \ - -d 'SetBit(frame="stargazer", repo_id=77777, stargazer_id=99999)' + -d 'SetBit(frame="stargazer", columnID=77777, rowID=99999)' ``` ### What's Next? diff --git a/docs/input-definition.md b/docs/input-definition.md index c0c34ff7f..da59ee391 100644 --- a/docs/input-definition.md +++ b/docs/input-definition.md @@ -18,9 +18,7 @@ Input definitions allow users to define a schema based on their data and to prov Before creating a schema, let's create the repository index first: ``` -curl localhost:10101/index/repository \ - -X POST \ - -d '{"options": {"columnLabel": "repo_id"}}' +curl localhost:10101/index/repository -X POST ``` Then we can send the following input definition as JSON to Pilosa. The sample input defintion schema for the "Star Trace" project is at [Pilosa Getting Started repository](https://github.com/pilosa/getting-started), `input-definition.json` file @@ -32,7 +30,6 @@ curl localhost:10101/index/repository/input-definition/stargazer \ { "name": "language", "options": { - "rowLabel": "language_id", "inverseEnabled": true, "timeQuantum": "YMD" } @@ -40,7 +37,6 @@ curl localhost:10101/index/repository/input-definition/stargazer \ { "name": "stargazer", "options": { - "rowLabel": "stargazer_id", "inverseEnabled": true, "timeQuantum": "YMD" } @@ -127,9 +123,9 @@ The data input above is equivalent to the following `SetBit()` operations: ``` curl localhost:10101/index/repository/query \ -X POST \ - -d 'SetBit(frame="stargazer", repo_id=91720568, stargazer_id=513114) - SetBit(frame="stargazer", repo_id=91720568, stargazer_id=513114, timestamp="2017-05-18T20:40") - SetBit(frame="language", repo_id=91720568, language_id=5) - SetBit(frame="language", repo_id=95122322, language_id=17) + -d 'SetBit(frame="stargazer", columnID=91720568, rowID=513114) + SetBit(frame="stargazer", columnID=91720568, rowID=513114, timestamp="2017-05-18T20:40") + SetBit(frame="language", columnID=91720568, rowID=5) + SetBit(frame="language", columnID=95122322, rowID=17) ' ``` diff --git a/docs/webui.md b/docs/webui.md index 1e123393f..a348f59a6 100644 --- a/docs/webui.md +++ b/docs/webui.md @@ -30,10 +30,10 @@ In addition to standard PQL, the console supports a few special commands, prefix - `:create frame ` - `:delete frame ` -Index and frame creation also supports options like `columnLabel`,`rowLabel` or `inverseEnabled`. When creating new index or new frame, add options by using the keys documented in [API reference](../api-reference). +Index and frame creation also supports options like `timeQuantum` or `inverseEnabled`. When creating new index or new frame, add options by using the keys documented in [API reference](../api-reference). -- `:create index columnLabel=col_id` -- `:create frame rowLabel=row_id inverseEnabled=true cacheSize=10000` +- `:create index timeQuantum=YM` +- `:create frame inverseEnabled=true cacheSize=10000` ### Cluster Admin