Class: graph

graph(new_idopt) → {this}

new graph(new_idopt) → {this}

Sublcass of bbop-graph for use with Noctua ideas and concepts. Unlike the superclass, can take an id as an argument, or will generate on on its own.
Parameters:
Name Type Attributes Description
new_id String <optional>
new id; otherwise new unique generated
Source:
See:
  • module:bbop-graph
Returns:
Type
this

Methods

add_edge(eedge)

Add an edge to the graph. Remember that edges are no anonymous edges here.
Parameters:
Name Type Description
eedge edge a bbop-graph-noctua#edge
Source:

add_edge_from_fact(fact) → {edge}

Add an edge to the graph using a "fact" as the seed. Creates and adds annotations as necessary.
Parameters:
Name Type Description
fact JSON structure representing a fact
Source:
Returns:
newly created edge
Type
edge

add_id(id) → {String}

Add an ID to the graph. Use .id() instead.
Parameters:
Name Type Description
id String string
Deprecated:
  • Yes
Source:
See:
  • module:bbop-graph#id
Returns:
string
Type
String

add_node(enode) → {Boolean}

Get the ID from the graph.
Parameters:
Name Type Description
enode node noctua node
Source:
Returns:
true on new node
Type
Boolean

add_node_from_individual(indv) → {node|null}

Add a node into the graph modeled from the the JSON-LD lite model. Creates or adds types and annotations as necessary.
Parameters:
Name Type Description
indv Object hash rep of graph individual from Minerva response?
Source:
Returns:
Type
node | null

clone() → {graph}

Create a clone of the graph. Naturally, ID is copied.
Source:
Returns:
bbop model graph
Type
graph

create_edge(subject, object, predicateopt) → {edge}

Create an edge for use in internal operations.
Parameters:
Name Type Attributes Description
subject string node id string or node
object string node id string or node
predicate string <optional>
a user-friendly description of the node
Source:
Returns:
bbop model edge
Type
edge

create_edge_mapping(eedge, connector)

Internally connect an edge to a connector ID TODO/BUG: Should use generic ID mapping rather than depending on jsPlumb thingamajunk.
Parameters:
Name Type Description
eedge edge edge
connector connector jsPlumb connector
Deprecated:
  • Yes
Source:

create_graph() → {graph}

Create a graph for use in internal operations.
Source:
Returns:
bbop model graph
Type
graph

create_node(id, labelopt, typesopt, inferred_typesopt) → {node}

Create a node for use in internal operations.
Parameters:
Name Type Attributes Description
id string a unique id for the node
label string <optional>
a user-friendly description of the node
types Array <optional>
list of types to pre-load
inferred_types Array <optional>
list of inferred types to pre-load
Source:
Returns:
new bbop model node
Type
node

dump() → {String}

Debugging text output function. Not sure what this is for anymore honestly...
Deprecated:
  • Yes
Source:
Returns:
a graph rep as a string
Type
String

edit_node_order() → {Array}

Return the "table" order of the nodes.
Source:
Returns:
node order by id?
Type
Array

extract_evidence_seeds() → {Object}

Extract all of the evidence seeds from the graph--nodes and edges. An evidence seed is a: 1) real node in the graph that 2) is referenced by the value of a node or edge special evidence annotation.
Source:
Returns:
a map of seeds (by id) to their referencing enity {node} or {edge}
Type
Object

fold_evidence() → {Boolean}

Fold the evidence individuals into the edges and nodes that reference them under the referenced_subgraph functions. Currently, a single pass is run to fold evidence subgraphs (sometimes containing a single node) into other nodes/edges as referenced subgraphs. However, additional passes can very easily be added to fold away references to references as long as a matching function is provided.
Source:
Returns:
if data was loaded
Type
Boolean

fold_go_noctua(relation_list, relation_reverse_list) → {Boolean}

In addition to everything we did for {fold_evidence}, we're going to search for nodes that have enabled_by and/or occurs_in (or any other specified relation) targets (that are themselves leaves) fold them in to the contained subgraph item, and remove them from the top-level graph. TODO: inferred individuals
Parameters:
Name Type Description
relation_list Array of relations (as strings) to scan for for collapsing
relation_reverse_list Array of relations (as strings) to scan for for collapsing in the opposite direction.
Source:
Returns:
if data was loaded
Type
Boolean

get_connector_id_by_edge_id(eid) → {String}

Return a connector by it's associated edge ID if extant.
Parameters:
Name Type Description
eid String the ID of the edge
Source:
Returns:
- the connector ID
Type
String

get_edge_by_id(edge_id) → {edge|null}

Return an edge by is ID.
Parameters:
Name Type Description
edge_id String the ID of the {edge}
Source:
Returns:
- the {edge}
Type
edge | null

get_edge_id_by_connector_id(cid) → {String}

Return an edge ID by it's associated connector ID if extant.
Parameters:
Name Type Description
cid String the ID of the connector.
Source:
Returns:
- the ID of the associated edge
Type
String

get_evidence_clique(node_id) → {graph}

Extract the entire super clique subgraph for an entity. The ID for the graph will be the ID of the seed node. BUG/WARNING: The clique actually needs to use the walker rather than the anc/desc functions it uses now.
Parameters:
Name Type Description
node_id String the ID of the see node in an evidence clique
Source:
Returns:
a list of found seeds as {node} ids
Type
graph

get_evidence_subclique(node_id) → {graph|null}

Extract an evidence subclique starting at a seed node. A subclique is a subgraph within a clique that represents a piece of evidence, and may overlap with other pieces of evidence. The ID for the graph will be the ID of the seed node. Returns a clone. TODO: More to do as we expand what the evidence subgraphs look like.
Parameters:
Name Type Description
node_id String the ID of the seed node in an evidence clique - it is *assumed* that this is a legit seed node id
Source:
Returns:
a list of found seeds as {node} ids
Type
graph | null

get_id() → {String}

Get the ID from the graph. Use .id() instead.
Deprecated:
  • Yes
Source:
See:
  • module:bbop-graph#id
Returns:
string
Type
String

get_node_by_elt_id() → {node|null}

Return a copy of a {node} by its element id.
Source:
Returns:
node
Type
node | null

get_node_by_individual() → {node|null}

Return a copy of a {node} by its corresponding Minerva JSON rep individual.
Source:
Returns:
node
Type
node | null

get_node_elt_id() → {String|null}

Return a node's element id.
Source:
Returns:
node element id
Type
String | null

get_nodes() → {Object}

Return a hash of node ids to nodes. Real, not a copy.
Source:
See:
  • module:bbop-graph#all_nodes
Returns:
node ids to nodes
Type
Object

get_violations_by_id(node_id) → {Array|Null}

Return an edge by is ID.
Parameters:
Name Type Description
node_id String the ID of the {edge}
Source:
Returns:
- Returns a list of 'violation' found in the graph for a given id.
Type
Array | Null

inconsistent_p() → {Boolean|null}

Returns true if the model had the "inconsistent-p" property when built.
Source:
Returns:
inconsistent or not; null if unknown
Type
Boolean | null

load_data_basic(the) → {Boolean}

Load minerva data response. TODO: inferred individuals
Parameters:
Name Type Description
the Object "data" portion of a Minerva graph-related response.
Source:
Returns:
if data was loaded
Type
Boolean

merge_in(in_graph) → {Boolean}

Merge another graph (addition) into the current graph. Includes the copying of annotations for the graph. This is an /additive/ operation (e.g. annotations and other non-unique entities accumulate). Graph ID is /not/ copied. modified-p and inconsistent-p properties are copied from the the incoming graph (assuming that the update has more recent information).
Parameters:
Name Type Description
in_graph graph the graph to merge in
Source:
Returns:
if graph was loaded
Type
Boolean

merge_special(in_graph) → {Boolean}

Merge another graph into the current graph, with special overwrite rules. In essence, this could be used when trying to simulate a rebuild even though you got merge data. Annotations in any top-level item (graph, node, edge), or lack thereof, from the incoming graph is preferred. All extant edges and nodes in the incoming graph are clobbered. The incoming graph is considered to be "complete", so any edges where both the source and sink are in the incoming graph are considered to be the only edges between those node. Graph ID is /not/ copied. Beware that you're in the right folded mode.
Parameters:
Name Type Description
in_graph graph the graph to merge in
Source:
Returns:
if graph was loaded
Type
Boolean

modified_p() → {Boolean|null}

Returns true if the model had the "modified-p" property when built.
Source:
Returns:
inconsistent or not; null if unknown
Type
Boolean | null

remove_edge_by_id(edge_id) → {Boolean}

Remove an edge to the graph. The edge as IDed.
Parameters:
Name Type Description
edge_id String edge by ID
Source:
Returns:
true if such an edge was found and deleted, false otherwise
Type
Boolean

remove_node(node_id, clean_popt) → {Boolean}

Remove a node from the graph.
Parameters:
Name Type Attributes Description
node_id String the id for a node
clean_p Boolean <optional>
remove all edges connects to node (default false)
Source:
Returns:
true if node found and destroyed
Type
Boolean

report_state() → {null}

Provide a verbose report of the current state of the graph and subgraphs. Writes using console.log; only to be used for debugging.
Source:
Returns:
just the facts
Type
null

unfold(incoming_graphopt) → {Boolean}

Essentially, undo anything that could be done in a folding step--return the graph to its most expanded form.
Parameters:
Name Type Attributes Description
incoming_graph Object <optional>
subgraph to unfold into the calling graph (default behaviour would be calling itself; only really used internally by this method for recursion)
Source:
Returns:
if unfolded (should always be true)
Type
Boolean

update_with(in_graph) → {Boolean}

DEPRECATED This uses a subgraph to update the contents of the current graph. The update graph is considered to be an updated complete self-contained subsection of the graph, clobbering nodes, edges, and the graph annotations. In the case of edges, all edges for the incoming nodes are deleted, and the ones described in the incoming graph are added (again, update). For example: you can think of it like this: if we have a graph: A, B, C, and A.1, where A, B, and C are nodes and A.1 is an annotation for A. And we have an argument subgraph: A, B, and edge (A,B), and A.2, B.1. The final graph would be: A, B, C and edge (A,B), and A.2, B.1. Essentially, any entity in the new graph clobbers the "old" version; nodes not mentioned are left alone, the subgraph edges are assumed to be complete with reference to the contained nodes. This can express removal of things like annotations and sometimes edges, but not of nodes and edges not contained in within the subgraph. See the unit tests for examples. Be careful of what happens when using with the various loaders as the contents of top-level entities can be very different--you probably want to apply the right loader first.
Parameters:
Name Type Description
in_graph graph the graph to update with
Deprecated:
  • Yes
Source:
Returns:
if graph was loaded
Type
Boolean

valid_owl_p() → {Boolean}

Returns boolean on whether the returned model is valid according to the owl reasoner; true if there is no logic to probe (this is a temporary measure until reasoner is "always on").
Source:
Returns:
p - bool
Type
Boolean

valid_p() → {Boolean}

Returns boolean on whether the returned model is /completely/ valid; true if there is no logic to probe (this is a temporary measure until reasoner is "always on").
Source:
Returns:
p - bool
Type
Boolean

valid_shex_p() → {Boolean}

Returns boolean on whether the returned model is valid according to ShEx shapes in Minerva; true if there is no logic to probe (this is a temporary measure until reasoner is "always on").
Source:
Returns:
p - bool
Type
Boolean

violations() → {Array}

Returns an array of objects that describe the ShEx violations found in a model.
Source:
Returns:
violations or an empty list if none
Type
Array