Changeset 27


Ignore:
Timestamp:
Jul 13, 2011, 1:46:00 AM (14 years ago)
Author:
cla
Message:

rdfint

  • reworked library setup for samples and unittests
Location:
php/trunk
Files:
2 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • php/trunk/rdfa.php

    r2 r27  
    1818 */
    1919
    20 // --- load ARC
    21 if (!defined( 'ARC2'))
    22         die( 'error: ARC2 not defined !');
    23 require_once( ARC2.'/ARC2.php');
    24 
    25 // --- load and initialize fDebug
    26 // if not defined, load dummy class
    27 if (defined( 'fDebug'))
    28   require_once( fDebug.'/server/php/fdebug.lib.php');
    29 else
    30   require_once( RDFINT.'/classes/fdebug.php');
    31 
    3220// --- load classes of this library
    33 if(!defined('RDFINT'))
    34         die( 'error: RDFINT not defined !');
     21if (!defined( 'RDFINT'))
     22  define( 'RDFINT', getenv( 'PHP_LIBROOT_RDFINT'));
     23if (RDFINT == '')
     24        die( 'error: environment variable PHP_LIBROOT_RDFINT not defined !');
    3525require_once( RDFINT.'/classes/rdfa_Data.php');
    3626require_once( RDFINT.'/classes/rdfa_Projection.php');
     
    3828require_once( RDFINT.'/classes/rdfa_SparqlQuery.php');
    3929
     30// --- load ARC
     31define( 'ARC2', getenv( 'PHP_LIBROOT_ARC2'));
     32if( ARC2 == '')
     33        die( 'error:environment variable PHP_LIBROOT_ARC2 not defined !');
     34require_once( ARC2.'/ARC2.php');
     35
     36// --- load fDebug
     37define( 'fDebug', getenv( 'PHP_LIBROOT_FDEBUG'));
     38$locationStub = RDFINT.'/classes/fdebug.php';
     39$locationLib1 = fDebug.'/server/php/fdebug.lib.php';
     40$locationLib2 = fDebug.'/fdebug.lib.php';
     41if (fDebug == '') {
     42  $location = $locationStub;
     43} else {
     44  $location = $locationLib1;
     45  if (!file_exists( $location))
     46    $location = locationLib2;
     47  if (!file_exists( $location))
     48    $location = $locationStub;
     49}
     50require_once( $location);
     51
     52// --- configure fDebug
     53$fdebug = \fDebug::getInstance();
     54If (isset( $_SERVER[ "SERVER_NAME"]))
     55  $fdebug->setSession( $_SERVER[ "SERVER_NAME"]);
     56else {
     57  $unittest_name = str_replace( '_', ' ', basename( getcwd()));
     58  if (defined( 'SAMPLE_NAME'))
     59    $fdebug->setSession( 'localhost', SAMPLE_NAME . ' ' . $unittest_name);
     60}
     61$fdebug->openSocket( '127.0.0.1');
     62$fdebug->sendSource( '<?xml version="1.0" ?><emptysource/>');
    4063
    4164?>
  • php/trunk/samples/rdfa_projection_queries/sample.php

    r6 r27  
    2020// load library setup
    2121require_once( '../sample_config.php');
    22 require_once( '../fdebug_setup.php');
     22define( 'RDFINT', getenv( 'PHP_LIBROOT_RDFINT'));
     23require_once( RDFINT.'/rdfa.php');
    2324
    2425$debugger = \fDebug::getInstance();
  • php/trunk/samples/rdfa_projections/sample.php

    r6 r27  
    2020// load library setup
    2121require_once( '../sample_config.php');
    22 require_once( '../fdebug_setup.php');
     22define( 'RDFINT', getenv( 'PHP_LIBROOT_RDFINT'));
     23require_once( RDFINT.'/rdfa.php');
    2324
    2425$debugger = \fDebug::getInstance();
  • php/trunk/samples/rdfa_simple_api/sample.php

    r17 r27  
    1919
    2020// load library setup
     21// load library setup
    2122require_once( '../sample_config.php');
    22 require_once( '../fdebug_setup.php');
     23define( 'RDFINT', getenv( 'PHP_LIBROOT_RDFINT'));
     24require_once( RDFINT.'/rdfa.php');
    2325
    2426$debugger = \fDebug::getInstance();
    2527const debugcontext = "RDFA_SAMPLE";
     28
    2629
    2730$turtlefile = "sample.ttl";
  • php/trunk/samples/sample_config.php

    r6 r27  
    55 * Author: Christian Langanke, Adrian Gschwend
    66 *
    7  * Licensed under the Apache License, Version 2.0 (the "License");
     7 * Licensed under the Apache License, Ve on 2.0 (the "License");
    88 * you may not use this file except in compliance with the License.
    99 * You may obtain a copy of the License at
     
    1818 */
    1919
    20 // ------ configure ARC2 - mandantory
    21 define( 'ARC2', getenv( 'PHP_LIBROOT_ARC2'));
    2220
    23 // ----- configure fDebug - optional
    24 // define locations of required external libraries
    25 define( 'fDebug', getenv( 'PHP_LIBROOT_FDEBUG'));
    26 if (fDebug !== '') {
     21// define base name of sample in fDebug
     22define( 'SAMPLE_NAME', 'RDFInt Sample');
    2723
    28   // define base name of sample in fDebug
    29   define( 'SAMPLE_NAME', 'RDFInt Sample');
     24// activate debug output of the library classes
     25// if not set, only the sample code itself generates debug messages
     26define( 'RDFA_DEBUGOUTPUT_CLASSES', true);
    3027
    31   // activate debug output of the library classes
    32   // if not set, only the sample code itself generates debug messages
    33   define( 'RDFA_DEBUGOUTPUT_CLASSES', true);
    34 
    35   // activate debug output for specific RDFaLIB classes in samples and unittests
    36   define( 'RDFA_DEBUGOUTPUT_READER', true);
    37   define( 'RDFA_DEBUGOUTPUT_PROJECTION', true);
    38   define( 'RDFA_DEBUGOUTPUT_SPARQLENDPOINT', true);
    39   define( 'RDFA_DEBUGOUTPUT_SPARQLQUERY', true);
    40 }
    41 
    42 // define location of rdfint
    43 // TODO - replace with autoload code
    44 define( 'RDFINT', getenv( 'PHP_LIBROOT_RDFINT'));
    45 require_once( RDFINT.'/rdfa.php');
     28// activate debug output for specific RDFaLIB classes in samples and unittests
     29define( 'RDFA_DEBUGOUTPUT_READER', true);
     30define( 'RDFA_DEBUGOUTPUT_PROJECTION', true);
     31define( 'RDFA_DEBUGOUTPUT_SPARQLENDPOINT', true);
     32define( 'RDFA_DEBUGOUTPUT_SPARQLQUERY', true);
    4633
    4734?>
  • php/trunk/unittest/rdfa_merge/unittest.php

    r7 r27  
    1919
    2020// load library setup
    21 require_once( '../unittest_config.php');
     21define( 'RDFINT', getenv( 'PHP_LIBROOT_RDFINT'));
     22require_once( RDFINT.'/rdfa.php');
    2223
    2324class UnitTest extends PHPUnit_Framework_TestCase
  • php/trunk/unittest/rdfa_parse_sparql/unittest.php

    r7 r27  
    1919
    2020// load library setup
    21 require_once( '../unittest_config.php');
     21define( 'RDFINT', getenv( 'PHP_LIBROOT_RDFINT'));
     22require_once( RDFINT.'/rdfa.php');
    2223
    2324class UnitTest extends PHPUnit_Framework_TestCase
  • php/trunk/unittest/rdfa_projection_queries/unittest.php

    r7 r27  
    1919
    2020// load library setup
    21 require_once( '../unittest_config.php');
     21define( 'RDFINT', getenv( 'PHP_LIBROOT_RDFINT'));
     22require_once( RDFINT.'/rdfa.php');
    2223
    2324class UnitTest extends PHPUnit_Framework_TestCase
  • php/trunk/unittest/rdfa_projections/unittest.php

    r7 r27  
    1919
    2020// load library setup
    21 require_once( '../unittest_config.php');
     21define( 'RDFINT', getenv( 'PHP_LIBROOT_RDFINT'));
     22require_once( RDFINT.'/rdfa.php');
    2223
    2324class UnitTest extends PHPUnit_Framework_TestCase
  • php/trunk/unittest/rdfa_serialize/unittest.php

    r17 r27  
    1919
    2020// load library setup
    21 require_once( '../unittest_config.php');
     21define( 'RDFINT', getenv( 'PHP_LIBROOT_RDFINT'));
     22require_once( RDFINT.'/rdfa.php');
    2223
    2324class UnitTest extends PHPUnit_Framework_TestCase
  • php/trunk/unittest/rdfa_set/unittest.php

    r23 r27  
    1919
    2020// load library setup
    21 require_once( '../unittest_config.php');
     21define( 'RDFINT', getenv( 'PHP_LIBROOT_RDFINT'));
     22require_once( RDFINT.'/rdfa.php');
    2223
    2324class UnitTest extends PHPUnit_Framework_TestCase
  • php/trunk/unittest/rdfa_simple_api/unittest.php

    r17 r27  
    1919
    2020// load library setup
    21 require_once( '../unittest_config.php');
     21define( 'RDFINT', getenv( 'PHP_LIBROOT_RDFINT'));
     22require_once( RDFINT.'/rdfa.php');
    2223
    2324class UnitTest extends PHPUnit_Framework_TestCase
  • php/trunk/unittest/rdftestcases/unittest.php

    r17 r27  
    1818 */
    1919
    20 // load unittest setup
    21 require_once( '../unittest_config.php');
     20// load library setup
     21define( 'RDFINT', getenv( 'PHP_LIBROOT_RDFINT'));
     22require_once( RDFINT.'/rdfa.php');
    2223
    2324class UnitTest extends PHPUnit_Framework_TestCase {
Note: See TracChangeset for help on using the changeset viewer.