Exemplo n.º 1
0
        }
    }
    // Generate data Dictionary
    date_default_timezone_set('Europe/Madrid');
    print "----------------------------------------\n";
    print "--\tDATA DICTIONARY MACHINE GENERATED\n";
    print "--\tGeneration date: " . date('Y-m-d') . "\n";
    print "----------------------------------------\n";
    print "\n";
    foreach ($dictonary as $namespace => $table) {
        print "----------------------------------------\n";
        print "--\t\t" . $namespace . "\n";
        print "----------------------------------------\n";
        foreach ($table as $table_name => $fields) {
            print $namespace . '.' . $table_name . '=' . $route[$namespace . '.' . $table_name];
            foreach ($fields as $field_name => $type) {
                print ',';
                if ($type === 'M') {
                    print '$';
                }
                print $field_name;
            }
            print "\n";
        }
        print "\n";
    }
    //print_r($dictonary);
}
//dump_contents($fname_xml);
extract_metadata($fname_xml);
Exemplo n.º 2
0
<?php

$_GET = ["cmaan" => "1953.212", "mode" => "preview"];
$cmaan = $_GET['cmaan'];
if (!$cmaan) {
    die("Must pass in an accession number");
}
$raw_metadata = load_provenance_data($cmaan);
$creation_timestamp = time();
$GLOBALS['approved_tags'] = array("i", "em", "b", "strong");
# Start by extracting all citations, footnotes, and provenance from the full
# record
$metadata = extract_metadata($raw_metadata);
$metadata = normalize_metadata($metadata);
$metadata = reorder_by_nid($metadata);
# Renumber and dedupe footnote entries across the entire record
list($metadata, $footnotes) = reindex_footnotes($metadata);
# Renumber and dedupe citations across the entire record
list($metadata, $citations) = reindex_citations($metadata);
$response = array("provenanceEntries" => $metadata, "footnotes" => $footnotes, "citations" => $citations);
send_response($response);
# BEGIN FUNCTION DEFINITIONS
# Determine whether you should pull from the preview or the approved
# metadata as defined in Drupal. Both queries use a Drupal module which could
# eventually be superseded by a custom one if this lasts more than the next few
# months
function load_provenance_data($accession_number)
{
    if (isset($_GET['mode']) && $_GET['mode'] == "preview") {
        $source = "http://cmaweb14.clevelandart.org/export/preview?cmaan={$accession_number}";
    } else {