Beispiel #1
0
// | xmi2db                                                               |
// | Creating SQL Queries from an xmi file                                |
// | Requirements: PHP5 with SimpleXMI Support                            |
// +----------------------------------------------------------------------+
// | Author: Christian Seip <*****@*****.**>               |
// +----------------------------------------------------------------------+
// based on http://www.phpclasses.org/package/2272-PHP-Generate-SQL-queries-to-import-data-from-XML-files.html
//Begin Start Pascoul
require_once '../lib/pascoul/pascoul.php';
include '../classes/schema.php';
include '../classes/logger.php';
include '../conf/database_conf.php';
$xmi2db = new xmi2db("XMI.content");
#Set DB connection
$schema = new Schema($xmi2db->schema, new Logger(0));
$xmi2db->setConn($schema->openConnection(PG_HOST, PG_DBNAME, PG_USER, PG_PASSWORD));
$xmi2db->start();
class xmi2db
{
    private $root_element;
    private $table;
    private $data;
    private $xmi_file;
    private $basePackage;
    private $progress;
    /**
     * Constructor
     *
     * @param XMI root element
     */
    function xmi2db($root)
Beispiel #2
0
include '../classes/featuretype.php';
if (file_exists(FILTER_FILE)) {
    $filter = json_decode(file_get_contents(FILTER_FILE), true);
} else {
    $logger->log("Filterdatei " . FILTER_FILE . " nicht gefunden.");
    $filter = array();
}
$tabNameAssoc = array();
$log_sql = '';
$logger = new Logger(LOGLEVEL);
#*****************************************************************************
#
#*****************************************************************************
# Initialize the umlSchema object
$umlSchema = new Schema(UML_SCHEMA, $logger);
$umlSchema->openConnection(PG_HOST, PG_DBNAME, PG_USER, PG_PASSWORD);
# Initialize the gmlSchema object
$ogrSchema = new OgrSchema(OGR_SCHEMA, $logger);
$ogrSchema->umlSchema = $umlSchema;
$sql = $ogrSchema->asSql();
#**************
# FeatureTypes
#**************
# Lade oberste Klassen vom Typ FeatureType, die von keinen anderen abgeleitet wurden
$topClasses = $umlSchema->getTopUmlClasses('FeatureType');
# Für alle oberen Klassen
foreach ($topClasses as $topClass) {
    $ogrSchema->listFeatureTypesAttributes('FeatureType', null, $topClass, false);
}
# Sortiere Ausgabeliste
ksort($ogrSchema->renameList);