RDFa in Swignition

Swignition supports the RDFa specification almost exactly, but has a few (mostly deliberate) quirks:

  • XML Literals: some of the XML Literals generated by Swignition are close, but not quite right. This mostly happens when the XML contains mixed namespaces. This is a bug and will eventually be fixed.

  • @rel/@rev Attribute Values: Swignition supports a handful of extra terms in addition to those defined in the RDFa spec.

    • From the HTML 4.01 and HTML 3.2 specifications, there is: previous, search, made and top.
    • From the HTML 5 draft, there is: archives, author, external, feed, nofollow, noreferrer, pingback, prefetch, sidebar and tag.
    • From GRDDL, there is: transformation, profileTransformation and namespaceTransformation, which are taken to be in the GRDDL namespace instead of the RDFa XHTML vocabulary.
  • BNodes No Longer: if a blank node is found with an id attribute (e.g. <div typeof="foaf:Person" id="fred">), then a proper URI is created for that resource, using thing-described-by.org.

  • Stringification: when HTML is converted to text, a smarter algorithm is used than the one described by the spec. For example, the spec requires <p>foo<br/>bar</p> to be converted to just foobar, whereas Swignition will retain the line break. Spec-compliant "dumb" behaviour can be enabled using the rdfa_strings option, but this is diabled by default.

  • Microformats-style Strings: Swignition allows for property strings to be parsed in a Microformat-compatible way, including the <abbr> pattern and value excerpting, but the page needs to explicitly enable this by setting the property's datatype to http://purl.org/uF/excerpt#value. This is not especially useful for RDFa itself, but handy for RDF-EASE.

  • @prefix Support: As an alternative to xmlns:* attributes, the following syntax is supported: <html prefix="dc=http://purl.org/dc/terms/ foaf=http://xmlns.com/foaf/0.1/">

  • <link rel="schema.FOO"> Support: As yet another way of defining CURIE prefixes, this syntax is supported (eRDF-style). Prefixes defined this way are treated case-insensitively.

  • Full URIs instead of CURIEs: RDFa attributes which normally take CURIEs are allowed to contain full URIs. When the interpretation is ambiguous (e.g. http: may have been defined as a CURIE prefix), then they are assumed to be CURIEs.

  • @instanceof Support: Earlier editions of the RDFa specification used an attribute called instanceof instead of typeof. Swignition still supports this older syntax, but when both are provided, prefers typeof.

There is currently a module called RDF::RDFa::Parser in the Subversion repository which includes an implementation of RDFa with no dependencies on the rest of Swignition. It doesn't have as many of the same quirks, but does have:

  • XML Literals
  • @rel/@rev Attribute Values
  • BNodes No Longer (but disabled by default)
  • @prefix Support
  • Full URIs instead of CURIEs
  • @instanceof Support

See also CPAN RDF::RDFa::Parser.