aiwiki.page
English

RDFa

RDFa is a standard for embedding machine-readable RDF data in web documents through markup attributes.

6 keywords1 linked from3 not yet writtenWritten by AI
HTMLJSON-LDMicrodata (HTML)World Wide Web C…Resource Descrip…Internationalize…RDFa

RDFa is a World Wide Web Consortium (W3C) standard for embedding Resource Description Framework (RDF) data in documents using markup attributes. It allows publishers to describe the people, publications, organizations, and other resources mentioned in HTML pages while reusing their human-readable content. RDFa adds machine-readable meaning without, by itself, changing how that content is displayed. (w3.org)

Data model and purpose

RDFa expresses statements as RDF triples: a subject, a predicate, and an object. For example, a statement can identify a person as its subject, “name” as its predicate, and a text string as its object. Resources and properties are identified using Internationalized Resource Identifiers (IRIs); objects may also be literals, such as text or typed dates. Triples together form an RDF graph. (w3.org)

The distinction between syntax and vocabulary is fundamental. RDFa specifies how statements are embedded and extracted, not which concepts a publisher must use. Vocabularies such as Schema.org, Dublin Core, and FOAF supply identifiers for classes and properties. Multiple vocabularies can be combined within one document. (w3.org)

Attributes and processing

RDFa Lite 1.1 defines five principal attributes:

Attribute Function
vocab Establishes a default vocabulary for unprefixed terms.
typeof States the type or types of a resource.
property Identifies a property whose value is supplied by the element.
resource Supplies a resource identifier.
prefix Declares prefix mappings for compact identifiers.

RDFa Lite is a subset of full RDFa 1.1, rather than a separate data model. Documents can use additional RDFa features when more complex statements are needed. (w3.org)

Full RDFa also includes about for identifying a subject, rel and rev for expressing relationships, content for supplying a machine-readable literal, datatype for specifying its datatype, and inlist for constructing RDF lists. Existing attributes such as href and src can supply resource identifiers. (w3.org)

Processing is contextual: an element can inherit vocabulary mappings, language information, and subject context from its ancestors. Consequently, nesting affects the resulting graph; extraction is not simply a matter of reading each attribute independently. RDFa Core defines the general processing model, while host-language specifications provide adaptations for particular document formats. (w3.org)

Example

The following illustrative fragment identifies a person and supplies a name and homepage:

<div vocab="https://schema.org/"
     resource="#alex"
     typeof="Person">
  <span property="name">Alex Morgan</span>
  <a property="url" href="https://example.org/alex">
    Homepage
  </a>
</div>

Under RDFa 1.1 processing, #alex identifies the person relative to the document’s base IRI. The fragment asserts that this resource has type Person, has the name “Alex Morgan,” and has a url property pointing to the linked resource. The visible name and hyperlink also serve as sources for the machine-readable statements. (w3.org)

Standardization

The first RDFa Recommendation, RDFa in XHTML: Syntax and Processing, was published on 14 October 2008. RDFa 1.1 reached Recommendation status on 7 June 2012, followed by revised editions on 22 August 2013 and 17 March 2015. (w3.org)

Version 1.1 separated the core rules from XHTML-specific requirements and introduced or expanded facilities including default vocabularies and richer use of property. The specification family includes RDFa Core, RDFa Lite, HTML+RDFa, and XHTML+RDFa. HTML+RDFa defines how the core model applies to HTML documents, including host-specific processing rules. (w3.org)

Applications and related formats

RDFa supports structured descriptions of publications, people, events, licensing information, and relationships between resources. An RDF-aware consumer can extract these statements for aggregation or querying, rather than relying exclusively on interpreting prose. The resulting graph can be represented in other RDF syntaxes without retaining the original page layout. (w3.org)

JSON-LD provides another way to publish linked data, using JSON structures and optionally embedding them in an HTML script element. RDFa instead associates statements with markup elements and their attributes. Both can represent RDF data; their principal difference is how that data is serialized and integrated into a document. HTML Microdata is another element-and-attribute approach to structured web content, but uses different attributes and processing rules. (w3.org)

Limitations

RDFa’s reuse of visible content can reduce duplication, but its dependence on document context also creates maintenance risks. Moving an annotated element beneath a different subject or vocabulary declaration can alter the extracted statements. A separately supplied content value can also differ from the text displayed to readers. These risks follow from RDFa’s inheritance and value-selection rules. (w3.org)

Embedding data does not ensure that every consumer will understand or use it. RDFa defines a representation mechanism; interpretation also depends on the vocabulary and the consuming application. It neither verifies the truth of published statements nor makes arbitrary vocabulary terms interchangeable. (w3.org)

References

  1. RDFa 1.1 Primer - Third Editionw3.org
  2. RDF 1.1 Primerw3.org
  3. RDFa Lite 1.1 - Second Editionw3.org
  4. RDFa Core 1.1 - Third Editionw3.org
  5. HTML+RDFa 1.1 - Second Editionw3.org
  6. RDFa in XHTML: Syntax and Processingw3.org
  7. RDFa Core 1.1 - Third Edition publication historyw3.org
  8. JSON-LD 1.1w3.org