|
|
|
@ -3,6 +3,7 @@ |
|
|
|
|
use std::char; |
|
|
|
|
use url::Url; |
|
|
|
|
use model::data::*; |
|
|
|
|
use std::str::FromStr; |
|
|
|
|
use std::iter; |
|
|
|
|
use rio::turtle::ParserState; |
|
|
|
|
|
|
|
|
@ -70,7 +71,7 @@ objectList -> () = object _ ("," _ object _)* |
|
|
|
|
|
|
|
|
|
//[9] |
|
|
|
|
verb -> NamedNode = predicate / |
|
|
|
|
"a" { data_factory.named_node(Url::parse("http://www.w3.org/1999/02/22-rdf-syntax-ns#type").unwrap()) } |
|
|
|
|
"a" { NamedNode::from_str("http://www.w3.org/1999/02/22-rdf-syntax-ns#type").unwrap() } |
|
|
|
|
|
|
|
|
|
// [10] |
|
|
|
|
subject -> NamedOrBlankNode = |
|
|
|
@ -115,9 +116,9 @@ blankNodePropertyList_open -> () = "[" { |
|
|
|
|
|
|
|
|
|
//[15] |
|
|
|
|
collection -> NamedOrBlankNode = '(' _ o:(collection_value*) ')' { |
|
|
|
|
let first = data_factory.named_node(Url::parse("http://www.w3.org/1999/02/22-rdf-syntax-ns#first").unwrap()); |
|
|
|
|
let rest = data_factory.named_node(Url::parse("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest").unwrap()); |
|
|
|
|
let mut current_list_node = NamedOrBlankNode::from(data_factory.named_node(Url::parse("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil").unwrap())); |
|
|
|
|
let first = NamedNode::from_str("http://www.w3.org/1999/02/22-rdf-syntax-ns#first").unwrap(); |
|
|
|
|
let rest = NamedNode::from_str("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest").unwrap(); |
|
|
|
|
let mut current_list_node = NamedOrBlankNode::from(NamedNode::from_str("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil").unwrap()); |
|
|
|
|
for obj in o.into_iter().rev() { |
|
|
|
|
let new_blank_node = NamedOrBlankNode::from(data_factory.new_blank_node()); |
|
|
|
|
buffer.push(data_factory.triple(new_blank_node.clone(), first.clone(), obj)); |
|
|
|
@ -130,20 +131,20 @@ collection_value -> Term = o:object_value _ { o } |
|
|
|
|
|
|
|
|
|
//[16] |
|
|
|
|
NumericLiteral -> Literal = |
|
|
|
|
d:$(DOUBLE) { data_factory.typed_literal(d, data_factory.named_node(Url::parse("http://www.w3.org/2001/XMLSchema#double").unwrap())) } / |
|
|
|
|
d:$(DECIMAL) { data_factory.typed_literal(d, data_factory.named_node(Url::parse("http://www.w3.org/2001/XMLSchema#decimal").unwrap())) } / |
|
|
|
|
i:$(INTEGER) { data_factory.typed_literal(i, data_factory.named_node(Url::parse("http://www.w3.org/2001/XMLSchema#integer").unwrap())) } |
|
|
|
|
d:$(DOUBLE) { data_factory.typed_literal(d, NamedNode::from_str("http://www.w3.org/2001/XMLSchema#double").unwrap()) } / |
|
|
|
|
d:$(DECIMAL) { data_factory.typed_literal(d, NamedNode::from_str("http://www.w3.org/2001/XMLSchema#decimal").unwrap()) } / |
|
|
|
|
i:$(INTEGER) { data_factory.typed_literal(i, NamedNode::from_str("http://www.w3.org/2001/XMLSchema#integer").unwrap()) } |
|
|
|
|
|
|
|
|
|
//[128s] |
|
|
|
|
RDFLiteral -> Literal = |
|
|
|
|
v:String _ "^^" _ t:iri { data_factory.typed_literal(v, t) } / |
|
|
|
|
v:String _ l:LANGTAG { data_factory.language_tagged_literal(v, l) } / |
|
|
|
|
v:String { data_factory.simple_literal(v) } |
|
|
|
|
v:String { v.into() } |
|
|
|
|
|
|
|
|
|
//[133s] |
|
|
|
|
BooleanLiteral -> Literal = |
|
|
|
|
"true" { data_factory.typed_literal("true", data_factory.named_node(Url::parse("http://www.w3.org/2001/XMLSchema#boolean").unwrap())) } / |
|
|
|
|
"false" { data_factory.typed_literal("false", data_factory.named_node(Url::parse("http://www.w3.org/2001/XMLSchema#boolean").unwrap())) } |
|
|
|
|
"true" { true.into() } / |
|
|
|
|
"false" { false.into() } |
|
|
|
|
|
|
|
|
|
//[17] |
|
|
|
|
String -> String = STRING_LITERAL_LONG_SINGLE_QUOTE / STRING_LITERAL_LONG_QUOTE / STRING_LITERAL_QUOTE / STRING_LITERAL_SINGLE_QUOTE |
|
|
|
|