$langCodes[$countryCode] = $langCode; } } $langCodes = array('AT' => 'de', 'UK' => 'en', 'BE' => 'nl', 'BG' => 'bg', 'IT' => 'ita', 'RO' => 'ro', 'PL' => 'szl', 'TR' => 'tr', 'GR' => 'el', 'GE' => 'ka', 'BY' => 'be', 'CZ' => 'sk', 'AZ' => 'az', 'MT' => 'mt', 'CY' => 'tr', 'SK' => 'sk', 'BE' => 'de', 'HU' => 'hun', 'LV' => 'lav', 'UA' => 'ukr', 'BA' => 'bs', 'SM' => 'ita'); $file = fopen('eumida.csv', 'r'); $countries = json_decode(file_get_contents('countries.json'), 1); $columnNames = fgetcsv($file); function varify($i) { return preg_replace('/[^0-9a-zA-Z]+/', '_', $i); } $vars = array_map('varify', $columnNames); $Rdf = new RdfBuilder(); register('eum', NS); register('aiiso', $curieous->uri('aiiso:')); $Rdf->create_vocabulary('eum', NS, 'EUMIDA Vocabulary', 'http://keithalexander.co.uk/id/me'); $doctoratesDatasetUri = EUMIDA . 'dataset/doctorates-awarded'; $studentsISCED5DatasetUri = EUMIDA . 'dataset/ISCED5-students-enrolled'; $internationStudentsDatasetUri = EUMIDA . 'dataset/international-ISCED5-students-enrolled'; $studentsISCED6DatasetUri = EUMIDA . 'dataset/ISCED-6-students-enrolled'; $isced6InternationalStudentsDatasetUri = EUMIDA . 'dataset/international-ISCED-6-students-enrolled'; $totalStaffDatasetUri = EUMIDA . 'dataset/total-staff'; $Rdf->thing($doctoratesDatasetUri)->a('qb:DataSet')->label('Numbers of Doctorates Awarded by Higher Education Institutions', 'en'); $Rdf->thing($studentsISCED5DatasetUri)->a('qb:DataSet')->label('Numbers of ISCED 5 Students Enrolled in European Higher Education Institutions', 'en'); $Rdf->thing($internationStudentsDatasetUri)->a('qb:DataSet')->label('Numbers of International ISCED 5 Students at European Higher Education Institutions', 'en'); $Rdf->thing($studentsISCED6DatasetUri)->a('qb:DataSet')->label('Numbers of ISCED 6 Students Enrolled in European Higher Education Institutions', 'en'); $Rdf->thing($isced6InternationalStudentsDatasetUri)->a('qb:DataSet')->label('Numbers of International ISCED 6 Students at European Higher Education Institutions', 'en'); $Rdf->thing($totalStaffDatasetUri)->a('qb:DataSet')->label('Numbers of Members of Staff at European Higher Education Institutions', 'en'); foreach (array('eum:numberOfStaff', 'eum:numberOfDoctoratesAwarded', 'eum:numberOfInternationalISCED6Students', 'eum:numberOfISCED6Students', 'eum:numberOfInternationalISCED5Students', 'eum:numberOfISCED5Students') as $curie) { $Rdf->get_vocab_builder()->thing(uri($curie))->a('qb:MeasureProperty'); }
<?php ini_set('max_execution_time', 999999999999); define('MORIARTY_ARC_DIR', 'arc/'); require_once 'moriarty/simplegraph.class.php'; require 'curieous/rdfbuilder.class.php'; define('NS', 'http://ecb.publicdata.eu/'); $rdf = new RdfBuilder(); $rdf->create_vocabulary('ecbstats', NS . 'schema/', 'European Central Bank Statistics RDF Vocabulary', 'http://keithalexander.co.uk/id/me'); register('ecbstats', NS . 'schema/'); $output = array(); $concepts = array(); $codeLists = array(); $keyFamilies = array(); $reader = new XMLReader(); $reader->open('xml-schema/KeyFamily.xml'); while ($reader->read()) { set_time_limit(10000); switch ($reader->nodeType) { case XMLREADER::ELEMENT: if ($reader->localName == "Concept") { $node = $reader->expand(); $agencyID = $node->getAttribute('agencyID'); $id = $node->getAttribute('id'); $Name = $node->getELementsByTagName('Name')->item(0)->textContent; $rdf->thing_from_identifier(NS . 'schema/', $id)->a('qb:DimensionProperty')->label($Name, 'en')->has('rdfs:isDefinedBy')->r(NS . 'schema/')->is('ov:defines')->of(NS . 'schema/')->has('dct:creator')->r(NS . 'agency/' . $agencyID); echo $rdf->dump_ntriples(); } else { if ($reader->localName == "Dimension") { // $node = $reader->expand(); // $concepts[$node->getAttribute('conceptAgency')][$node->getAttribute('conceptRef')]['codeLists'][]=$node->getAttribute('codelist');