|
|
|
@ -1,6 +1,6 @@ |
|
|
|
|
use crate::files::{guess_rdf_format, load_to_graph}; |
|
|
|
|
use crate::vocab::*; |
|
|
|
|
use anyhow::{bail, Result}; |
|
|
|
|
use anyhow::{bail, Context, Result}; |
|
|
|
|
use oxigraph::model::vocab::*; |
|
|
|
|
use oxigraph::model::*; |
|
|
|
|
use std::collections::VecDeque; |
|
|
|
@ -273,16 +273,37 @@ impl TestManifest { |
|
|
|
|
return Ok(None); |
|
|
|
|
}; |
|
|
|
|
self.graph.clear(); |
|
|
|
|
load_to_graph(&url, &mut self.graph, guess_rdf_format(&url)?, false)?; |
|
|
|
|
load_to_graph(&url, &mut self.graph, guess_rdf_format(&url)?, None, false)?; |
|
|
|
|
|
|
|
|
|
let manifests = self |
|
|
|
|
.graph |
|
|
|
|
.subjects_for_predicate_object(rdf::TYPE, mf::MANIFEST) |
|
|
|
|
.collect::<Vec<_>>(); |
|
|
|
|
if manifests.len() != 1 { |
|
|
|
|
bail!("The file {url} should contain a single manifest"); |
|
|
|
|
bail!("The file should contain a single manifest"); |
|
|
|
|
} |
|
|
|
|
for manifest in manifests { |
|
|
|
|
let mut manifest = manifests[0]; |
|
|
|
|
if let Some(base_iri) = self |
|
|
|
|
.graph |
|
|
|
|
.object_for_subject_predicate(manifest, mf::ASSUMED_TEST_BASE) |
|
|
|
|
{ |
|
|
|
|
let Term::NamedNode(base_iri) = base_iri.into_owned() else { |
|
|
|
|
bail!("Invalid base IRI: {base_iri}"); |
|
|
|
|
}; |
|
|
|
|
self.graph.clear(); |
|
|
|
|
load_to_graph( |
|
|
|
|
&url, |
|
|
|
|
&mut self.graph, |
|
|
|
|
guess_rdf_format(&url)?, |
|
|
|
|
Some(base_iri.as_str()), |
|
|
|
|
false, |
|
|
|
|
)?; |
|
|
|
|
manifest = self |
|
|
|
|
.graph |
|
|
|
|
.subject_for_predicate_object(rdf::TYPE, mf::MANIFEST) |
|
|
|
|
.context("no manifest found")?; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
match self |
|
|
|
|
.graph |
|
|
|
|
.object_for_subject_predicate(manifest, mf::INCLUDE) |
|
|
|
@ -313,7 +334,6 @@ impl TestManifest { |
|
|
|
|
} |
|
|
|
|
None => (), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
Ok(Some(())) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|