Skip to content

Commit

Permalink
Bump rdf-types to version 0.22.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
timothee-haudebourg committed Mar 22, 2024
1 parent d137046 commit 36868e3
Show file tree
Hide file tree
Showing 15 changed files with 94 additions and 96 deletions.
58 changes: 29 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ members = [
resolver = "2"

[workspace.package]
version = "0.2.0"
edition = "2021"
authors = ["Spruce Systems Inc."]
rust-version = "1.74"
edition = "2021"
rust-version = "1.74.0"
version = "0.2.0"

[workspace.dependencies]
treeldr-layouts = { path = "layouts", version = "0.2.0" }
Expand All @@ -25,16 +25,16 @@ num-bigint = "0.4"
num-rational = "0.4"
iref = "3.1.4"
static-iref = "3.0"
rdf-types = "0.19.8"
xsd-types = "0.9.1"
rdf-types = "0.22.0"
xsd-types = "0.9.2"
btree-range-map = { version = "0.7.2", features = ["serde"] }
langtag = "0.4.0"
thiserror = "1.0.50"
serde = "1.0.192"
serde_json = { version = "1.0", features = ["arbitrary_precision"] }

locspan = "0.8.2"
nquads-syntax = "0.18.0"
nquads-syntax = "0.19.0"

clap = "4.0"
stderrlog = "0.5"
Expand Down
8 changes: 4 additions & 4 deletions generators/rust/treeldr-rs-macros/src/generate/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,17 +719,17 @@ fn generate_data(
for l in rdf.interpretation.literals_of(&resource) {
has_literal = true;
let literal = rdf.vocabulary.literal(l).unwrap();
let ty_iri = match &literal.type_ {
::treeldr::rdf_types::LiteralType::Any(i) => {
let ty_iri = match literal.type_ {
::treeldr::rdf_types::LiteralTypeRef::Any(i) => {
rdf.vocabulary.iri(i).unwrap()
},
::treeldr::rdf_types::LiteralType::LangString(_) => {
::treeldr::rdf_types::LiteralTypeRef::LangString(_) => {
::treeldr::rdf_types::RDF_LANG_STRING
}
};

if ty_iri == expected_ty_iri {
if let Ok(value) = ::treeldr::de::FromRdfLiteral::from_rdf_literal(&literal.value) {
if let Ok(value) = ::treeldr::de::FromRdfLiteral::from_rdf_literal(literal.value) {
if result.replace(value).is_some() {
return Err(::treeldr::DeserializeError::AmbiguousLiteralValue)
}
Expand Down
9 changes: 5 additions & 4 deletions generators/rust/treeldr-rs/src/datatypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ use rdf_types::{
ReverseTermInterpretation, ReverseTermInterpretationMut, TermInterpretation,
TermInterpretationMut,
},
Dataset, InterpretationMut, Literal, LiteralType, Vocabulary, VocabularyMut, XSD_STRING,
Dataset, InterpretationMut, Literal, LiteralType, LiteralTypeRef, Vocabulary, VocabularyMut,
XSD_STRING,
};

use crate::{
Expand Down Expand Up @@ -120,10 +121,10 @@ where
{
for l in rdf.interpretation.literals_of(&inputs[0]) {
let literal = rdf.vocabulary.literal(l).unwrap();
if let LiteralType::Any(i) = &literal.type_ {
if let LiteralTypeRef::Any(i) = literal.type_ {
let iri = rdf.vocabulary.iri(i).unwrap();
if iri == XSD_STRING {
return Ok(literal.value.clone());
return Ok(literal.value.to_owned());
}
}
}
Expand Down Expand Up @@ -178,7 +179,7 @@ macro_rules! xsd_datatypes {
for l in rdf.interpretation.literals_of(&inputs[0]) {
has_literal = true;
let literal = rdf.vocabulary.literal(l).unwrap();
if let LiteralType::Any(i) = &literal.type_ {
if let LiteralTypeRef::Any(i) = literal.type_ {
let iri = rdf.vocabulary.iri(i).unwrap();
if iri == xsd_types::$xsd_iri {
match Self::parse_xsd(&literal.value) {
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion generators/rust/treeldr-rs/src/rdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ impl<'a, V, I> RdfContext<'a, V, I> {
LiteralType::LangString(tag) => LiteralType::LangString(tag),
};

let lit = self.vocabulary.get_literal(&Literal::new(value, type_))?;
let lit = self
.vocabulary
.get_literal(Literal::new(value, type_).as_ref())?;
self.interpretation.literal_interpretation(&lit)
}
}
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions layouts/examples/combine.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rdf_types::{dataset::BTreeDataset, BlankIdBuf, Id, RdfDisplay, Term};
use rdf_types::{dataset::IndexedBTreeDataset, BlankIdBuf, Id, RdfDisplay, Term};
use serde_json::json;
use treeldr_layouts::{
abs::{syntax::Layout, Builder},
Expand Down Expand Up @@ -108,7 +108,7 @@ fn main() {

let mut generator = rdf_types::generator::Blank::new();

let mut dataset = BTreeDataset::default();
let mut dataset = IndexedBTreeDataset::default();
let (nested_dataset, _) = treeldr_layouts::distill::de::dehydrate(
&layouts,
&nested_json.into(),
Expand Down
3 changes: 3 additions & 0 deletions layouts/src/distill/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ impl<G> Options<G> {
/// treeldr_layouts::distill::de::Options::default()
/// ).unwrap();
///
/// // Index the dataset so we can run queries on it.
/// let dataset = dataset.into_indexed();
///
/// // The number of subjects is equal to the number of layout inputs.
/// assert_eq!(subjects.len(), 1);
///
Expand Down
Loading

0 comments on commit 36868e3

Please sign in to comment.