Skip to content

Commit

Permalink
i want to code on my laptop
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoMfer committed Mar 4, 2024
1 parent 2d69b9a commit 0be7453
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.
16 changes: 16 additions & 0 deletions examples/metadata_bench.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use remote_hdt::error::RemoteHDTError;
use remote_hdt::metadata::Metadata;
use remote_hdt::storage::params::Serialization;
use remote_hdt::storage::params::Backend;
use remote_hdt::storage::params::ReferenceSystem;

fn main() -> Result<(), RemoteHDTError> {

let rdf_path = "";
let metadata_path = "";
let fields = vec!["X_pos", "Y_pos"];
let mut metadata: Metadata = Metadata::new(Serialization::Zarr);
metadata.serialize(rdf_path, ReferenceSystem::SPO,metadata_path,fields).unwrap();

Ok(())
}
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ pub mod error;
mod io;
pub mod storage;
mod utils;
pub mod metadata;
82 changes: 82 additions & 0 deletions src/metadata/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@



use std::default;

Check warning on line 4 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Check (stable)

unused import: `std::default`

Check failure on line 4 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Clippy (stable)

unused import: `std::default`

Check warning on line 4 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Test Suite (stable)

unused import: `std::default`
use std::path::PathBuf;

Check warning on line 5 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Check (stable)

unused import: `std::path::PathBuf`

Check failure on line 5 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Clippy (stable)

unused import: `std::path::PathBuf`

Check warning on line 5 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Test Suite (stable)

unused import: `std::path::PathBuf`
use std::str::FromStr;

Check warning on line 6 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Check (stable)

unused import: `std::str::FromStr`

Check failure on line 6 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Clippy (stable)

unused import: `std::str::FromStr`

Check warning on line 6 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Test Suite (stable)

unused import: `std::str::FromStr`


use crate::dictionary::Dictionary;

use crate::io::Graph;
use crate::io::RdfParser;

use crate::storage::params::Serialization;
use crate::storage::params::Backend;

Check warning on line 15 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Check (stable)

unused import: `crate::storage::params::Backend`

Check failure on line 15 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Clippy (stable)

unused import: `crate::storage::params::Backend`

Check warning on line 15 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Test Suite (stable)

unused import: `crate::storage::params::Backend`
use crate::storage::params::ReferenceSystem;
use crate::error::RemoteHDTError;

use fcsd::Set;

Check warning on line 19 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Check (stable)

unused import: `fcsd::Set`

Check failure on line 19 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Clippy (stable)

unused import: `fcsd::Set`

Check warning on line 19 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Test Suite (stable)

unused import: `fcsd::Set`
use zarrs::opendal::raw::oio::StreamExt;

Check warning on line 20 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Check (stable)

unused import: `zarrs::opendal::raw::oio::StreamExt`

Check failure on line 20 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Clippy (stable)

unused import: `zarrs::opendal::raw::oio::StreamExt`

Check warning on line 20 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Test Suite (stable)

unused import: `zarrs::opendal::raw::oio::StreamExt`
use zarrs::opendal::services::Fs;

Check warning on line 21 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Check (stable)

unused import: `zarrs::opendal::services::Fs`

Check failure on line 21 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Clippy (stable)

unused import: `zarrs::opendal::services::Fs`

Check warning on line 21 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Test Suite (stable)

unused import: `zarrs::opendal::services::Fs`
use zarrs::opendal::services::Http;

Check warning on line 22 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Check (stable)

unused import: `zarrs::opendal::services::Http`

Check failure on line 22 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Clippy (stable)

unused import: `zarrs::opendal::services::Http`

Check warning on line 22 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Test Suite (stable)

unused import: `zarrs::opendal::services::Http`
use zarrs::opendal::Operator;

Check warning on line 23 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Check (stable)

unused import: `zarrs::opendal::Operator`

Check failure on line 23 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Clippy (stable)

unused import: `zarrs::opendal::Operator`

Check warning on line 23 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Test Suite (stable)

unused import: `zarrs::opendal::Operator`
use zarrs::storage::store::OpendalStore;
use zarrs::array::Array;



pub type MetadataResult<T> = Result<T, RemoteHDTError>;

pub struct Metadata {
flatten_graph: Vec<(u32, u32, u32)>,
serialization: Serialization,
dictionary : Dictionary,
array: Option<Array<OpendalStore>>
}


impl Metadata{
pub fn new( serialization: Serialization) -> Self {
Metadata {
flatten_graph: Vec::<(u32, u32, u32)>::default(),
serialization: serialization,

Check failure on line 43 in src/metadata/mod.rs

View workflow job for this annotation

GitHub Actions / Clippy (stable)

redundant field names in struct initialization
dictionary: Dictionary::default(),
array: None,
}
}




pub fn serialize(&mut self, rdf_path: &str, reference_system: ReferenceSystem, metadata_path: &str, fields: Vec<&str>) -> MetadataResult<&mut Self>{

let graph_vector: Graph;

match RdfParser::parse(rdf_path, &reference_system) {
Ok((graph, dictionary)) => {
graph_vector = graph;
self.dictionary = dictionary;
}
Err(_) => return Err(RemoteHDTError::RdfParse),
};

let mut count = 0;
for i in graph_vector.iter() {
for j in i.iter(){
self.flatten_graph.push((count, j.0, j.1))
}
count +=1;
}


Ok(self)
}







}

0 comments on commit 0be7453

Please sign in to comment.