Git Product home page Git Product logo

gasket's Introduction

Gasket

Gasket is an example interface for the Cayley rdf graph store :

A gasket is a seal which fills the space between two or more mating surfaces, generally to prevent leakage.

The gasket project is an example API written in golang featuring :

  • 'Normalized' JSON object model mapped to an rdf data store (see schema below for details)
  • Integration of Cayley as a go library
  • Example of capturing quad meta-data using cayley v0.6
  • Examples of miscellaneous plumbing required for an API in golang (external configuration, logging, unit tests for handlers)

Items not yet implemented

This project will build, compile, and run as a functional API; however, there are certain crucial elements which are not implemented. Those include :

  • Validation
  • Security
  • Documentation (ala Swagger)

Installation

Requirements

Config

  • The project will look for a configuration path from an Environment variable at ACES_CFG. There are two separate files that can be set. log.toml and config.toml. Example files for each can be found within the project within the config folder.
  • If a database server name is not found in config.toml, the project will not run

Build

  • run 'go build' from the project directory

Run

  • run ./gasket to start the server

Schema

The project utilizes three JSON objects. Node, Relation, and Metadata.

Node

Node : Is a basic object with an extensible list of properties. The JSON schema for a Node is defined as :

"node": {
	"type":"object",
	"properties": {
		"id": {"type":"string"},
		"name":{"type":"string"},
		"label":{"type":"string"},
	},
	"patternProperties": {
        	"^(/[^/]+)+$": { "type": "object" }
		/**
		 * Accept any property without a '/' character
		 */
   		}
	"required":["name"]
}

Each node will be stored as several quads within the graph store. The basic quad representation is

<id> <schema:name> "nameParam" "label"
<id> <patternPropertyA> "propertyAParam" "label"
<id> <patternPropertyB> "propertyBParam" "label"
... etc 

Relation

Relation : will relate two nodes within a typical rdf quad. The schema is :


"relation": { 
	"type":"object",
	"properties": {
		"id": {"type":"string"},
		"sourceId":{"type":"string"},
		"type":{"type":"string"},
		"targetId":{"type":"string"},
		"label":{"type":"string"},
	}
	"required":["sourceId", "type", "targetId", "label"]
}
	

The relation will be stored as a quad with

quad.Quad{
	Subject : sourceId,
	Predicate : type,
	Object : targetId,
	Label : label,
}

A JSON representation of this quad will be stored and assigned an id. This id will be associated with the JSON object.

Metadata

Metadata : Provides a way of storing additional details about the relation. The schema is similar to a node :

"metadata": {
	"type":"object",
	"properties": {
		"id": {"type":"string"},
		"relationId":{"type":"string"},
	},
	"patternProperties": {
        	"^(/[^/]+)+$": { "type": "object" }
		/**
		 * Accept any property without a '/' character
		 */
   		}
	"required":["relationId"]

}

And the method of mapping metadata to quads is similar to that used for nodes.

License

Released under the MIT license. See LICENSE file for more details.

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.