Skip to content

Commit

Permalink
Move all core traits and types in sophia_api.
Browse files Browse the repository at this point in the history
This contributes to issues #23 and #26.
  • Loading branch information
pchampin committed Jul 16, 2020
2 parents 91bbb99 + ef0da6b commit 1b328de
Show file tree
Hide file tree
Showing 72 changed files with 2,148 additions and 1,964 deletions.
11 changes: 11 additions & 0 deletions api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,20 @@ keywords = ["rdf", "linked-data", "semantic-web"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = []
# This feature enables to use the graph and dataset test macros in other crates
test_macro = ["lazy_static"]

[dependencies]
sophia_iri = { version = "0.5.3", path = "../iri" }
mownstr = "0.1.1"
resiter = "0.4.0"
thiserror = "1.0.15"

lazy_static = { version = "1.4.0", optional = true }


[dev-dependencies]
lazy_static = { version = "1.4.0" }
sophia_iri = { version = "0.5.3", path = "../iri", features = ["test_data"] }
3 changes: 0 additions & 3 deletions sophia/src/dataset.rs → api/src/dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
pub mod test;

pub mod adapter;
#[macro_use]
pub mod indexed;
pub mod inmem;

mod _ext_impl;
pub use self::_ext_impl::*;
Expand Down
12 changes: 7 additions & 5 deletions sophia/src/dataset/_ext_impl.rs → api/src/dataset/_ext_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use super::*;
use crate::quad::stream::{AsQuadSource, QuadSource, StreamError, StreamResult};
use crate::quad::streaming_mode::*;
use crate::quad::*;
use sophia_api::term::{same_graph_name, term_eq, CopiableTerm, CopyTerm, TTerm};
use crate::term::{same_graph_name, term_eq, CopiableTerm, CopyTerm, TTerm};

impl<Q> Dataset for [Q]
where
Expand Down Expand Up @@ -192,10 +192,12 @@ impl<T, S: BuildHasher> SetDataset for HashSet<T, S> where T: Eq + Hash + Quad {
#[cfg(test)]
mod test {
use super::*;
use crate::ns::*;
use crate::quad::TupleQuad;
use sophia_api::ns::*;
use sophia_api::term::SimpleIri;
use crate::term::SimpleIri;

#[allow(dead_code)]
type BoxTerm = crate::term::test::TestTerm<Box<str>>;
static D: [TupleQuad<SimpleIri>; 3] = [
([rdf::type_, rdf::type_, rdf::Property], None),
([rdf::Property, rdf::type_, rdfs::Class], None),
Expand All @@ -214,7 +216,7 @@ mod test {
}

#[cfg(feature = "all_tests")]
type VecAsDataset = Vec<([sophia_term::BoxTerm; 3], Option<sophia_term::BoxTerm>)>;
type VecAsDataset = Vec<([BoxTerm; 3], Option<BoxTerm>)>;

#[cfg(feature = "all_tests")]
test_dataset_impl!(vec, VecAsDataset, false);
Expand All @@ -229,7 +231,7 @@ mod test {
}

#[cfg(feature = "all_tests")]
type HashSetAsDataset = HashSet<([sophia_term::BoxTerm; 3], Option<sophia_term::BoxTerm>)>;
type HashSetAsDataset = HashSet<([BoxTerm; 3], Option<BoxTerm>)>;

#[cfg(feature = "all_tests")]
test_dataset_impl!(hashset, HashSetAsDataset);
Expand Down
Loading

0 comments on commit 1b328de

Please sign in to comment.