Giter VIP home page Giter VIP logo

example-shop's Introduction

Example for multi-model queries - an e-commerce system

This is a toy example of an e-commerce system.

How to try it out

Launch a single server instance or a cluster. Here is an example for a single server using Docker, but any other deployment method should work as well:

docker run -it -p 8529:8529 -e ARANGO_NO_AUTH=1 arangodb

Then use the arangosh to import the data (for example with Docker):

docker run -it --net=host -v `pwd`:/mnt arangodb arangosh --javascript.execute /mnt/shop.js

From then on you can use the web UI to look at the collections, the overall setup, the graphs. Furthermore, you can issue queries. To this end the easiest is to click on the "Queries" tab, click "Queries" there again and then in the bottom right corner "Import Queries". Choose the file shopQueries.json. Alternatively, the queries are also as JavaScript code in the file shopQueries.js.

To generate more data, run

docker run -it --net=host -v `pwd`:/mnt arangodb arangosh --javascript.execute /mnt/moreData.js

This creates 100000 random customers, 100000 random items, 100000 sales, 1000 shopping baskets and 100000 reviews with some likes.

To modify these numbers, set the following environment variables in the docker run call:

NRUSERS
NRITEMS
NRSALES
NRREVIEWS
NRSALES

Use, for example, -e NRUSERS=1000000 in docker run for moreData.js above.

Data model

There are altogether 6 collections, 4 vertex collections:

  • customers
  • items
  • reviews
  • baskets

and 2 edge collections:

  • sales
  • reviewRel

The general idea is that the sales edge collection has an edge from a customer to an item for each item the customer buys in a sale. Furthermore, the reviewRel collection has edges of type wrote and liked, each pointing from a customer to a review, with the obvious meaning.

The baskets collection is simply using ArangoDB as a key/value store, so it has many shards and no replication configured.

In a single server setup all sharding and replication settings are simply ignored.

example-shop's People

Contributors

neunhoef avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.