What's the Graph ML?
Graph ML is for Graph Marked Lanuage, which is similar with Facebook's GraphQL, But mostly as a Domain-Specific expression in WeFlex team.
This libaray is for generating abstract syntax tree from given Graph ML source file.
WeFlex team internally takes StrongLoop's loopback framework be working with most other libraries, and we are focusing on writing more graceful codebase. Loopback's JSON model definition looks good to define SQL-like tables, but we have a document-based MongoDB to be generated for views, so we found the GraphQL is close to our needs.
This project doesn't be compatible with GraphQL, if you expect a library to parse the complete GraphQL, you should visit ooflorent/graphql-parser.
$ npm install graphml-parser --save
var graphql = require('graphml-parser');
var source = fs.readFileSync('../foo.graphml').toString('utf8');
var ast = graphql.parse(source);
The GraphML file should look like the following:
Basis {
foo,
bar,
items(limit=10, status=checkin) {
bar
}
}
Then you will get the following tree:
{
"type": "Basis",
"fields": [],
"root": {
"fields": [
"foo",
"bar"
],
"methods": {
"items": {
"type": false,
"args": {
"limit": 10,
"status": "checkin"
},
"fields": [
"bar"
]
}
}
}
}
MIT @ WeFlex, Inc.