Core Classes

This section documents the core classes of s3dgraphy that form the foundation of the library.

Graph

Graph module for s3Dgraphy, responsible for managing nodes and edges in the knowledge graph.

class s3dgraphy.graph.Node(node_id, name, description='')[source]

Bases: object

Base class to represent a node in the graph.

node_id

Unique identifier for the node.

Type:

str

name

Name of the node.

Type:

str

node_type

Type of the node.

Type:

str

description

Description of the node.

Type:

str

attributes

Dictionary for additional attributes.

Type:

dict

node_type_map = {'ActivityNodeGroup': <class 's3dgraphy.nodes.group_node.ActivityNodeGroup'>, 'BR': <class 's3dgraphy.nodes.stratigraphic_node.ContinuityNode'>, 'EpochNode': <class 's3dgraphy.nodes.epoch_node.EpochNode'>, 'Group': <class 's3dgraphy.nodes.group_node.GroupNode'>, 'LocationNodeGroup': <class 's3dgraphy.nodes.group_node.LocationNodeGroup'>, 'ParadataNode': <class 's3dgraphy.nodes.paradata_node.ParadataNode'>, 'ParadataNodeGroup': <class 's3dgraphy.nodes.group_node.ParadataNodeGroup'>, 'RSF': <class 's3dgraphy.nodes.stratigraphic_node.ReusedSpecialFind'>, 'SE': <class 's3dgraphy.nodes.stratigraphic_node.StratigraphicEventNode'>, 'SF': <class 's3dgraphy.nodes.stratigraphic_node.SpecialFindUnit'>, 'StratigraphicNode': <class 's3dgraphy.nodes.stratigraphic_node.StratigraphicNode'>, 'TSU': <class 's3dgraphy.nodes.stratigraphic_node.TransformationStratigraphicUnit'>, 'TimeBranchNodeGroup': <class 's3dgraphy.nodes.group_node.TimeBranchNodeGroup'>, 'UL': <class 's3dgraphy.nodes.stratigraphic_node.WorkingUnit'>, 'US': <class 's3dgraphy.nodes.stratigraphic_node.StratigraphicUnit'>, 'USD': <class 's3dgraphy.nodes.stratigraphic_node.DocumentaryStratigraphicUnit'>, 'USN': <class 's3dgraphy.nodes.stratigraphic_node.NegativeStratigraphicUnit'>, 'USVn': <class 's3dgraphy.nodes.stratigraphic_node.NonStructuralVirtualStratigraphicUnit'>, 'USVs': <class 's3dgraphy.nodes.stratigraphic_node.StructuralVirtualStratigraphicUnit'>, 'VSF': <class 's3dgraphy.nodes.stratigraphic_node.VirtualSpecialFindUnit'>, 'author': <class 's3dgraphy.nodes.author_node.AuthorNode'>, 'author_ai': <class 's3dgraphy.nodes.author_node.AuthorAINode'>, 'combiner': <class 's3dgraphy.nodes.combiner_node.CombinerNode'>, 'document': <class 's3dgraphy.nodes.document_node.DocumentNode'>, 'embargo': <class 's3dgraphy.nodes.embargo_node.EmbargoNode'>, 'extractor': <class 's3dgraphy.nodes.extractor_node.ExtractorNode'>, 'geo_position': <class 's3dgraphy.nodes.geo_position_node.GeoPositionNode'>, 'graph': <class 's3dgraphy.nodes.graph_node.GraphNode'>, 'license': <class 's3dgraphy.nodes.license_node.LicenseNode'>, 'link': <class 's3dgraphy.nodes.link_node.LinkNode'>, 'property': <class 's3dgraphy.nodes.property_node.PropertyNode'>, 'representation_model': <class 's3dgraphy.nodes.representation_node.RepresentationModelNode'>, 'representation_model_doc': <class 's3dgraphy.nodes.representation_node.RepresentationModelDocNode'>, 'representation_model_sf': <class 's3dgraphy.nodes.representation_node.RepresentationModelSpecialFindNode'>, 'representation_node': <class 's3dgraphy.nodes.representation_node.RepresentationNode'>, 'serSU': <class 's3dgraphy.nodes.stratigraphic_node.SeriesOfStratigraphicUnit'>, 'serUSD': <class 's3dgraphy.nodes.stratigraphic_node.SeriesOfDocumentaryStratigraphicUnit'>, 'serUSVn': <class 's3dgraphy.nodes.stratigraphic_node.SeriesOfNonStructuralVirtualStratigraphicUnit'>, 'serUSVs': <class 's3dgraphy.nodes.stratigraphic_node.SeriesOfStructuralVirtualStratigraphicUnit'>, 'unknown': <class 's3dgraphy.nodes.stratigraphic_node.UnknownNode'>}
__init__(node_id, name, description='')[source]
node_type = 'Node'
add_attribute(key, value)[source]
class s3dgraphy.graph.EpochNode(node_id, name, start_time, end_time, color='#FFFFFF', description='')[source]

Bases: Node

Nodo che rappresenta un’epoca temporale. Si tratta di un insieme di comodo che permette di attribuire d’ufficio una serie di azioni ad un delta temporale. Una volta che i dati puntuali sulla cronologia, espressi come proprietà start_time ed end_time delle singole US viene definito grazie ad elementi dtanti, tali nodi epoca vengono ignorati laddove ci sono i suddetti dati puntuali.

start_time

Tempo di inizio dell’epoca.

Type:

float

end_time

Tempo di fine dell’epoca.

Type:

float

color

Colore associato all’epoca.

Type:

str

node_type = 'EpochNode'
__init__(node_id, name, start_time, end_time, color='#FFFFFF', description='')[source]
set_name(name)[source]
set_start_time(start_time)[source]
set_end_time(end_time)[source]
set_color(color)[source]
class s3dgraphy.graph.StratigraphicNode(node_id, name, description='')[source]

Bases: Node

Base class for all stratigraphic units within the graph structure. Inherits from Node and provides additional functionality specific to stratigraphy.

node_type = 'StratigraphicNode'
__init__(node_id, name, description='')[source]
class s3dgraphy.graph.PropertyNode(node_id, name, description='', value=None, property_type='string', data=None, url=None)[source]

Bases: ParadataNode

Nodo che rappresenta una proprietà associata a un altro nodo.

value

Valore della proprietà.

Type:

any

property_type

Tipo di proprietà (es. “Height”, “Length”, etc.).

Type:

str

data

Metadati aggiuntivi, come ‘author’, ‘time_start’, ‘time_end’.

Type:

dict

PROPERTY_TYPES = {'Archaeometric Data': {'description': 'Scientific measurements or analyses related to the object.', 'label': 'Archaeometric Data', 'symbol': '📏'}, 'Bibliography': {'description': 'References or literature associated with the object.', 'label': 'Bibliography', 'symbol': '📚'}, 'Depth': {'description': 'The depth of the object, typically measured in meters.', 'label': 'Depth', 'symbol': '⇵'}, 'Diameter': {'description': 'The diameter of circular objects, typically measured in meters.', 'label': 'Diameter', 'symbol': '⬤'}, 'Documentation 2D-3D': {'description': 'Details on 2D or 3D documentation of the object.', 'label': 'Documentation', 'symbol': '📸'}, 'Existence': {'description': 'Indicates whether the object exists or has existed.', 'label': 'Existence', 'symbol': '✅'}, 'Field Compilation Responsible': {'description': 'Person responsible for data collection in the field.', 'label': 'Field Compilation Responsible', 'symbol': '👤'}, 'Find Spot': {'description': 'The stratigraphic unit where the object was found.', 'label': 'Find Spot', 'symbol': '🗺️'}, 'Height': {'description': 'The height of the object, typically measured in meters.', 'label': 'Height', 'symbol': '↕'}, 'Length': {'description': 'The length of the object, typically measured in meters.', 'label': 'Length', 'symbol': '↔'}, 'Location': {'description': 'The spatial position or general location of the object.', 'label': 'Location', 'symbol': '📍'}, 'Lower Diameter': {'description': 'The diameter at the bottom of the object, typically measured in meters.', 'label': 'Lower Diameter', 'symbol': '⬤'}, 'Lower Diameter at Apophyge': {'description': 'Diameter measured at the apophyge of the lower section.', 'label': 'Lower Diameter at Apophyge', 'symbol': '⬤'}, 'Material': {'description': 'The material the object is made from (e.g., stone, wood).', 'label': 'Material', 'symbol': '🔨'}, 'Morphology': {'description': 'The shape and structure of the object.', 'label': 'Morphology', 'symbol': '🔄'}, 'Restoration': {'description': 'Details on any restorations performed on the object.', 'label': 'Restoration', 'symbol': '🛠️'}, 'Reuse': {'description': 'Indications of whether the object has been reused.', 'label': 'Reuse', 'symbol': '♻️'}, 'Reworking': {'description': 'Information on any modifications or reworkings of the object.', 'label': 'Reworking', 'symbol': '🔧'}, 'Style': {'description': 'The architectural or artistic style of the object.', 'label': 'Style', 'symbol': '🎨'}, 'Upper Diameter': {'description': 'The diameter at the top of the object, typically measured in meters.', 'label': 'Upper Diameter', 'symbol': '⬤'}, 'Upper Diameter at Apophyge': {'description': 'Diameter measured at the apophyge of the upper section.', 'label': 'Upper Diameter at Apophyge', 'symbol': '⬤'}, 'Width': {'description': 'The width of the object, typically measured in meters.', 'label': 'Width', 'symbol': '⬌'}}
node_type = 'property'
__init__(node_id, name, description='', value=None, property_type='string', data=None, url=None)[source]
validate_property_type()[source]

Valida il tipo di proprietà in base al vocabolario. Stampa un avviso se il tipo non è valido.

get_property_info()[source]

Restituisce le informazioni sul tipo e valore della proprietà.

class s3dgraphy.graph.GeoPositionNode(node_id, epsg=4326, shift_x=0.0, shift_y=0.0, shift_z=0.0)[source]

Bases: Node

Classe per rappresentare un nodo GeoPosition all’interno del grafo.

Attributi:

type (str): Tipo di nodo, impostato su “geo_position”. data (dict): Dati relativi alla posizione geografica.

node_type = 'geo_position'
__init__(node_id, epsg=4326, shift_x=0.0, shift_y=0.0, shift_z=0.0)[source]

Inizializza una nuova istanza di GeoPositionNode.

Parameters:
  • node_id (str) – Identificativo univoco del nodo.

  • epsg (int, opzionale) – Codice EPSG del sistema di riferimento delle coordinate. Defaults to 4326.

  • shift_x (float, opzionale) – Spostamento lungo l’asse X. Defaults to 0.0.

  • shift_y (float, opzionale) – Spostamento lungo l’asse Y. Defaults to 0.0.

  • shift_z (float, opzionale) – Spostamento lungo l’asse Z. Defaults to 0.0.

to_dict()[source]

Converte l’istanza di GeoPositionNode in un dizionario.

Returns:

Rappresentazione del GeoPositionNode come dizionario.

Return type:

dict

class s3dgraphy.graph.Edge(edge_id, edge_source, edge_target, edge_type)[source]

Bases: object

Represents an edge in the graph, connecting two nodes with a specific relationship type.

edge_id

Unique identifier for the edge.

Type:

str

edge_source

ID of the source node.

Type:

str

edge_target

ID of the target node.

Type:

str

edge_type

Semantic type of the relationship.

Type:

str

label

A descriptive label for the relationship type.

Type:

str

description

A detailed description of the relationship type.

Type:

str

__init__(edge_id, edge_source, edge_target, edge_type)[source]
to_dict()[source]

Converts the Edge instance to a dictionary format.

Returns:

A dictionary representation of the edge, including its attributes.

Return type:

dict

__repr__()[source]

Returns a string representation of the Edge instance.

Returns:

A string representation of the edge, showing its source, target, and type.

Return type:

str

is_symmetric()[source]

Check if this edge is symmetric (bidirectional).

is_canonical()[source]

Check if this edge uses the canonical direction.

get_reverse_name()[source]

Get the reverse edge name if this edge has directionality.

static get_datamodel()[source]

Get the global connections datamodel instance.

s3dgraphy.graph.get_connections_datamodel(datamodel_path: str | None = None) ConnectionsDatamodel[source]

Get the global ConnectionsDatamodel instance.

This function implements a singleton pattern for efficient reuse.

Parameters:

datamodel_path – Optional path to the connections datamodel JSON file. Only used on first call.

Returns:

The global ConnectionsDatamodel instance

class s3dgraphy.graph.GraphIndices[source]

Bases: object

Indexing system for efficient graph queries

__init__()[source]
clear()[source]

Cleans all indexes

add_node(node)[source]

Adds a node to all relevant indices

add_node_by_type(node_type, node)[source]

Adds a node to the index by type

add_property_node(prop_name, node)[source]

Adds a property node to the indexes

add_edge(edge)[source]

Adds an edge to indices

add_property_relation(prop_name, strat_id, value)[source]

Adds a stratigraphic-property relationship

get_property_names()[source]

Returns all unique property names

get_property_values(prop_name)[source]

Returns all unique values for a property

get_strat_nodes_by_property_value(prop_name, value)[source]

Returns the IDs of stratigraphic nodes with a given property value

class s3dgraphy.graph.Graph(graph_id, name=None, description=None, audio=None, video=None, data=None)[source]

Bases: object

Class representing a graph containing nodes and edges.

graph_id

Unique identifier for the graph.

Type:

str

name

Dictionary of graph name translations.

Type:

dict

description

Dictionary of graph description translations.

Type:

dict

audio

Dictionary of audio file lists by language.

Type:

dict

video

Dictionary of video file lists by language.

Type:

dict

data

Additional metadata like geographical position.

Type:

dict

nodes

List of nodes in the graph.

Type:

List[Node]

edges

List of edges in the graph.

Type:

List[Edge]

warnings

List to accumulate warning messages during operations.

Type:

List[str]

__init__(graph_id, name=None, description=None, audio=None, video=None, data=None)[source]
property indices

Lazy loading degli indici con rebuild automatico se necessario

static validate_connection(source_node_type, target_node_type, edge_type)[source]

Validates if a connection type between two nodes is allowed by the rules.

Uses the v1.5.3 connections datamodel for validation.

Parameters:
  • source_node_type (str) – The type of the source node.

  • target_node_type (str) – The type of the target node.

  • edge_type (str) – The type of edge connecting the nodes.

Returns:

True if the connection is allowed, False otherwise.

Return type:

bool

add_warning(message)[source]

Adds a warning message to the warnings list.

add_node(node: Node, overwrite=False) Node[source]

Adds a node to the graph.

add_edge(edge_id: str, edge_source: str, edge_target: str, edge_type: str) Edge[source]

Adds an edge to the graph with connection validation.

Parameters:
  • edge_id (str) – Unique ID of the edge.

  • edge_source (str) – Source node ID.

  • edge_target (str) – Target node ID.

  • edge_type (str) – Type of edge, must be defined in the connection rules.

Returns:

The added edge.

Return type:

Edge

Raises:

ValueError – If the source or target node does not exist or if the edge is a duplicate.

connect_paradatagroup_propertynode_to_stratigraphic(verbose=False)[source]

Identifica le relazioni tra unità stratigrafiche e ParadataNodeGroup, poi collega direttamente le unità stratigrafiche ai PropertyNode contenuti nel ParadataNodeGroup.

Questa funzione permette due modalità di collegamento: 1. Collegamento diretto: Unità Stratigrafica -> PropertyNode (modalità già supportata nel codice esistente) 2. Collegamento indiretto: Unità Stratigrafica -> ParadataNodeGroup -> PropertyNode In questo caso, crea anche collegamenti diretti tra Unità Stratigrafica e PropertyNode

Il risultato è una rete semantica più ricca, dove ogni unità stratigrafica può accedere direttamente alle sue proprietà, indipendentemente dalla struttura organizzativa scelta dall’utente (collegamento diretto o tramite gruppo).

Parameters:

verbose (bool) – Se True, stampa messaggi dettagliati durante l’esecuzione. Utile per debug. Default: True

Returns:

Statistiche sulle operazioni eseguite (gruppi analizzati, collegamenti creati, ecc.)

Return type:

dict

display_warnings()[source]

Displays all accumulated warning messages.

find_node_by_id(node_id)[source]

Finds a node by ID.

✅ OPTIMIZATION: O(1) lookup using indices instead of O(n) iteration

find_edge_by_id(edge_id)[source]

Finds an edge by ID.

get_connected_nodes(node_id)[source]

Gets all nodes connected to a given node.

get_connected_edges(node_id)[source]

Gets all edges connected to a given node.

filter_nodes_by_connection_to_type(node_id, node_type)[source]

Filters nodes connected to a given node by node type.

get_nodes_by_type(node_type)[source]

Gets all nodes of a given type.

✅ OPTIMIZATION: O(1) lookup using type index instead of O(n) iteration

remove_node(node_id)[source]

Removes a node and all edges connected to it.

remove_edge(edge_id)[source]

Removes an edge from the graph.

update_node(node_id, **kwargs)[source]

Updates attributes of an existing node.

update_edge(edge_id, **kwargs)[source]

Updates attributes of an existing edge.

find_node_by_name(name)[source]

Cerca un nodo per nome.

Parameters:

name (str) – Nome del nodo da cercare.

Returns:

Il nodo trovato, o None se non esiste.

Return type:

Node

find_edge_by_nodes(source_id, target_id)[source]

Cerca un arco basato sugli ID dei nodi sorgente e destinazione.

Parameters:
  • source_id (str) – ID del nodo sorgente.

  • target_id (str) – ID del nodo destinazione.

Returns:

L’arco trovato, o None se non esiste.

Return type:

Edge

get_connected_node_by_type(node, node_type)[source]

Ottiene un nodo collegato di un determinato tipo.

Parameters:
  • node (Node) – Nodo di partenza.

  • node_type (str) – Tipo di nodo da cercare.

Returns:

Il nodo collegato del tipo specificato, o None se non trovato.

Return type:

Node

get_connected_epoch_node_by_edge_type(node, edge_type: str)[source]

Ottiene il nodo EpochNode connesso tramite un arco di tipo specifico.

Parameters:
  • node (Node) – Il nodo da cui partire.

  • edge_type (str) – Il tipo di arco da filtrare.

Returns:

Il nodo EpochNode connesso, oppure None se non trovato.

Return type:

EpochNode | None

✅ OPTIMIZATION: O(1) lookup using composite index instead of O(E) iteration

get_connected_epoch_nodes_list_by_edge_type(node, edge_type: str)[source]

Ottiene una lista di nodi EpochNode connessi tramite un arco di tipo specifico.

Parameters:
  • node (Node) – Il nodo da cui partire.

  • edge_type (str) – Il tipo di arco da filtrare.

Returns:

Lista di nodi EpochNode connessi.

Return type:

List[EpochNode]

✅ OPTIMIZATION: O(1) lookup using composite index instead of O(E) iteration

calculate_chronology(graph=None)[source]

Calculate chronology for all stratigraphic nodes in this graph.

Protocol (hierarchy: specific > local > general): 1. Assign base times from epoch associations (has_first_epoch, survive_in_epoch) 2. Override with specific property values (absolute_time_start, absolute_time_end) 3. Propagate TPQ/TAQ constraints through stratigraphic relations

Parameters:

graph – Deprecated, ignored. Kept for backwards compatibility.

get_property(node, rule_id, default=None)[source]

Resolve a propagative property on node via the registered rule.

Convenience wrapper around s3dgraphy.resolvers.resolve(). Walks the 3-level hierarchy (node > swimlane > graph) and returns the first non-null value, or default.

Example:

author = graph.get_property(node, "author")
start  = graph.get_property(node, "absolute_time_start")
Parameters:
  • node – The node to resolve the property for.

  • rule_id – Id of a registered PropagationRule (see s3dgraphy.resolvers.list_rules()).

  • default – Value to return when no level yields a non-null value.

Raises:

KeyError – If rule_id is not registered.

filter_nodes_by_time_range(*args)[source]

Filter stratigraphic nodes that overlap with a given time range.

Accepts:

filter_nodes_by_time_range(start_time, end_time) - new API filter_nodes_by_time_range(graph, start_time, end_time) - old API (graph ignored)

print_node_connections(node)[source]
get_connected_nodes_by_filters(node, target_node_type='all', edge_type='all')[source]

Ottiene una lista di nodi collegati in base ai filtri specificati su target_node_type ed edge_type.

Parameters:
  • node (Node) – Nodo di partenza.

  • target_node_type (str) – Tipo di nodo target da cercare (“all” per nessun filtro).

  • edge_type (str) – Tipo di edge da cercare (“all” per nessun filtro).

Returns:

Lista di nodi collegati che soddisfano i criteri specificati.

Return type:

list[Node]

get_connected_nodes_by_edge_type(node_id, edge_type)[source]

Ottiene tutti i nodi connessi a un nodo specifico tramite un tipo di edge.

Parameters:
  • node_id (str) – ID del nodo di partenza

  • edge_type (str) – Tipo di edge da filtrare

Returns:

Lista di nodi connessi attraverso il tipo di edge specificato

Return type:

list

✅ OPTIMIZATION: O(1) lookup using composite index instead of O(E) iteration

get_property_nodes_for_node(node_id)[source]

Ottiene tutti i nodi proprietà connessi a un nodo specifico.

Parameters:

node_id (str) – ID del nodo di partenza

Returns:

Lista di nodi proprietà connessi

Return type:

list

get_combiner_nodes_for_property(property_node_id)[source]

Ottiene tutti i nodi combiner connessi a un nodo proprietà.

Parameters:

property_node_id (str) – ID del nodo proprietà

Returns:

Lista di nodi combiner connessi

Return type:

list

✅ OPTIMIZATION: O(1) lookup using source index instead of O(E) iteration

get_extractor_nodes_for_node(node_id)[source]

Ottiene tutti i nodi extractor connessi a un nodo (proprietà o combiner).

Parameters:

node_id (str) – ID del nodo di partenza

Returns:

Lista di nodi extractor connessi

Return type:

list

get_document_nodes_for_extractor(extractor_node_id)[source]

Ottiene tutti i nodi documento connessi a un nodo extractor.

Parameters:

extractor_node_id (str) – ID del nodo extractor

Returns:

Lista di nodi documento connessi

Return type:

list

get_paradata_chain(strat_node_id)[source]

Ottiene la catena completa di paradata per un nodo stratigrafico.

Parameters:

strat_node_id (str) – ID del nodo stratigrafico

Returns:

Dizionario con le catene di paradata strutturate

Return type:

dict

refine_edge_types(verbose=False)[source]

Refines placeholder edge types to more specific semantic types based on the types of connected nodes.

This method applies the same logic as the GraphML importer’s enhance_edge_type() to edges that are already in memory, transforming placeholders into semantic edge types according to the s3Dgraphy datamodel.

Refines both: - ‘has_data_provenance’ (placeholder for GraphML ‘dashed’ edges) - ‘generic_connection’ (placeholder for runtime-created edges)

Parameters:

verbose (bool) – If True, prints details about refined edges

Returns:

Number of edges that were refined

Return type:

int

refine_generic_connections(verbose=False)[source]

Deprecated: Use refine_edge_types() instead.

Base Node

s3dgraphy.nodes.base_node.files(package: ModuleType | str) Traversable[source]

Get a Traversable resource from a package

s3dgraphy.nodes.base_node.load_json_mapping(filename)[source]

Load JSON mapping data from a specified file.

Parameters:

filename (str) – Name of the JSON file containing mapping data.

Returns:

Mapping data loaded from the JSON file.

Return type:

dict

class s3dgraphy.nodes.base_node.Node(node_id, name, description='')[source]

Bases: object

Base class to represent a node in the graph.

node_id

Unique identifier for the node.

Type:

str

name

Name of the node.

Type:

str

node_type

Type of the node.

Type:

str

description

Description of the node.

Type:

str

attributes

Dictionary for additional attributes.

Type:

dict

node_type_map = {'ActivityNodeGroup': <class 's3dgraphy.nodes.group_node.ActivityNodeGroup'>, 'BR': <class 's3dgraphy.nodes.stratigraphic_node.ContinuityNode'>, 'EpochNode': <class 's3dgraphy.nodes.epoch_node.EpochNode'>, 'Group': <class 's3dgraphy.nodes.group_node.GroupNode'>, 'LocationNodeGroup': <class 's3dgraphy.nodes.group_node.LocationNodeGroup'>, 'ParadataNode': <class 's3dgraphy.nodes.paradata_node.ParadataNode'>, 'ParadataNodeGroup': <class 's3dgraphy.nodes.group_node.ParadataNodeGroup'>, 'RSF': <class 's3dgraphy.nodes.stratigraphic_node.ReusedSpecialFind'>, 'SE': <class 's3dgraphy.nodes.stratigraphic_node.StratigraphicEventNode'>, 'SF': <class 's3dgraphy.nodes.stratigraphic_node.SpecialFindUnit'>, 'StratigraphicNode': <class 's3dgraphy.nodes.stratigraphic_node.StratigraphicNode'>, 'TSU': <class 's3dgraphy.nodes.stratigraphic_node.TransformationStratigraphicUnit'>, 'TimeBranchNodeGroup': <class 's3dgraphy.nodes.group_node.TimeBranchNodeGroup'>, 'UL': <class 's3dgraphy.nodes.stratigraphic_node.WorkingUnit'>, 'US': <class 's3dgraphy.nodes.stratigraphic_node.StratigraphicUnit'>, 'USD': <class 's3dgraphy.nodes.stratigraphic_node.DocumentaryStratigraphicUnit'>, 'USN': <class 's3dgraphy.nodes.stratigraphic_node.NegativeStratigraphicUnit'>, 'USVn': <class 's3dgraphy.nodes.stratigraphic_node.NonStructuralVirtualStratigraphicUnit'>, 'USVs': <class 's3dgraphy.nodes.stratigraphic_node.StructuralVirtualStratigraphicUnit'>, 'VSF': <class 's3dgraphy.nodes.stratigraphic_node.VirtualSpecialFindUnit'>, 'author': <class 's3dgraphy.nodes.author_node.AuthorNode'>, 'author_ai': <class 's3dgraphy.nodes.author_node.AuthorAINode'>, 'combiner': <class 's3dgraphy.nodes.combiner_node.CombinerNode'>, 'document': <class 's3dgraphy.nodes.document_node.DocumentNode'>, 'embargo': <class 's3dgraphy.nodes.embargo_node.EmbargoNode'>, 'extractor': <class 's3dgraphy.nodes.extractor_node.ExtractorNode'>, 'geo_position': <class 's3dgraphy.nodes.geo_position_node.GeoPositionNode'>, 'graph': <class 's3dgraphy.nodes.graph_node.GraphNode'>, 'license': <class 's3dgraphy.nodes.license_node.LicenseNode'>, 'link': <class 's3dgraphy.nodes.link_node.LinkNode'>, 'property': <class 's3dgraphy.nodes.property_node.PropertyNode'>, 'representation_model': <class 's3dgraphy.nodes.representation_node.RepresentationModelNode'>, 'representation_model_doc': <class 's3dgraphy.nodes.representation_node.RepresentationModelDocNode'>, 'representation_model_sf': <class 's3dgraphy.nodes.representation_node.RepresentationModelSpecialFindNode'>, 'representation_node': <class 's3dgraphy.nodes.representation_node.RepresentationNode'>, 'serSU': <class 's3dgraphy.nodes.stratigraphic_node.SeriesOfStratigraphicUnit'>, 'serUSD': <class 's3dgraphy.nodes.stratigraphic_node.SeriesOfDocumentaryStratigraphicUnit'>, 'serUSVn': <class 's3dgraphy.nodes.stratigraphic_node.SeriesOfNonStructuralVirtualStratigraphicUnit'>, 'serUSVs': <class 's3dgraphy.nodes.stratigraphic_node.SeriesOfStructuralVirtualStratigraphicUnit'>, 'unknown': <class 's3dgraphy.nodes.stratigraphic_node.UnknownNode'>}
__init__(node_id, name, description='')[source]
node_type = 'Node'
add_attribute(key, value)[source]

Edge

s3dgraphy.edges.edge.get_connections_datamodel(datamodel_path: str | None = None) ConnectionsDatamodel[source]

Get the global ConnectionsDatamodel instance.

This function implements a singleton pattern for efficient reuse.

Parameters:

datamodel_path – Optional path to the connections datamodel JSON file. Only used on first call.

Returns:

The global ConnectionsDatamodel instance

class s3dgraphy.edges.edge.Edge(edge_id, edge_source, edge_target, edge_type)[source]

Bases: object

Represents an edge in the graph, connecting two nodes with a specific relationship type.

edge_id

Unique identifier for the edge.

Type:

str

edge_source

ID of the source node.

Type:

str

edge_target

ID of the target node.

Type:

str

edge_type

Semantic type of the relationship.

Type:

str

label

A descriptive label for the relationship type.

Type:

str

description

A detailed description of the relationship type.

Type:

str

__init__(edge_id, edge_source, edge_target, edge_type)[source]
to_dict()[source]

Converts the Edge instance to a dictionary format.

Returns:

A dictionary representation of the edge, including its attributes.

Return type:

dict

__repr__()[source]

Returns a string representation of the Edge instance.

Returns:

A string representation of the edge, showing its source, target, and type.

Return type:

str

is_symmetric()[source]

Check if this edge is symmetric (bidirectional).

is_canonical()[source]

Check if this edge uses the canonical direction.

get_reverse_name()[source]

Get the reverse edge name if this edge has directionality.

static get_datamodel()[source]

Get the global connections datamodel instance.

Multi Graph Manager