<?php
// $Id: rdf_import.module,v 1.1 2008/02/11 21:54:40 arto Exp $
/**
 * rdf_import.module - Imports RDF data in the RDF/XML, Turtle and N-Triples formats.
 *
 * @author Arto Bendiken <http://bendiken.net/>
 * @copyright Copyright (c) 2007-2008 Arto Bendiken. All rights reserved.
 * @license GPL <http://creativecommons.org/licenses/GPL/2.0/>
 * @package rdf.module
 * @subpackage rdf_import.module
 */

//////////////////////////////////////////////////////////////////////////////
// Core API hooks

/**
 * Implementation of hook_perm().
 */
function rdf_import_perm() {
  return array('import RDF data');
}

/**
 * Implementation of hook_menu().
 */
function rdf_import_menu() {
  return array(
    // Administer >> Content management >> RDF data
    'admin/content/rdf/import' => array(
      'title' => 'Import data',
      'type' => MENU_LOCAL_TASK,
      'weight' => 20,
      'access arguments' => array('import RDF data'),
      'page callback' => 'drupal_get_form',
      'page arguments' => array('rdf_import_admin_screen'),
      'file' => 'rdf_import.admin.inc',
    ),
  );
}

//////////////////////////////////////////////////////////////////////////////
// RDF API hooks

/**
 * Implementation of hook_rdf_formats().
 */
function rdf_import_rdf_formats() {
  return array(
    'rdf+xml' => array(
      'title'       => t('RDF/XML'),
      'link'        => 'http://www.w3.org/TR/rdf-syntax-grammar/',
      'mime_type'   => 'application/rdf+xml',
      'encoding'    => 'utf-8',
      'file_ext'    => 'rdf',
      'unserialize' => 'rdf_unserialize_xml',
      'file'        => 'rdf_import.inc',
    ),
    'turtle' => array(
      'title'       => t('Turtle'),
      'link'        => 'http://www.dajobe.org/2004/01/turtle/',
      'mime_type'   => 'application/x-turtle',
      'encoding'    => 'utf-8',
      'file_ext'    => 'ttl',
      'unserialize' => 'rdf_unserialize_turtle',
      'file'        => 'rdf_import.inc',
    ),
    'ntriples' => array(
      'title'       => t('N-Triples'),
      'link'        => 'http://www.w3.org/TR/rdf-testcases/#ntriples',
      'mime_type'   => 'text/plain', // TODO: any semi-standardized alternative?
      'encoding'    => 'ascii',
      'file_ext'    => 'nt',
      'unserialize' => 'rdf_unserialize_ntriples',
      'file'        => 'rdf_import.inc',
    ),
  );
}
