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

bbop-graph-noctua

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bbop-graph-noctua - npm Package Compare versions

Comparing version

to
0.0.5

39

lib/edit.js

@@ -882,3 +882,4 @@ /**

// Remove the node itself from super.
ret = bbop_graph.prototype.remove_edge.call(eedge.subject_id(),
ret = bbop_graph.prototype.remove_edge.call(this,
eedge.subject_id(),
eedge.object_id(),

@@ -947,2 +948,38 @@ eedge.predicate_id());

/**
* Merge another graph (addition) into the current graph. Includes the
* copying of annotations for the graph.
* Graph ID is /not/ copied.
*
* @param {graph} in_graph - the graph to merge in
* @returns {Boolean} if graph was loaded
*/
noctua_graph.prototype.merge_in = function(in_graph){
var anchor = this;
var ret = bbop_graph.prototype.merge_in.call(anchor, in_graph);
function _is_same_ann(a1, a2){
var ret = false;
if( a1.key() == a2.key() &&
a1.value() == a2.value() &&
a1.value_type() == a2.value_type() ){
ret = true;
}
return ret;
}
// Merge in graph annotations.
var in_graph_anns = in_graph.annotations();
each(in_graph_anns, function(ann){
// If there are no annotations that have the same KVT triple,
// add a clone.
if( anchor.get_annotations_by_filter( function(a){ return _is_same_ann(ann, a); } ).length == 0 ){
anchor.add_annotation(ann.clone());
}
});
return ret;
};
/**
* Load minerva data response.

@@ -949,0 +986,0 @@ *

2

package.json
{
"name": "bbop-graph-noctua",
"version": "0.0.4",
"version": "0.0.5",
"license": "BSD-3-Clause",

@@ -5,0 +5,0 @@ "description": "A subclass of bbop-graph that layers on a complete annotation and graph editing model for the Noctua set of tools.",

@@ -226,3 +226,27 @@ ////

describe('merging works as expected', function(){
it("we've got to merge it merge it", function(){
// Setup.
var g_base = new model.graph();
var raw_resp = require('./minerva-01.json');
var g_new = new model.graph();
g_new.load_data_fold_evidence(raw_resp['data']);
// Empty g_base should now essentially be g_new.
g_base.merge_in(g_new);
// Check it, make sure that bbop-graph-noctua structures are
// all present.
assert.equal(g_base.all_nodes().length, 14, 'right num nodes');
assert.equal(g_base.all_edges().length, 14, 'right num edges');
var a_node = g_base.all_nodes()[0];
assert.isString(g_base.get_node_elt_id(a_node.id()),
'generated elt_id');
assert.equal(g_base.annotations().length, 4, 'four annotations');
});
});
// var assert = require('chai').assert;

@@ -229,0 +253,0 @@ // var model = new require('..');