Triplify Configuration for Drupal with example CCK content type

<?php
/* triplify config for Drupal (www.drupal.org)
 * should be suitable for major Drupal version (tested 4.6, 5.7)
 * todo: teaser (drupal 4.x: in node, 5.x in node_revisions)
 * todo: table prefixes !!!
 * no custom content type fields exported
 */

$triplify['namespaces']=array(
    
'vocabulary'=>'http://triplify.org/vocabulary/Drupal/',
    
'sioc'=>'http://rdfs.org/sioc/ns#',
    
'foaf'=>'http://xmlns.com/foaf/0.1/',
    
'dc'=>'http://purl.org/dc/elements/1.1/',
    
'dcterms'=>'http://purl.org/dc/terms/',
    
'skos'=>'http://www.w3.org/2004/02/skos/core#',
    
'tag'=>'http://www.holygoat.co.uk/owl/redwood/0.1/tags/',    
    
'xsd'=>'http://www.w3.org/2001/XMLSchema#',
);

$sql['user']   = "SELECT uid AS id, name AS 'sioc:name', SHA(CONCAT('mailto:',mail)) AS 'sioc:email_sha1', FROM_UNIXTIME(created) AS 'sioc:created_at' FROM users WHERE uid > 0";
               
//"SELECT uid AS id, name AS 'foaf:nickname', SHA(CONCAT('mailto:',mail)) AS 'foaf:mbox_sha1sum', FROM_UNIXTIME(created) AS created FROM users WHERE uid > 0 AND status = 1",    

/* Drupal core node, adjust to your contenttype, usually type='page' or remove to expose all */

$sql['node']   = "SELECT n.nid AS id, n.title AS 'dc:title', FROM_UNIXTIME(n.created) AS 'sioc:created_at', FROM_UNIXTIME(n.changed) AS 'sioc:modified_at', n.uid AS 'sioc:has_creator' FROM node n WHERE n.status = 1 AND type='pub'";

/* Drupal node to taxonomy/category terms */

$sql['terms']  = "SELECT n.nid AS id, td.name AS 'skos:prefLabel' FROM node n INNER JOIN (term_node tn NATURAL JOIN term_data td) ON n.nid=tn.nid WHERE n.status = 1";

/* Drupal CCK custom content type fields */

$sql['pub']    = "SELECT nid AS id, field_authorsconcat_value AS 'dc:contributor', field_year_value AS 'dc:date', field_pages_value AS 'pages', field_language_value AS 'dc:language', field_copyright_value AS 'dc:rights', field_appeared_value AS 'dc:publisher' FROM content_type_pub";

$sql['author'] = "SELECT nid AS id, field_authors_value as 'dc:creator' FROM content_field_authors ORDER BY nid,delta";

/* putting it together for triplify */

$triplify['queries']=array(
    
'user' => $sql['user'],
    
'pub'  => array(
        
$sql['node'],
        
$sql['pub'],
        
$sql['author'],
        
$sql['terms'],
        ),
);

$triplify['objectProperties']=array(
//    'user_id'=>'user',
    
'sioc:has_creator'=>'user',
    
);

$triplify['classMap']=array(
//    'node'=>'sioc:Post',
    
'pub'=>'sioc:Post',
    
'user'=>'sioc:User',
//    'user'=>'foaf:person'
);

$triplify['TTL']=0;

$triplify['db']=new PDO('mysql:host=localhost;dbname=drupal''user''pass');
?>


 
There are no files on this page. [Display files/form]
There is no comment on this page. [Display comments/form]

Information

Last Modification: 2008-03-16 02:14:57 by Soeren Auer