Giter Site home page Giter Site logo

xapi2gremlin's Introduction

This library tries to port xAPI towards a graph DB in Gremlin.

First npm install and to test, use npm test

It is still under development

#Test output

The test will output like the following. You can add more test files and use node convert.js -s xxx.json

0:
statement0=graph.addVertex(label, "statement", "id", 'da5c5561-3d1c-445b-bc54-6b6b5d2f1f66', "timestamp", 1493820996111)
actor0=g.V().has("agent", "mbox", 'mailto:[email protected]')
if (!actor0.hasNext()) actor0=graph.addVertex(label, "agent", "mbox", 'mailto:[email protected]', "name", 'Student')
statement0.addEdge('has', actor0);
object0=g.V().has("statement", "id", 'e05aa883-acaf-40ad-bf54-02c8ce485fb0')
if (object0.hasNext()) statement0.addEdge('has', object0)
actor0.addEdge('voided', object0)
result0=graph.addVertex(label, "result", "score.scale",0.1,"score.raw",10,"score.max",100,"response",'Wow, nice work!')
statement0.addEdge('has', result0)
context0=graph.addVertex(label, "context", "registration",'this is uuid',"platform",'offline')
actor1=g.V().has("agent", "mbox", 'mailto:[email protected]')
if (!actor1.hasNext()) actor1=graph.addVertex(label, "agent", "mbox", 'mailto:[email protected]', "name", 'Teacher')
context0.addEdge('has', actor1);
contextstatement0=g.V().has("statement", "id", 'e05aa883-acaf-40ad-bf54-02c8ce485fb0')
if (contextstatement0.hasNext()) context0.addEdge('has', contextstatement0)
statement0.addEdge('has', context0)
attachment00=graph.addVertex(label, "attachment", "display",'picture',"fileUrl",'http://google.com',"length",14)
statement0.addEdge('has', attachment00)
attachment01=graph.addVertex(label, "attachment", "display",'video',"fileUrl",'http://bing.com',"length",144344,"contentType",'video/mpeg',"sha2",'rgt834yutu4hgi3u4hgi934uhg3')
statement0.addEdge('has', attachment01)


1:
statement0=graph.addVertex(label, "statement", "id", 'b5731d0f-670b-4b50-8942-5a00d1270fbc', "timestamp", 1493990919662)
actor0=g.V().has("group", "id", 'undefined')
if (!actor0.hasNext()) actor0=graph.addVertex(label, "group", "id", '483a0a23-127b-4815-adc9-c47c51d67759', "name", 'I am a group')
actor1=g.V().has("agent", "mbox", 'mailto:[email protected]')
if (!actor1.hasNext()) actor1=graph.addVertex(label, "agent", "mbox", 'mailto:[email protected]', "name", 'student1')
actor0.addEdge('has', actor1);
actor1=g.V().has("agent", "mbox", 'mailto:[email protected]')
if (!actor1.hasNext()) actor1=graph.addVertex(label, "agent", "mbox", 'mailto:[email protected]', "name", 'student2')
actor0.addEdge('has', actor1);
actor1=g.V().has("agent", "mbox", 'mailto:[email protected]')
if (!actor1.hasNext()) actor1=graph.addVertex(label, "agent", "mbox", 'mailto:[email protected]', "name", 'student3')
actor0.addEdge('has', actor1);
statement0.addEdge('has', actor0);
statement1=graph.addVertex(label, "statement", "id", 'fe14e179-0df4-46fb-837f-251619da5605', "timestamp", 1493990919662)
actor1=g.V().has("agent", "mbox", 'mailto:[email protected]')
if (!actor1.hasNext()) actor1=graph.addVertex(label, "agent", "mbox", 'mailto:[email protected]', "name", 'undefined')
statement1.addEdge('has', actor1);
object1=g.V().has("activity", "id", 'http://example.com/website')
if (!object1.hasNext()) object1=graph.addVertex(label, "activity", "id", 'http://example.com/website', "name", 'Some Awesome Website')
statement1.addEdge('has', object1)
actor1.addEdge('will visit', object1)
statement0.addEdge('has', statement1)
object0=statement1
actor0.addEdge('planned', object0)

xapi2gremlin's People

Contributors

bobzhouef avatar

Watchers

Bob Zhou avatar James Cloos 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.