oxgraph 0.1.0

High-performance, zero-copy graph and topology substrate.
Documentation
//! Curated feature-gated re-exports for `OxGraph`.
//!
//! The umbrella crate does not add helper APIs that kernel crates lack. It only
//! collects the workspace surface behind explicit feature flags so consumers can
//! choose the layers they need.
#![no_std]

#[cfg(kani)]
extern crate kani;

/// Substrate-neutral topology capability traits.
///
/// # Performance
///
/// `perf: unspecified`; this module re-exports another crate.
#[cfg(feature = "topology")]
pub mod topology {
    pub use oxgraph_topology::{
        CanonicalElementIdentity, CanonicalIncidenceIdentity, CanonicalRelationIdentity,
        ContainsElement, ContainsIncidence, ContainsRelation, ElementId, ElementIncidenceCount,
        ElementIncidences, ElementIndex, ElementPredecessors, ElementSuccessors, ElementWeight,
        IncidenceBase, IncidenceCounts, IncidenceElement, IncidenceIndex, IncidenceRelation,
        IncidenceRole, IncidenceView, IncidenceWeight, LocalElementIdentity,
        LocalIncidenceIdentity, LocalRelationIdentity, RelationId, RelationIncidenceCount,
        RelationIncidences, RelationIndex, RelationWeight, TopologyBase, TopologyCounts,
        TopologyId,
    };
}

/// Binary graph vocabulary traits.
///
/// # Performance
///
/// `perf: unspecified`; this module re-exports another crate.
#[cfg(feature = "graph")]
pub mod graph {
    pub use oxgraph_graph::{
        ContainsEdge, ContainsEndpoint, ContainsNode, DirectedGraph, EdgeEndpointGraph, EdgeId,
        EdgeIndex, EdgeSourceGraph, EdgeTargetGraph, EndpointId, EndpointIndex, EndpointRole,
        ForwardGraph, GraphBase, GraphCounts, IncomingEdgeCount, IncomingGraph,
        IncomingNeighborsGraph, NodeId, NodeIndex, OutgoingEdgeCount, OutgoingGraph,
        OutgoingNeighborsGraph, ReverseGraph,
    };
}

/// Hypergraph vocabulary traits.
///
/// # Performance
///
/// `perf: unspecified`; this module re-exports another crate.
#[cfg(feature = "hyper")]
pub mod hyper {
    pub use oxgraph_hyper::{
        ContainsHyperedge, ContainsParticipant, ContainsVertex, DirectedHyperedgeIncidences,
        DirectedHyperedgeParticipants, DirectedHypergraph, DirectedVertexHyperedges,
        DirectedVertexPredecessors, DirectedVertexSuccessors, HyperedgeId, HyperedgeIncidences,
        HyperedgeIndex, HyperedgeParticipantCount, HyperedgeParticipants, Hypergraph,
        HypergraphBase, HypergraphCounts, IncidentHyperedgeCount, IncidentHyperedges,
        ParticipantBase, ParticipantCounts, ParticipantHyperedge, ParticipantId, ParticipantIndex,
        ParticipantRole, ParticipantRoleOf, ParticipantVertex, VertexId, VertexIncidences,
        VertexIndex,
    };
}

/// Borrowed compressed-sparse-column (inbound) graph views.
///
/// # Performance
///
/// `perf: unspecified`; this module re-exports another crate.
#[cfg(feature = "csc")]
pub mod csc {
    pub use oxgraph_csc::{
        CscNodeId, CscSnapshotError, CscSnapshotGraph, SNAPSHOT_KIND_PG_INBOUND_OFFSETS_U32,
        SNAPSHOT_KIND_PG_INBOUND_TARGETS_U32,
    };
}

/// Borrowed CSR graph layout.
///
/// # Performance
///
/// `perf: unspecified`; this module re-exports another crate.
#[cfg(feature = "csr")]
pub mod csr {
    pub use oxgraph_csr::{
        CsrEdgeId, CsrError, CsrGraph, CsrIndex, CsrNativeGraph, CsrNodeId, CsrOutEdges,
        CsrOutNeighbors, CsrSnapshotError, CsrSnapshotGraph, CsrSnapshotIndex, CsrSnapshotWord,
        CsrWord, SNAPSHOT_KIND_CSR_OFFSETS_U16, SNAPSHOT_KIND_CSR_OFFSETS_U32,
        SNAPSHOT_KIND_CSR_OFFSETS_U64, SNAPSHOT_KIND_CSR_TARGETS_U16,
        SNAPSHOT_KIND_CSR_TARGETS_U32, SNAPSHOT_KIND_CSR_TARGETS_U64,
    };
}

/// Borrowed bipartite-CSR hypergraph layout.
///
/// # Performance
///
/// `perf: unspecified`; this module re-exports another crate.
#[cfg(feature = "hyper-bcsr")]
pub mod hyper_bcsr {
    pub use oxgraph_hyper_bcsr::{
        BcsrChainedHyperedges, BcsrChainedParticipants, BcsrChainedRelationIncidences,
        BcsrElementIncidences, BcsrError, BcsrHyperedgeId, BcsrHyperedgeSlice, BcsrHypergraph,
        BcsrIndex, BcsrNativeHypergraph, BcsrParticipantId, BcsrParticipantSlice,
        BcsrPredecessorVertices, BcsrRole, BcsrRoleSide, BcsrSection, BcsrSections,
        BcsrSnapshotError, BcsrSnapshotHypergraph, BcsrSnapshotIndex, BcsrSnapshotWord,
        BcsrSuccessorVertices, BcsrValidation, BcsrVertexId, BcsrVertexSlice, BcsrWord,
        SNAPSHOT_KIND_BCSR_HEAD_OFFSETS_U16, SNAPSHOT_KIND_BCSR_HEAD_OFFSETS_U32,
        SNAPSHOT_KIND_BCSR_HEAD_OFFSETS_U64, SNAPSHOT_KIND_BCSR_HEAD_PARTICIPANTS_U16,
        SNAPSHOT_KIND_BCSR_HEAD_PARTICIPANTS_U32, SNAPSHOT_KIND_BCSR_HEAD_PARTICIPANTS_U64,
        SNAPSHOT_KIND_BCSR_TAIL_OFFSETS_U16, SNAPSHOT_KIND_BCSR_TAIL_OFFSETS_U32,
        SNAPSHOT_KIND_BCSR_TAIL_OFFSETS_U64, SNAPSHOT_KIND_BCSR_TAIL_PARTICIPANTS_U16,
        SNAPSHOT_KIND_BCSR_TAIL_PARTICIPANTS_U32, SNAPSHOT_KIND_BCSR_TAIL_PARTICIPANTS_U64,
        SNAPSHOT_KIND_BCSR_VERTEX_INCOMING_HYPEREDGES_U16,
        SNAPSHOT_KIND_BCSR_VERTEX_INCOMING_HYPEREDGES_U32,
        SNAPSHOT_KIND_BCSR_VERTEX_INCOMING_HYPEREDGES_U64,
        SNAPSHOT_KIND_BCSR_VERTEX_INCOMING_OFFSETS_U16,
        SNAPSHOT_KIND_BCSR_VERTEX_INCOMING_OFFSETS_U32,
        SNAPSHOT_KIND_BCSR_VERTEX_INCOMING_OFFSETS_U64,
        SNAPSHOT_KIND_BCSR_VERTEX_OUTGOING_HYPEREDGES_U16,
        SNAPSHOT_KIND_BCSR_VERTEX_OUTGOING_HYPEREDGES_U32,
        SNAPSHOT_KIND_BCSR_VERTEX_OUTGOING_HYPEREDGES_U64,
        SNAPSHOT_KIND_BCSR_VERTEX_OUTGOING_OFFSETS_U16,
        SNAPSHOT_KIND_BCSR_VERTEX_OUTGOING_OFFSETS_U32,
        SNAPSHOT_KIND_BCSR_VERTEX_OUTGOING_OFFSETS_U64,
    };
}

/// Topology-agnostic snapshot container.
///
/// # Performance
///
/// `perf: unspecified`; this module re-exports another crate.
#[cfg(feature = "snapshot")]
pub mod snapshot {
    #[cfg(feature = "snapshot-alloc")]
    pub use oxgraph_snapshot::SnapshotBuilder;
    pub use oxgraph_snapshot::{
        FORMAT_MAGIC, FORMAT_MAJOR, FORMAT_MINOR, HEADER_SIZE, HeaderOnlySnapshot,
        MAX_ALIGNMENT_LOG2, MAX_SECTION_COUNT, MAX_SUPPORTED_MINOR, PendingSection, PlanError,
        SECTION_ENTRY_SIZE, Section, SectionIter, SectionViewError, Snapshot, SnapshotError,
        SnapshotPlan, ValidationLevel,
    };
}

/// Substrate-agnostic algorithms.
///
/// # Performance
///
/// `perf: unspecified`; this module re-exports another crate.
#[cfg(feature = "algo")]
pub mod algo {
    pub use oxgraph_algo::{
        BfsEpochScratch, BfsError, BreadthFirstSearchEpochScratch, BreadthFirstSearchScratch,
        HyperWeighted, HypergraphOutgoingDistribution, HypergraphPageRankScratch,
        IntoPageRankScalar, OutgoingDistribution, PageRankConfig, PageRankError, PageRankReport,
        PageRankScalar, PageRankScratch, ReverseBreadthFirstSearchEpochScratch,
        ReverseBreadthFirstSearchScratch, Uniform, Weighted,
        breadth_first_search_with_epoch_scratch, breadth_first_search_with_scratch,
        pagerank_graph_with_scratch, pagerank_hypergraph_with_scratch,
        reverse_breadth_first_search_with_epoch_scratch, reverse_breadth_first_search_with_scratch,
    };
    #[cfg(feature = "algo-alloc")]
    pub use oxgraph_algo::{
        BfsWorkspace, BreadthFirstSearch, BreadthFirstSearchWorkspace, GenericBreadthFirstSearch,
        GenericReverseBreadthFirstSearch, HypergraphPageRankWorkspace, PageRankWorkspace,
        ReverseBreadthFirstSearch, ReverseBreadthFirstSearchWorkspace, breadth_first_search,
        breadth_first_search_generic, breadth_first_search_with_workspace, pagerank_graph,
        pagerank_graph_with_workspace, pagerank_hypergraph, pagerank_hypergraph_with_workspace,
        reverse_breadth_first_search, reverse_breadth_first_search_generic,
        reverse_breadth_first_search_with_workspace,
    };
    #[cfg(feature = "algo-std")]
    pub use oxgraph_algo::{
        HashBreadthFirstSearch, HashReverseBreadthFirstSearch, breadth_first_search_generic_hash,
        reverse_breadth_first_search_generic_hash,
    };
}

/// Arrow-backed property layers.
///
/// # Performance
///
/// `perf: unspecified`; this module re-exports another crate.
#[cfg(feature = "property-arrow")]
pub mod property {
    pub use oxgraph_property::{
        DenseWeights, ElementAxis, EncodedPropertySnapshot, GraphPropertyLayers,
        HyperPropertyLayers, IdFamily, IdentityMapMode, IdentityModeRecord, IdentityModeSummary,
        IdentitySnapshotSummary, IncidenceAxis, LayerId, LayerName, LayerRole, MissingPolicy,
        PropertyAxis, PropertyError, PropertyIndex, PropertyLayer, PropertyLayerData,
        PropertyLayerDescriptor, PropertySnapshotMetaWord, PropertySnapshotRecord,
        PropertySnapshotSummary, RelationAxis, SNAPSHOT_KIND_ELEMENT_IDENTITY_MAP_U16,
        SNAPSHOT_KIND_ELEMENT_IDENTITY_MAP_U32, SNAPSHOT_KIND_ELEMENT_IDENTITY_MAP_U64,
        SNAPSHOT_KIND_IDENTITY_MODES_U16, SNAPSHOT_KIND_IDENTITY_MODES_U32,
        SNAPSHOT_KIND_IDENTITY_MODES_U64, SNAPSHOT_KIND_INCIDENCE_IDENTITY_MAP_U16,
        SNAPSHOT_KIND_INCIDENCE_IDENTITY_MAP_U32, SNAPSHOT_KIND_INCIDENCE_IDENTITY_MAP_U64,
        SNAPSHOT_KIND_PROPERTY_DATA_U16, SNAPSHOT_KIND_PROPERTY_DATA_U32,
        SNAPSHOT_KIND_PROPERTY_DATA_U64, SNAPSHOT_KIND_PROPERTY_DESCRIPTORS_U16,
        SNAPSHOT_KIND_PROPERTY_DESCRIPTORS_U32, SNAPSHOT_KIND_PROPERTY_DESCRIPTORS_U64,
        SNAPSHOT_KIND_RELATION_IDENTITY_MAP_U16, SNAPSHOT_KIND_RELATION_IDENTITY_MAP_U32,
        SNAPSHOT_KIND_RELATION_IDENTITY_MAP_U64, SNAPSHOT_PROPERTY_VERSION, SparseWeights,
        StorageMode, encode_graph_property_snapshot, encode_hyper_property_snapshot,
        encode_property_snapshot, rekey_layer_to_local, validate_identity_snapshot,
        validate_property_sections, validate_property_snapshot, validate_unique_layer_ids,
        validate_unique_names,
    };
}

/// Embedded OxGraph-native database primitives.
///
/// This module is the ergonomic library entry point for applications that build
/// databases directly from the umbrella crate. It re-exports the embedded engine
/// and its catalog, query, projection, property, and identity types; server and
/// CLI concerns remain in the separate `oxgraphd` package.
///
/// # Examples
///
/// ```no_run
/// use oxgraph::db::{Database, QueryLanguage};
///
/// fn main() -> Result<(), oxgraph::db::DbError> {
///     let database = Database::create("target/example.oxgdb")?;
///     let prepared = database.prepare(QueryLanguage::Oxql, "MATCH ELEMENTS")?;
///     let _rows = database.begin_read().execute(&prepared)?;
///     Ok(())
/// }
/// ```
///
/// # Performance
///
/// `perf: unspecified`; this module re-exports another crate.
#[cfg(feature = "db")]
pub mod db {
    pub use oxgraph_db::{
        Catalog, CatalogSummary, CheckpointGeneration, CommitSeq, Database, DatabaseStatus,
        DbError, ElementId, ElementRecord, GraphProjection, GraphProjectionDefinition,
        HypergraphProjection, HypergraphProjectionDefinition, IncidenceId, IncidenceRecord,
        IndexDefinition, IndexEntry, IndexId, IndexLookup, LabelDefinition, LabelId, PreparedQuery,
        ProjectionDefinition, ProjectionElementId, ProjectionEntry, ProjectionId,
        ProjectionIncidenceId, ProjectionRelationId, PropertyFamily, PropertyKeyDefinition,
        PropertyKeyId, PropertySubject, PropertyType, PropertyValue, QueryLanguage, QueryResult,
        QueryRow, QueryValue, ReadPin, ReadTransaction, RelationId, RelationRecord,
        RelationTypeDefinition, RelationTypeId, RoleDefinition, RoleId, TransactionId,
        TraversalDirection, TraversalOptions, TraversalResult, TraversalRow, WriteTransaction,
    };
}

/// Append/update graph builders.
///
/// # Performance
///
/// `perf: unspecified`; this module re-exports another crate.
#[cfg(feature = "graph-build")]
pub mod graph_build {
    pub use oxgraph_csr::build::{
        BuildIndex, FrozenGraph, FrozenOutEdges, FrozenSuccessors, FrozenWeightedGraph,
        GraphBuildError, GraphBuilder, GraphEdgeId, GraphNodeId, WeightedGraphBuilder,
        csr_slice_to_le, export_csr_snapshot, export_weighted_csr_snapshot, identity_slice_to_le,
    };
    #[cfg(feature = "graph-property-arrow")]
    pub use oxgraph_csr::build::{
        export_csr_snapshot_with_properties, export_weighted_csr_snapshot_with_properties,
    };
}

/// Append/update hypergraph builders.
///
/// # Performance
///
/// `perf: unspecified`; this module re-exports another crate.
#[cfg(feature = "hyper-build")]
pub mod hyper_build {
    pub use oxgraph_hyper_bcsr::build::{
        BuildIndex, FrozenHypergraph, FrozenWeightedHypergraph, HyperBuildError,
        HyperParticipantId, HyperParticipantRole, HyperVertexId, HyperedgeId, HyperedgeSliceIter,
        HypergraphBuilder, IncidentHyperedgeIter, ParticipantRangeIter, ParticipantSliceIter,
        PredecessorIter, SuccessorIter, VertexSliceIter, WeightedHypergraphBuilder,
        bcsr_slice_to_le, export_bcsr_snapshot, export_weighted_bcsr_snapshot,
    };
    #[cfg(feature = "hyper-property-arrow")]
    pub use oxgraph_hyper_bcsr::build::{
        export_bcsr_snapshot_with_properties, export_weighted_bcsr_snapshot_with_properties,
        identity_slice_to_le,
    };
}

/// `PostgreSQL` graph engine library.
///
/// # Performance
///
/// `perf: unspecified`; this module re-exports another crate.
#[cfg(feature = "postgres")]
pub mod postgres {
    pub use oxgraph_csc::{
        CscNodeId, CscSnapshotError, CscSnapshotGraph, SNAPSHOT_KIND_PG_INBOUND_OFFSETS_U32,
        SNAPSHOT_KIND_PG_INBOUND_TARGETS_U32,
    };
    pub use oxgraph_postgres::{
        BuildError, BuildEstimate, Catalog, CatalogError, Config, ConfigError,
        DualTopologySnapshot, EdgeId, EdgeRow, Engine, EngineBuilder, EngineStatus, FilterColumn,
        ForwardCsr, GraphRole, GraphTopology, InboundCsc, NodeKey, OverlayEdge, OverlayState,
        PostgresGraphError, PostgresMetadata, QueryError, QueryFreshness, RegisteredEdge,
        RegisteredTable, SNAPSHOT_KIND_PG_CATALOG, SNAPSHOT_KIND_PG_METADATA, SearchPredicate,
        SnapshotRebuild, SyncAction, SyncActionCodec, SyncError, SyncHealth, SyncRow, TableId,
        TraversalDirection, TraverseLimits, estimate_build,
    };
}