Skip to main content

PrebuildLoader

Struct PrebuildLoader 

Source
pub struct PrebuildLoader { /* private fields */ }
Expand description

Loader for prebuild directories

Implementations§

Source§

impl PrebuildLoader

Source

pub fn new<P: AsRef<Path>>(path: P) -> Result<Self, LoaderError>

Create a new loader for the given prebuild directory

Source

pub fn get_info(&self) -> Result<PrebuildInfo, LoaderError>

Get information about what’s in the prebuild directory

Source

pub fn load_graph<P: AsRef<Path>>( &self, path: P, ) -> Result<StaticGraph, LoaderError>

Load a single graph from a JSON file

Source

pub fn load_indexed_graph<P: AsRef<Path>>( &self, path: P, ) -> Result<IndexedGraph, LoaderError>

Load a single graph and create an indexed version

Source

pub fn load_all_graphs(&self) -> Result<Vec<StaticGraph>, LoaderError>

Load all graphs from the graphs directory

Source

pub fn load_all_indexed_graphs(&self) -> Result<Vec<IndexedGraph>, LoaderError>

Load all graphs and create indexed versions

Source

pub fn load_graphs_by_id( &self, ) -> Result<HashMap<String, IndexedGraph>, LoaderError>

Load all graphs into a map keyed by graph ID

Source

pub fn get_subdir(&self, name: &str) -> PathBuf

Get the path to a specific subdirectory

Source

pub fn root_path(&self) -> &Path

Get the root path

Source

pub fn find_collection_files(&self) -> Result<Vec<PathBuf>, LoaderError>

Find all SKOS XML files across the reference_data subdirectories: concepts/, collections/, controlled_lists/, and staging/.

Source

pub fn load_collections( &self, base_uri: &str, ) -> Result<Vec<SkosCollection>, LoaderError>

Load all SKOS collections from reference_data/ (XML and JSON).

XML files are parsed via parse_skos_to_collections; JSON files are deserialized directly as SkosCollection. When a collection ID appears in both formats, the XML version takes priority.

Source

pub fn find_ontology_dirs(&self) -> Result<Vec<PathBuf>, LoaderError>

Find ontology subdirectories (those containing ontology_config.json)

Source

pub fn load_ontology_config( &self, ontology_dir: &Path, ) -> Result<OntologyConfig, LoaderError>

Load an ontology config from a directory containing ontology_config.json

Source

pub fn collect_ontology_xml_contents( &self, ontology_dir: &Path, ) -> Result<Vec<String>, LoaderError>

Collect ontology RDFS XML contents from a directory containing ontology_config.json. Returns the raw XML strings (base file + extensions in order) without building the validator, so they can be combined with extra ontology files.

Source

pub fn load_ontology_validator( &self, ontology_dir: &Path, ) -> Result<OntologyValidator, LoaderError>

Load an OntologyValidator from a directory containing ontology_config.json and RDFS XML files. Reads the base file and all extensions listed in config.

Source

pub fn find_business_data_files(&self) -> Result<Vec<PathBuf>, LoaderError>

Find all business data JSON files (searches recursively)

Source

pub fn load_resource_summaries_from_file( &self, path: &Path, graph_id: &str, ) -> Result<Vec<StaticResourceSummary>, LoaderError>

Load resource summaries from a single business data file Uses typed deserialization for fast parsing

Source

pub fn load_resource_summaries( &self, graph_id: &str, offset: usize, limit: usize, ) -> Result<(Vec<StaticResourceSummary>, bool), LoaderError>

Load resource summaries for a graph, with optional limit Returns (summaries, has_more)

Source

pub fn count_resources_for_graph( &self, graph_id: &str, ) -> Result<usize, LoaderError>

Get total count of resources for a graph (without loading all data)

Source

pub fn fast_count_resources_in_file( &self, path: &Path, graph_id: &str, ) -> Result<usize, LoaderError>

Fast count of resources in a single file (minimal deserialization)

Source

pub fn get_business_data_file_counts( &self, graph_id: &str, ) -> Result<Vec<(PathBuf, usize)>, LoaderError>

Get file counts for per-file progress tracking Returns Vec of (file_path, resource_count) for each file

Source

pub fn load_full_resources_from_file( &self, path: &Path, graph_id: &str, ) -> Result<Vec<StaticResource>, LoaderError>

Load all full resources (with tiles) from a single business_data file.

Like load_resource_summaries_from_file but returns StaticResource with tiles and resolved descriptors. Useful for bulk index building.

Source

pub fn load_all_full_resources_from_file( &self, path: &Path, ) -> Result<Vec<StaticResource>, LoaderError>

Load all full resources (with tiles) from a single business_data file, across all graphs. Reads and parses the file only once.

Supports two formats:

  • Prebuild wrapper: { business_data: { resources: [...] } }
  • Bare resource: { resourceinstance: {...}, tiles: [...], ... }
Source

pub fn load_full_resource( &self, resource_id: &str, graph_id: &str, ) -> Result<StaticResource, LoaderError>

Load a full StaticResource by its resourceinstanceid Searches through all business_data files to find the resource

Source

pub fn load_resources_parallel( &self, files: &[(PathBuf, usize)], graph_id: &str, tx: &Sender<Vec<StaticResourceSummary>>, ) -> Result<usize, LoaderError>

Sequential fallback when parallel feature is not enabled

Source

pub fn count_resources_parallel( &self, files: &[PathBuf], graph_id: &str, ) -> Vec<(PathBuf, usize)>

Sequential fallback for counting

Source

pub fn find_preindex_files( &self, _graph_id: &str, ) -> Result<Vec<PathBuf>, LoaderError>

Find all preindex .pi files (searches recursively)

Source

pub fn load_preindex_summaries( &self, graph_id: &str, offset: usize, limit: usize, ) -> Result<(Vec<StaticResourceSummary>, bool), LoaderError>

Load resource summaries from preindex .pi files .pi files contain StaticResourceSummary objects directly (one per line or as JSON array)

Source

pub fn count_preindex_resources_for_graph( &self, graph_id: &str, ) -> Result<usize, LoaderError>

Count resources in preindex files for a graph

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.