Drupal core does not define RDFa mappings for files, as files are not viewable outside of fields. File entity should implement hook_rdf_mapping() to define the RDFa mappings for a default bundle and all of the included file types. File entity should also implement MODULE_preprocess_HOOK() on behalf of RDF module to add RDFa markup to the file container.

I'm not sure what properties need to be mapped, so I've listed all of them below. Unlike nodes, many properties are currently not actually displayed to the user, such as a file's associated user or timestamp.

Default file types (bundles) defined by File entity include:

  • audio
  • document
  • image
  • video

All files have the following properties:

  • uid - The user ID of the user who is associated with the file.
  • filename - The title of the file. This may differ from the URI of the file.
  • uri - The URI to access the file.
  • filemime - The file's MIME type.
  • filesize - The size of the file in bytes.
  • status - A flag which indicates whether the file is permanent (1) or temporary (0) and should be removed after a certain amount of time has passed.
  • timestamp - A UNIX timestamp for when the file was added.
  • type - The type of the file (ex. image, document, etc.).

Files with the image file type also have the following properties:

  • alt - The alternative text for text-based browsers.
  • title - The title text is displayed when the image is hovered in some popular browsers.
  • width - The width of the image in pixels.
  • height - The height of the image in pixels.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Devin Carlson’s picture

Status: Active » Needs review
FileSize
3.39 KB

Here's an initial patch to get the RDF information to show up on files. It includes an implementation of hook_rdf_mapping() which needs to be expanded (and more likely, rewritten).

scor’s picture

Assigned: Unassigned » scor
FileSize
3.89 KB

Here is an improved version. I'd like to add some tests next.

Devin Carlson’s picture

Status: Needs review » Needs work

It sounds like this is "needs work" per #2.