pub struct PrebuildLoader { /* private fields */ }Expand description
Loader for prebuild directories
Implementations§
Source§impl PrebuildLoader
impl PrebuildLoader
Sourcepub fn new<P: AsRef<Path>>(path: P) -> Result<Self, LoaderError>
pub fn new<P: AsRef<Path>>(path: P) -> Result<Self, LoaderError>
Create a new loader for the given prebuild directory
Sourcepub fn get_info(&self) -> Result<PrebuildInfo, LoaderError>
pub fn get_info(&self) -> Result<PrebuildInfo, LoaderError>
Get information about what’s in the prebuild directory
Sourcepub fn load_graph<P: AsRef<Path>>(
&self,
path: P,
) -> Result<StaticGraph, LoaderError>
pub fn load_graph<P: AsRef<Path>>( &self, path: P, ) -> Result<StaticGraph, LoaderError>
Load a single graph from a JSON file
Sourcepub fn load_indexed_graph<P: AsRef<Path>>(
&self,
path: P,
) -> Result<IndexedGraph, LoaderError>
pub fn load_indexed_graph<P: AsRef<Path>>( &self, path: P, ) -> Result<IndexedGraph, LoaderError>
Load a single graph and create an indexed version
Sourcepub fn load_all_graphs(&self) -> Result<Vec<StaticGraph>, LoaderError>
pub fn load_all_graphs(&self) -> Result<Vec<StaticGraph>, LoaderError>
Load all graphs from the graphs directory
Sourcepub fn load_all_indexed_graphs(&self) -> Result<Vec<IndexedGraph>, LoaderError>
pub fn load_all_indexed_graphs(&self) -> Result<Vec<IndexedGraph>, LoaderError>
Load all graphs and create indexed versions
Sourcepub fn load_graphs_by_id(
&self,
) -> Result<HashMap<String, IndexedGraph>, LoaderError>
pub fn load_graphs_by_id( &self, ) -> Result<HashMap<String, IndexedGraph>, LoaderError>
Load all graphs into a map keyed by graph ID
Sourcepub fn get_subdir(&self, name: &str) -> PathBuf
pub fn get_subdir(&self, name: &str) -> PathBuf
Get the path to a specific subdirectory
Sourcepub fn find_collection_files(&self) -> Result<Vec<PathBuf>, LoaderError>
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/.
Sourcepub fn load_collections(
&self,
base_uri: &str,
) -> Result<Vec<SkosCollection>, LoaderError>
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.
Sourcepub fn find_ontology_dirs(&self) -> Result<Vec<PathBuf>, LoaderError>
pub fn find_ontology_dirs(&self) -> Result<Vec<PathBuf>, LoaderError>
Find ontology subdirectories (those containing ontology_config.json)
Sourcepub fn load_ontology_config(
&self,
ontology_dir: &Path,
) -> Result<OntologyConfig, LoaderError>
pub fn load_ontology_config( &self, ontology_dir: &Path, ) -> Result<OntologyConfig, LoaderError>
Load an ontology config from a directory containing ontology_config.json
Sourcepub fn collect_ontology_xml_contents(
&self,
ontology_dir: &Path,
) -> Result<Vec<String>, LoaderError>
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.
Sourcepub fn load_ontology_validator(
&self,
ontology_dir: &Path,
) -> Result<OntologyValidator, LoaderError>
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.
Sourcepub fn find_business_data_files(&self) -> Result<Vec<PathBuf>, LoaderError>
pub fn find_business_data_files(&self) -> Result<Vec<PathBuf>, LoaderError>
Find all business data JSON files (searches recursively)
Sourcepub fn load_resource_summaries_from_file(
&self,
path: &Path,
graph_id: &str,
) -> Result<Vec<StaticResourceSummary>, LoaderError>
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
Sourcepub fn load_resource_summaries(
&self,
graph_id: &str,
offset: usize,
limit: usize,
) -> Result<(Vec<StaticResourceSummary>, bool), LoaderError>
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)
Sourcepub fn count_resources_for_graph(
&self,
graph_id: &str,
) -> Result<usize, LoaderError>
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)
Sourcepub fn fast_count_resources_in_file(
&self,
path: &Path,
graph_id: &str,
) -> Result<usize, LoaderError>
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)
Sourcepub fn get_business_data_file_counts(
&self,
graph_id: &str,
) -> Result<Vec<(PathBuf, usize)>, LoaderError>
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
Sourcepub fn load_full_resources_from_file(
&self,
path: &Path,
graph_id: &str,
) -> Result<Vec<StaticResource>, LoaderError>
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.
Sourcepub fn load_all_full_resources_from_file(
&self,
path: &Path,
) -> Result<Vec<StaticResource>, LoaderError>
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: [...], ... }
Sourcepub fn load_full_resource(
&self,
resource_id: &str,
graph_id: &str,
) -> Result<StaticResource, LoaderError>
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
Sourcepub fn load_resources_parallel(
&self,
files: &[(PathBuf, usize)],
graph_id: &str,
tx: &Sender<Vec<StaticResourceSummary>>,
) -> Result<usize, LoaderError>
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
Sourcepub fn count_resources_parallel(
&self,
files: &[PathBuf],
graph_id: &str,
) -> Vec<(PathBuf, usize)>
pub fn count_resources_parallel( &self, files: &[PathBuf], graph_id: &str, ) -> Vec<(PathBuf, usize)>
Sequential fallback for counting
Sourcepub fn find_preindex_files(
&self,
_graph_id: &str,
) -> Result<Vec<PathBuf>, LoaderError>
pub fn find_preindex_files( &self, _graph_id: &str, ) -> Result<Vec<PathBuf>, LoaderError>
Find all preindex .pi files (searches recursively)
Sourcepub fn load_preindex_summaries(
&self,
graph_id: &str,
offset: usize,
limit: usize,
) -> Result<(Vec<StaticResourceSummary>, bool), LoaderError>
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)
Sourcepub fn count_preindex_resources_for_graph(
&self,
graph_id: &str,
) -> Result<usize, LoaderError>
pub fn count_preindex_resources_for_graph( &self, graph_id: &str, ) -> Result<usize, LoaderError>
Count resources in preindex files for a graph