Notation3

Last updated
Notation3
Filename extension
.n3
Internet media type
text/n3;charset=utf-8
Developed by Tim Berners-Lee
Type of format semantic web
Container for RDF data
Standard n3
Website www.w3.org/TeamSubmission/n3/

Notation3, or N3 as it is more commonly known, is a shorthand non-XML serialization of Resource Description Framework models, designed with human-readability in mind: N3 is much more compact and readable than XML RDF notation. The format is being developed by Tim Berners-Lee and others from the Semantic Web community. A formalization of the logic underlying N3 was published by Berners-Lee and others in 2008. [1]

Contents

N3 has several features that go beyond a serialization for RDF models, such as support for RDF-based rules. Turtle is a simplified, RDF-only subset of N3.

Examples

The following is an RDF model in standard XML notation:

<rdf:RDFxmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:dc="http://purl.org/dc/elements/1.1/"><rdf:Descriptionrdf:about="https://en.wikipedia.org/wiki/Tony_Benn"><dc:title>TonyBenn</dc:title><dc:publisher>Wikipedia</dc:publisher></rdf:Description></rdf:RDF>

may be written in Notation3 like this:

@prefixdc:<http://purl.org/dc/elements/1.1/>.<https://en.wikipedia.org/wiki/Tony_Benn>dc:title"Tony Benn";dc:publisher"Wikipedia".

This N3 code above would also be in valid Turtle syntax.

Comparison of Notation3, Turtle, and N-Triples

FeatureNotation3TurtleN-Triples
Character encoding UTF-8 ASCII
Directives@baseYesYesNo
@forAllYesNoNo
@forSomeYesNoNo
@keywordsYesNoNo
@prefixYesYesNo
Lists
()(DAML lists)YesYesNo
{ … }(statement lists)YesNoNo
Literals true / false
(Boolean)
YesYesNo
xsd:decimal
(decimal arbitrary length)
YesYesNo
xsd:double
(decimal double)
YesYesNo
xsd:integer
(decimal integer)
YesYesNo
Syntactic sugar RDF pathsYesNoNo
QNames YesYesNo
a/@a(equiv. to rdf:type)YesYesNo
[](shorthand for blank node)YesYesNo
=>(x implies y)YesNoNo
<=(y implies x)YesNoNo
=(x is equivalent to y)YesNoNo
,(repeat object in list)YesYesNo
;(repeat subject/verb in list)YesYesNo

See also

References

  1. Berners-Lee, T. I. M.; Connolly, D. A. N.; Kagal, L.; Scharf, Y.; Hendler, J. I. M. (2008). "N3Logic: A logical framework for the World Wide Web". Theory and Practice of Logic Programming. 8 (3): 249–269. arXiv: 0711.1533 . doi:10.1017/S1471068407003213.