Giter VIP home page Giter VIP logo

data's Introduction

Data.js

Data.js is a data representation framework for Javascript. It's being developed in the context of Substance, an open publishing platform.

For documentation, usage, and examples, see the offical documentation: http://substance.io/michael/data-js

With Data.js you can:

  • Model your domain data using a simple graph-based object model that can be serialized to JSON.
  • Traverse your graph, including relationships using a simple API.
  • Manipulate and query data on the client (browser) or on the server (Node.js) by using exactly the same API.

Features

  • Data.Graph (A data abstraction for all kinds of linked data)
  • Data.Collection (A simplified interface for tabular data)

Getting Started

Define a schema

var schema = {
  "/type/person": {
    "type": "/type/type",
    "name": "Person",
    "properties": {
      "name": {"name": "Name", "type": "string", "required": true},
      "origin": {"name": "Origin", "type": "/type/location" }
    }
  },
  "/type/location": {
    "type": "/type/type",
    "name": "Location",
    "properties": {
      "name": { "name": "Name", "unique": true, "type": "string", "required": true },
      "citizens": {"name": "Citizens", "unique": false, "type": "/type/person"}
    }
  }
};

Create a new Data.Graph.

var graph = new Data.Graph(schema);

Add some objects.

graph.set({
  _id: "/person/bart",
  type: "/type/person",
  name: "Bart Simpson"
});

graph.set({
  _id: "/location/springfield",
  name: "Springfield",
  type: "/type/location",
  citizens: ["/person/bart"]
});

Set properties (including relationships to other objects)

graph.get('/person/bart')
     .set({origin: '/location/springfield'});

Access your data.

var citizens = graph.get('/location/springfield').get('citizens');

_.each(citizens, function(person) {
  console.log(person.get('name'));
});

In The Wild

  • Substance - A web-based document authoring and publication platform that relies on Data.js for object persistence.
  • Déjàvis - A tool for analyzing and visualizing data. It uses Data.js for filtering and aggregating data
  • Dance.js Dance.js - A data-driven visualization library.

data's People

Contributors

gr2m avatar michael avatar navaru avatar snusnu avatar timjb avatar

Watchers

 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.