RDF has no single syntax; RDF is just a standard way of modeling ideas. That said, it's gotta be expressed.
(Trying to make this list as comprehensive as possible. If you know of one I've missed, link to it here.)
Various forms are:
- RdfXmlSyntax ("RDF/XML syntax") - the most common
- Basic Semantic Web Language (BSWL)
- GRDDL - not really a serialization in itself but a way of mapping from non-RDF XML to RDF.
- RDFX - includes excellent support for reification (assertions about assertions)
- Rx - a similar feel to RDF/XML
- RXR - similar to TriX
- SPOG - a dialect of the SPARQL XML results format.
- TriX - a "raw"-ish XML form
- Ideas that don't seem fully-formed (yet):
- NotationThree, which has various dialects, some of which go beyond the RDF data model (as does N3 itself):
- JSON-LD - Rather than force RDF on developers, eases developers into RDF, using models they're already familiar with deploying.
- RDF PHP - same idea, but PHP code rather than JSON.
- jsonGRDDL - analogous to XML's GRDDL
- Dataset Transformations - Uses json to navigate the contents of html and outputs the result as RDF/XML
- JSON+RDF - a more in-depth look at the state of RDF in JSON.
- RDF/POST - serialization on top of application/x-www-form-urlencoded
- HTML embedded:
- RDF as S-expressions
- Uniform Resource Framework (URF) - a superset of RDF.
(This doesn't need to be quite as comprehensive.)
|SPOG||XML, SPARQL Results||yes||no||SPARQL result format is a W3C Rec|
|Notation3||-||yes||yes||W3C Team Submission|
|Turtle||Notation3||no||no||W3C Team Submission|
|N-Triples||Notation3||no||no||W3C Rec (sort of)|
|RDF/JSON||JSON||no||no||proposal on Talis wiki|
|eRDF||(X)HTML||no||no||proposal on Talis wiki|
|XHTML+RDFa||XHTML||no, but proposed||no||W3C Rec|
Some serializations are only capable of representing a subset of the RDF data model.
- RDF/XML requires property URIs to be encoded as XML QNames. Some URIs cannot be abbreviated this way. In practice, vocabulary designers tend to take this into account, so it's not much of a problem.
- Microdata cannot represent datatypes for literals, and cannot handle cyclical relationships between blank nodes.
- BSWL doesn't support blank nodes.
- Certain unicode control characters are forbidden by XML, even when escaped as numeric character references. Unless an XML-based RDF serialisation provides an additional escaping mechanism, literals containing these characters cannot be serialised.