Class Graph#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Base Types#

  • public GraphObject

  • public Iterable< Edge >

  • public Graph

  • public Graphable

  • public TripleStore

Class Documentation#

class Graph : public GraphObject, public Iterable<Edge>, public Graph, public Graphable, public TripleStore#

Graph Manager Edges are stored in an index An index is a table: predicate -> List<Edge> Edge List are sorted Join on a Node is computed by dichotomy getEdges() return edges of all named graphs as quads Default Graph: g.getDefault().iterate() Named Graphs: g.getNamed().iterate() See DataProducer for more iterators.

Author

Olivier Corby, Edelweiss INRIA 2010

Public Functions

inline boolean isSkolem()#

Returns whether the graph is a skolemization.

This docstring was generated by AI.

Returns:

true if the graph is a skolemization, false otherwise

inline void setSkolem(boolean isSkolem)#

Sets the skolem flag for the graph.

This docstring was generated by AI.

Parameters:

isSkolem – the skolem flag value

inline String getName()#

Returns the name of the graph.

This docstring was generated by AI.

Returns:

The name of the graph

inline void setName(String name)#

Sets the name of the graph.

This docstring was generated by AI.

Parameters:

name – The name of the graph

inline boolean isFlawed()#

Contain undefined datatype.

inline boolean isCorrect()#

Checks if the graph is not flawed.

This docstring was generated by AI.

Returns:

true if the graph is not flawed, false otherwise

inline boolean typeCheck()#

Performs type checking and recursively checks entailment if present.

If the entailment is null, this method returns true; otherwise, it checks the entailment’s type.

This docstring was generated by AI.

Returns:

true if the type check passes, false otherwise

inline boolean conform()#

Checks if the graph conforms to a given shape.

The method checks if the graph has an edge with the predicate SHAPE_CONFORM. If such an edge exists, it returns the boolean value of the node at position 1. Otherwise, it returns false.

This docstring was generated by AI.

Returns:

True if the graph conforms to the given shape, false otherwise

inline boolean isTuple()#

Returns whether the instance is a tuple.

This docstring was generated by AI.

Returns:

True if the instance is a tuple, false otherwise

inline void setTuple(boolean isTuple)#

Sets the tuple flag for the graph.

This docstring was generated by AI.

Parameters:

isTuple – The new value for the tuple flag

inline boolean hasRuleEdgeList()#

Indicates whether the graph has a rule edge list.

This docstring was generated by AI.

Returns:

true if the graph has a rule edge list, false otherwise

inline void setHasList(boolean hasRuleEdgeList)#

Sets the hasRuleEdgeList flag and updates the list accordingly.

This docstring was generated by AI.

Parameters:

hasRuleEdgeList – The flag value

inline String toGraph()#

Returns a string representation of the graph.

This docstring was generated by AI.

Returns:

A string representation of the graph.

inline void setGraph(Object obj)#

Intentionally empty method for setting the graph object.

This docstring was generated by AI.

Parameters:

obj – The object to be set as the graph

inline Object getGraph()#

Returns the graph instance itself.

This docstring was generated by AI.

Returns:

The graph instance.

inline Graph getTripleStore()#

Returns the graph object itself.

This docstring was generated by AI.

Returns:

The current graph object.

inline String getDatatypeLabel()#

Returns a string representation of the graph object with its size.

This docstring was generated by AI.

Returns:

A string in the format “[Graph: size={size}]”

inline Iterable<Edge> getLoop()#

Return copy edges in specific objects.

Returns:

inline Iterable<Edge> getEdgesRDF4J(Node s, Node p, Node o, Node... from)#

Return statements with the specified subject, predicate, object and (optionally) from exist in this graph.

Parameters:
  • s – The subject of the statements to match, null to match statements with any subject.

  • p – Predicate of the statements to match, null to match statements with any predicate.

  • o – Object of the statements to match, null to match statements with any object.

  • from – Contexts of the statements to match. If from = Node[0] or from = null, statements will match disregarding their context.

Returns:

List of edges that match the specified pattern.

inline Iterator<Edge> iterator()#

Iterate graph edges Successive edges of the same property are returned in the “same physical” Edge object The reason is that edges are stored without the property Node.

Iterator creates a buffer to store a copy of edges with the property Node. For performance purpose in SPARQL Producer, we iterate edges in the same buffer If needed, it may be necessary to make copy of edge buffer using g.getEdgeFactory().copy(edge) .

inline IDatatype getValue(String var, int n)#

Returns the n-th value in the graph.

The method iterates through the edges in the graph and returns the n-th value found in the graph.

This docstring was generated by AI.

Parameters:
  • var – The variable name

  • n – The index of the value in the graph

Returns:

The value at the specified index in the graph or null if not found

inline Context getContext()#

Returns the context associated with this graph.

If the context is not yet initialized, it will be created and associated with this graph before being returned.

This docstring was generated by AI.

Returns:

The context associated with this graph

inline void setContext(Context context)#

Sets the context of the graph.

This docstring was generated by AI.

Parameters:

context – The new context for the graph

inline PointerType pointerType()#

Returns the pointer type for this graph.

This docstring was generated by AI.

Returns:

The pointer type for this graph, which is PointerType#GRAPH.

inline int getDefaultGraphMode()#

Returns the default graph mode.

This docstring was generated by AI.

Returns:

The default graph mode.

inline void setDefaultGraphMode(int defaultGraph)#

Sets the default graph mode.

This docstring was generated by AI.

Parameters:

defaultGraph – The default graph mode.

inline TreeNode treeNode()#

Returns a new instance of TreeNode.

This docstring was generated by AI.

Returns:

A new TreeNode object.

inline Graph()#

Constructs a new Graph object with default length.

This docstring was generated by AI.

Parameters:

none – This constructor does not accept any parameters.

Returns:

A new instance of the Graph class.

inline Graph(int length)#

Constructs a new Graph object with a specified length.

This docstring was generated by AI.

Parameters:

length – The length of the graph.

inline Node getNode(int n)#

Returns the node at the specified index.

This docstring was generated by AI.

Parameters:

n – The index of the node to retrieve

Returns:

The node at the specified index

inline Node getNodeDefault()#

Returns the Node from the default index.

This docstring was generated by AI.

Returns:

Node The Node from the default index

inline Node getNodeRule()#

Returns the node for the RULE index.

This docstring was generated by AI.

Returns:

The node for the RULE index

inline Node getNodeEntail()#

Returns the node from the entailment index.

This docstring was generated by AI.

Returns:

The node from the entailment index.

inline EdgeFactory getEdgeFactory()#

Returns the edge factory instance used by the graph.

This docstring was generated by AI.

Returns:

The edge factory instance.

inline void setOptimize(boolean b)#

Sets the optimization flag for graph queries.

This docstring was generated by AI.

Parameters:

b – The optimization flag value

inline void setByIndex(boolean b)#

set byIndex on this graph only reset EdgeIndex as well and sort edge list accordingly

inline boolean isByIndex()#

Returns whether the graph uses indexing mechanism.

This docstring was generated by AI.

Returns:

true if the graph uses indexing, false otherwise

inline boolean isLog()#

Returns true if the log is not null.

This docstring was generated by AI.

Returns:

true if the log is not null, false otherwise

inline Log getLog()#

Returns the log object for the graph manager.

This docstring was generated by AI.

Returns:

The log object

inline void setLog(Log l)#

Sets the log object for the graph manager.

This docstring was generated by AI.

Parameters:

l – The log object to be set for the graph manager

inline void log(int type, Object obj)#

Logs an object based on a given type, if a logger is available.

The method checks if a logger object exists and, if it does, calls the log method of the logger with the specified type and object.

This docstring was generated by AI.

Parameters:
  • type – The type of the log entry.

  • obj – The object to be logged.

inline void log(int type, Object obj1, Object obj2)#

Logs a message with the given type and objects.

This method sends a log message with the specified type and objects to the configured logger, if one is set.

This docstring was generated by AI.

Parameters:
  • type – The type of the log message

  • obj1 – The first object associated with the log message

  • obj2 – The second object associated with the log message

inline void addEngine(Engine e)#

Adds an engine to the manager.

This docstring was generated by AI.

Parameters:

e – The engine to be added

inline void removeEngine(Engine e)#

Removes the specified engine from the manager.

This docstring was generated by AI.

Parameters:

e – The engine to remove

inline Workflow getWorkflow()#

Returns the current workflow manager.

This docstring was generated by AI.

Returns:

The workflow manager

inline void setWorkflow(Workflow wf)#

Sets the workflow manager.

This docstring was generated by AI.

Parameters:

wf – The workflow manager to set

inline void setClearEntailment(boolean b)#

Sets the value of the clear entailment flag in the manager.

This docstring was generated by AI.

Parameters:

b – The value to set the clear entailment flag to.

inline synchronized void process ()

Process entailments.

inline synchronized void process (Engine e)

Processes an engine instance.

This docstring was generated by AI.

Parameters:

e – The engine instance

inline synchronized void remove ()

Remove entailments.

inline void addListener(GraphListener gl)#

Adds a listener to the graph for update notifications.

If the listener list is null, it will be initialized as a new ArrayList. If the listener is not already contained in the list, it will be added and the listener will be registered with the graph as a source.

This docstring was generated by AI.

Parameters:

gl – The listener to add to the graph

inline void removeListener(GraphListener gl)#

Removes a listener from the listener list.

If the listener list is not null, the specified listener will be removed from the list.

Parameters:

gl – The listener to be removed

inline void removeListener()#

Removes all listeners from the listener list.

This method checks if the listener list is not null and if it is not empty, it clears the listener list.

This docstring was generated by AI.

Returns:

No value is returned.

inline void setTagger(Tagger t)#

Sets the tagger for the graph manager.

The tagger is set and, if the tagger is not null, the tag is set to true.

This docstring was generated by AI.

Parameters:

t – The tagger object to be set

inline Tagger getTagger()#

Returns the tagger object.

This docstring was generated by AI.

Returns:

The tagger object.

inline Lock readLock()#

Returns a read lock for the graph manager.

This docstring was generated by AI.

Returns:

A lock for read access to the graph.

inline Lock writeLock()#

Returns the write lock for the graph.

This docstring was generated by AI.

Returns:

The write lock for the graph.

inline ReentrantReadWriteLock getLock()#

Returns the lock object for managing synchronization and locking during concurrent access.

This docstring was generated by AI.

Returns:

The lock object

inline boolean isReadLocked()#

Checks if the graph is currently read-locked.

This docstring was generated by AI.

Returns:

true if the graph is currently read-locked, false otherwise

inline boolean isLocked()#

Checks if the graph is locked for reading or writing.

This docstring was generated by AI.

Returns:

True if the graph is locked, false otherwise

inline Entailment getEntailment()#

Returns the entailment object of the current workflow.

This docstring was generated by AI.

Returns:

The entailment object associated with the workflow.

inline void setEntailment()#

Set RDFS entailment.

inline synchronized void setRDFSEntailment (boolean b)

Use Case: GUI Remove or perform RDFS Entailment.

inline void pragmaRDFSentailment(boolean b)#

Enables or disables RDF entailment for the workflow.

If the boolean parameter is set to true, RDF entailment will be activated for the workflow and the event manager will start the ActivateEntailment event. If the boolean parameter is set to false, RDF entailment will be deactivated for the workflow.

Parameters:

b – A boolean value to enable or disable RDF entailment

inline void set(String property, boolean value)#

Sets a property to a boolean value in the graph.

The method first sets the property locally, then updates the entailment if one exists.

This docstring was generated by AI.

Parameters:
  • property – The name of the property

  • value – The boolean value to set the property to

inline String toString()#

Returns the RDF string representation of the graph.

This docstring was generated by AI.

Returns:

The RDF string representation of the graph

inline String toRDF()#

Generates an RDF representation of the graph.

The RDF representation is created by iterating over the indexed edges and appending their RDF representation to a string builder. Various graph statistics, such as the number of nodes, edges, and triples, are also included in the RDF representation.

This docstring was generated by AI.

Returns:

The RDF representation of the graph

inline NodeManager getNodeManager()#

Returns the node manager of the index.

This docstring was generated by AI.

Returns:

The node manager of the index.

inline Graphable describe()#

Generate an RDF Graph that describes the KGRAM system and the current RDF graph.

inline String toString2()#

Returns a string representation of the graph’s nodes, categorized by type.

The method iterates over each node in the graph and counts the number of nodes of each type (URI, blank, literal, string, number, and date), then returns the counts as a formatted string.

This docstring was generated by AI.

Returns:

A string representing the node counts of each type in the graph

inline String display(int max)#

Displays a subset of the graph with a given maximum limit.

This docstring was generated by AI.

Parameters:

max – The maximum number of elements to display

Returns:

A string representation of the graph subset

inline String display()#

Displays a subgraph of the graph manager.

This docstring was generated by AI.

Parameters:
  • startIndex – The starting index of the subgraph

  • endIndex – The ending index of the subgraph

Returns:

A string representation of the subgraph

inline String display(int n, int max)#

Displays a partial list of edges and their associated predicates.

The method iterates through the sorted properties (predicates) of the graph, adding each one and its corresponding edges to a string builder. The number of edges displayed for each property can be limited using the ‘n’ parameter, while the ‘max’ parameter determines the maximum number of edges to display in total.

This docstring was generated by AI.

Parameters:
  • n – An integer to limit the number of edges displayed for each property

  • max – An integer to limit the total number of edges displayed

Returns:

A string representation of the displayed edges and their associated predicates

inline Entailment getProxy()#

Returns a proxy entailment for the graph manager.

If the proxy is not yet initialized, the method creates a new entailment using the current graph manager. If the creation of a new entailment fails, a new entailment is initialized using the default configuration.

This docstring was generated by AI.

Returns:

A proxy entailment for the graph manager

inline boolean isType(Edge edge)#

Checks if an edge has a type.

This docstring was generated by AI.

Parameters:

edge – The edge to check

Returns:

True if the edge has a type, false otherwise

inline boolean isType(Node pred)#

Checks if a node is a type node in the graph.

This docstring was generated by AI.

Parameters:

pred – The node to check

Returns:

True if the node is a type node, false otherwise

inline boolean isSubClassOf(Node pred)#

Checks if this node is a subclass of the given predicate.

This docstring was generated by AI.

Parameters:

pred – The predicate node

Returns:

True if this node is a subclass of the given predicate, false otherwise

inline boolean isSubClassOf(Node node, Node sup)#

Checks if the given node is a subclass of the specified superclass node.

This docstring was generated by AI.

Parameters:
  • node – The node to check for being a subclass

  • sup – The superclass node to compare against

Returns:

True if the given node is a subclass of the specified superclass node, false otherwise

inline EventManager getEventManager()#

Consistency Management

inline void setEventHandler(EventHandler h)#

Sets the event handler for the graph.

This docstring was generated by AI.

Parameters:

h – The event handler

inline void setVerbose(boolean b)#

Sets the verbose mode for event management.

In verbose mode, additional events such as insertion and construction are hidden from the logger.

This docstring was generated by AI.

Parameters:

b – The verbose mode flag

inline boolean isVerbose()#

Indicates whether the event manager is in verbose mode.

This docstring was generated by AI.

Returns:

True if the event manager is verbose, false otherwise.

inline boolean isEdgeMetadata()#

Returns whether this edge has metadata associated with it.

This docstring was generated by AI.

Returns:

true if this edge has metadata, false otherwise

inline boolean isRDFStar()#

Returns whether the graph is an RDF* graph.

This docstring was generated by AI.

Returns:

true if the graph is an RDF* graph, false otherwise

inline void setEdgeMetadata(boolean b)#

Sets the flag indicating whether edge metadata should be stored.

This docstring was generated by AI.

Parameters:

b – The new value for the edge metadata flag

inline synchronized void init ()

EventManager call init() before query execution First time: Index graph: edge list sorted and reduced, compute graph node index Next time: recompute graph node index All time: Perform entailment.

inline IDatatype start()#

Initializes the graph and returns a datatype value.

This method calls the ‘init’ method to initialize the graph, and then returns the ‘DatatypeMap.TRUE’ value. This method is typically called when the graph is first started.

This docstring was generated by AI.

Returns:

The ‘DatatypeMap.TRUE’ value.

inline void clean()#

Cleans the timestamp index in the graph manager.

This method cleans the timestamp index for rule edge lists in the graph manager. It only performs an action if rule edge lists are present.

This docstring was generated by AI.

Returns:

void

inline void cleanEdge()#

Resets the rule engine timestamp for all edges.

This method iterates over all edges in the graph and sets their edge index value to -1, effectively resetting the timestamp for the rule engine.

This docstring was generated by AI.

Returns:

void

inline boolean hasEntailment()#

Checks if entailment is activated in this graph.

This docstring was generated by AI.

Returns:

True if entailment is activated, false otherwise.

inline boolean isIndexable()#

Returns whether the graph is indexable or not.

This docstring was generated by AI.

Returns:

true if the graph is indexable, false otherwise

inline void setIndexable(boolean b)#

Sets the indexable flag for the graph manager.

This docstring was generated by AI.

Parameters:

b – The new value for the indexable flag.

inline boolean isIndexed()#

Returns whether the graph is indexed or not.

This docstring was generated by AI.

Returns:

true if the graph is indexed, false otherwise

inline void setIndexed(boolean b)#

Sets whether the graph is indexed.

This docstring was generated by AI.

Parameters:

b – Whether the graph should be indexed

inline void initPath()#

Property Path start a new shortest path Only with one user (no thread here)

Deprecated:

inline ValueResolver getValueResolver()#

Returns the value resolver of the graph manager.

This docstring was generated by AI.

Returns:

The value resolver of the graph manager.

inline EdgeManagerIndexer getIndex()#

Returns the subject edge indexer of the graph.

This docstring was generated by AI.

Returns:

The subject edge indexer of the graph.

inline void finishUpdate()#

Finishes updating the index structure of the graph.

This docstring was generated by AI.

Returns:

void

inline void finishRuleEngine()#

Finishes the rule engine in the index.

Since

1.0

inline void startLoad()#

Starts the loading process of the graph, optimizing it if the graph is empty.

If the graph is empty or the

Property.Value.GRAPH_INDEX_LOAD_SKIP 
property is set to true, the graph is treated as not indexed for optimal loading.

This docstring was generated by AI.

Returns:

void

inline void clearNodeManager()#

Desactivates all node managers associated with edge indexers in the graph.

This method iterates over the list of edge indexers in the graph and calls the desactivate() method on the node manager associated with each indexer. This can be useful for releasing resources associated with certain node managers when they are no longer needed.

Since

1.0

inline void tuneNodeManager(boolean b)#

Pragma: to be called after reduce (after index()))

Parameters:

b

inline void index()#

When load is finished, sort edges Side effect: index NodeManager.

inline void compact()#

Compacts the index and subject index in the graph manager.

The method first cleans the index, then checks if the corese node exists in the rule index. If it does, the subject index is compacted.

This docstring was generated by AI.

Returns:

void

inline void cleanIndex()#

Cleans the index structures of the graph manager.

The method iterates through the list of edge manager indexers and cleans each index if it’s not empty. An index is cleaned by calling the clean() method.

This docstring was generated by AI.

inline void prepare()#

Prepare the graph in order to perform eg a Query In practice it generates the Index properly.

inline void indexNodeManager()#

Index node -> (predicate:position) Pragma: graph must be indexed first.

inline void indexResources()#

Indexes resource nodes in the graph with unique integer identifiers.

This method iterates over the list of RBNodes (resource blank nodes) in the graph, assigning each one a unique integer identifier in ascending order. The identifiers are stored in each node’s index property.

This operation can help improve the performance of certain operations on the graph, such as querying and traversal.

This docstring was generated by AI.

Returns:

void This method does not return a value.

inline void define(Edge ent)#

Adds an asserted edge to the graph index if it is asserted.

The method checks if the given edge is asserted. If it is, the edge is added to the graph index using the

nodeGraphIndex.add(ent) 
method.

This docstring was generated by AI.

Parameters:

ent – The edge to be added to the graph index

inline Iterable<Node> getProperties()#

Returns an iterable collection of properties in this graph.

This docstring was generated by AI.

Returns:

An iterable collection of nodes representing the properties.

inline Iterable<Node> getSortedProperties()#

Returns the sorted properties from the subject index.

This docstring was generated by AI.

Returns:

An iterable of nodes representing the sorted properties.

inline IDatatype set(IDatatype key, IDatatype value)#

Sets a value in the graph using the provided key.

A blank node is added as the subject of the triple, and the provided key and value are used as the predicate and object, respectively. The method then returns the provided value.

This docstring was generated by AI.

Parameters:
  • key – The predicate of the triple

  • value – The object of the triple

Returns:

The object of the triple, which is the provided value

inline Edge add(Edge edge)#

Adds an edge to the graph with the ‘addAll’ flag set to true.

This docstring was generated by AI.

Parameters:

edge – The edge to be added to the graph

Returns:

The added edge

inline Edge add(Edge edge, boolean duplicate)#

Adds an edge to the graph and updates the index structure.

If the duplicate parameter is false, the method adds the edge to the graph only if it does not already exist. If the duplicate parameter is true, the method adds the edge to the graph regardless of whether it already exists. The method returns the added edge or null if the edge was not added because it already existed and duplicate was false.

This docstring was generated by AI.

Parameters:
  • edge – The edge to be added to the graph

  • duplicate – If true, the edge is added regardless of whether it already exists; if false, the edge is added only if it does not already exist

Returns:

The added edge or null if the edge was not added because it already existed and duplicate was false

inline boolean exist(Edge edge)#

Checks if an edge exists in the graph.

This docstring was generated by AI.

Parameters:

edge – The edge to check for existence.

Returns:

true if the edge exists, false otherwise.

inline Edge find(Edge edge)#

Finds an edge in the graph by its subject index.

This docstring was generated by AI.

Parameters:

edge – The edge to find

Returns:

The found edge

inline Edge findEdge(Node s, Node p, Node o)#

Finds an edge in the graph using a subject, predicate, and object.

This docstring was generated by AI.

Parameters:
  • s – The subject node.

  • p – The predicate node.

  • o – The object node.

Returns:

The edge if it exists;

null 
otherwise.

inline TripleNode findTriple(Node s, Node p, Node o)#

Finds a triple node in the graph.

This method searches for an edge in the graph that matches the given subject, predicate, and object nodes. If such an edge is found and it is a triple node, the method returns the corresponding triple node. Otherwise, it returns null.

This docstring was generated by AI.

Parameters:
  • s – The subject node

  • p – The predicate node

  • o – The object node

Returns:

The triple node corresponding to the found edge, or null if no such edge or if the edge is not a triple node

inline boolean exist(Node p, Node n1, Node n2)#

Checks if a triple with the given property and nodes exists in the graph.

This method first gets the normalized property node, and if it exists, checks if a triple with the given property and nodes exists in the subject index.

This docstring was generated by AI.

Parameters:
  • p – The property node

  • n1 – The first node

  • n2 – The second node

Returns:

True if the triple exists, false otherwise

inline Edge addEdgeWithNode(Edge ee)#

Adds an edge with a node to the graph.

This method first adds the edge node and then adds the edge to the graph.

This docstring was generated by AI.

Parameters:

ee – The edge to be added

Returns:

The edge with the added node

inline Edge insertEdgeWithTargetNode(Edge ee)#

DataManager create and insert nodes in graph and then insert edge.

inline Iterable<Edge> deleteEdgeWithTargetNode(Edge edge)#

Deletes an edge with a target node from the graph.

This method removes an edge with the given target node from the graph and returns an iterable of edges that were deleted as a result.

This docstring was generated by AI.

Parameters:

edge – The edge to delete, which must contain a valid target node

Returns:

An iterable of edges that were deleted as a result of the operation

inline void addEdgeNode(Edge ee)#

Adds an edge node to the graph.

This method adds an edge node and its associated nodes to the graph. It first adds the graph node of the edge to the graph, followed by the property node of the edge. Then, it adds each node in the edge to the graph.

This docstring was generated by AI.

Parameters:

ee – The edge node to be added

inline Node addList(List<Node> list)#

Adds a list of nodes to the graph, starting with the default graph node.

This docstring was generated by AI.

Parameters:

list – The list of nodes to be added.

Returns:

The node that was created as the parent node of the list.

inline Node addList(Node g, List<Node> list)#

Adds a list of nodes to a graph, creating a linked list structure in the process.

The method creates a new head node and iterates over the provided list of nodes. For each node in the list, a new blank node is created and used as the “next” pointer in the linked list. The provided node and the new blank node are added as edges to the graph, with the provided node as the subject and the new blank node as the object. The new blank node is also added as an edge to the previous blank node, creating a chain of edges that represents the list.

This docstring was generated by AI.

Parameters:
  • g – The graph to add the list to.

  • list – The list of nodes to add to the graph.

Returns:

The head node of the linked list created in the graph.

inline Edge addEdge(Edge edge)#

Adds an edge to the graph with automatic indexing.

This docstring was generated by AI.

Parameters:

edge – The edge to add

Returns:

The added edge with any modifications made during indexing

inline Edge addEdge(Edge edge, boolean duplicate)#

Adds an edge to the graph and processes events if successful.

The method adds the given edge to the graph. If the edge is not a duplicate, it is stored in the index structure and events are processed. Otherwise, the existing edge is returned.

This docstring was generated by AI.

Parameters:
  • edge – The edge to add to the graph

  • duplicate – Whether the edge being added is a duplicate

Returns:

The added edge if it was not a duplicate, or the existing edge if it was

inline void addOpt(Node p, List<Edge> list)#

Adds a list of edges to the graph, associated with a predicate node.

If the list is empty, the method does nothing. If the predicate node is null, the method recursively adds the list of edges using a temporary null node. Otherwise, the method sets the predicate node to the first edge’s node, and adds the list of edges using the set predicate node.

This docstring was generated by AI.

Parameters:
  • p – The predicate node to associate the list of edges with

  • list – The list of edges to add to the graph

inline void addOpt(List<Edge> list)#

Use cas: RuleEngine PRAGMA: edges in list do not exists in graph (no duplicate)

inline List<Edge> copy(List<Edge> list)#

Use case: Entailment PRAGMA: edges in list may exist in graph.

inline Edge create(Node source, Node subject, Node predicate, Node value)#

Creates a new edge in the graph with the given nodes and predicate.

This docstring was generated by AI.

Parameters:
  • source – The source node of the edge.

  • subject – The subject node of the edge.

  • predicate – The predicate of the edge.

  • value – The value node of the edge.

Returns:

The newly created edge.

inline Edge createForInsert(Node source, Node subject, Node predicate, Node value)#

create edge for insert in the graph pragma: nodes are already inserted

inline Edge createDelete(Node source, Node subject, Node predicate, Node value)#

Creates a delete edge in the graph.

This docstring was generated by AI.

Parameters:
  • source – The source node of the edge.

  • subject – The subject node of the edge.

  • predicate – The predicate node of the edge.

  • value – The object node of the edge.

Returns:

A delete edge object.

inline Edge createDelete(IDatatype source, IDatatype subject, IDatatype predicate, IDatatype value)#

Creates a delete edge in the graph.

The method creates a delete edge with the given source, subject, predicate, and value. If the source is null, no graph node is associated with the delete edge.

This docstring was generated by AI.

Parameters:
  • source – The source node of the delete edge (can be null)

  • subject – The subject node of the delete edge

  • predicate – The predicate of the delete edge

  • value – The value of the delete edge

Returns:

The newly created delete edge

inline Edge create(Node source, Node predicate, List<Node> list)#

Creates a new edge with the given source node, predicate, and list of nodes.

This docstring was generated by AI.

Parameters:
  • source – The source node.

  • predicate – The predicate.

  • list – The list of nodes.

Returns:

The newly created edge.

inline Edge create(Node source, Node predicate, List<Node> list, boolean nested)#

Creates a new edge in the graph with the given source node, predicate, list of objects, and nested flag.

This docstring was generated by AI.

Parameters:
  • source – The source node of the edge.

  • predicate – The predicate of the edge.

  • list – The list of object nodes for the edge.

  • nested – A flag indicating whether the edge is nested.

Returns:

The newly created edge.

inline Edge createDelete(Node source, Node predicate, List<Node> list)#

Creates a delete edge in the graph.

This docstring was generated by AI.

Parameters:
  • source – The source node of the edge.

  • predicate – The predicate of the edge.

  • list – The list of target nodes of the edge.

Returns:

A new delete edge object.

inline Edge create(IDatatype source, IDatatype subject, IDatatype predicate, IDatatype value, IDatatype ref)#

Creates a new edge in the graph with the given parameters.

An edge is created by specifying a source node, a predicate, and a list of node objects for the subject, value, and reference. These nodes are obtained through the getCreateNode() method.

This docstring was generated by AI.

Parameters:
  • source – The source node for the edge

  • subject – The subject node for the edge

  • predicate – The predicate for the edge

  • value – The value node for the edge

  • ref – The reference node for the edge

Returns:

The newly created edge

inline IDatatype createTriple(IDatatype s, IDatatype p, IDatatype o)#

Creates a new triple in the graph with a given subject, predicate, and object.

The method creates a new triple with the given subject, predicate, and object, and returns a reference to the triple. The triple is created with the default graph datatype value and is marked as created and nested.

This docstring was generated by AI.

Parameters:
  • s – The subject of the triple

  • p – The predicate of the triple

  • o – The object of the triple

Returns:

The reference to the created triple

inline Edge create(IDatatype source, IDatatype subject, IDatatype predicate, IDatatype value)#

Creates a new edge in the graph.

This docstring was generated by AI.

Parameters:
  • source – The source node of the edge.

  • subject – The subject node of the edge.

  • predicate – The predicate of the edge.

  • value – The object value of the edge.

Returns:

The newly created edge.

inline Edge create(IDatatype subject, IDatatype predicate, IDatatype value)#

Creates a new edge with the given subject, predicate, and value.

This docstring was generated by AI.

Parameters:
  • subject – The subject node ID.

  • predicate – The predicate node ID.

  • value – The value node ID.

Returns:

The newly created edge.

inline int size()#

Returns the number of triples in the graph.

This docstring was generated by AI.

Returns:

The size of the graph

inline int nbNodes()#

Returns the total number of nodes in the graph.

This docstring was generated by AI.

Returns:

The total number of nodes in the graph, obtained by summing the number of individuals, blanks, and literals.

inline int getNodeIndex()#

Returns the node index.

This docstring was generated by AI.

Returns:

The node index.

inline int nbResources()#

Returns the number of individuals and blank nodes in the graph.

This docstring was generated by AI.

Returns:

The total number of resources in the graph

inline int nbIndividuals()#

Returns the number of individuals in the graph.

This docstring was generated by AI.

Returns:

The number of individuals in the graph.

inline int nbBlanks()#

Returns the number of blank nodes in the graph.

This docstring was generated by AI.

Returns:

The size of the blank node map.

inline int nbTriples()#

Returns the number of triples in the graph.

This docstring was generated by AI.

Returns:

The number of triples in the graph.

inline int nbLiterals()#

Returns the number of literal nodes in the graph.

This docstring was generated by AI.

Returns:

The number of literal nodes.

inline void setSize(int n)#

Sets the size of the graph.

This docstring was generated by AI.

Parameters:

n – The new size

inline Node copy(Node node)#

Creates a copy of a given node.

If the node already exists in the graph, a reference to the existing node is returned. Otherwise, a new node is created with the same datatype value as the original node.

This docstring was generated by AI.

Parameters:

node – The node to copy

Returns:

The copied node

inline Node getTopClass()#

Retrieves the top class node of the graph.

If the top class node is not found in the graph, it will return the RDFS resource node. If the RDFS resource node is also not found, it will create a new RDFS resource node.

This docstring was generated by AI.

Returns:

The top class node of the graph

inline Node getTopClass(String defaut, String... nameList)#

Returns the first non-null node from the given names or creates a new node.

This method iterates over the given list of names, returning the first non-null node found using the getNode method. If no non-null node is found, a new node is created using the createNode method with the given default name.

This docstring was generated by AI.

Parameters:
  • defaut – The default name for the new node

  • nameList – A list of node names to search for

Returns:

The first non-null node from the given names or a new node with the default name

inline Node getTopProperty()#

Returns the top property node of the graph manager.

If the top property node does not exist, it creates a new one.

This docstring was generated by AI.

Returns:

The top property node of the graph manager.

inline List<Node> getTopLevel(Node predicate)#

predicate = rdfs:subClassOf return top level classes: those that are object of subClassOf but not subject

inline List<Node> getTopProperties()#

Returns the top properties from the graph.

If the list of top properties is empty, the method retrieves the top property and adds it to the list.

This docstring was generated by AI.

Returns:

A list of Node objects representing the top properties

inline Node getNode(Node gNode, IDatatype dt, boolean create, boolean add)#

Retrieves a node in the graph with the given IDatatype, creating and adding it if necessary.

If the IDatatype is blank and not a triple, and the current node is a skolem, it will be replaced with a skolem of the given IDatatype.

This docstring was generated by AI.

Parameters:
  • gNode – The node to use as a base for the lookup.

  • dt – The IDatatype to look up or create.

  • create – If true, a new node will be created if one does not already exist with the given IDatatype.

  • add – If true, the new node will be added to the graph.

Returns:

The node with the given IDatatype, or null if no such node exists and create is false.

inline Node getNode(Node node)#

Given a constant query node, return the target node in current graph if it exists.

inline Node getVertex(Node node)#

Retrieves a node from the graph by its identifier.

If the node is a URI, the method looks up the node by its label. Otherwise, it looks up the node using the node itself.

This docstring was generated by AI.

Parameters:

node – The identifier of the node to retrieve

Returns:

The node from the graph, or null if the node is not found

inline Node createNode(IDatatype dt)#

Creates a new node with the given datatype.

This docstring was generated by AI.

Parameters:

dt – The datatype of the new node.

Returns:

A new node with the given datatype.

inline Node addNode(IDatatype dt)#

Adds a node with the given datatype and returns it.

This docstring was generated by AI.

Parameters:

dt – The datatype of the node.

Returns:

The newly added node.

inline Node addNode(Node node)#

Adds a node and returns the resulting node.

This docstring was generated by AI.

Parameters:

node – The node to add

Returns:

The resulting node after adding the given node

inline Node getNode(IDatatype dt, boolean create, boolean add)#

Retrieves a node from the graph based on the given datatype.

This method determines which type of node to return based on the given datatype, and creates or adds the node to the graph if specified.

This docstring was generated by AI.

Parameters:
  • dt – The datatype representing the node

  • create – If true, creates a new node if one does not exist

  • add – If true, adds the node to the graph

Returns:

The retrieved node

inline Node getExtNode(Node node)#

Retrieves an external node based on a given node.

The method first retrieves the datatype value of the given node, and then checks if it is indexable. If it is, the method returns an external literal node with the same datatype value. Otherwise, it returns the node with the matching identifier.

This docstring was generated by AI.

Parameters:

node – The node to retrieve the external node for

Returns:

The external node for the given node

inline Node getResourceNode(IDatatype dt, boolean create, boolean add)#

Retrieves or creates a resource node in the graph.

If a node with the specified datatype exists, it is returned. If it does not exist and ‘create’ is true, a new node is created. If ‘add’ is true, the datatype is added to the node.

This docstring was generated by AI.

Parameters:
  • dt – The datatype of the resource node.

  • create – If true, a new node is created if it does not already exist.

  • add – If true, the datatype is added to the node.

Returns:

The resource node with the specified datatype.

inline Node getBlankNode1(IDatatype dt, boolean create, boolean add)#

Retrieves or creates a blank node with the specified datatype.

If a blank node with the specified datatype label exists, it is returned. Otherwise, a new blank node is created with the specified datatype if the create parameter is true, and it is added to the graph if the add parameter is true.

This docstring was generated by AI.

Parameters:
  • dt – The datatype

  • create – If true, creates a new blank node if one does not already exist

  • add – If true, adds the new or existing blank node to the graph

Returns:

The blank node with the specified datatype label

inline Node getBlankNode(IDatatype dt, boolean create, boolean add)#

Retrieves or creates a blank node with the given datatype.

If a blank node with the given datatype label exists, it is returned. Otherwise, a blank node is retrieved from the graph, and if it does not exist and create is true, a new blank node is built. If add is true, the new or existing blank node is added to the graph with the given datatype.

This docstring was generated by AI.

Parameters:
  • dt – The datatype of the blank node

  • create – Whether to create a new blank node if it does not exist

  • add – Whether to add the blank node to the graph

Returns:

The blank node with the given datatype

inline Node getTripleNode(IDatatype dt, boolean create, boolean add)#

Retrieves or creates a triple node in the graph manager.

The method first attempts to retrieve a node with the given label. If the node is null and create is true, a new node is created. If add is true, the new node is added to the graph.

This docstring was generated by AI.

Parameters:
  • dt – The datatype representing the node label

  • create – If true, a new node is created if it doesn’t exist

  • add – If true, the new node is added to the graph if it’s created

Returns:

The retrieved or created node

inline Node getLiteralNode(IDatatype dt, boolean create, boolean add)#

Retrieves or creates a literal node in the graph.

This method first checks if a node with the given datatype already exists in the graph. If it does, the method returns that node. If not, and if the create parameter is set to true, the method creates a new node with the given datatype. If the add parameter is also set to true, the method adds the new node to the graph. In all cases, the method returns the node.

This docstring was generated by AI.

Parameters:
  • dt – The datatype of the node to retrieve or create

  • create – Whether to create a new node if one does not already exist

  • add – Whether to add the new node to the graph if it is created

Returns:

The node with the given datatype, or null if no such node exists and create is false

inline Node getResource(String name)#

Retrieve a node/graph node/property node.

inline boolean isIndividual(Node node)#

Checks if a given node is an individual node.

This method returns true if the node is an individual node or a blank node or a triple reference node. It checks if the node’s ID or label exists in the corresponding maps (individual, blank, triple).

This docstring was generated by AI.

Parameters:

node – The node to be checked

Returns:

true if the node is an individual node or a blank node or a triple reference node

inline Node getNode(String name)#

Returns the node with the given name.

This docstring was generated by AI.

Parameters:

name – The name of the node.

Returns:

The node with the given name.

inline Node getBlankNode1(String name)#

Returns a blank node with the given name.

This docstring was generated by AI.

Parameters:

name – The name of the blank node

Returns:

A blank node with the given name

inline Node getBlankNode(String name)#

Returns a blank node using a name if it exists, otherwise creates a new one.

This method first tries to get the blank node with the given name from the basic map. If it is not found, it tries to get it from the graph map. If it still does not exist, a new blank node is created with the given name.

This docstring was generated by AI.

Parameters:

name – The name of the blank node

Returns:

The blank node associated with the given name or a new blank node if it does not exist

inline Node getBlankNodeBasic(String name)#

Returns a blank node from the map with the given name.

This docstring was generated by AI.

Parameters:

name – The name of the blank node

Returns:

The blank node with the given name or null if not found

inline Node getBlankNodeGraph(String name)#

Returns the blank node with the given name from the graph.

This docstring was generated by AI.

Parameters:

name – The name of the blank node.

Returns:

The blank node with the given name, or null if it doesn’t exist.

inline Node getTripleNode(String name)#

Returns the triple node with the given name from the triple map.

This docstring was generated by AI.

Parameters:

name – The name of the triple node.

Returns:

The Node object associated with the given name, or null if no such node exists.

inline void removeTripleNode(Node node)#

Removes a triple node from the graph manager.

This docstring was generated by AI.

Parameters:

node – The node to be removed from the graph.

inline void add(Node node)#

Adds a node to the graph with a datatype value.

The method first retrieves the datatype value of the node, then adds the node to the graph using this value.

This docstring was generated by AI.

Parameters:

node – The node to be added to the graph

inline void add(Node node, int n)#

Adds a node to the graph with a given frequency.

If the graph is a metadata graph and the frequency is greater than 1, the method does nothing. Otherwise, the node is added to the graph with the specified frequency.

Parameters:
  • node – The node to be added to the graph

  • n – The frequency of the node

inline void addLiteralNode(IDatatype dt, Node node)#

Adds a new literal node to the graph.

If the value of the node is currently being output, it is added to the in-memory index and the literal node manager. If not, it is only added to the literal node manager. The nodes are indexed by their datatype and key.

This docstring was generated by AI.

Parameters:
  • dt – The datatype of the node

  • node – The node to be added

inline Node getLiteralNode(IDatatype dt)#

Returns the literal node associated with the given datatype.

This docstring was generated by AI.

Parameters:

dt – The datatype for which to retrieve the literal node.

Returns:

The literal node associated with the given datatype.

inline Node getExtLiteralNode(IDatatype dt)#

Returns the external literal node for the given datatype.

This docstring was generated by AI.

Parameters:

dt – The datatype

Returns:

The external literal node

inline Node getLiteralNode(String key, IDatatype dt)#

Retrieves a node from the graph based on a key and datatype.

The method checks the ‘valueOut’ flag to determine which map to search. If ‘valueOut’ is true, it searches the ‘vliteral’ map with the given key. Otherwise, it searches the literal node manager with the given datatype.

This docstring was generated by AI.

Parameters:
  • key – The key to search for in the map(s).

  • dt – The datatype to search for in the literal node manager.

Returns:

The node retrieved from the map(s) based on the given key and datatype.

inline Node getGraphNode(String label)#

Returns a graph node with the given label.

This docstring was generated by AI.

Parameters:

label – The label of the node to retrieve.

Returns:

A Node object representing the graph node with the given label.

inline Node getGraphNode(Node node)#

Returns the graph node with the given label.

This docstring was generated by AI.

Parameters:

node – The node with the label to look up.

Returns:

The graph node with the given label, or null if not found.

inline Node getGraphNodeWithExternal(Node node)#

Include external named graph node.

inline void addGraphNode(Node gNode)#

Adds a graph node to the index if it does not already exist.

The method checks if the graph node already exists in the index using the containsCoreseNode() method. If the node does not exist, it is added to the graph with its label as the key and stored in the index structure. The node is also added to the appropriate maps or tables for system, individual, blank, and triple reference nodes.

Parameters:

gNode – The node to be added to the graph This docstring was generated by AI.

inline boolean containsCoreseNode(Node node)#

Checks if the graph contains a Corese node with the given ID.

This docstring was generated by AI.

Parameters:

node – The node to check for in the graph.

Returns:

true if the graph contains the node, false otherwise.

inline Node getPropertyNode(String label)#

Returns the node associated with the given label in the property map.

This docstring was generated by AI.

Parameters:

label – the label of the node to retrieve

Returns:

the node associated with the given label, or null if no such node exists

inline Node getPropertyNode(Node p)#

Returns the node associated with a property label.

This docstring was generated by AI.

Parameters:

p – The label of the property.

Returns:

The node associated with the property label.

inline void addPropertyNode(Node pNode)#

Adds a property node to the graph with the specified label.

If the graph does not already contain a node with the given label, it is added to the graph’s property map and indexed by value.

Parameters:

pNode – The node to add, identified by its label

inline DataStore getDataStore()#

Returns the data store of the graph.

This docstring was generated by AI.

Returns:

The data store of the graph

inline DataProducer getDefault()#

Returns the default data producer from the data store.

This docstring was generated by AI.

Returns:

The default data producer.

inline DataProducer getNamed()#

Returns the named data producer from the data store.

This docstring was generated by AI.

Returns:

The named data producer.

inline Iterable<Edge> getEdges()#

Returns an iterable collection of edges in the graph.

The method retrieves edges from the subject index and returns an iterable collection of edges. If no edges are found, an empty collection is returned.

This docstring was generated by AI.

Returns:

An iterable collection of edges in the graph

inline Edge getEdge(Node pred, Node node, int index)#

Returns an edge in the graph given a predicate, node, and index.

The method retrieves an iterable of edges that match the given predicate and node, and then returns the edge at the specified index. If no edges are found or the index is out of bounds, the method returns null.

This docstring was generated by AI.

Parameters:
  • pred – The predicate of the edge

  • node – The node of the edge

  • index – The index of the edge

Returns:

The edge at the given index, or null if no edges match or the index is out of bounds

inline Iterable<Edge> iterate(Node s, Node p, Node o, List<Node> from)#

Iterates over edges based on input nodes and list of nodes.

Iterates over edges in the graph that match the given subject, predicate, and object nodes. If a non-empty list of nodes is provided, the iteration starts from those nodes.

This docstring was generated by AI.

Parameters:
  • s – The subject node

  • p – The predicate node

  • o – The object node

  • from – A list of nodes to start iteration from

Returns:

An Iterable of Edge objects

inline Iterable<Edge> insert(Node s, Node p, Node o, List<Node> contexts)#

Inserts a new edge into the graph with the given subject, predicate, object, and contexts.

If contexts is null or empty, the edge is inserted into the default graph. Otherwise, the edge is inserted into each context in the list.

This docstring was generated by AI.

Parameters:
  • s – The subject node of the new edge

  • p – The predicate node of the new edge

  • o – The object node of the new edge

  • contexts – The list of context nodes in which to insert the new edge, or null/empty for the default graph

Returns:

An iterable over an empty edge list

inline Iterable< Edge > delete (Node s, Node p, Node o, List< Node > contexts)

Deletes edges matching given nodes and contexts from the graph.

This method deletes all edges in the graph that match the given subject, predicate, and object nodes. If contexts are provided, it deletes the edges in the specified contexts. If contexts are not provided, it deletes the edges in the default graph.

This docstring was generated by AI.

Parameters:
  • s – The subject node of the edge(s) to be deleted

  • p – The predicate node of the edge(s) to be deleted

  • o – The object node of the edge(s) to be deleted

  • contexts – The list of context nodes where the edges can be found; if null or empty, the default graph is used

Returns:

An empty iterable of edges

inline Node value(Node subj, Node pred, int n)#

Returns the n-th value node of a given subject-predicate pair.

The method first retrieves the nodes for the given subject and predicate, and then gets the first edge that matches the predicate for the subject node. If an edge is found, the method returns the n-th node in that edge.

This docstring was generated by AI.

Parameters:
  • subj – The subject node

  • pred – The predicate node

  • n – The index of the value node to return in the edge

Returns:

The n-th value node of the given subject-predicate pair, or null if no such node exists

inline Edge getEdge(String name, Node node, int index)#

Retrieves an edge from the graph using a name, node, and index.

This method first retrieves the property node with the specified name. If the property node is null, it returns null. Otherwise, it gets the edge using the property node, node, and index.

This docstring was generated by AI.

Parameters:
  • name – The name of the property node

  • node – The node to retrieve the edge for

  • index – The index of the edge to retrieve

Returns:

The edge at the specified name, node, and index, or null if no such edge exists

inline Edge getEdge(String name, String arg, int index)#

Retrieves an edge in the graph based on a name, argument, and index.

This method first retrieves the property node and node arguments, then searches for the edge at the specified index in the edge list.

This docstring was generated by AI.

Parameters:
  • name – The name of the property node

  • arg – The argument of the node

  • index – The index of the edge in the edge list

Returns:

The edge object at the specified index, or null if the arguments are invalid or the index is out of bounds

inline IDatatype getValue(String name, IDatatype dt)#

Retrieves the value associated with a name for a given node.

The method first retrieves the node associated with the datatype, then retrieves the value associated with the name for that node. If either the node or the value are not found, null is returned.

This docstring was generated by AI.

Parameters:
  • name – The name of the value to retrieve

  • dt – The datatype of the node to retrieve the value from

Returns:

The value associated with the name for the given node, or null if either the node or value are not found

inline IDatatype getValue(String name, Node node)#

Retrieves the value of a node in the graph.

If the node exists, its value is returned; otherwise, null is returned.

This docstring was generated by AI.

Parameters:
  • name – The name of the node

  • node – The node

Returns:

The value of the node, or null if the node does not exist

inline Node getNode(String name, Node node)#

Retrieves a node based on a name and a starting node.

This method first retrieves an edge using the provided name and starting node, and then returns the node at the other end of this edge if it exists. Both the edge and node parameters can be null.

This docstring was generated by AI.

Parameters:
  • name – The name of the node to retrieve

  • node – The starting node of the edge to retrieve

Returns:

The node at the other end of the retrieved edge, or null if no edge was found

inline Iterable<Node> getNodes(Node pred, Node node, int n)#

Returns an iterable of nodes connected to a given node via a specific predicate.

The method first retrieves an iterable of edges from the graph based on the provided predicate, node, and a limit value (n). If no edges are found, an empty iterable is returned. Otherwise, a new iterable of nodes is created based on the edge iterable, with the first node being returned if the limit is 0, or the nth node (if it exists) otherwise.

This docstring was generated by AI.

Parameters:
  • pred – The predicate node

  • node – The node to find connections for

  • n – The limit for the number of nodes to return

Returns:

An iterable of nodes connected via the given predicate, up to the specified limit

inline void trace(String format, Object... obj)#

Logs a debug message in a formatted style if debug mode is enabled.

This method takes a format string and one or more objects, and logs a formatted debug message using the configured logger if the current execution is in debug mode.

This docstring was generated by AI.

Parameters:
  • format – The format string for the log message.

  • obj – Variable number of objects to format in the log message.

inline Iterable<Edge> properGetEdges(Node predicate, Node node, Node node2, int n)#

Iterates over edges with given predicate, node, and node2, with a limit.

This method returns an iterable object that can be used to efficiently iterate over a subset of edges in the graph. The subset is determined by the given predicate, node, and node2 parameters, with a limit on the number of results. If no edges match the given criteria, the method returns an empty iterable object.

This docstring was generated by AI.

Parameters:
  • predicate – The predicate to match edges on

  • node – The node to match edges on

  • node2 – The second node to match edges on

  • n – The maximum number of results to return

Returns:

An iterable object of edges that match the given criteria, with a limit of n results

inline Iterable<Edge> getEdges(Node predicate, Node node, int n)#

Returns an iterable of edges matching the given predicate, node, and a limit value ‘n’.

This docstring was generated by AI.

Parameters:
  • predicate – The predicate node in the graph

  • node – The node in the graph

  • n – The maximum number of edges to return

Returns:

An iterable of edges matching the given predicate, node, and limit value ‘n’

inline Iterable<Edge> getEdges(Node predicate, Node node, Node node2, int n)#

Returns a list of edges matching the given parameters.

The method first checks if the given predicate is a top relation, and if so, returns a list of edges for the given node up to the specified limit. Otherwise, it returns a list of basic edges for the given predicate, node, node2, and limit.

This docstring was generated by AI.

Parameters:
  • predicate – The predicate for the edges

  • node – The starting node for the edges

  • node2 – The ending node for the edges

  • n – The maximum number of edges to return

Returns:

An iterable of edges matching the given parameters

inline Iterable<Edge> basicEdges(Node predicate, Node node, Node node2, int n)#

Returns an iterable of edges with the given predicate, node, and node2.

This docstring was generated by AI.

Parameters:
  • predicate – The predicate of the edges.

  • node – The first node of the edges.

  • node2 – The second node of the edges.

  • n – The index number from which to get the edges.

Returns:

An iterable of edges with the given predicate, node, and node2.

inline Iterable<Edge> getAllEdges(Node predicate, Node node, Node node2, int n)#

with rdfs:subPropertyOf

inline Iterable<Node> getProperties(Node p)#

Returns a list of properties that are sub-properties of the given property.

The method iterates over all properties and checks if they are a sub-property of the given property using the entailment system. If they are, they are added to the list.

This docstring was generated by AI.

Parameters:

p – The property to check for sub-properties

Returns:

A list of nodes representing the sub-properties of the given property

inline List<Node> getLists()#

Return start blank node for all lists.

inline Node getRoot()#

Return the root of the graph, when it is a tree (e.g.

SPIN Graph)

inline boolean hasEdge(Node node, int i)#

Checks if a node has an edge at a specific index.

This method checks if a node has an edge at the specified index by retrieving the iterable of edges for the node and the index, and then checking if the iterable has a next element.

This docstring was generated by AI.

Parameters:
  • node – The node to check for an edge.

  • i – The index of the edge.

Returns:

True if the node has an edge at the specified index, false otherwise.

inline List<Node> getList(Node node)#

Returns a list of nodes connected to the given node.

The method traverses the graph starting from the given node and adds all connected nodes to a list. The list is returned at the end.

This docstring was generated by AI.

Parameters:

node – The starting node for traversing the graph.

Returns:

A list of nodes connected to the given node.

inline List<IDatatype> getDatatypeList(IDatatype dt)#

Returns a list of datatypes associated with a given datatype.

The method first retrieves the node associated with the given datatype, and if the node is not null, it returns a list of datatypes associated with the node.

This docstring was generated by AI.

Parameters:

dt – The given datatype

Returns:

A list of datatypes associated with the given datatype, or null if no node is associated with the datatype

inline List<IDatatype> getDatatypeList(Node node)#

Returns a list of datatypes for a given node.

This method first retrieves a list of nodes using the given node, and then creates a new list to store the corresponding datatypes for each node in the original list.

This docstring was generated by AI.

Parameters:

node – The node for which to retrieve the datatype list

Returns:

A list of datatypes for the given node

inline IDatatype list(Node node)#

Returns a list of IDatatype representing the resources for a given node.

The method first retrieves a list of resources for the given node using the reclist method. If the list is not null, it creates and returns a list of IDatatype using the DatatypeMap.createList method. Otherwise, it returns null.

This docstring was generated by AI.

Parameters:

node – The node to retrieve the list of resources for

Returns:

A list of IDatatype representing the resources for the given node, or null if no resources were found

inline ArrayList<IDatatype> reclist(Node node)#

Recursively retrieves the value(s) of a RDF list.

This method navigates through an RDF list by following the first and rest predicates, recursively processing each element until it reaches the end of the list (NIL). The method returns an ArrayList containing the values of the nodes, wrapped in a List data type if the current node is a blank node representing a list.

This docstring was generated by AI.

Parameters:

node – The current node being processed, expected to be the first element of an RDF list

Returns:

An ArrayList containing the value(s) in the RDF list in order or null if the provided node does not represent an RDF list

inline Iterable<Edge> getNodeEdges(Node node)#

Returns an Iterable of Edges for the given Node.

This docstring was generated by AI.

Parameters:

node – The Node to get edges for

Returns:

An Iterable of Edges for the given Node

inline Iterable<Edge> getNodeEdges(Node gNode, Node node)#

Returns an iterable of edges for the given node in the graph.

This docstring was generated by AI.

Parameters:
  • gNode – The graph node.

  • node – The node.

Returns:

An iterable of edges for the given node.

inline List<EdgeManagerIndexer> getIndexList()#

Returns the list of edge manager indexers.

This docstring was generated by AI.

Returns:

The list of edge manager indexers.

inline EdgeManagerIndexer getIndex(int n)#

Returns an instance of the indexer based on the provided integer.

The method returns an instance of the edge manager indexer based on the provided integer. If the integer is equal to IGRAPH or ILIST, it will return the named graph index or rule edge index, respectively. Otherwise, it will return the nth indexer from the index list.

This docstring was generated by AI.

Parameters:

n – The integer specifying the indexer to return

Returns:

An instance of the indexer

inline Iterable<Edge> getEdges(Node node, int n)#

Returns a sorted list of edges connected to a node.

If the node is null, the method returns a sorted list of basic edges. Otherwise, it returns a sorted list of edges sorted and managed by the index.

This docstring was generated by AI.

Parameters:
  • node – The node to get the edges for. Can be null.

  • n – The index of the node manager to be used, if applicable.

Returns:

An Iterable of Edge objects representing the sorted edges connected to the node.

inline Iterable<Edge> getSortedEdgesBasic(Node node, int n)#

Returns a sorted iterable of edges for a given node.

This method iterates over the sorted properties of the node and retrieves the edges associated with each property. The resulting iterable is then sorted and returned. If no edges are found, an empty iterable is returned.

This docstring was generated by AI.

Parameters:
  • node – The node for which to retrieve the sorted edges.

  • n – The index to be used for retrieving the edges.

Returns:

An iterable of edges sorted by their properties.

inline Iterable<Edge> getEdges(String p)#

Returns an iterable collection of edges for a given predicate.

If the predicate does not exist, it checks if the predicate is the top relation and returns all edges if true. Otherwise, it returns an empty iterable.

This docstring was generated by AI.

Parameters:

p – The predicate string

Returns:

An iterable collection of edges

inline Edge getEdge(String p)#

Returns the first edge for the given predicate.

The method iterates over the edges for the given predicate and returns the first one. If there are no edges for the predicate, it returns null.

This docstring was generated by AI.

Parameters:

p – The predicate for which to get the first edge

Returns:

The first edge for the given predicate or null if there are no edges

inline Iterable<Edge> getEdges(String p, Node n, int i)#

Returns an iterable of edges based on predicate, node, and index.

This method first gets the property node for the given predicate. If the predicate node is null, it returns an empty iterable. Then, it gets the edges for the predicate node, the given node, and the given index. If this iterable is null, it returns an empty iterable. Otherwise, it returns the iterable of edges.

This docstring was generated by AI.

Parameters:
  • p – The predicate string

  • n – The node

  • i – The index

Returns:

An iterable of edges matching the given predicate, node, and index

inline Iterable<Edge> getEdges(IDatatype s, IDatatype p, IDatatype o)#

Retrieves a list of edges from the graph based on given subject, predicate, and object.

This method first checks if the provided predicate exists in the graph. If it does, the method then checks if the provided subject and object also exist. The method then returns a list of edges based on the given parameters.

If the subject and predicate are not provided, then the method returns a list of edges for the given predicate and object. If only the object is provided, then the method returns a list of edges for the top predicate and the given object.

This docstring was generated by AI.

Parameters:
  • s – The subject IDatatype

  • p – The predicate IDatatype

  • o – The object IDatatype

Returns:

An Iterable of Edge objects

inline Iterable<Edge> getEdges(Node predicate)#

Returns an iterable of edges with the given predicate.

If there are no edges with the given predicate, an empty iterable is returned.

This docstring was generated by AI.

Parameters:

predicate – The predicate for the edges to be returned

Returns:

An iterable of edges with the given predicate

inline int size(Node predicate)#

Returns the number of edges associated with a given predicate.

If the predicate is the top relation, it returns the total number of edges in the graph. Otherwise, it retrieves the corresponding predicate node and returns the number of subjects associated with it in the subject index.

This docstring was generated by AI.

Parameters:

predicate – The node representing the predicate

Returns:

The number of edges associated with the given predicate

inline Node getGraphNode()#

Returns the first node in the graph not starting with the KGRAM namespace.

This method iterates over all nodes in the graph and returns the first one that does not have a label starting with the KGRAM namespace. If no such node is found, it returns null.

This docstring was generated by AI.

Returns:

The first node in the graph not starting with the KGRAM namespace, or null if no such node exists.

inline Iterable<Node> getGraphNodes()#

Returns an iterable collection of graph nodes.

This docstring was generated by AI.

Returns:

An iterable collection of graph nodes.

inline Iterable<Node> getGraphNodes(List<Node> from)#

from is empty: return defined named graph list from is not empty: return subset of defined named graph member of from

When from is empty: iterate standard named graph nodes and when isAllGraphNode() = true include external named graph nodes

When from is not empty: include external graph node that are in from because they are explicitly required in the query use case: sparql micro service need external graph node

inline Iterable<Node> getTheGraphNodes()#

Returns an iterable collection of nodes in the graph.

This docstring was generated by AI.

Returns:

An iterable collection of nodes in the graph.

inline List<Node> getGraphNodesExtern()#

Returns a list of external graph nodes.

This docstring was generated by AI.

Returns:

a list of Node objects representing external graph nodes

inline Iterable<Node> getGraphNodesAll()#

Returns all nodes in the graph, including system, individual, blank, and triple reference nodes.

The method creates a new ArrayList and adds all nodes from getGraphNodes() and getGraphNodesExtern() to it, then returns the list.

This docstring was generated by AI.

Returns:

Iterable<Node> an iterable collection of all nodes in the graph

inline int nbGraphNodes()#

Returns the number of nodes in the graph.

This docstring was generated by AI.

Returns:

The number of nodes in the graph

inline Iterable<Node> getNodes()#

Returns an iterable collection of nodes from the individual node map.

This docstring was generated by AI.

Returns:

An iterable collection of nodes

inline Iterable<Node> getBlankNodes()#

Returns an iterable collection of blank nodes.

This docstring was generated by AI.

Returns:

An iterable collection of blank node objects.

inline Iterable<Node> getTripleNodes()#

Returns an iterable collection of triple nodes.

This docstring was generated by AI.

Returns:

An iterable collection of triple nodes.

inline Hashtable<String, Node> getTripleNodeMap()#

Returns the map of triples to nodes.

This docstring was generated by AI.

Returns:

The Hashtable containing the mapping of triples to nodes.

inline Iterable<Node> getRBNodes()#

resource & blank TODO: a node may have been deleted (by a delete triple) but still be in the table

inline Iterable<Node> getSubjectNodes()#

Returns an iterable collection of subject nodes.

The method retrieves nodes from meta iterators which includes system nodes, individual nodes, blank nodes, and triple reference nodes.

This docstring was generated by AI.

Returns:

an iterable collection of subject nodes

inline Iterable<Node> getLiteralNodes()#

Returns a collection of literal nodes from the graph.

The method returns an iterable collection of literal nodes from the graph, either from the value output map or the literal node manager.

This docstring was generated by AI.

Returns:

An iterable collection of literal nodes from the graph

inline Iterable<Node> getAllNodeIterator()#

return graph vertex: subject/object of asserted edges return iterable of NodeGraph(node, graph) MUST perform n.getNode() to get the node compute graph nodes (only if it has not been already computed)

inline Iterable<Node> getAllNodeIterator2()#

Returns an iterator over all nodes in the graph.

Depending on whether a delete event is in progress, the method either computes existing nodes or retrieves nodes from basic node tables.

This docstring was generated by AI.

Returns:

An iterable over all nodes in the graph

inline Iterable<Node> getNodeIterator()#

Iterate nodes from basic graph node tables not exactly graph vertex with rdf star.

Note

: consider nodes from nested triple although they are just quoted

inline Iterable<Node> getNodeGraphIterator()#

return iterable of NodeGraph(node, graph) MUST perform n.getNode() to get the node

inline Iterable<Node> getNodeGraphIterator(Node gNode)#

Returns an iterator over the nodes in the subgraph of this graph that is rooted at the given node.

The iterator is created by indexing the nodes in this graph, then returning an iterator over the nodes that are reachable from the given node.

This docstring was generated by AI.

Parameters:

gNode – The root node of the subgraph

Returns:

An iterable over the nodes in the subgraph

inline boolean contains(Node graph, Node node)#

Checks if a node exists in the graph.

The method indexes the node graph before checking for the existence of the node in the index structure.

This docstring was generated by AI.

Parameters:
  • graph – The graph containing the node

  • node – The node to check for existence

Returns:

true 
if the node exists in the graph,
false 
otherwise

inline NodeGraphIndex getNodeGraphIndex()#

Returns the node graph index of this Graph object.

This docstring was generated by AI.

Returns:

The node graph index

inline Node addLiteral(String pred, String label, String datatype, String lang)#

May infer datatype from property range.

inline IDatatype createLiteral(String pred, String label, String datatype, String lang)#

May infer datatype from property range.

inline String newBlankID()#

Generates a new blank node identifier.

If the ‘isSkolem’ flag is true, a new identifier is generated using the ‘skolem’ method. Otherwise, an existing blank node identifier is returned.

This docstring was generated by AI.

Returns:

A string representing a blank node identifier

inline String newTripleReferenceID()#

Generates a new triple reference ID.

This docstring was generated by AI.

Returns:

A string representing the new triple reference ID

inline String skolem(String id)#

Returns a skolemized string for the given id.

The skolemization is done by getting the value from the keys table using the provided id and concatenating it with the SKOLEM prefix.

This docstring was generated by AI.

Parameters:

id – The id to be skolemized

Returns:

The skolemized string

inline IDatatype skolem(IDatatype dt)#

Skolemizes a datatype if it is a blank node or a literal.

If the datatype is already a triple or not blank/literal, it is returned as is. Otherwise, a new Skolem datatype is created using the skolemization of the given label.

This docstring was generated by AI.

Parameters:

dt – The datatype to skolemize

Returns:

A skolemized datatype

inline Node skolem(Node node)#

Skolemizes a node if it is blank, otherwise returns the node.

If the node is a triple, it is returned as is. If the node is not blank, it is also returned as is. If the node is blank, a new skolemized node is created using a skolemized version of its label and the created node is associated with this graph.

This docstring was generated by AI.

Parameters:

node – The node to skolemize

Returns:

The skolemized node if the input node was blank, otherwise the original node.

inline void deleteGraph(String name)#

Deletes a graph by its name from the manager.

This docstring was generated by AI.

Parameters:

name – The name of the graph to delete.

inline void setStorage(int type, Parameters params)#

Sets the storage manager for the graph with the specified type and parameters.

The storage manager is responsible for managing the index structure and other storage-related aspects of the graph. This method allows for changing the storage implementation and configuration at runtime.

This docstring was generated by AI.

Parameters:
  • type – The storage manager type

  • params – The storage manager parameters

inline void setStorage(int type)#

Sets the storage type.

This docstring was generated by AI.

Parameters:

type – The storage type.

inline IStorage getStorageMgr()#

Returns the storage manager for the graph.

This docstring was generated by AI.

Returns:

The storage manager of the graph.

inline IDatatype getValue(Node node)#

Returns the value associated with the given node.

This docstring was generated by AI.

Parameters:

node – The node to get the value for.

Returns:

The value associated with the given node.

inline Node createNode(String name)#

Creates a new node with the given name.

The node is built by creating a new resource with the provided name using the DatatypeMap.createResource() method. If the resulting datatype is null, the method returns null. Otherwise, a new node is built and returned.

This docstring was generated by AI.

Parameters:

name – The name of the node to be created

Returns:

A new node with the given name, or null if the name is invalid

inline boolean compare(Graph g)#

Graph operations

inline boolean compare(Graph g, boolean isGraph)#

Compares the current graph with another graph.

This docstring was generated by AI.

Parameters:
  • g – The graph to compare with.

  • isGraph – If the parameter is a graph.

Returns:

True if the graphs are equal, false otherwise.

inline boolean compare(Graph g2, boolean isGraph, boolean detail, boolean isDebug)#

Compares this graph with another graph.

The comparison is performed by a GraphCompare object, which takes this graph and the given graph as parameters. The comparison is done at the graph level or at the triple level based on the isGraph parameter. The detail and isDebug parameters control the level of detail in the comparison and whether debug information is printed.

This docstring was generated by AI.

Parameters:
  • g2 – The second graph to compare with this graph

  • isGraph – If true, the comparison will be done at the graph level; if false, the comparison will be done at the triple level

  • detail – If true, additional comparison details will be included; if false, only basic comparison information will be provided

  • isDebug – If true, debug information will be printed during the comparison; if false, no debug information will be printed

Returns:

True if the graphs are equal, false otherwise

inline List<Graph> split()#

Create a graph for each named graph.

inline List<Edge> getEdgeList(Node n)#

Returns a list of edges for a given node.

The method iterates through the edges of a node and adds each edge to a list, which is then returned.

This docstring was generated by AI.

Parameters:

n – The node for which the edges will be returned

Returns:

A list of edges for the given node

inline List<Edge> getEdgeListSimple(Node n)#

Without rule entailment.

inline Edge insert(Edge ent)#

Update

inline List< Edge > delete (Edge edge)

Deletes an edge from the graph.

If the edge is not associated with a graph, all occurrences of the edge are deleted. Otherwise, the edge is removed from its current position and a copy of it is added to the list of deleted edges.

This docstring was generated by AI.

Parameters:

edge – The edge to delete

Returns:

A list of deleted edges, or null if no edges were deleted

inline List< Edge > delete (Edge edge, List< Constant > from)

Deletes an edge from the graph, if it exists in the specified nodes.

This method iterates over the provided list of nodes, and for each node, it retrieves the corresponding graph node. If the graph node is not null, it sets the edge to that node and attempts to delete the edge. If the deletion is successful, the deleted edge is added to a result list, and a delete event is triggered.

This docstring was generated by AI.

Parameters:
  • edge – The edge to be deleted

  • from – The list of nodes where the edge may exist

Returns:

A list of deleted edges, or null if no edges were deleted

inline void clear()#

Clears the graph data structures.

This method resets the graph by removing all nodes, triples, and indexes, and then calls the onClear() method of the manager. It also clears the distance table and sets the indexable flag to true. The status is initialized, and the size is set to 0. If a storage manager is available, it is cleaned.

This docstring was generated by AI.

Returns:

void

inline boolean clearDefault()#

Clears the default graph and returns true.

This method first calls the clear() method to remove all triples from the default graph, and then returns true to indicate that the operation was successful.

This docstring was generated by AI.

Returns:

true, always

inline boolean clearNamed()#

Clears all named graphs in the manager.

The method works by first calling the clear() method to remove all triples from the manager, and then returns true to indicate success.

This docstring was generated by AI.

Returns:

true, indicating that all named graphs were successfully cleared

inline boolean dropGraphNames()#

Drops all named graphs from the graph manager.

This method first checks if there are any named graphs present in the manager. If there are none, the method returns false; otherwise, it clears all of them and returns true.

This docstring was generated by AI.

Returns:

true if all named graphs were dropped, false otherwise

inline boolean clear(String uri, boolean isSilent)#

Clears the graph for the given URI.

This docstring was generated by AI.

Parameters:
  • uri – The URI of the graph to clear

  • isSilent – Flag indicating whether to operate silently or not

Returns:

True if the graph was cleared, false otherwise

inline boolean clear(String graph_name)#

Clears a graph in the semantic web framework.

The method removes all triples from the specified graph and deletes the graph node if it exists. It also triggers the delete event for the graph node.

This docstring was generated by AI.

Parameters:

graph_name – The name of the graph to clear

Returns:

true, indicating successful clearance

inline boolean update(String source, String target, boolean isSilent, int mode)#

Updates the graph based on provided parameters.

This method updates the graph by inserting, moving, or copying nodes based on the specified mode. The method returns true if the update is successful and false otherwise.

This docstring was generated by AI.

Parameters:
  • source – The source node

  • target – The target node

  • isSilent – If true, suppresses event notifications

  • mode – One of ADD, MOVE, or COPY to specify the update operation

Returns:

true if the update is successful and false otherwise

inline boolean add(String source, String target, boolean isSilent)#

Adds an edge between the source and target nodes.

This docstring was generated by AI.

Parameters:
  • source – The source node.

  • target – The target node.

  • isSilent – If true, no notifications will be sent.

Returns:

True if the edge was added, false otherwise.

inline boolean move(String source, String target, boolean isSilent)#

Moves a node from one location to another in the graph.

This docstring was generated by AI.

Parameters:
  • source – The starting location of the node

  • target – The destination location of the node

  • isSilent – Specifies whether to mute notifications

Returns:

True if the operation was successful, false otherwise

inline boolean copy(String source, String target, boolean isSilent)#

Copies a graph from a source to a target with an option to be silent.

This docstring was generated by AI.

Parameters:
  • source – The source graph name.

  • target – The target graph name.

  • isSilent – A flag to indicate whether to be silent or not.

Returns:

True if the copy operation was successful, false otherwise.

inline void setClassDistance(Distance distance)#

Distance

inline synchronized Distance setClassDistance ()

Returns the class distance if it has been set, or sets and returns it otherwise.

The class distance is initially null. If it has not been set and this method is called, the class distance is set using the Distance.classDistance(this) method and then returned. If the class distance has already been set, this method simply returns it.

This docstring was generated by AI.

Returns:

The class distance.

inline Distance getClassDistance()#

Returns the distance of this class.

This docstring was generated by AI.

Returns:

The distance of this class.

inline void setPropertyDistance(Distance distance)#

Sets the property distance for the graph manager.

This docstring was generated by AI.

Parameters:

distance – The new distance value.

inline synchronized Distance setPropertyDistance ()

Returns the property distance if it is set, otherwise sets and returns it.

If the property distance is already set, this method simply returns it. Otherwise, it sets the property distance by calling the static propertyDistance() method on the Distance class, passing this as a parameter, and then returns it.

This docstring was generated by AI.

Returns:

The property distance

inline Distance getPropertyDistance()#

Returns the property distance.

This docstring was generated by AI.

Returns:

The distance object

inline Edge copy(Edge edge)#

User API

TODO: no code here, use call to basic methods secure addEdge wrt addGraph/addProperty api with IDatatype

Add a copy of edge Use case: edge comes from another graph, create a local copy of nodes

inline Edge copy(Node gNode, Node pred, Edge ent)#

TODO: setUpdate(true)

inline void copy(Graph g)#

Copies the nodes and edges from the given graph into this graph.

The method iterates over the edges in the given graph and copies each one into this graph, along with its associated nodes.

This docstring was generated by AI.

Parameters:

g – The graph to copy nodes and edges from

inline Graph copy()#

Creates a copy of the graph.

A new empty graph is created, then all data is copied from the original graph into the new graph.

This docstring was generated by AI.

Returns:

A copy of the graph

inline Graph empty()#

Returns an empty graph with the same schema as this graph.

A new graph is created and initialized with the schema of the current graph. The new graph is then returned.

This docstring was generated by AI.

Returns:

A new empty graph with the same schema as this graph

inline Graph construct()#

Constructs and returns a new graph with specified metadata.

This method creates a new instance of the Graph class, sets its edge metadata based on the value of isEdgeMetadata(), and returns the newly created graph.

This docstring was generated by AI.

Returns:

The newly created Graph object

inline Graph union (Graph g)

This method creates a new graph that is the union of this graph and another graph.

The new graph contains all the triples from both this graph and the provided graph.

This docstring was generated by AI.

Parameters:

g – The graph to be unioned with this graph

Returns:

A new graph that is the union of this graph and the provided graph

inline Graph merge(Graph g)#

Merges the contents of another graph into this graph.

The method copies the contents of the input graph g into this graph and initializes the state of this graph.

This docstring was generated by AI.

Parameters:

g – The graph to merge into this graph

Returns:

This graph, with the merged contents

inline Edge add(Node source, Node subject, Node predicate, Node value)#

Add edge and add it’s nodes Node MUST be graph node.

inline Edge insert(Node s, Node p, Node o)#

Inserts a new edge into the graph.

This docstring was generated by AI.

Parameters:
  • s – The subject node of the new edge.

  • p – The predicate node of the new edge.

  • o – The object node of the new edge.

Returns:

The newly inserted edge.

inline Edge insert(Node g, Node s, Node p, Node o)#

Inserts a new edge into the graph.

The method takes in four nodes: a graph node, a subject node, a predicate node, and an object node. It creates a new edge object using the provided nodes and inserts it into the graph. If the graph node is null, a default graph node is used instead.

This docstring was generated by AI.

Parameters:
  • g – The graph node

  • s – The subject node

  • p – The predicate node

  • o – The object node

Returns:

The newly inserted edge, or null if the graph node is null

inline Edge insert(IDatatype subject, IDatatype predicate, IDatatype value)#

Add edge and add it’s nodes xt:insert.

inline Edge insert(IDatatype source, IDatatype subject, IDatatype predicate, IDatatype value)#

Inserts a new edge into the graph.

The method creates a new edge by specifying a source, subject, predicate, and value. The source, subject, predicate, and value are first converted into nodes. If the source node is not specified, the default graph node is used.

This docstring was generated by AI.

Parameters:
  • source – The node representing the source of the edge or null for the default graph node

  • subject – The node representing the subject of the edge

  • predicate – The node representing the predicate of the edge

  • value – The node representing the value of the edge

Returns:

The newly created edge instance

inline List< Edge > delete (Node s, Node p, Node o)

Deletes an edge from the graph.

This docstring was generated by AI.

Parameters:
  • s – The subject node.

  • p – The predicate node.

  • o – The object node.

Returns:

A list of deleted edges.

inline List< Edge > delete (Node g, Node s, Node p, Node o)

Deletes triples from the graph based on given nodes and predicate.

This method removes triples that match the given graph, subject, predicate, and object nodes from the graph manager. If any of the nodes are null, it would be treated as a wildcard.

This docstring was generated by AI.

Parameters:
  • g – The graph node, can be null

  • s – The subject node

  • p – The predicate node

  • o – The object node

Returns:

A list of deleted edges

inline List< Edge > delete (IDatatype subject, IDatatype predicate, IDatatype value)

Deletes an edge from the graph with the given subject, predicate, and value.

This docstring was generated by AI.

Parameters:
  • subject – The subject IDatatype of the edge to delete.

  • predicate – The predicate IDatatype of the edge to delete.

  • value – The value IDatatype of the edge to delete.

Returns:

A list of deleted edges.

inline List< Edge > delete (IDatatype source, IDatatype subject, IDatatype predicate, IDatatype value)

Deletes an edge from the graph.

The method creates a delete edge object using the given parameters, then deletes it from the graph, and returns a list of deleted edges.

This docstring was generated by AI.

Parameters:
  • source – The source node ID

  • subject – The subject node ID

  • predicate – The predicate ID

  • value – The object value ID

Returns:

A list of deleted edges

inline Edge addEdge(Node source, Node subject, Node predicate, Node value)#

Add Edge, not add nodes.

inline Edge addEdge(Node subject, Node predicate, Node value)#

Adds an edge to the graph with the given subject, predicate, and value node.

A default graph node is first added, then the edge is added to that graph node.

This docstring was generated by AI.

Parameters:
  • subject – The subject node of the edge

  • predicate – The predicate node of the edge

  • value – The object node of the edge

Returns:

The newly created edge

inline Edge addEdge(Node source, Node predicate, List<Node> list)#

Adds an edge to the graph with the specified source node, predicate, and list of object nodes.

If the list of object nodes has a size of 2, a new edge is created with two object nodes. If the list of object nodes has a size other than 2, a new edge is created with the list of object nodes. If an edge with the same source, predicate, and object nodes already exists, it is returned. Otherwise, the new edge is added to the graph and returned.

This docstring was generated by AI.

Parameters:
  • source – The source node of the edge

  • predicate – The predicate of the edge

  • list – The list of object nodes of the edge

Returns:

The edge that was added or an existing edge with the same source, predicate, and object nodes

inline Node addGraph(String label)#

Graph in itself is not considered as a graph node for SPARQL path unless explicitely referenced as a subject or object Hence ?x :p* ?y does not return named graph nodes.

inline Node addGraph(String label, boolean bnode)#

Adds a new graph to the manager with the given label and blank node flag.

This docstring was generated by AI.

Parameters:
  • label – The label of the new graph.

  • bnode – A flag indicating whether the new graph is a blank node.

Returns:

The node representing the new graph.

inline Node addDefaultGraphNode()#

Adds a default graph node and returns it.

This docstring was generated by AI.

Returns:

The default graph node.

inline boolean isDefaultGraphNode(Node g)#

Checks if the given node is the default graph node.

This docstring was generated by AI.

Parameters:

g – The node to check

Returns:

True if the given node is the default graph node, false otherwise

inline boolean isDefaultGraphNode(String name)#

Checks if the given name is the default graph node.

This docstring was generated by AI.

Parameters:

name – The name to check

Returns:

True if the name is the default graph node, false otherwise

inline Node getDefaultGraphNode()#

Returns the default graph node.

This docstring was generated by AI.

Returns:

The default graph node

inline IDatatype getDefaultGraphDatatypeValue()#

Returns the default graph datatype value.

This docstring was generated by AI.

Returns:

The default graph datatype value.

inline Node addRuleGraphNode()#

Adds a rule graph node and returns it.

This docstring was generated by AI.

Returns:

The added rule graph node.

inline Node getRuleGraphNode()#

Returns the rule graph node.

This docstring was generated by AI.

Returns:

The rule graph node

inline Node addConstraintGraphNode()#

Adds a constraint graph node and returns it.

This docstring was generated by AI.

Returns:

The added constraint graph node.

inline Node getConstraintGraphNode()#

Returns the constraint graph node.

This docstring was generated by AI.

Returns:

The constraint graph node.

inline Graph getConstraintGraph()#

Returns the constraint graph, referring to the current graph instance.

This docstring was generated by AI.

Returns:

The

Graph 
instance representing the constraint graph.

inline boolean isRuleGraphNode(Node node)#

Checks if the given node is the rule graph node.

This docstring was generated by AI.

Parameters:

node – The node to check

Returns:

True if the node is the rule graph node, false otherwise

inline Node addResource(String label)#

Adds a resource with the given label to the graph.

This docstring was generated by AI.

Parameters:

label – The label of the resource to add

Returns:

The newly added resource node

inline Node addProperty(String label)#

Property in itself is not considered as a graph node for SPARQL path unless explicitely referenced as a subject or object Hence ?x :p* ?y does not return property nodes.

inline Node addBlank(String label)#

label must have been generated by newBlankID()

inline Edge beforeInsert(Edge edge)#

Returns the edge before it is inserted into the graph.

This docstring was generated by AI.

Parameters:

edge – The edge to be inserted.

Returns:

The same edge that was passed in as a parameter.

inline Node addTripleReference()#

Adds a new triple reference node to the graph and returns it.

This docstring was generated by AI.

Returns:

The new triple reference node.

inline Node addTripleReference(String label)#

Adds a triple reference with the given label and returns it.

This docstring was generated by AI.

Parameters:

label – The label of the triple reference

Returns:

The added triple reference node

inline Node addTripleReference(Node s, Node p, Node o)#

Adds a triple reference to the graph.

If the RDF_STAR_TRIPLE property is true, the method adds the triple reference directly. Otherwise, it first wraps the triple in a reference before adding it.

This docstring was generated by AI.

Parameters:
  • s – The subject node

  • p – The predicate node

  • o – The object node

Returns:

The node representing the added triple reference

inline Node getTripleReference(Node s, Node p, Node o)#

Returns the triple reference node for a given subject, predicate, and object.

This docstring was generated by AI.

Parameters:
  • s – The subject node.

  • p – The predicate node.

  • o – The object node.

Returns:

The triple reference node.

inline Node getTripleReference(Edge edge)#

Returns the triple reference node for a given edge.

This docstring was generated by AI.

Parameters:

edge – The edge for which to retrieve the triple reference node.

Returns:

The triple reference node for the given edge.

inline IDatatype createTripleReference(Node s, Node p, Node o)#

Creates a triple reference with the given nodes.

This docstring was generated by AI.

Parameters:
  • s – The subject node

  • p – The predicate node

  • o – The object node

Returns:

A triple reference corresponding to the given nodes

inline IDatatype createTripleReference(Edge edge)#

Creates a triple reference with the given edge components.

This docstring was generated by AI.

Parameters:

edge – The edge containing subject, property, and object nodes.

Returns:

A new triple reference associated with the edge.

inline String reference(Node s, Node p, Node o)#

generate unique reference node ID for given s p o pragma: nodes MUST have been inserted in the graph to have an index _:ti.j.k where i, j, k are node index

inline String reference(Node n)#

Returns a string representation of a node’s reference in the graph.

The returned string representation is based on the node’s value type. If the value is a URI, the returned string is the node’s index. If the value is a number, the returned string is the result of the

referenceNumber 
method called with the number value. If the value is a boolean, the returned string is “btrue” or “bfalse”, depending on the boolean value. If the value is a date, the returned string is “dindex”, where “index” is the node’s index, if the timezone is “Z”, or “bindex”, where “index” is the node’s index, if the timezone is not “Z”. If the value is none of the above, the returned string is the node’s index.

This docstring was generated by AI.

Parameters:

n – The node to be referenced

Returns:

A string representation of the node’s reference

inline IDatatype createTripleReference()#

Creates a triple reference with a new ID.

This docstring was generated by AI.

Returns:

A new triple reference ID.

inline IDatatype createBlank(String label)#

Creates a blank node with the given label.

If the isSkolem flag is true, a skolem blank node is created, otherwise a blank node is created using the createBlank method from the DatatypeMap class.

This docstring was generated by AI.

Parameters:

label – The label for the blank node

Returns:

An IDatatype object representing the blank node

inline Node addBlank()#

Adds a new blank node to the graph and returns it.

This docstring was generated by AI.

Returns:

The newly created blank node.

inline Node addTripleName()#

Adds a blank node to the graph and returns it.

This docstring was generated by AI.

Returns:

The newly added blank node.

inline Node addLiteral(String label, String datatype, String lang)#

Adds a literal with the given label, datatype, and language to the graph.

The method first creates a new literal using the provided parameters and the DatatypeMap. If the literal cannot be created, the method returns null. Otherwise, it adds the new literal as a node in the graph.

This docstring was generated by AI.

Parameters:
  • label – The label of the literal

  • datatype – The datatype of the literal

  • lang – The language of the literal

Returns:

The node representing the added literal, or null if the literal could not be created

inline Node addLiteral(String label, String datatype)#

Adds a new node with a literal label and datatype to the graph.

The method creates a new node with a given label and datatype using the DatatypeMap.createLiteral() method. If the creation is successful, the node is added to the graph using the addNode() method.

This docstring was generated by AI.

Parameters:
  • label – The string label of the literal

  • datatype – The datatype of the literal

Returns:

The added node or null if the node creation fails

inline Node addLiteral(String label)#

Adds a literal node with the given label to the graph.

This docstring was generated by AI.

Parameters:

label – The label of the node.

Returns:

A node object representing the new literal node.

inline Node addLiteral(int n)#

Adds a new literal node with the given integer value to the graph.

This docstring was generated by AI.

Parameters:

n – The integer value of the literal node.

Returns:

The new literal node that was added to the graph.

inline Node addLiteral(long n)#

Adds a literal node to the graph with the given long value.

This docstring was generated by AI.

Parameters:

n – The long value for the new literal node.

Returns:

The new node object representing the added literal node.

inline Node addLiteral(double n)#

Adds a literal value as a node to the graph.

This docstring was generated by AI.

Parameters:

n – The literal value as a double

Returns:

The node representing the added literal value

inline Node addLiteral(float n)#

Adds a literal node with the given float value to the graph.

This docstring was generated by AI.

Parameters:

n – The float value for the literal node.

Returns:

The added node.

inline Node addLiteral(boolean n)#

Adds a literal node to the graph.

This docstring was generated by AI.

Parameters:

n – The boolean value for the datatype of the literal node.

Returns:

The newly added node.

inline void setDebug(boolean b)#

Sets the debug mode for the graph manager.

Parameters:

b

inline void setDebugMode(boolean b)#

Sets the debug mode for the graph manager and related components.

This method enables or disables the debug mode for the Graph object, as well as for its internal components such as the EdgeManagerIndexer objects and the Entailment object. When debug mode is enabled, these components will produce debugging output.

This docstring was generated by AI.

Parameters:

b – The new debug mode setting

inline void tag(Edge ent)#

Tags the given edge using the factory object.

This docstring was generated by AI.

Parameters:

ent – The edge to be tagged

inline boolean hasTag()#

Returns whether the graph has a tag.

This docstring was generated by AI.

Returns:

True if the graph has a tag, false otherwise.

inline void setTag(boolean b)#

Sets the tag value and updates the tuple status accordingly.

This method sets the value of the ‘hasTag’ instance variable to the input boolean value ‘b’. If ‘b’ is true, it also sets the ‘tuple’ instance variable to true.

Parameters:

b – The value to set the ‘hasTag’ instance variable to

inline void logDelete(Edge ent)#

This log would be used to broadcast deletion to peers.

inline void logInsert(Edge ent)#

Logs the insertion of an edge in the graph.

This method notifies all registered listeners about the insertion of a new edge in the graph. If there are no registered listeners, the method does nothing.

Parameters:

ent – The edge to be logged

inline void declareUpdate(boolean b)#

Declares an update operation on the graph.

The method iterates over all indexes in the graph and declares the update operation on them.

Parameters:

b – A boolean flag indicating whether to declare an update operation

inline void logStart(Query q)#

Logs the start of a query execution.

The method notifies all registered listeners that a query execution is starting on the current graph instance.

Parameters:

q – The query being executed

inline void logFinish(Query q)#

Logs the finish time of a query.

This docstring was generated by AI.

Parameters:
  • q – The query object

  • log – The log object, or null if not provided

inline void logFinish(Query q, Mappings m)#

Logs query finish and notifies registered listeners.

This method checks if there are any registered listeners and, if so, notifies each one of the query finish event by calling the ‘finish’ method on each listener, passing this graph, the query, and the mappings as arguments.

Parameters:
  • q – The query being logged

  • m – The mappings associated with the query

inline void logLoad(String path)#

Logs the loading of a graph from a specified path.

This method notifies all registered GraphListeners of the loading of a graph from the provided path. If there are no registered listeners, the method does nothing.

This docstring was generated by AI.

Parameters:

path – The path of the graph file to be loaded

inline boolean onInsert(Edge ent)#

Notifies registered listeners of an edge insertion.

This method calls the onInsert() method of each registered GraphListener, allowing them to react to the insertion of a new edge. If any listener returns false, this method also returns false to indicate that the insertion was not successful. Otherwise, it returns true to indicate that the insertion was successful.

This docstring was generated by AI.

Parameters:

ent – The inserted edge

Returns:

True if the edge was successfully inserted, false otherwise

inline boolean check(Query q)#

Check if query may succeed on graph PRAGMA: no RDFS entailments, simple RDF match.

inline void shareNamedGraph(Graph g)#

Shares a named graph.

This docstring was generated by AI.

Parameters:

g – The graph to share

inline Collection<String> getNames()#

Returns an empty collection of strings.

This docstring was generated by AI.

Returns:

An empty collection of strings.

inline Graph getNamedGraph(String name)#

Returns the named graph with the given name.

This docstring was generated by AI.

Parameters:

name – The name of the graph.

Returns:

The Graph with the given name or null if it doesn’t exist.

inline Graph setNamedGraph(String name, Graph g)#

Sets the named graph with the given name to the provided graph.

This docstring was generated by AI.

Parameters:
  • name – The name of the graph

  • g – The graph to set

Returns:

The current instance of the Graph for method chaining

inline Dataset getDataset()#

Returns a new Dataset object containing all nodes from the graph.

The method creates a new Dataset object and adds all graph nodes to it. For each graph node, it adds a default graph from the node’s label and a named graph with the node’s label as the name.

This docstring was generated by AI.

Returns:

A new Dataset object containing all nodes from the graph

inline Graph getRuleGraph(boolean constraint)#

Returns this graph instance for rule processing.

This docstring was generated by AI.

Parameters:

constraint – If true, use constraint rule graph

Returns:

This graph instance

inline Node getRuleGraphName(boolean constraint)#

Returns the name of the rule graph or constraint graph.

This docstring was generated by AI.

Parameters:

constraint – If true, returns the constraint graph name; otherwise, returns the rule graph name.

Returns:

The node representing the name of the rule or constraint graph.

inline boolean isMetadata()#

Returns whether this graph is a metadata graph.

This docstring was generated by AI.

Returns:

true if this graph is a metadata graph, false otherwise

inline boolean isMetadataNode()#

Checks if the node is a metadata node.

This docstring was generated by AI.

Returns:

true if the node is an edge metadata or a metadata node

inline boolean isFormerMetadata()#

Checks if a node is a former metadata node.

This docstring was generated by AI.

Returns:

true if the node is a metadata node and not a RDF-star triple, false otherwise

inline void setMetadata(boolean metadata)#

Sets the metadata value.

This docstring was generated by AI.

Parameters:

metadata – The new metadata value

inline JSONObject match(ASTQuery ast)#

For each triple pattern: Search if there exists graph name, subject, property, object in the graph with similar URI mode=message&param=sv:distance~n => levenshtein distance <= n

inline JSONObject match(ASTQuery ast, int d)#

Executes a query and returns the result as a JSON object using GraphDistance.

This docstring was generated by AI.

Parameters:
  • ast – The ASTQuery object representing the query

  • d – An integer value

Returns:

A JSONObject containing the result of the query

inline JSONObject cardinality(ASTQuery ast)#

Returns the cardinality for the given ASTQuery using a GraphDistance object.

This docstring was generated by AI.

Parameters:

ast – The ASTQuery object for which to return the cardinality.

Returns:

A JSONObject containing the cardinality information.

inline SortedMap<IDatatype, Node> getLiteralNodeManager()#

Returns the map of literal nodes managed by this graph.

This docstring was generated by AI.

Returns:

A sorted map containing literal nodes as values and their corresponding datatype keys.

inline void setLiteralNodeManager(SortedMap<IDatatype, Node> literal)#

Sets the map for managing literal nodes in the graph.

This docstring was generated by AI.

Parameters:

literal – The sorted map of literals and nodes.

inline SortedMap<IDatatype, Node> getLiteralIndexManager()#

Returns the literal index manager of the graph.

This docstring was generated by AI.

Returns:

A sorted map of literals to nodes.

inline void setLiteralIndexManager(SortedMap<IDatatype, Node> sliteral)#

Sets the literal index manager in the graph manager.

This docstring was generated by AI.

Parameters:

sliteral – The sorted map of IDatatype to Node

inline boolean isAllGraphNode()#

Returns whether the object is a graph node.

This docstring was generated by AI.

Returns:

Whether the object is a graph node

inline void setAllGraphNode(boolean allGraphNode)#

Sets whether all nodes in the graph are to be considered.

This docstring was generated by AI.

Parameters:

allGraphNode – If true, all nodes in the graph will be considered.

inline EdgeManagerIndexer getSubjectIndex()#

Returns the subject indexer of the graph.

This docstring was generated by AI.

Returns:

The subject indexer of the graph.

inline void setIndexList(ArrayList<EdgeManagerIndexer> tables)#

Sets the list of index tables for the graph manager.

This docstring was generated by AI.

Parameters:

tables – The list of edge manager indexers.

inline boolean isDebugSparql()#

Returns whether SPARQL debugging is enabled.

This docstring was generated by AI.

Returns:

boolean value indicating whether SPARQL debugging is enabled

inline void setDebugSparql(boolean debugSparql)#

Sets the debug SPARQL flag.

This docstring was generated by AI.

Parameters:

debugSparql – The flag value

inline List<GraphListener> getListenerList()#

Returns the list of graph listeners.

This docstring was generated by AI.

Returns:

The list of graph listeners.

inline void setListenerList(List<GraphListener> listenerList)#

Sets the listener list for the graph manager.

This docstring was generated by AI.

Parameters:

listenerList – The list of graph listeners

Public Static Functions

static inline Graph create()#

Creates a new instance of the Graph class.

This docstring was generated by AI.

Returns:

A new instance of the Graph class.

static inline Graph create(boolean b)#
Parameters:

b – true for RDFS entailment

static inline void setValueTable(boolean b)#

Sets the value table based on the provided boolean value.

If the boolean value is true, the value table is set to true. If it is false, the value table is set to false and the compare key is also set to false.

This docstring was generated by AI.

Parameters:

b – The boolean value to set the value table to

static inline void setCompareKey(boolean b)#

Sets the value table based on the given boolean flag.

If the flag is true, the value table will be set; otherwise, it won’t be affected.

This docstring was generated by AI.

Parameters:

b – The boolean flag to determine whether to set the value table

static inline void setCompareIndex(boolean b)#

Edge Index is sorted on integer index value of Node Set default behavior for all graphs PRAGMA: PB with several graphs, index are not shared.

static inline void setDistinctDatatype(boolean b)#

Sets the distinct datatype flag.

This method is intentionally empty as it is deprecated.

This docstring was generated by AI.

Parameters:

b – The flag value

static inline void setNodeAsDatatype(boolean b)#

Sets the node as datatype.

This docstring was generated by AI.

Parameters:

b – The boolean value

static inline void setEdgeMetadataDefault(boolean b)#

Sets the default value for edge metadata.

This docstring was generated by AI.

Parameters:

b – The new default value for edge metadata

static inline void setRDFStar(boolean b)#

Sets the RDF Star mode.

This docstring was generated by AI.

Parameters:

b – The new value for RDF Star mode

static inline boolean isTopRelation(Node predicate)#

Checks if the given predicate is a top relation.

This docstring was generated by AI.

Parameters:

predicate – The node whose label is checked.

Returns:

True if the predicate is a top relation, false otherwise.

static inline void setDefaultVerbose(boolean b)#

Sets the default verbose mode.

This docstring was generated by AI.

Parameters:

b – The new verbose mode

static inline void setDefaultSkolem(boolean b)#

Sets the default Skolem mode.

This docstring was generated by AI.

Parameters:

b – The new default Skolem mode.

Public Static Attributes

static final String SYSTEM   = ExpType.KGRAM + "system"
static final String TOPREL   = fr.inria.corese.sparql.triple.cst.RDFS.RootPropertyURI
static boolean valueOut = !true#
static final int IGRAPH   = -1
static final int ILIST   = -2
static final int LENGTH   = 2
static final int DEFAULT   = 0
static final int EXTENSION   = 1
static final int COPY   = 0
static final int MOVE   = 1
static final int ADD   = 2
static final int CLEAR   = 3
static String BLANK = "_:b"#
static String TRIPLE_REF = "_:t"#
static boolean VERBOSE = false#
static boolean DEBUG_SPARQL = false#
static boolean SKOLEM_DEFAULT = false#
static boolean EXTERNAL_NAMED_GRAPH = false#
static boolean CONSTRAINT_NAMED_GRAPH = true#
static boolean CONSTRAINT_GRAPH = false#
static boolean METADATA_DEFAULT = false#
static boolean EDGE_METADATA_DEFAULT = false#
static boolean RDFS_ENTAILMENT_DEFAULT = true#
static boolean TRIPLE_UNIQUE_NAME = true#
static final int DEFAULT_INDEX   = 0
static final int ENTAIL_INDEX   = 1
static final int RULE_INDEX   = 2
static final int RULE_CONSTRAINT   = 3
static final int SUBCLASS_INDEX   = 4
static final int LABEL_INDEX   = 5
static final int TYPE_INDEX   = 6
static final int FIRST_INDEX   = 7
static final int REST_INDEX   = 8
static final int DEFAULT_UNION   = 0
static final int DEFAULT_GRAPH   = 1
static int DEFAULT_GRAPH_MODE = DEFAULT_UNION#
class TreeNode : public java::util::TreeMap<IDatatype, Node>#

With CompareNode: manage 1, 01, 1.0 as different Node (with same index) With CompareIndex: manage IDatatype(1) IDatatype(01) IDatatype(1.0) with same index With CompareIndexStrict: manage IDatatype(1) IDatatype(01) with same index and 1.0 with different index (sparql compliant)

Public Functions

inline TreeNode()#

Constructs a new TreeNode object with a CompareNode object as its value.

This docstring was generated by AI.

Returns:

A new TreeNode object.