usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From timangl...@apache.org
Subject svn commit: r1543106 [6/23] - in /incubator/usergrid/site: ./ content/ content/bootstrap/ content/community/ content/css/ content/docs/ content/font/ content/img/ content/img/check_flat/ content/js/ content/static/ layouts/ lib/ lib/helpers/ publish/ p...
Date Mon, 18 Nov 2013 18:51:22 GMT
Added: incubator/usergrid/site/content/docs/data-query-overview.md
URL: http://svn.apache.org/viewvc/incubator/usergrid/site/content/docs/data-query-overview.md?rev=1543106&view=auto
==============================================================================
--- incubator/usergrid/site/content/docs/data-query-overview.md (added)
+++ incubator/usergrid/site/content/docs/data-query-overview.md Mon Nov 18 18:51:18 2013
@@ -0,0 +1,62 @@
+---
+title: Apache Usergrid data query overview
+category: docs
+layout: docs
+---
+
+Apache Usergrid data query overview
+===================================
+
+You can write code to query for data you've stored in your Apache Usergrid
+application. You'll most likely use queries as filters to retrieve
+specific entities. For example, you might want to get data about users
+who are "following" a specific other user, businesses in specific
+geographical locations, and so on.
+
+The following example retrieves a list of restaurants (from a
+restaurants collection) whose name property contains the value "diner",
+sorting the list in ascending order by name:
+
+    /restaurants?ql=select * where name contains 'diner' order by name asc
+
+> **Note:**Query examples in this content are shown unencoded to make
+> them easier to read. Keep in mind that you might need to encode query
+> strings if you're sending them as part of URLs, such as when you're
+> executing them with the cURL tool.
+
+Having retrieved the list of restaurants, your code could display the
+list to your users. You could also use a query to retrieve a list of
+diners that are located within a particular geographical area (such as
+near your user's current location).
+
+> **Important:** By default, results from queries of your Apache Usergrid
+> data are limited to 10 items at a time. You can control this with the
+> `limit` parameter, as discussed in [Working with
+> queries](/working-queries).
+
+You query your Apache Usergrid data by using a query syntax that's like
+Structured Query Language (SQL), the query language for relational
+databases. Unlike a relational database, where you specify tables and
+columns containing the data you want to query, in your Apache Usergrid
+queries you specify collections and entities.
+
+> **Note:** The syntax of Apache Usergrid queries only *resembles* SQL to
+> make queries familiar and easier to write. However, the language isn't
+> SQL. Only the syntax items documented here are supported.
+
+The examples in these topics illustrate queries using simple strings to
+make the queries easier to read. You can also use one of the Apigee
+SDKs, which provide functions through which you can pass query strings,
+and in some cases shortcuts for bypassing queries altogether.
+
+> **Note:** Queries replace filters, which are deprecated.
+
+For more detail about support for queries your Apache Usergrid database,
+see the following topics:
+
+-   [Basic query syntax](/basic-query-syntax)
+-   [Query response values](/query-response-values)
+-   [Data types supported in queries](/data-types-supported-queries)
+-   [Querying data from the admin portal](/querying-data-admin-portal)
+-   [Working with queries](/working-queries)
+

Added: incubator/usergrid/site/content/docs/data-types-supported-queries.md
URL: http://svn.apache.org/viewvc/incubator/usergrid/site/content/docs/data-types-supported-queries.md?rev=1543106&view=auto
==============================================================================
--- incubator/usergrid/site/content/docs/data-types-supported-queries.md (added)
+++ incubator/usergrid/site/content/docs/data-types-supported-queries.md Mon Nov 18 18:51:18
2013
@@ -0,0 +1,84 @@
+---
+title: Data types supported in queries
+category: docs
+layout: docs
+---
+
+Data types supported in queries
+===============================
+
+As you develop queries for your Apache Usergrid data, remember that entity
+properties each conform to a particular data type (whether the entity is
+included by default or an entity you defined). Your queries must
+acknowledge this, testing with values that conform to each property's
+data type. (You can view the list of property data types for the default
+entities at [Default Data Entities](/default-data-entities).)
+
+For example, in the default entity `User`, the `name` property is stored
+as a `string`, the created date as a `long`, and metadata is stored as a
+JSON object. Your queries must be data type-aware so that you can be
+sure that query results are as you expect them to be.
+
+So imagine you define an entity with a `price` property whose value
+might be `100.00`. Querying for `100` will return no results even if
+there are occurrences of `100.00` as `price` values in your data set.
+That's because the database expected a decimal-delimited `float` value
+in your query.
+
++-------------------------+-------------------------+-------------------------+
+| Data Type               | Examples                | Notes                   |
++=========================+=========================+=========================+
+| `string`                | `'value'`,              |                         |
+|                         | `unicode '\uFFFF'`,     |                         |
+|                         | `octal '\0707'`         |                         |
++-------------------------+-------------------------+-------------------------+
+| `long`                  |     1357412326021       | Timestamps are          |
+|                         |                         | typically stored as     |
+|                         |                         | `long` values.          |
++-------------------------+-------------------------+-------------------------+
+| `float`                 |     10.1, -10.1, 10e10, | Your query must be      |
+|                         |  10e-10, 10E10, 10E-10  | specific about the      |
+|                         |                         | value you're looking    |
+|                         |                         | for, down to the value  |
+|                         |                         | (if any) after the      |
+|                         |                         | decimal point.          |
++-------------------------+-------------------------+-------------------------+
+| `boolean`               |     true | false        |                         |
++-------------------------+-------------------------+-------------------------+
+| `UUID`                  |     ee912c4b-5769-11e2- | UUID types are          |
+|                         | 924d-02e81ac5a17b       | typically used for the  |
+|                         |                         | unique IDs of entities. |
+|                         |                         | The value must conform  |
+|                         |                         | to the following format |
+|                         |                         | (do not enclose with    |
+|                         |                         | quotation marks):       |
+|                         |                         |     xxxxxxxx-xxxx-xxxx- |
+|                         |                         | xxxx-xxxxxxxxxxxx       |
+|                         |                         |                         |
+|                         |                         | .                       |
++-------------------------+-------------------------+-------------------------+
+| `object`                | For a JSON object like  | Objects are often used  |
+|                         | this one:               | to contain entity       |
+|                         |                         | metadata, such as the   |
+|                         |     {                   | activities associated   |
+|                         |      "items": [         | with a user, the users  |
+|                         |       {                 | associated with a role, |
+|                         |        "name": "rocks"  | and so on.              |
+|                         |       },                |                         |
+|                         |       {                 |                         |
+|                         |        "name": "boats"  |                         |
+|                         |       }                 |                         |
+|                         |      ]                  |                         |
+|                         |     }                   |                         |
+|                         |                         |                         |
+|                         | ... you can use dot     |                         |
+|                         | notation to reach       |                         |
+|                         | property values in the  |                         |
+|                         | object:                 |                         |
+|                         |                         |                         |
+|                         |     /mycollection/thing |                         |
+|                         | ?ql="select * where ite |                         |
+|                         | ms.name = 'rocks'"      |                         |
++-------------------------+-------------------------+-------------------------+
+
+



Mime
View raw message