Subversion

helios_wp3

[/] [trunk/] [triplify/] [mantis/] [config.inc.php] - Rev 132 Go to most recent revision

Compare with Previous - Blame


<?php
/* This file contains the configuration for triplify in order to triplify Bugzilla.
 * See https://picoforge.int-evry.fr/cgi-bin/twiki/view/Helios_wp3/Web/TriplifyBugzillaToRdf for some details 
 *
 * Triplify rapidly simplifies the creation of structured content for Web 2.0
 * mashups and Semantic Web applications.
 *
 * Triplyfy uses a number of SQL queries, whose results are converted into
 * either RDF/N3, JSON or Linked Data.
 *
 * @version $Id:$
 * @license LGPL
 * @copyright 2008 Sören Auer (soeren.auer@gmail.com) for the original example config file
 * @copyright 2009 Andrei Sambra and Olivier Berger for the bugzilla triplification
 * Internal version: v0.2beta (for Bugzilla 3.4.1)
 */

/*
 * You can either use an external file or you can uncomment the line containing the object.
 */
include("db.inc.php");

#$triplify['db']=new PDO('mysql:host=localhost;dbname=yourdbname','user','password');


/*
 * This is the base URI where your Bugzilla installation is.
 * You need to modify this file to contain your own URL (don't forget to include the bugzilla dir and the trailing /).
 */
$BASEURI 'https://erty.int-evry.fr:4443/mantis/';


/*
 * List of ontologies
 */
$triplify['namespaces']=array(
    
'rdf'=>'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
    
'rdfs'=>'http://www.w3.org/2000/01/rdf-schema#',
    
'owl'=>'http://www.w3.org/2002/07/owl#',
    
'foaf'=>'http://xmlns.com/foaf/0.1/',
    
'doap'=>'http://usefulinc.com/ns/doap#',
    
'sioc'=>'http://rdfs.org/sioc/ns#',
    
'sioctypes'=>'http://rdfs.org/sioc/types#',
    
'dc'=>'http://purl.org/dc/elements/1.1/',
    
'bom'=>'http://www.ifi.uzh.ch/ddis/evoont/2008/11/bom#',
    
'hel'=>'http://picoforge.int-evry.fr/projects/svn/helios_wp3/helios_bt.owl#',
    
'wf'=>'http://www.w3.org/2005/01/wf/flow#',
);

/*
 * Mantis queries
 */
$triplify['queries']=array(
    
'product'=>array(
            
"SELECT p.id AS id,
            p.name AS 'bom:name',
            id AS 'rdfs:seeAlso->productissue'
            FROM mantis_project_table p WHERE id IS NOT NULL"
            
),
    
'issue'=>array(
        
"SELECT * FROM (
            SELECT b.id AS id,
            CONCAT('" 
$BASEURI "view.php?id=',b.id) AS 'bom:bugURL',
            b.summary AS 'dc:title',
            b.date_submitted AS 'bom:dateOpened',
            b.reporter_id AS 'bom:hasReporter->user',
            b.severity AS 'bom:hasSeverity',
            b.status AS 'bom:hasState',
            b.priority AS 'bom:hasPriority',
            b.resolution AS 'bom:hasResolution',
            b.project_id AS 'bom:isInProduct->product',
            b.id AS 'owl:sameAs->issuecomments',
            b.id AS 'rdfs:seeAlso->seealso',
            CONCAT(CONCAT('Bug ',b.id), ' of " 
$BASEURI "') AS 'rdfs:label'
            FROM mantis_bug_table b) b WHERE b.id IS NOT NULL"
        
),
    
'productissue'=>array(
        
"SELECT * FROM (
            SELECT project_id AS id,
            id AS 'bom:inProject->product',
            project_id AS 'rdfs:seeAlso->product',
            project_id AS 'owl:sameAs->product'
            FROM mantis_bug_table) b WHERE b.id IS NOT NULL"
            
),
    
'submission'=>array(
        
"SELECT * FROM (
            SELECT reporter_id AS id,
            id AS 'bom:isReporterOf->issue',
            reporter_id AS 'owl:sameAs->user'
            FROM mantis_bug_table) b WHERE b.id IS NOT NULL"
            
),
    
'user'=>array(
        
"SELECT * FROM (
            SELECT id AS id,
            username AS 'rdfs:label',
            SHA(CONCAT('mailto:',email)) AS 'sioc:email_sha1',
            id AS 'rdfs:seeAlso->person'
            FROM mantis_user_table) u WHERE u.id IS NOT NULL"
            
),
    
'person'=>array(
        
"SELECT * FROM (
            SELECT id AS id,
            id AS 'foaf:holdsAccount->user',
            SHA(CONCAT('mailto:',email)) AS 'foaf:mbox_sha1sum',
            realname AS 'foaf:name',
            id AS 'rdfs:seeAlso->user'
            FROM mantis_user_table) u WHERE u.id IS NOT NULL"
            
),
);

$triplify['objectProperties']=array(
    
'bom:hasSeverity'=>'http://picoforge.int-evry.fr/projects/svn/helios_wp3',
    
'bom:hasState'=>'http://picoforge.int-evry.fr/projects/svn/helios_wp3',
    
'bom:hasPriority'=>'http://picoforge.int-evry.fr/projects/svn/helios_wp3',
    
'bom:hasResolution'=>'http://picoforge.int-evry.fr/projects/svn/helios_wp3',
);

$triplify['classMap']=array(
    
'product'=>'bom:Product',
    
'issue'=>'bom:Issue',
    
'user'=>'sioc:User',
    
'person'=>'foaf:person',
    
'productissue'=>'bom:hostsIssue',
    
'submission'=>'sioc:User',
);

$triplify['license']='http://creativecommons.org/licenses/by/3.0/us/';

/*
$triplify['metadata']=array(
    'hel:bugtracker'=>'Helios Bugzilla Test Tracker',
    'hel:bugTrackerURL'=>$BASEURI,
);
 */

/* 
 * Do not register by default.
 */
$triplify['register']=false;

$triplify['TTL']=0;

$triplify['cachedir']='cache/';

/* 
 * We decided to use "2" since Bugzilla trackers can contain a lot of data,
 * so it's not a good idea to display everything in one page!
 */
$triplify['LinkedDataDepth']='2';

$triplify['CallbackFunctions']=array(
    
'bom:hasSeverity'=>'fix_severity',
    
'bom:hasPriority'=>'fix_priority',
    
'bom:hasResolution'=>'fix_resolution',
    
'bom:hasState'=>'fix_state',    
);

function 
fix_severity ($string)
{
    
$ret 'helios_bt.owl#MantisSeverity';
    switch (
$string) {
        case 
'10'
            
$ret .= 'FEATURE';
            break;
        case 
'20':
            
$ret .= 'TRIVIAL';
            break;
        case 
'30':
            
$ret .= 'TEXT';
            break;
        case 
'40':
            
$ret .= 'TWEAK';
            break;
        case 
'50':
            
$ret .= 'MINOR';
            break;
        case 
'60':
            
$ret .= 'MAJOR';
            break;
        case 
'70':
            
$ret .= 'CRASH';
            break;
        case 
'80':
            
$ret .= 'BLOCK';
            break;
    }
    return 
$ret;
}

function 
fix_priority ($string)
{
    
$ret 'helios_bt.owl#MantisPriority';

    switch(
$string) {
        case 
'10':
            
$ret .= 'NONE';
            break;
        case 
'20':
            
$ret .= 'LOW';
            break;
        case 
'30':
            
$ret .= 'NORMAL';
            break;
        case 
'40':
            
$ret .= 'HIGH';
            break;
        case 
'50':
            
$ret .= 'URGENT';
            break;
        case 
'60':
            
$ret .= 'IMMEDIATE';    
            break;
    }
    return 
$ret;
}    

function 
fix_resolution ($string)
{
    
$ret 'helios_bt.owl#MantisResolution';

    switch(
$string) {
        case 
'10':
            
$ret .= 'OPEN';
            break;
        case 
'20':
            
$ret .= 'FIXED';
            break;
        case 
'30':
            
$ret .= 'REOPENED';
            break;
        case 
'40':
            
$ret .= 'UNABLE_TO_DUPLICATE';
            break;
        case 
'50':
            
$ret .= 'NOT_FIXABLE';
            break;
        case 
'60':
            
$ret .= 'DUPLICATE';
            break;
        case 
'70':
            
$ret .= 'NOT_A_BUG';
            break;
        case 
'80':
            
$ret .= 'SUSPENDED';
            break;
        case 
'90':
            
$ret .= 'WONT_FIX';
            break;
    }
    return 
$ret;    
}

function 
fix_state ($string)
{
    
$ret 'helios_bt.owl#MantisState';

    switch(
$string) {
        case 
'10':
            
$ret .= 'NEW_';
            break;
        case 
'20':
            
$ret .= 'FEEDBACK';
            break;
        case 
'30':
            
$ret .= 'ACKNOWLEDGED';
            break;
        case 
'40':
            
$ret .= 'CONFIRMED';
            break;
        case 
'50':
            
$ret .= 'ASSIGNED';
            break;
        case 
'80':
            
$ret .= 'RESOLVED';
            break;
        case 
'90':
            
$ret .= 'CLOSED';
            break;
    }
    return 
$ret;
}


?>

Powered by WebSVN v1.61