Adds basic support of RDF-star to reading I/O

pull/171/head
Tpt 3 years ago
parent 4b3cdc6831
commit 7858eb210a
  1. 6
      lib/Cargo.toml
  2. 16
      lib/src/io/read.rs
  3. 25
      testsuite/tests/parser.rs

@ -32,9 +32,9 @@ digest = "0.9"
regex = "1"
oxilangtag = "0.1"
oxiri = "0.1"
rio_api = "0.5"
rio_turtle = "0.5"
rio_xml = "0.5"
rio_api = { git = "https://github.com/oxigraph/rio", branch = "rdf-star", features = ["star"] }
rio_turtle = { git = "https://github.com/oxigraph/rio", branch = "rdf-star", features = ["star"] }
rio_xml = { git = "https://github.com/oxigraph/rio", branch = "rdf-star" }
hex = "0.4"
nom = "6"
siphasher = "0.3"

@ -330,10 +330,12 @@ impl<'a> RioMapper {
}
}
fn subject(&mut self, node: rio::NamedOrBlankNode<'a>) -> Subject {
fn subject(&mut self, node: rio::Subject<'a>) -> Subject {
match node {
rio::NamedOrBlankNode::NamedNode(node) => self.named_node(node).into(),
rio::NamedOrBlankNode::BlankNode(node) => self.blank_node(node).into(),
rio::Subject::NamedNode(node) => self.named_node(node).into(),
rio::Subject::BlankNode(node) => self.blank_node(node).into(),
rio::Subject::Triple(triple) => self.triple(triple).into(),
_ => unreachable!(),
}
}
@ -342,6 +344,8 @@ impl<'a> RioMapper {
rio::Term::NamedNode(node) => self.named_node(node).into(),
rio::Term::BlankNode(node) => self.blank_node(node).into(),
rio::Term::Literal(literal) => self.literal(literal).into(),
rio::Term::Triple(triple) => self.triple(triple).into(),
_ => unreachable!(),
}
}
@ -353,10 +357,10 @@ impl<'a> RioMapper {
}
}
fn graph_name(&mut self, graph_name: Option<rio::NamedOrBlankNode<'a>>) -> GraphName {
fn graph_name(&mut self, graph_name: Option<rio::GraphName<'a>>) -> GraphName {
match graph_name {
Some(rio::NamedOrBlankNode::NamedNode(node)) => self.named_node(node).into(),
Some(rio::NamedOrBlankNode::BlankNode(node)) => self.blank_node(node).into(),
Some(rio::GraphName::NamedNode(node)) => self.named_node(node).into(),
Some(rio::GraphName::BlankNode(node)) => self.blank_node(node).into(),
None => GraphName::DefaultGraph,
}
}

@ -44,3 +44,28 @@ fn trig_w3c_testsuite() -> Result<()> {
fn rdf_xml_w3c_testsuite() -> Result<()> {
run_testsuite("http://www.w3.org/2013/RDFXMLTests/manifest.ttl")
}
#[test]
fn ntriples_star_w3c_testsuite() -> Result<()> {
run_testsuite("https://w3c.github.io/rdf-star/tests/nt/syntax/manifest.ttl")
}
#[test]
fn turtle_star_syntax_w3c_testsuite() -> Result<()> {
run_testsuite("https://w3c.github.io/rdf-star/tests/turtle/syntax/manifest.ttl")
}
#[test]
fn turtle_star_eval_w3c_testsuite() -> Result<()> {
run_testsuite("https://w3c.github.io/rdf-star/tests/turtle/eval/manifest.ttl")
}
#[test]
fn trig_star_syntax_w3c_testsuite() -> Result<()> {
run_testsuite("https://w3c.github.io/rdf-star/tests/trig/syntax/manifest.ttl")
}
#[test]
fn trig_star_eval_w3c_testsuite() -> Result<()> {
run_testsuite("https://w3c.github.io/rdf-star/tests/trig/eval/manifest.ttl")
}

Loading…
Cancel
Save