The Resource Description Framework (RDF) is a general-purpose language for representing information in the Web.

This document defines a textual syntax for RDF called Trig that allows an RDF dataset to be completely written in a compact and natural text form, with abbreviations for common usage patterns and datatypes. TriG is an extension of the Turtle format.

Introduction

This document defines TriG a concrete syntax for RDF as defined in the RDF Concepts and Abstract Syntax ([[!RDF-CONCEPTS]]) W3C Recommendation. TriG is an extension of Turtle ([[!TURTLE]]), extended to support representing a complete RDF Dataset.

An Introduction to TriG

The TriG Syntax and TriG Grammar sections formally define the language.

A TriG document allows writing down an RDF Dataset in a compact textual form. It consists of a sequence of directives, graph statements which contain triple-generating statements and optional blank lines. Comments may be given after a # that is not part of another lexical token and continue to the end of the line.

Graph statements are a pair of an IRI and a group of triple statements surrounded by {}. The IRI of the graph statement may not be used in another graph statement, but may reoccur as part of any triple statement. Optionally one graph statement may not not be labeled with an IRI. Such a graph statement corresponds to the Default Graph of an RDF Dataset.

Graph Statements

Examples should not refer to TriX vocabularies.

This draft does NOT support N3 style graph literals. That is, no = and no trailing .

A graph statement pairs an IRI with a RDF Graph. It is intended that triple statements made using that IRI are being made about the graph. The triple statements that make up the graph are enclosed in {}.

In a TriG document a graph IRI MUST NOT be used to label more then one graph. The IRI of a graph statement may be omitted. In this case the graph is considered the default graph of the RDF Dataset.

A RDF Dataset may contain named graphs that refer to other named graphs to provide providence. In this case :G3 provides providence for :G1 and :G2.

					
				

A RDF Dataset may contain only a single graph.

					
				

A RDF Dataset may contain a default graph, and named graphs.

				
				

Other Terms

All other terms and directives come from Turtle.

Special Considerations for Blank Nodes

ISSUE-12 BlankNodes being shared between graphs is unresolved.

The formal semantics [[RDF-MT]] of RDF do not provide for the meaning of blank nodes between graphs. BlankNodes sharing the same label in different graph literals MUST not be considered to be the same BlankNode.

Syntax

There should likely be come content here.

TriG Grammar

Defer to Turtle

Grammar

The EBNF used here is defined in XML 1.0 (Third Edition) [[!EBNF-NOTATION]].



	            

Media Type and Content Encoding

The media type of TriG is application/trig. The content encoding of TriG content is always UTF-8. See Internet Media Type, File Extension and Macintosh File Type for the media type registration form.

Internet Media Type, File Extension and Macintosh File Type

TODO