<html> <head> <title>Test Store Models in Database</title> </head> <body> <?php // Include RAP require_once 'config.php'; include RDFAPI_INCLUDE_DIR . "RdfAPI.php"; ## 1. Connect to MsAccess database (via ODBC) ## ------------------------------------------ // Connect to MsAccess (rdf_db DSN) database using connection settings // defined in constants.php : $rdf_database = new DbStore(); $rdf_database->createTables(ADODB_DB_DRIVER); ## 2. Store a memory model in database. ## ------------------------------------ // Load an RDF-Documtent into a memory model // Filename of an RDF document $base = "example1.rdf"; // Create a new memory model $memModel = new MemModel(); // Load and parse document $memModel->load($base); // Now store the model in database // An unique modelURI will be generated $rdf_database->putModel($memModel); // You can also provide an URI for the model to be stored $modelURI = "example1.rdf"; // But then you must check if there already is a model with the same modelURI
define("RDFAPI_INCLUDE_DIR", "./../api/"); include RDFAPI_INCLUDE_DIR . "RdfAPI.php"; ## 1. Connect to MsAccess database (via ODBC) and create tables. // Connect to MsAccess (rdf_db DSN) database using connection settings // defined in constants.php : // ---------------------------------------------------------------------------------- // Database // ---------------------------------------------------------------------------------- // define("ADODB_DB_DRIVER", "odbc"); // define("ADODB_DB_HOST", "rdf_db"); // define("ADODB_DB_NAME", ""); // define("ADODB_DB_USER", ""); // define("ADODB_DB_PASSWORD", ""); $rdf_database = new DbStore(); // Create tables for MsAccess $rdf_database->createTables('MsAccess'); ## 2. Connect to MySQL database and create tables. /* // Connect to MySQL database with user defined connection settings $rdf_database = new DbStore('MySQL', 'localhost', 'db_name', 'user_name', 'password' ); // Create tables for MySQL $rdf_database->createTables('MySQL'); */ ## 3. Connect to other databases /* // Example: // Connect to Oracle database with user defined connection settings $rdf_database = new DbStore('Oracle', FALSE, 'db_name', 'username', 'password' ); // Method createTables() currently supports only MySQL and MsAccess.