Giter Club home page Giter Club logo

cypher.js's Introduction

Cypher.js

Cypher graph database query engine and graph database in Javascript. The Cypher query language in your browser! Zero dependencies

For inquiries, reach out to Cypher.js author Niclas Kjäll-Ohlsson ([email protected]).

Demos

  1. Just for fun: https://bit.ly/2Dbylrh
  2. Molecule interactions
  3. Game of Thrones: https://bit.ly/2QoBSG9
  4. Time series analysis: https://bit.ly/2zSQkzt
  5. Generate random strings: https://bit.ly/2FoJcAW
  6. Bill of material explosion: https://bit.ly/2DoKJE6

Usage

Client-side (web browser)

  1. Include

    <script type="text/javascript" src="Cypher.min.js"></script>

  2. Use

    var options = {
    
    	// Default will run as Web Worker, i.e. runInWebWorker = true if not specified
    	// Set runInWebWorker to false to run in same thread as main page javascript
    	runInWebWorker: true,
    
    	// Proxy for xmlhttprequest to avoid CORS. This is optional. If not provided
    	// will attempt to download from given URL directly which might give error
    	// Access denied for URL resource due to "Cross-Origin Request Blocked"
    	// The data download proxy must take one GET parameter, u, which is the URL to download
    	// and must return the data from the URL to download. 
    	// Also it should add the "Access-Control-Allow-Origin: *" http header to the response
    	// if the proxy is not served from same url as Cypher.js script is run from
    	dataDownloadProxy: "http://proxy_url?u="
    
    };
    var cypher = new Cypher(options);
    
    var query = 'merge (n:Test{what:"Hello World"}) return n';
    
    cypher.execute(
    	query,
    	function(results) {
    		console.log(results);
    	},
    	function(errorText) {
    		console.log(errorText);
    	}
    );
    

Node.js

// Dependency to https package
var https = require("https");

var Cypher = require("Cypher.min.js").Cypher;

var options = {

	// In Node.js the runInWebWorker option must be set to false
	// Web Workers are not supported in Node.js
	runInWebWorker: false,

	// In Node.js a proxy is not needed
	dataDownloadProxy: null

};
var cypher = new Cypher(true);

cypher.execute(
	'unwind range(0,10) as item return item',
	function(results) {
		console.log(JSON.stringify(results));
	},
	function(error) {
		console.log(error);
	}
);

cypher.js's People

Contributors

niclasko 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.