Example #1
0
$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');
}
while ($line = fgetcsv($file)) {
    foreach ($vars as $n => $name) {
        ${$name} = trim($line[$n]);
    }
    $instUri = EUMIDA . 'institution/' . $EUMIDA_ID;
    $countryUri = EUMIDA . 'country/' . $Country_Code;
    $countryName = $countries[$Country_Code];
    $regionUri = $Rdf->thing_from_identifier(EUMIDA . 'region/', $NUTS_Region)->a('dcterms:Location')->has('owl:sameAs')->r('http://nuts.psi.enakting.org/id/' . trim($NUTS_Region))->r('http://nuts.geovocab.org/id/' . trim($NUTS_Region))->has('places:in')->r($countryUri)->get_uri();
    $Rdf->thing($countryUri)->a('places:Country')->has('rdfs:label')->l($countryName)->has('dcterms:identifier')->l($Country_Code)->has('owl:sameAs')->r('http://data.kasabi.com/dataset/european-election-results/country/' . strtolower($Country_Code))->r('http://airports.dataincubator.org/countries/' . strtoupper($Country_Code))->r('http://www.geonames.org/countries/#' . strtoupper($Country_Code))->r('http://dbtune.org/musicbrainz/resource/country/' . strtoupper($Country_Code))->r('http://lexvo.org/id/iso3166/' . strtoupper($Country_Code))->r('http://telegraphis.net/data/countries/' . strtoupper($Country_Code) . '#' . strtoupper($Country_Code));
    if (!empty($Institution_Category_English)) {
        $categoryUri = $Rdf->thing_from_label(NS, $Institution_Category_English, 'en')->get_uri();
        $Rdf->thing($categoryUri)->a('rdfs:Class')->label($Institution_Category_English, 'en')->has('rdfs:subClassOf')->r('aisso:Institution')->has('rdfs:isDefinedBy')->r(NS)->is('ov:defines')->of(NS);
    } else {
        $categoryUri = uri('aiiso:Institution');
    }
    $legalStatusUri = $Rdf->thing_from_label(EUMIDA . 'legal-status/', $Legal_Status, 'en')->a('skos:Concept')->has('skos:inScheme')->r(NS)->get_uri();
    $Institution = $Rdf->thing($instUri)->a('aiiso:Institution')->label($English_Institution_Name, 'en')->has('foaf:name')->l($Institution_Name)->has('eum:country')->r($countryUri)->has('rdf:type')->r($categoryUri)->has('places:in')->r($regionUri)->has('eum:legalStatus')->r($legalStatusUri)->has('eum:yearOfCurrentStatus')->r('http://reference.data.gov.uk/id/year/' . trim($Current_Status_Year))->has('eum:yearOfFoundation')->r('http://reference.data.gov.uk/id/year/' . trim($Foundation_Year));
    if (strtolower(trim($Distance_Education)) == 'yes') {
        $Institution->has('eum:feature')->r($instUri . '/distance')->object()->a('eum:DistanceEducationProvision')->label('Distance Education at ' . $Institution_Name, 'en')->has('dcterms:description')->l($Distance_Education_Comments, 'en');
    }
    if (strtolower(trim($Research_Active)) == 'yes') {
        $Institution->has('eum:feature')->r($instUri . '/research')->object()->a('eum:ResearchProvision')->label('Active Research at ' . $Institution_Name, 'en')->has('dcterms:description')->l($Research_Active_Comments, 'en');
    }
$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');
                    //            $concepts[$node->getAttribute('conceptAgency')][$node->getAttribute('conceptRef')]['codeLists'] = array_unique($concepts[$node->getAttribute('conceptAgency')][$node->getAttribute('conceptRef')]['codeLists']);
                } else {
                    if ($reader->localName == "CodeList") {
                        $node = $reader->expand();
                        $id = $node->getAttribute('id');
                        $Name = $node->getELementsByTagName('Name')->item(0)->textContent;
                        $codeLists[$id]['label'] = $Name;
                        $id = strtolower(str_replace('CL_', '', $node->getAttribute('id')));
                        $Scheme = $rdf->thing_from_identifier(NS . 'codes/', $id)->a('ecbstats:CodeList')->label($Name, 'en');
                        $scheme_uri = $Scheme->get_uri();