Skip to content

Add support for multi-labeled nodes#82

Open
jeffreylovitz wants to merge 1 commit intomasterfrom
multi-label
Open

Add support for multi-labeled nodes#82
jeffreylovitz wants to merge 1 commit intomasterfrom
multi-label

Conversation

@jeffreylovitz
Copy link
Copy Markdown
Contributor

This PR allows nodes to be created and parsed with an array of label string as well as with a label string (for backwards compatibility).

This should not break existing functionality, but adds the ability to have multiple labels on a given node.

@jeffreylovitz jeffreylovitz added the enhancement New feature or request label Oct 21, 2021
@jeffreylovitz jeffreylovitz requested a review from leibale October 21, 2021 18:06
@jeffreylovitz jeffreylovitz self-assigned this Oct 21, 2021
Comment thread src/resultSet.js
}
let properties = await this.parseEntityProperties(cell[2]);
let node = new Node(label, properties);
let node = new Node(labels, properties);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

Comment thread src/resultSet.js
if (cell[1].length == 1) {
labels = await this.parseNodeLabel(cell[1][0]);
} else {
labels = await Promise.all(cell[1].map(x => this.parseNodeLabel(x)));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').
Missing semicolon.

Comment thread src/resultSet.js
let node_id = cell[0];
var labels = undefined;
if (cell[1].length == 1) {
labels = await this.parseNodeLabel(cell[1][0]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon.

Comment thread src/resultSet.js
// [[name, value, value type] X N]

let node_id = cell[0];
var labels = undefined;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessary to initialize 'labels' to 'undefined'.

Comment thread src/resultSet.js
// [label string offset (integer) X N],
// [[name, value, value type] X N]

let node_id = cell[0];
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

Comment thread src/resultSet.js
* @param {object[]} cell raw node representation.
* @returns {Promise<Node>} Node object.
*/
async parseNode(cell) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class properties must be methods. Expected '(' but instead saw 'parseNode'.
Duplicate class method 'async'.

Comment thread src/resultSet.js
var tries = 0;
while (label == undefined && tries < 10) {
label = await this._graph.fetchAndGetLabel(cell[1][0]);
label = await this._graph.fetchAndGetLabel(label_idx);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon.

Comment thread src/resultSet.js
let node_id = cell[0];
let label = this._graph.getLabel(cell[1][0]);
async parseNodeLabel(label_idx) {
let label = this._graph.getLabel(label_idx);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

Comment thread src/resultSet.js

let node_id = cell[0];
let label = this._graph.getLabel(cell[1][0]);
async parseNodeLabel(label_idx) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class properties must be methods. Expected '(' but instead saw 'parseNodeLabel'.
Duplicate class method 'async'.

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 25, 2021

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.74%. Comparing base (312f4ea) to head (6bab604).
⚠️ Report is 11 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #82   +/-   ##
=======================================
  Coverage   90.74%   90.74%           
=======================================
  Files           6        6           
  Lines         108      108           
  Branches        6        6           
=======================================
  Hits           98       98           
  Misses         10       10           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant