2

In <body>, controlled vocabularies may be initialized as follows:

<!DOCTYPE html>
<html
  lang="en"
  xml:lang="en"
  xmlns="http://www.w3.org/1999/xhtml"
>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title></title>
</head>
<body prefix="
  bibo: http://purl.org/ontology/bibo/
  cc: http://creativecommons.org/ns#
  dc: http://purl.org/dc/terms/
  foaf: http://xmlns.com/foaf/0.1/
  schema: http://schema.org/
">

Is it acceptable (and a good programing practice) to take a similar approach to using controlled vocabularies in <head>? For example:

<!DOCTYPE html>
<html
  lang="en"
  xml:lang="en"
  xmlns="http://www.w3.org/1999/xhtml"
>
<head prefix="
  bibo: http://purl.org/ontology/bibo/
  cc: http://creativecommons.org/ns#
  dc: http://purl.org/dc/terms/
  foaf: http://xmlns.com/foaf/0.1/
  schema: http://schema.org/
">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta dc:author content="fname_lname" />
<meta schema:dateCreated content="yy-mm-dd" />
<meta bibo:Website href="http://www.example.com" />
<link foaf:Person href="https://plus.google.com/u/0/_Google_mbox_string_/about" rel="publisher" />
<title></title>
</head>
Jay Gray
  • 1,706
  • 2
  • 20
  • 36

1 Answers1

3

Yes, you can use prefix on any element. The prefixes will apply to descendant elements; so if you specify prefix on head, you can’t use those prefixes for elements in body.

If you want to use the same prefixes in the whole document, you might want to use the html element.

Just in case you don’t know: You don’t have to specify the prefixes for vocabularies defined in the RDFa Core Initial Context. As long as you use the registered prefixes (and you don’t define these prefixes for something else in your document), you can use foaf, schema etc. without using prefix/vocab.

unor
  • 92,415
  • 26
  • 211
  • 360
  • TY. I was aware of the default initialization of certain CV (http://www.w3.org/2011/rdfa-context/rdfa-1.1). However, I did not know that I could assign the CVs to the html element. TY for telling me that. I conclude from your advice: initialize the CV one time. The CV term will be parsed properly where ever used BELOW the initialization. – Jay Gray Apr 26 '14 at 14:38