Notation3
{{Short description|Compact non-XML format for RDF models}}
{{Infobox file format
| name = Notation3
| icon =
| icon_size = 100px
| logo =
| extension = .n3
| mime = text/n3;charset=utf-8
| type code =
| uniform type =
| magic =
| owner = Tim Berners-Lee
| genre = semantic web
| container for = RDF data
| extended from =
| extended to =
| standard = [http://www.w3.org/TeamSubmission/n3/ n3]
| url = {{URL|https://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.{{Cite journal | last1 = Berners-Lee | first1 = T. I. M. | last2 = Connolly | first2 = D. A. N. | last3 = Kagal | first3 = L. | last4 = Scharf | first4 = Y. | last5 = Hendler | first5 = J. I. M. | title = N3Logic: A logical framework for the World Wide Web | doi = 10.1017/S1471068407003213 | journal = Theory and Practice of Logic Programming | volume = 8 | issue = 3 | year = 2008 | pages = 249–269 | arxiv = 0711.1533 }}
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:
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
may be written in Notation3 like this:
@prefix dc:
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
{{incomplete list|date=June 2018}}
class="wikitable"
! scope="col" colspan="2" | Feature !! scope="col" | Notation3 !! scope="col" | Turtle !! scope="col" | N-Triples | |||
colspan="2" {{rh2|align=right}} | Character encoding | |||
---|---|---|---|
scope="row" rowspan="5" {{rh2|align=right}} | Directives
| {{code|@base}} || {{ya}} || {{ya}} || {{na}} | |||
{{code|@forAll}} | {{ya}} | {{na}} | {{na}} |
{{code|@forSome}} | {{ya}} | {{na}} | {{na}} |
{{code|@keywords}} | {{ya}} | {{na}} | {{na}} |
{{code|@prefix}} | {{ya}} | {{ya}} | {{na}} |
scope="row" rowspan="3" {{rh2|align=right}} | Lists | |||
{{code|()}} {{small|(DAML lists)}} | {{ya}} | {{ya}} | {{na}} |
{{code| | {{ya}} | {{na}} | {{na}} |
scope="row" rowspan="4" {{rh2|align=right}} | Literals
| {{code|true}} / {{code|false}} | |||
{{code|xsd:decimal}} {{small|(decimal arbitrary length)}} | {{ya}} | {{ya}} | {{na}} |
{{code|xsd:double}} {{small|(decimal double)}} | {{ya}} | {{ya}} | {{na}} |
{{code|xsd:integer}} {{small|(decimal integer)}} | {{ya}} | {{ya}} | {{na}} |
scope="row" rowspan="9" {{rh2|align=right}} | Syntactic sugar
| RDF paths || {{ya}} || {{na}} || {{na}} | |||
QNames | {{ya}} | {{ya}} | {{na}} |
{{code|a}}/{{code|@a}} {{small|(equiv. to {{code|rdf:type}})}} | {{ya}} | {{ya}} | {{na}} |
{{code|[]}} {{small|(shorthand for blank node)}} | {{ya}} | {{ya}} | {{na}} |
{{code| | {{ya}} | {{na}} | {{na}} |
{{code|< | {{ya}} | {{na}} | {{na}} |
{{code| | {{ya}} | {{na}} | {{na}} |
{{code|,}} {{small|(repeat object in list)}} | {{ya}} | {{ya}} | {{na}} |
{{code|;}} {{small|(repeat subject/verb in list)}} | {{ya}} | {{ya}} | {{na}} |
See also
External links
- [http://www.w3.org/TeamSubmission/n3/ Notation 3 W3C Submission]
- [http://www.w3.org/DesignIssues/Notation3.html Notation 3 Outline] on W3C Design Issues by Tim Berners-Lee
- [http://www.w3.org/2000/10/swap/Primer Notation 3 Primer]: Getting into RDF & Semantic Web using N3
- [http://infomesh.net/2002/notation3 A Rough Guide to Notation3]
- [http://www.ninebynine.org/RDFNotes/RDFForLittleLanguages.htm RDF for "Little Languages"]
- [https://web.archive.org/web/20090409213144/http://larve.net/people/hugo/2003/scratchpad/NotationThreeEmacsMode.html An editing mode of N3 for Emacs]
- [http://www.vim.org/scripts/script.php?script_id=944 An editing mode of N3 for vim]
- [https://web.archive.org/web/20130517202748/http://www.openvest.com/trac//wiki/n3SyntaxHighlighting An editing mode of N3 for textmate]
- [http://jamesrdf.blogspot.fr/2009/04/in-searching-for-highlighting-mode-for.html An editing mode of N3 for gedit]
- [http://eulergui.sourceforge.net/ EulerGUI], an IDE centered on N3 editor with translation from RDF, with validation, prefix management, uploading of resources, graph view, table view, etc.