Fixes compatibility with latest OxIRI version

pull/836/head
Tpt 9 months ago committed by Thomas Tanon
parent ba396bad10
commit 184b8367dc
  1. 44
      Cargo.lock
  2. 27
      Cargo.toml
  3. 2
      lib/oxrdfio/Cargo.toml
  4. 2
      lib/oxrdfxml/Cargo.toml
  5. 28
      lib/oxrdfxml/src/parser.rs
  6. 2
      lib/oxttl/Cargo.toml
  7. 5
      lib/oxttl/src/lexer.rs
  8. 29
      lib/oxttl/src/n3.rs
  9. 729
      lib/oxttl/src/terse.rs

44
Cargo.lock generated

@ -559,9 +559,9 @@ dependencies = [
[[package]] [[package]]
name = "fastrand" name = "fastrand"
version = "2.0.1" version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984"
[[package]] [[package]]
name = "flate2" name = "flate2"
@ -810,9 +810,9 @@ dependencies = [
[[package]] [[package]]
name = "json-event-parser" name = "json-event-parser"
version = "0.2.0-alpha.2" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b5ddd02379e99769e117ab30d21ad42dcec8ad3c12be77f9a34779e62d46346" checksum = "f850fafca79ebacd70eab9d80cb75a33aeda38bde8f3dd784c1837cdf0bde631"
dependencies = [ dependencies = [
"tokio", "tokio",
] ]
@ -1033,9 +1033,9 @@ dependencies = [
[[package]] [[package]]
name = "oxhttp" name = "oxhttp"
version = "0.2.0-alpha.4" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bc77c20aeeab248232d09bf748d9cf59548190c128efe4edc271a1e4db2ae95" checksum = "f3cc8fa85d054762930759faa582ba6b6dd0e115156229cdb8cca02b0e0451ae"
dependencies = [ dependencies = [
"flate2", "flate2",
"httparse", "httparse",
@ -1049,7 +1049,7 @@ dependencies = [
[[package]] [[package]]
name = "oxigraph" name = "oxigraph"
version = "0.4.0-alpha.5" version = "0.4.0-alpha.6-dev"
dependencies = [ dependencies = [
"codspeed-criterion-compat", "codspeed-criterion-compat",
"digest", "digest",
@ -1080,7 +1080,7 @@ dependencies = [
[[package]] [[package]]
name = "oxigraph-cli" name = "oxigraph-cli"
version = "0.4.0-alpha.5" version = "0.4.0-alpha.6-dev"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"assert_cmd", "assert_cmd",
@ -1099,7 +1099,7 @@ dependencies = [
[[package]] [[package]]
name = "oxigraph-js" name = "oxigraph-js"
version = "0.4.0-alpha.5" version = "0.4.0-alpha.6-dev"
dependencies = [ dependencies = [
"console_error_panic_hook", "console_error_panic_hook",
"js-sys", "js-sys",
@ -1133,9 +1133,9 @@ dependencies = [
[[package]] [[package]]
name = "oxiri" name = "oxiri"
version = "0.2.3-alpha.1" version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b225dad32cfaa43a960b93f01fa7f87528ac07e794b80f6d9a0153e0222557e2" checksum = "d05417ee46e2eb40dd9d590b4d67fc2408208b3a48a6b7f71d2bc1d7ce12a3e0"
[[package]] [[package]]
name = "oxrdf" name = "oxrdf"
@ -1150,7 +1150,7 @@ dependencies = [
[[package]] [[package]]
name = "oxrdfio" name = "oxrdfio"
version = "0.1.0-alpha.4" version = "0.1.0-alpha.5-dev"
dependencies = [ dependencies = [
"oxrdf", "oxrdf",
"oxrdfxml", "oxrdfxml",
@ -1161,7 +1161,7 @@ dependencies = [
[[package]] [[package]]
name = "oxrdfxml" name = "oxrdfxml"
version = "0.1.0-alpha.4" version = "0.1.0-alpha.5-dev"
dependencies = [ dependencies = [
"oxilangtag", "oxilangtag",
"oxiri", "oxiri",
@ -1173,7 +1173,7 @@ dependencies = [
[[package]] [[package]]
name = "oxrocksdb-sys" name = "oxrocksdb-sys"
version = "0.4.0-alpha.5" version = "0.4.0-alpha.6-dev"
dependencies = [ dependencies = [
"bindgen", "bindgen",
"cc", "cc",
@ -1191,7 +1191,7 @@ dependencies = [
[[package]] [[package]]
name = "oxttl" name = "oxttl"
version = "0.1.0-alpha.4" version = "0.1.0-alpha.5-dev"
dependencies = [ dependencies = [
"memchr", "memchr",
"oxilangtag", "oxilangtag",
@ -1347,9 +1347,9 @@ dependencies = [
[[package]] [[package]]
name = "prettyplease" name = "prettyplease"
version = "0.2.16" version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"syn", "syn",
@ -1429,7 +1429,7 @@ dependencies = [
[[package]] [[package]]
name = "pyoxigraph" name = "pyoxigraph"
version = "0.4.0-alpha.5" version = "0.4.0-alpha.6-dev"
dependencies = [ dependencies = [
"oxigraph", "oxigraph",
"pyo3", "pyo3",
@ -1486,9 +1486,9 @@ dependencies = [
[[package]] [[package]]
name = "rayon" name = "rayon"
version = "1.9.0" version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4963ed1bc86e4f3ee217022bd855b297cef07fb9eac5dfa1f788b220b49b3bd" checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa"
dependencies = [ dependencies = [
"either", "either",
"rayon-core", "rayon-core",
@ -1820,9 +1820,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.53" version = "2.0.55"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032" checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",

@ -19,7 +19,7 @@ members = [
resolver = "2" resolver = "2"
[workspace.package] [workspace.package]
version = "0.4.0-alpha.5" version = "0.4.0-alpha.6-dev"
authors = ["Tpt <thomas@pellissier-tanon.fr>"] authors = ["Tpt <thomas@pellissier-tanon.fr>"]
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
edition = "2021" edition = "2021"
@ -45,9 +45,9 @@ json-event-parser = "0.2.0-alpha.2"
libc = "0.2.147" libc = "0.2.147"
md-5 = "0.10" md-5 = "0.10"
memchr = "2.5" memchr = "2.5"
oxhttp = "0.2.0-alpha.4" oxhttp = "0.2.0"
oxilangtag = "0.1" oxilangtag = "0.1"
oxiri = "0.2.3-alpha.1" oxiri = "0.2.3"
peg = "0.8" peg = "0.8"
pkg-config = "0.3.25" pkg-config = "0.3.25"
predicates = ">=2.0, <4.0" predicates = ">=2.0, <4.0"
@ -68,17 +68,16 @@ wasm-bindgen = "0.2.83"
zstd = ">=0.12, <0.14" zstd = ">=0.12, <0.14"
# Internal dependencies # Internal dependencies
oxigraph = { version = "0.4.0-alpha.4", path = "lib/oxigraph" } oxigraph = { version = "=0.4.0-alpha.6-dev", path = "lib/oxigraph" }
oxrdf = { version = "0.2.0-alpha.4", path = "lib/oxrdf" } oxrdf = { version = "=0.2.0-alpha.4", path = "lib/oxrdf" }
oxrdfio = { version = "0.1.0-alpha.4", path = "lib/oxrdfio" } oxrdfio = { version = "=0.1.0-alpha.5-dev", path = "lib/oxrdfio" }
oxrdfxml = { version = "0.1.0-alpha.4", path = "lib/oxrdfxml" } oxrdfxml = { version = "=0.1.0-alpha.5-dev", path = "lib/oxrdfxml" }
oxrocksdb-sys = { version = "0.4.0-alpha.3", path = "./oxrocksdb-sys" } oxrocksdb-sys = { version = "=0.4.0-alpha.6-dev", path = "./oxrocksdb-sys" }
oxsdatatypes = { version = "0.2.0-alpha.1", path = "lib/oxsdatatypes" } oxsdatatypes = { version = "=0.2.0-alpha.1", path = "lib/oxsdatatypes" }
oxttl = { version = "0.1.0-alpha.4", path = "lib/oxttl" } oxttl = { version = "=0.1.0-alpha.5-dev", path = "lib/oxttl" }
sparesults = { version = "0.2.0-alpha.4", path = "lib/sparesults" } sparesults = { version = "=0.2.0-alpha.4", path = "lib/sparesults" }
spargebra = { version = "0.3.0-alpha.4", path = "lib/spargebra" } spargebra = { version = "=0.3.0-alpha.4", path = "lib/spargebra" }
sparopt = { version = "0.1.0-alpha.4", path = "lib/sparopt" } sparopt = { version = "=0.1.0-alpha.4", path = "lib/sparopt" }
sparql-smith = { version = "0.1.0-alpha.5", path = "lib/sparql-smith" }
[workspace.lints.rust] [workspace.lints.rust]
absolute_paths_not_starting_with_crate = "warn" absolute_paths_not_starting_with_crate = "warn"

@ -1,6 +1,6 @@
[package] [package]
name = "oxrdfio" name = "oxrdfio"
version = "0.1.0-alpha.4" version = "0.1.0-alpha.5-dev"
authors.workspace = true authors.workspace = true
license.workspace = true license.workspace = true
readme = "README.md" readme = "README.md"

@ -1,6 +1,6 @@
[package] [package]
name = "oxrdfxml" name = "oxrdfxml"
version = "0.1.0-alpha.4" version = "0.1.0-alpha.5-dev"
authors.workspace = true authors.workspace = true
license.workspace = true license.workspace = true
readme = "README.md" readme = "README.md"

@ -586,16 +586,13 @@ impl<R> RdfXmlReader<R> {
}); });
} else if attribute.key.as_ref() == b"xml:base" { } else if attribute.key.as_ref() == b"xml:base" {
let iri = self.convert_attribute(&attribute)?; let iri = self.convert_attribute(&attribute)?;
base_iri = Some( base_iri = Some(if self.unchecked {
if self.unchecked { Iri::parse_unchecked(iri.clone())
Iri::parse_unchecked(iri.clone()) } else {
} else { Iri::parse(iri.clone()).map_err(|error| {
Iri::parse(iri.clone())
}
.map_err(|error| {
RdfXmlSyntaxError(SyntaxErrorKind::InvalidIri { iri, error }) RdfXmlSyntaxError(SyntaxErrorKind::InvalidIri { iri, error })
})?, })?
) })
} else { } else {
// We ignore other xml attributes // We ignore other xml attributes
} }
@ -1175,14 +1172,13 @@ impl<R> RdfXmlReader<R> {
if self.unchecked { if self.unchecked {
base_iri.resolve_unchecked(&relative_iri) base_iri.resolve_unchecked(&relative_iri)
} else { } else {
base_iri.resolve(&relative_iri) base_iri.resolve(&relative_iri).map_err(|error| {
RdfXmlSyntaxError(SyntaxErrorKind::InvalidIri {
iri: relative_iri,
error,
})
})?
} }
.map_err(|error| {
RdfXmlSyntaxError(SyntaxErrorKind::InvalidIri {
iri: relative_iri,
error,
})
})?
.into_inner(), .into_inner(),
)) ))
} else { } else {

@ -1,6 +1,6 @@
[package] [package]
name = "oxttl" name = "oxttl"
version = "0.1.0-alpha.4" version = "0.1.0-alpha.5-dev"
authors.workspace = true authors.workspace = true
license.workspace = true license.workspace = true
readme = "README.md" readme = "README.md"

@ -219,9 +219,10 @@ impl N3Lexer {
if self.unchecked { if self.unchecked {
base_iri.resolve_unchecked(&iri) base_iri.resolve_unchecked(&iri)
} else { } else {
base_iri.resolve(&iri) base_iri
.resolve(&iri)
.map_err(|e| (position, e.to_string()))?
} }
.map_err(|e| (position, e.to_string()))?
.into_inner() .into_inner()
} else if self.unchecked { } else if self.unchecked {
iri iri

@ -785,17 +785,11 @@ impl RuleRecognizer for N3Recognizer {
} }
errors.push("A dot is expected at the end of N3 statements".into()); errors.push("A dot is expected at the end of N3 statements".into());
} }
N3State::BaseExpectIri => return match token { N3State::BaseExpectIri => return if let N3Token::IriRef(iri) = token {
N3Token::IriRef(iri) => { context.lexer_options.base_iri = Some(Iri::parse_unchecked(iri));
match Iri::parse_unchecked(iri) {
Ok(iri) => {
context.lexer_options.base_iri = Some(iri);
self self
} } else {
Err(e) => self.error(errors, format!("Invalid base IRI: {e}")) self.error(errors, "The BASE keyword should be followed by an IRI")
}
}
_ => self.error(errors, "The BASE keyword should be followed by an IRI"),
}, },
N3State::PrefixExpectPrefix => return match token { N3State::PrefixExpectPrefix => return match token {
N3Token::PrefixedName { prefix, local, .. } if local.is_empty() => { N3Token::PrefixedName { prefix, local, .. } if local.is_empty() => {
@ -806,17 +800,10 @@ impl RuleRecognizer for N3Recognizer {
self.error(errors, "The PREFIX keyword should be followed by a prefix like 'ex:'") self.error(errors, "The PREFIX keyword should be followed by a prefix like 'ex:'")
} }
}, },
N3State::PrefixExpectIri { name } => return match token { N3State::PrefixExpectIri { name } => return if let N3Token::IriRef(iri) = token {
N3Token::IriRef(iri) => { context.prefixes.insert(name, Iri::parse_unchecked(iri));
match Iri::parse_unchecked(iri) { self
Ok(iri) => { } else { self.error(errors, "The PREFIX declaration should be followed by a prefix and its value as an IRI")
context.prefixes.insert(name, iri);
self
}
Err(e) => self.error(errors, format!("Invalid prefix IRI: {e}"))
}
}
_ => self.error(errors, "The PREFIX declaration should be followed by a prefix and its value as an IRI"),
}, },
// [9] triples ::= subject predicateObjectList? // [9] triples ::= subject predicateObjectList?
N3State::Triples => { N3State::Triples => {

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save