PieNt

From W3C Wiki

Pient RDF Serialization

Pient is a proposed alternate RdfSyntax that is an extension of N-Triples to include some constructs from Notation3 (NotationThree.) The language can be thought of as N-Triples+ or N3-. Its name is pronounced "pint".

Goals: isomorphism with RDF/XML, using the best features from N-Triples and N3. Rigid grammar and definition. Possibly to be published as a W3C Note? Nearby: NotationThree.

Grammar

The EBNF used is that defined in the XML recommendation.


document ::= ( comment crlf | pdirective ws+ | triple ws+ )* 
   ( pdirective | triple )?
pdirective ::= '@prefix' ws+ prefix? ':' ws+ uriref ws* '.'

triple ::= ( subject polist | anonnode ) '.'
subject ::= qname | uriref | bnode
predicate ::= qname | uriref | 'a'
object ::= qname | uriref | bnode | literal

prefix ::= [A-Za-z][A-Za-z0-9_]*
name ::= [A-Za-z0-9_]+
qname ::= prefix? ':' name

uriref ::= '<' URI-reference '>'
bnode ::= nodeID | '[' ws* ']' | anonnode
anonnode ::= '[' ws* polist ws* ']'
polist ::= predicate ws+ objtlist ws* ( ';' ws* predicate ws+ objtlist )*
objtlist ::= object ws* ( ',' ws* object )*

/* Whitespace is " \t\r\n" */
ws ::= #x20 | #xD | #xA | #x9 


Imported productions are as follows:


URI-reference from RFC 2396
nodeID from N-Triples
literal from N-Triples
comment from N-Triples
crlf from N-Triples


How about a diff from an N3 grammar in the same form?

Documents are to be served as text/plain, with ASCII character encoding.

FAQ

Does the world really need another RDF notation?

This notation was devised in response to comments on www-rdf-interest (@@ LinkMe), and Bijan Parsia et al.'s ideas on #rdfig. It sticks to the RDF model used in the current suite of RDF specifications, i.e. rejecting N3's formulae and other logic extensions. It is therefore meant to be isomorphic with RDF/XML. The value comes from its brevity, human readability, and editability. Whilst serialization merits are always highly debatable, giving people a choice is almost certainly worthwhile.

Why "Pient"?

"Pie" is taken from the Pie/Echo/Atom project, and "nt" is taken from N-Triples. The result is distinctive, has a fairly low Googlecount (pient: 3,470; pient RDF: 2), and conforms quite well to ProjectNameGuidelines. It's pronouncable as "pint" quite clearly, and "peint" means pint in Welsh, so there's a tie-in to the SWAP Python tools. Really, it's a play on pLUS(iNVERSE("3'n")"t'"), if you can work that out.

How can one tell a peint document from N3 or N-Triples?

If N3 and N-Triples were served with their own MIME types, this would be trivial. But N3 is rarely served as application/n3, and N-Triples is required to be served as text/plain. So the answer is really to parse and hope...
On the other hand, maybe it doesn't matter.   An N3 parser will do the right thing with Pient input (wont it?), and an N3 generator will output Pient when serializing pure RDF data (will it?).   So if you have an N3 parser, use it.  If you don't then knowing you were getting N3 wouldn't help you very much anyway.

Discussion

Feel free to discuss the syntax here, or add questions to the FAQ above, etc.

References

Contributors

Sean B. Palmer hashed out the initial grammar and documentation for pient. TimBL developed N3 with much input from DanC et al. Dave Beckett and Jan Grant are the editors for N-Triples. RDF was developed by hundreds or thousands.