rdftk_io 0.2.1

This crate provides traits for reading and writing Statements and Graphs as well as implementations of these for common representations.
Documentation
/*
This file is based turtlestar.g4 in this same directory. The license for that file remains intact.
*/

turtleStarDoc = {
	SOI ~ statement* ~ EOI
}

statement = {
	directive | triples ~ "."
}
	
directive = {
	prefixID
	| base 
	| sparqlPrefix 
	| sparqlBase
}


prefixID = {
	"@prefix" ~ PNAME_NS ~ IRIREF ~ "."
}

base = {
	"@base" ~ IRIREF ~ "."
}
	
sparqlBase = {
	^"BASE" ~ IRIREF
}
	
sparqlPrefix = {
	^"PREFIX" ~ PNAME_NS ~ IRIREF
}

triples  = {
	subject ~ predicateObjectList
	| blankNodePropertyList ~ predicateObjectList?
}
	
predicateObjectList = {
	verbObjectList ~ (";" ~ verbObjectList?)*
}

verbObjectList = {
    verb ~ objectList
}

objectList = {
	object ~ ("," ~ object)*
}
	
verb = {
	predicate | "a"
}

subject = {
	iri
	| BlankNode 
	| collection
	| tripleX
}
	
predicate = {
	iri
}
	
object = {
	iri
	| BlankNode  
	| literal
	| collection 
	| blankNodePropertyList
	| tripleX
}

tripleX = {
	"<<" ~ subjectX ~ predicate ~ objectX ~ ">>"
}
	
subjectX = {
	iri
	| BlankNode
	| tripleX
}
	
objectX = {
	iri
	| BlankNode
	| literal
	| tripleX
}
	
literal = {
	rdfLiteral
	| NumericLiteral 
	| BooleanLiteral
}

String = {
	STRING_LITERAL_LONG_SINGLE_QUOTE
	| STRING_LITERAL_LONG_QUOTE
	| STRING_LITERAL_QUOTE
	| STRING_LITERAL_SINGLE_QUOTE
}

blankNodePropertyList = {
	"[" ~ predicateObjectList ~ "]"
}
		
collection = {
	"(" ~ object* ~ ")"
}