New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@nelson-ai/graph-traversal

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nelson-ai/graph-traversal

Gremlin-like graph traversal for JSON-LD

  • 1.0.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

Edge Factory Graph Traversal library

This is a graph traversal library, loosely inspired from Gremlin.

Main differences with Gremlin

  • Gremlin uses a property graph, where edges may have properties. Since Edge Factory is in JSON-LD (aka RDF), edges are predicates and cannot embed attributes.

  • In the Edge Factory graph, type is mandatory. We leverage this by auto-indexing on types.

Playing

We provide a REPL to play with the edge-graph. You can start it by running npm run repl.

You can then start playing with the API. For example, to

Examples

  • fetch all classes that inherit edgeo:Thing
> g.v('edgeo:Thing').in('subClassOf').get('id')
  • get the id and label of Asset instances
> g.t('Asset').get('id', 'label')
  • get the levers, count them, add some conditions
> g.t('Lever').count()
> g.t('Lever').has('timeHorizon', 12).count()
> g.v('edger:process1').out('levers').get('id', 'timeHorizon')
> g.v('edger:process1').out('levers').count()
> g.v('edger:process1').out('levers').has('timeHorizon', 12).count()
> g.v('edger:process1').out('levers').has('timeHorizon', 12).get('id', 'timeHorizon')

API

TODO: list all API methods

Gotchas :

g.v

  • id => return a Vertex
  • array of id => return a VertexList

VertexList.filter

The data received by a filter function is a Vertex, not a POJO. Use get() to access data fields...

const r = g.v('test:edge')
           .in('worksFor')
           .filter(p => p.get().age < 30)
           .get('id', 'age');

FAQs

Package last updated on 29 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc