Knowledge graph tools
MCP.Scientio.Com documentation

Knowledge graph

Every knowledge base has a knowledge graph: a network of nodes (the things the KBase knows about) joined by edges (the relationships between them). Nodes carry attributes holding values, and may carry an existence describing when the thing existed in time. Nodes and edges are typed by a lineage drawn from a shared taxonomy of concepts.

The graph is built automatically as content is indexed, but these tools let an agent read it and curate it by hand.

Whole graph

Nodes

Node attributes

Time

Edges

GetGraph

read-only

Gets the whole graph structure for a knowledge base.

Parameters

NameTypeDescription
indexIdstringThe Id of the KBase.

Returns

The graph as a set of nodes and edges in Cytoscape form, suitable for visualisation or traversal.

GetFilteredGraph

read-only

Gets the graph as it stood at a particular moment: only the nodes that existed on the given date, according to their existence data, are returned.

Parameters

NameTypeDescription
indexIdstringThe Id of the KBase.
iso8601datestringAn ISO 8601 Extended date, where negative years are BCE dates.

Returns

The filtered graph, in the same form as GetGraph. An invalid or missing date fails with Invalid date.

GetTimeLine

read-only

Gets the timeline of a knowledge base: the set of existences recorded for its nodes.

Parameters

NameTypeDescription
indexIdstringThe Id of the KBase.

Returns

A list of existences, or an empty list if none have been set.

CreateNode

destructive

Creates a new node in the graph of a knowledge base.

Parameters

NameTypeDescription
indexIdstringThe Id of the KBase.
nodeNamestringThe name of the node.
lineagestringThe lineage that types the node. Find one with the lineage tools.

Returns

The Id of the new node. An unrecognised lineage is rejected.

GetNodeCore

Gets the core information for a node — its name, lineage and identity — without its attributes.

Parameters

NameTypeDescription
indexIdstringThe Id of the KBase.
nodeIdstringThe Id of the node.

Returns

The node's core record. An unknown node fails with Node not found.

GetGraphObject

Gets a complete graph object by its Id, including everything attached to it.

Parameters

NameTypeDescription
indexIdstringThe Id of the KBase.
objectIdstringThe Id of the graph object.

Returns

The complete graph object.

UpdateNode

destructive

Renames a node and/or changes the lineage that types it.

Parameters

NameTypeDescription
indexIdstringThe Id of the KBase.
nodeIdstringThe Id of the node to update.
nodeNamestringThe new name of the node.
lineagestringThe new lineage of the node.

Returns

true if the node was updated.

DeleteNode

destructive

Deletes a node from the graph.

Parameters

NameTypeDescription
indexIdstringThe Id of the KBase.
nodeIdstringThe Id of the node to delete.

Returns

true if the node was deleted; an unknown KBase or node fails with KBase or Node not found.

AnnotateNode

destructive

Annotates a node using a piece of text: the server reads the text and enriches the node with the attributes and relationships it finds there.

Parameters

NameTypeDescription
indexIdstringThe Id of the KBase.
nodeIdstringThe Id of the node to annotate.
textstringThe text to annotate the node with.

Returns

The annotated graph object.

AnnotateNodeFromUrl

destructive

As AnnotateNode, but the text is fetched from a web page.

Parameters

NameTypeDescription
indexIdstringThe Id of the KBase.
nodeIdstringThe Id of the node to annotate.
urlstringThe URL whose content should be used.

Returns

The annotated graph object.

GetNodeAttributes

Gets all the attributes held by a node.

Parameters

NameTypeDescription
indexIdstringThe Id of the KBase.
nodeIdstringThe Id of the node.

Returns

A list of attributes, each with its Id, name, lineage, datatype and value.

UpsertNodeAttribute

destructive

Adds an attribute to a node, or updates it if an attribute with that Id already exists ("upsert").

Parameters

NameTypeDescription
indexIdstringThe Id of the KBase.
nodeIdstringThe Id of the node.
attributeIdstringThe Id of the new or existing attribute.
attributeValuestringThe value of the attribute.
attributeNamestringThe name of the attribute.
attributeLineagestringThe lineage that types the attribute.
attributeDatatypestringOne of numeric, categorical, textual, sequence, temporal, duration or markdown.

Returns

true if the attribute was written.

DeleteNodeAttribute

destructive

Deletes an attribute from a node.

Parameters

NameTypeDescription
indexIdstringThe Id of the KBase.
nodeIdstringThe Id of the node.
attributeIdstringThe Id of the attribute to delete.

Returns

true if the attribute was deleted.

GetNodeExistence

Gets the temporal existence data for a node: when the thing it represents began, ended, or occurred.

Parameters

NameTypeDescription
indexIdstringThe Id of the KBase.
nodeIdstringThe Id of the node.

Returns

The node's existence, expressed as a fuzzy time.

UpdateExistence

destructive

Sets the temporal existence data for a node. Supply between one and four ISO 8601 Extended dates (a negative year means BCE):

Dates givenMeaning
onean event — a single point in time
twoan interval — a start and an end
threea fuzzy event
foura fuzzy interval

Each date may be given a precision: the tolerance of that date in seconds. Leave a precision at 0.0 for an exact date.

Parameters

NameTypeDescription
indexIdstringThe Id of the KBase.
nodeIdstringThe Id of the node.
iso8601Date1stringThe first date.
iso8601Date2string (optional)The second date.
iso8601Date3string (optional)The third date.
iso8601Date4string (optional)The fourth date.
precision1number (optional)Tolerance of the first date in seconds. Default 0.0.
precision2number (optional)Tolerance of the second date in seconds. Default 0.0.
precision3number (optional)Tolerance of the third date in seconds. Default 0.0.
precision4number (optional)Tolerance of the fourth date in seconds. Default 0.0.

Returns

true if the existence was updated. Existence data set here is what GetFilteredGraph and GetTimeLine report on.

CreateEdge

destructive

Creates a new edge joining two existing nodes.

Parameters

NameTypeDescription
indexIdstringThe Id of the KBase.
sourceNodeIdstringThe Id of the node the edge starts from.
targetNodeIdstringThe Id of the node the edge points to.
edgeNamestringThe name of the edge.
lineagestringThe lineage that types the edge.

Returns

The Id of the new edge.

GetEdgeCore

Gets the core information for an edge.

Parameters

NameTypeDescription
indexIdstringThe Id of the KBase.
edgeIdstringThe Id of the edge.

Returns

The edge record, including the nodes it connects. An unknown edge fails with Edge not found.

UpdateEdge

destructive

Renames an edge and/or changes the lineage that types it.

Parameters

NameTypeDescription
indexIdstringThe Id of the KBase.
edgeIdstringThe Id of the edge to update.
edgeNamestringThe new name of the edge.
lineagestringThe new lineage of the edge.

Returns

true if the edge was updated.

DeleteEdge

destructive

Deletes an edge from the graph, leaving the nodes it joined in place.

Parameters

NameTypeDescription
indexIdstringThe Id of the KBase.
edgeIdstringThe Id of the edge to delete.

Returns

true if the edge was deleted; an unknown KBase or edge fails with KBase or Edge not found.