예제 #1
0
 public function getOption($key)
 {
     if (null === $this->options) {
         return null;
     }
     return $this->options->getOption($key);
 }
예제 #2
0
 public function extractPage($pageID, $pageTitle, $pageSource)
 {
     $this->extractor->setPageURI($pageID);
     if (!$this->extractor->isActive()) {
         return $result = new ExtractionResult($pageID, $this->extractor->getLanguage(), $this->getExtractorID());
     }
     Timer::start($this->extractor->getExtractorID());
     $result = $this->extractor->extractPage($pageID, $pageTitle, $pageSource);
     Timer::stop($this->extractor->getExtractorID());
     Timer::start('validation');
     //$this->extractor->check();
     if (Options::getOption('validateExtractors')) {
         ValidateExtractionResult::validate($result, $this->extractor);
     }
     Timer::stop('validation');
     Statistics::increaseCount($this->extractor->getExtractorID(), 'created_Triples', count($result->getTriples()));
     Statistics::increaseCount('Total', 'created_Triples', count($result->getTriples()));
     if ($this->extractor->isGenerateOWLAxiomAnnotations()) {
         $triples = $result->getTriples();
         if (count($triples) > 0) {
             foreach ($triples as $triple) {
                 $triple->addDCModifiedAnnotation();
                 $triple->addExtractedByAnnotation($this->extractor->getExtractorID());
             }
         }
     }
     return $result;
 }
예제 #3
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($id = false)
 {
     if ($id === false) {
         $model = new Picture();
     } else {
         $model = $this->loadModel($id);
     }
     $msg = '';
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Picture'])) {
         $model->attributes = $_POST['Picture'];
         $path = Options::getOption('imgPath') . '/' . date('Y') . '/' . date('m') . '/' . date('his') . '-';
         $model->image = $path . CUploadedFile::getInstance($model, 'image');
         if ($model->save()) {
             $pathTo = $_SERVER['DOCUMENT_ROOT'] . $model->image;
         }
         $pathFrom = $_FILES['Picture']['tmp_name']['image'];
         Controller::createPathUploadsNow();
         if (!copy($pathFrom, $pathTo)) {
             $msg = '<p style="color: red; margin: 5px; border: 1px solid red; text-align: center">Файл не был записан.</p>';
         } else {
             chmod($pathTo, 0777);
             $msg = '<p style="color: green; margin: 5px; border: 1px solid green; text-align: center">Файл был записан.</p>';
         }
     }
     $this->render('create', array('model' => $model, 'msg' => $msg));
 }
예제 #4
0
 public static function plot()
 {
     $gnuscript = Options::getOption("harvester_gnu_script");
     if (Options::getOption("useGnuplot")) {
         system("gnuplot {$gnuscript}");
     }
 }
예제 #5
0
파일: ODBC.php 프로젝트: ljarray/dbpedia
 public static function getDefaultConnection()
 {
     $dataSourceName = Options::getOption('Store.dsn');
     $username = Options::getOption('Store.user');
     $password = Options::getOption('Store.pw');
     return new ODBC($dataSourceName, $username, $password);
 }
예제 #6
0
파일: helpers.php 프로젝트: ljarray/dbpedia
/**
 * Not used in the release. But a convenience function for testing stuff.
 *
 */
function myDefaultOdbcConnect()
{
    $dataSourceName = Options::getOption('dsn');
    $username = Options::getOption('user');
    $password = Options::getOption('pw');
    $con = myOdbcConnect($dataSourceName, $username, $password);
    return $con;
}
 protected function value($row)
 {
     if (!isset($this->language)) {
         $this->language = Options::getOption('language');
     }
     $category = Util::getMediaWikiNamespace($this->language, MW_CATEGORY_NAMESPACE);
     return $category . ":" . $row['page_title'];
 }
예제 #8
0
 public function __construct($language, $templateNameFilter, $templateDb, $parseHintToTripleGenerator, $mediaWikiUtil)
 {
     self::$wikiPageUsesTemplateUri = new URI(DB_WIKIPAGEUSESTEMPLATE, false);
     $this->breadCrumbTransformer = new DefaultBreadCrumbTransformer();
     $this->templateDb = $templateDb;
     $this->templateNameFilter = $templateNameFilter;
     $this->parseHintToTripleGenerator = $parseHintToTripleGenerator;
     $this->mediaWikiUtil = $mediaWikiUtil;
     //$this->defaultTripleGenerator = new DefaultTripleGenerator($language);
     $this->allowUnmappedProperties = Options::getOption('allowUnmappedProperties');
 }
예제 #9
0
 public function __construct(URI $subject, $language)
 {
     $this->subject = $subject;
     $this->language = $language;
     $this->use = Options::getOption('Sparql.use');
     if ($this->use == 'odbc') {
         $this->odbc = ODBC::getDefaultConnection();
     } else {
         $this->sparqlEndpoint = SPARQLEndpoint::getDefaultEndpoint();
     }
 }
예제 #10
0
파일: Hash.php 프로젝트: ljarray/dbpedia
 public function __construct($oaiId, $subject)
 {
     $this->subject = $subject;
     //$this->subjectOAIidentifier = $subjectOAIidentifier;
     //	$this->language = $language;
     $this->oaiId = $oaiId;
     $this->log(INFO, "_construct: " . $this->oaiId . " " . $this->subject);
     if (Options::getOption('LiveUpdateDestination.useHashForOptimization')) {
         $this->odbc = ODBC::getDefaultConnection();
         $this->hasHash = $this->_retrieveHashValues();
         $this->active = true;
     }
 }
예제 #11
0
 public static function createPathUploadsNow()
 {
     $target0 = $_SERVER['DOCUMENT_ROOT'] . Options::getOption('imgPath') . '/' . date('Y');
     $target1 = $_SERVER['DOCUMENT_ROOT'] . Options::getOption('imgPath') . '/' . date('Y') . '/' . date('m');
     if (!is_dir($target0)) {
         mkdir($target0);
         chmod($target0, 0777);
     }
     if (!is_dir($target1)) {
         mkdir($target1);
         chmod($target1, 0777);
     }
 }
예제 #12
0
 /**
  * Remember language, set URL of modified Wikipedia instance, init cURL,
  * call start() on destinations.
  * @param $language
  * @return void
  */
 public function start($language)
 {
     $this->language = $language;
     $this->page_url_format = Options::getOption('AbstractExtractor.page_url_format');
     if ($this->page_url_format == null || strlen($this->page_url_format) == 0) {
         die('Please define AbstractExtractor.page_url_format in your option file, e.g. dbpedia.ini.');
     }
     $this->curl = curl_init();
     if ($this->extraDestinationsGiven) {
         $this->longDestination->start();
         $this->shortDestination->start();
     }
 }
예제 #13
0
 private function getPageID($pageTitle, $PageSource, $Language)
 {
     if ($Language == "en" || false == Options::getOption('dependsOnEnglishLangLink')) {
         return $pageTitle;
     } else {
         if (Options::getOption('dependsOnEnglishLangLink')) {
             if (!preg_match("/\\[\\[en:(.*?)\\]\\]/", $PageSource, $match)) {
                 return false;
             } else {
                 return str_replace(" ", "_", $match[1]);
                 /* underscores are allowed in links */
             }
         } else {
             $this->log(ERROR, 'bad tail in ExtractionManager, getPageID');
         }
     }
 }
예제 #14
0
 public function accept($extractionResult)
 {
     $model1 = ModelFactory::getDefaultModel(Options::getOption('graphURI'));
     // RAP model
     $count = 0;
     foreach (new ArrayObject($extractionResult->getTriples()) as $triple) {
         $count++;
         $tripleString = explode(">", $triple->toString());
         $s = str_replace("<", "", $tripleString[0]);
         $p = str_replace("<", "", $tripleString[1]);
         // $s = preg_replace("/<|>/","",$triple->getSubject());
         // $p = preg_replace("/<|>/","",$triple->getPredicate());
         $o = $tripleString[2];
         $subject = new Resource($s);
         $predicate = new Resource($p);
         if (strpos($o, "<")) {
             // echo "<br>" . $s. $p . $p;
             if (!strpos($o, "^^")) {
                 // echo " a";
                 $o = str_replace("<", "", $o);
                 $object = new Resource($o);
             } else {
                 // echo " b";
                 $pos = strpos($o, "^^");
                 $literal = substr($o, 0, $pos);
                 $object = new Literal($literal);
                 $object->setDatatype(substr($o, $pos + 3, strlen($o) - $pos - 3));
             }
         } else {
             // $lang = "en";
             if (preg_match("/(.*)(@)([a-zA-Z]+) \\.\$/", $o, $match)) {
                 $o = $match[1];
                 $lang = $match[3];
             }
             $object = new Literal($o, $lang);
         }
         $statement = new Statement($subject, $predicate, $object);
         $model1->add($statement);
     }
     if ($count > 0) {
         echo "<br><br><h3>" . $extractionResult->getExtractorID() . "</h3>";
         echo $model1->writeAsHtmlTable();
     }
 }
예제 #15
0
파일: URI.php 프로젝트: nsystem1/ZeeJong
 public function __construct($uri, $doValidation = true)
 {
     Timer::start('URI::construct');
     $this->doValidation = $doValidation && Options::getOption('dbpedia.useURIvalidation');
     $this->uri = $uri;
     Timer::stop('URI::construct');
     //echo "a:$doValidation,b:".Options::getOption('dbpedia.useURIvalidation').", $uri\n";
     /*
             if ($doValidation &&  !(strpos($uri,'oai:')===0) ) {
                 //echo "validation of $uri\n{$this->validate($uri)}\n";
                 Timer::start('URI::construct::validate');
                 if(!$this->validate($uri)){
                     Timer::stop('URI::construct::validate');
                     Timer::stop('URI::construct');
                     throw new Exception('URI: Not a valid URI: '.$uri);
                 }
                 Timer::stop('URI::construct::validate');
             }
     */
 }
예제 #16
0
파일: dbpedia.php 프로젝트: ljarray/dbpedia
/*
define("CMP_EXTRACTOR", 'iterator');
*/
/*
 * WIKIMEDIA NAMESPACES
 * */
define("MW_CATEGORY_NAMESPACE", 'Category');
define("MW_FILE_NAMESPACE", 'File');
define("MW_FILEALTERNATIVE_NAMESPACE", 'FileAlt');
define("MW_TEMPLATE_NAMESPACE", 'Template');
/*
 * Namespaces
 * */
//define("EXTRACTORNS", 'http://dbpedia.org/extractors/');
define("DBPEDIA_NS", Options::getOption('dbpedia_ns'));
define("DB_META_NS", Options::getOption('db_meta_ns'));
define("DB_RESOURCE_NS", DBPEDIA_NS . 'resource/');
define("DB_PROPERTY_NS", DBPEDIA_NS . 'property/');
define("DB_ONTOLOGY_NS", DBPEDIA_NS . 'ontology/');
define("DB_COMMUNITY_NS", DBPEDIA_NS . 'ontology/');
define("DB_YAGO_NS", DBPEDIA_NS . 'class/yago/');
define("GEONAMES_NS", 'http://www.geonames.org/ontology#');
define("UMBEL_NS", 'http://umbel.org/umbel/');
define("OPENCYC_NS", 'http://sw.opencyc.org/');
//define("DB_CATEGORY_NS", DB_RESOURCE_NS.WIKIMEDIA_CATEGORY.':');
define("DBM_TEMPLATE_NS", DB_META_NS . 'Template:');
define("DB_TEMPLATE_NS", DB_RESOURCE_NS . 'Template:');
define("VIRTUOSO", 'virtuoso');
/*
 GENERAL Vocabulary
*/
예제 #17
0
    // Automatic SSL Client Certificate authentication
    if (isset($_SERVER['SSL_CLIENT_S_DN_Email']) && isset($CONFIG_SSL_CLIENT_AUTHENTICATION) && $CONFIG_SSL_CLIENT_AUTHENTICATION == true) {
        $user = User::sslCertificateLogin();
        // was the email correct/does the user exist?
        if ($user != null) {
            $_SESSION['user'] =& $user;
            $options = new Options($user);
        } else {
            $errorHandler->clear();
        }
        // clear ID does not exist error
    }
    // ... no user yet
    if (!isset($_SESSION['user'])) {
        // Guest login if allowed
        if ($options->getOption('requireLogin') != 1) {
            // we require no login? then create a guest user
            $_SESSION['user'] = new GuestUser();
        }
        session_regenerate_id(TRUE);
        // try to fix logout problem with expired server session
        //echo "---- SESSION USER NOT SET!! ----";
    }
}
// If guest login is disallowed $_SESSION['user'] is not set at this point!
// allow config to exec a few satements after session creation - if needed
if (isset($CONFIG_POST_INIT_EVAL)) {
    eval($CONFIG_POST_INIT_EVAL);
}
// At this point RightsManager takes over ...
// RightsManager::setUser() ->
예제 #18
0
 private function _odbc_ttlp_execute($ntriples, $graphURI)
 {
     $odbc_result = false;
     if (Options::getOption('dryRun')) {
         $virtuosoPl = "DB.DBA.TTLP_MT (\n'{$ntriples}', '{$graphURI}', '{$graphURI}', 255)";
         $this->log(INFO, $virtuosoPl);
         $odbc_result = true;
     } else {
         $virtuosoPl = "DB.DBA.TTLP_MT (?, '{$graphURI}', '{$graphURI}', 255)";
         $stmt = $this->odbc->prepare($virtuosoPl, 'LiveUpdateDestination');
         $odbc_result = odbc_execute($stmt, array($ntriples));
         if ($odbc_result == false) {
             $this->log(ERROR, 'ttlp insert failes');
             $this->log(ERROR, $virtuosoPl);
             $this->log(ERROR, substr(odbc_errormsg(), 0, 100));
             $this->log(ERROR, substr($ntriples, 0, 100));
         } else {
             $this->log(INFO, 'insert returned a true via odbc_execute');
         }
         //old line, now we use odbc_prepare
         //$result = $this->odbc->exec( $virtuosoPl,'LiveUpdateDestination');
         $this->counterTotalODBCOperations += 1;
         $this->log(TRACE, $virtuosoPl);
     }
     return $odbc_result;
 }
예제 #19
0
 public function toSPARULPattern()
 {
     Timer::start('RDFliteral::toSPARULPattern');
     if (is_null($this->SPARULpattern)) {
         $storespecific = Options::getOption('Store.SPARULdialect');
         $quotes = $storespecific == VIRTUOSO ? '"""' : '"';
         if (is_null($this->datatypeURI) && is_null($this->language)) {
             $this->SPARULpattern = $quotes . RDFliteral::escape($this->lexicalForm) . $quotes;
         } else {
             if (is_null($this->datatypeURI)) {
                 $this->SPARULpattern = $quotes . RDFliteral::escape($this->lexicalForm) . $quotes . "@{$this->language}";
             } else {
                 $this->SPARULpattern = $quotes . RDFliteral::escape($this->lexicalForm) . $quotes . "^^<{$this->datatypeURI}>";
             }
         }
     }
     Timer::stop('RDFliteral::toSPARULPattern');
     return $this->SPARULpattern;
 }
 private function _odbc_sparul_insert_one_triple($sparulpattern, $graphURI)
 {
     $odbc_result = false;
     $sparul = "Insert Into <{$graphURI}> { {$sparulpattern} }";
     if (Options::getOption('dryRun')) {
         $this->log(INFO, $sparul);
         $odbc_result = true;
     } else {
         $odbc_result = $this->odbc->exec($sparul, 'LiveUpdateDestination');
         if ($odbc_result == false) {
             $this->log(ERROR, 'insert failed patter:');
             $this->log(ERROR, $sparulpattern);
         } else {
             $this->log(INFO, 'insert returned a true via odbc_execute');
         }
         $this->counterTotalODBCOperations += 1;
         $this->log(TRACE, $sparul);
     }
     return $odbc_result;
 }
예제 #21
0
 public function finish()
 {
     if (Options::getOption('geousedb')) {
         mysql_close($this->dbSharedConnection);
     }
     return $this->getPredicates();
 }
예제 #22
0
 public static function getDefaultEndpoint()
 {
     $sparqlendpointURL = Options::getOption('sparqlendpoint');
     $defaultGraphURI = Options::getOption('graphURI');
     return new SPARQLEndpoint($sparqlendpointURL, $defaultGraphURI);
 }
예제 #23
0
 public function extractPage($pageID, $pageTitle, $pageSource)
 {
     $result = new ExtractionResult($pageID, $this->language, $this->getExtractorID());
     $PersonData = $this->extractPersondata($pageSource, $this->language);
     //var_dump($PersonData);
     if ($PersonData != null) {
         // preg_match("/\[\[en:(.*)\]\]/", $pageSource, $LangLinkmatch);
         // $PersonData['enPageID'] = str_replace(" ","_",$LangLinkmatch[1]);
         if (Options::getOption('Persondata.usedb')) {
             $WikiDB = new DatabaseWikipediaCollection($this->language);
         }
         $mysource = "";
         if (isset($PersonData['birthplace'])) {
             preg_match("/\\[\\[([^\\]]*)\\]\\]/", $PersonData['birthplace'], $Birthplacematch);
             if (isset($Birthplacematch[0])) {
                 $Birthplacematch = $this->getLinkForLabeledLink($Birthplacematch);
                 if (Options::getOption('Persondata.usedb')) {
                     $mySource = $WikiDB->getSource($Birthplacematch);
                 }
                 preg_match("/\\[\\[en:(.*)\\]\\]/", $mySource, $LangLinkmatch);
                 if (isset($LangLinkmatch[1])) {
                     $BirthPlace = $LangLinkmatch[1];
                 }
             }
         }
         if (isset($PersonData['deathplace'])) {
             preg_match("/\\[\\[([^\\]]*)\\]\\]/", $PersonData['deathplace'], $Deathplacematch);
             if (isset($Deathplacematch[0])) {
                 $Deathplacematch = $this->getLinkForLabeledLink($Deathplacematch);
                 if (Options::getOption('Persondata.usedb')) {
                     $mySource = $WikiDB->getSource($Deathplacematch);
                 }
                 preg_match("/\\[\\[en:(.*)\\]\\]/", $mySource, $LangLinkmatch);
                 if (isset($LangLinkmatch[1])) {
                     $DeathPlace = $LangLinkmatch[1];
                 }
             }
         }
         //var_dump($PersonData);
         //var_dump($BirthPlace);
         //var_dump($DeathPlace);
         //var_dump($Deathplacematch);
         if (isset($PersonData['name']) && $PersonData['name'] != "") {
             $result->addTriple($this->getPageURI(), RDFtriple::URI(FOAF_NAME, false), RDFtriple::Literal($PersonData['name'], null, "de"));
         }
         if (isset($PersonData['givenname']) && $PersonData['givenname'] != "") {
             $result->addTriple($this->getPageURI(), RDFtriple::URI(FOAF_GIVENNAME, false), RDFtriple::Literal($PersonData['givenname'], null, "de"));
         }
         if (isset($PersonData['surname']) && $PersonData['surname'] != "") {
             $result->addTriple($this->getPageURI(), RDFtriple::URI(FOAF_SURNAME, false), RDFtriple::Literal($PersonData['surname'], null, "de"));
         }
         if (isset($BirthPlace) && $BirthPlace != "") {
             $result->addTriple($this->getPageURI(), RDFtriple::URI(DB_BIRTHPLACE, false), RDFtriple::page($BirthPlace));
             // $result->addTriple(
             // RDFtriple::page($pageID),
             // RDFtriple::URI("http://purl.org/vocab/bio/0.1/event"),
             // RDFtriple::URI("http://dbp     edia.org/resource/" . URI::wikipediaEncode($pageID) . "/Birth"));
             // $result->addTriple(
             // RDFtriple::URI("http://dbp     edia.org/resource/" . URI::wikipediaEncode($pageID) . "/Birth");
             // RDFtriple::URI("http://purl.org/vocab/bio/0.1/place"),
             // RDFtriple::page($BirthPlace));
         }
         if (isset($PersonData['birthdate']) && $PersonData['birthdate'] != "") {
             $result->addTriple($this->getPageURI(), RDFtriple::URI(DB_BIRTH, false), RDFtriple::Literal($PersonData['birthdate'], XS_DATE, null));
         }
         if (isset($DeathPlace) && $DeathPlace != "") {
             $result->addTriple($this->getPageURI(), RDFtriple::URI(DB_DEATHPLACE, false), RDFtriple::page($DeathPlace));
         }
         if (isset($PersonData['deathdate']) && $PersonData['deathdate'] != "") {
             $result->addTriple($this->getPageURI(), RDFtriple::URI(DB_DEATH, false), RDFtriple::Literal($PersonData['deathdate'], XS_DATE, null));
         }
         if (isset($PersonData['description']) && $PersonData['description'] != "") {
             $result->addTriple($this->getPageURI(), RDFtriple::URI(DC_DESCRIPTION, false), RDFtriple::Literal($PersonData['description'], null, "de"));
         }
         $result->addTriple($this->getPageURI(), RDFtriple::URI(RDF_TYPE, false), RDFtriple::URI(FOAF_PERSON, false));
     }
     return $result;
 }
예제 #24
0
 public function __construct()
 {
     $this->metadata[EXTRACTORID] = $this->getExtractorID();
     $this->language = Options::getOption('language');
     $this->addMetaData(ExtractorConfiguration::getMetadata($this->getLanguage(), get_class($this)));
 }
 private function executeUpdate($odbc, $query, $graphURI)
 {
     $result = false;
     if (Options::getOption('dryRun')) {
         $this->log(INFO, $query);
         $result = true;
     } else {
         // escape characters that delimit the query within the query
         $query = addcslashes($query, '\'\\');
         // build Virtuoso/PL query
         //$virtuosoPl = 'CALL DB.DBA.SPARQL_EVAL(\'' . $query . '\', \'' . $graphURI . '\', 0)';
         $virtuosoPl = 'CALL DB.DBA.SPARQL_EVAL(\'' . $query . '\', NULL,  0)';
         $result = $odbc->exec($virtuosoPl, 'LiveUpdateDestination');
         $this->log(TRACE, $virtuosoPl);
     }
     return $result;
 }
예제 #26
0
function printAll($lastarticles, $language)
{
    $statisticdir = Options::getOption('statisticdir');
    Timer::start('main::glob');
    if (Options::getOption('noglob')) {
        Statistics::setArticleQueue('deactivated for speed');
    } else {
        Statistics::setArticleQueue(count(glob(Options::getOption('oaiRecords') . "/*.*")));
    }
    Timer::stop('main::glob');
    /*
     *      //too slow
            Timer::start('main::lswc');
            Statistics::setArticleQueue(exec ('ls -1 '.Options::getOption('oaiRecords').' | wc -l'));
            Timer::stop('main::lswc');
    */
    $data = array();
    $data['lastarticles'] = $lastarticles;
    Timer::stop("main::Runtime");
    $timeString = Timer::getTimeAsString();
    $data['timeString'] = $timeString;
    $data['time'] = Timer::$time;
    Timer::start("main::Runtime");
    $overall = array();
    $overall['startingtime'] = Timer::$startingTime;
    $overall['lasttime'] = microtime(true);
    $data['timeOverall'] = $overall;
    Timer::stop("main::processing");
    $data['processingTime'] = Timer::$time["main::processing"]['total'];
    Timer::start("main::processing");
    //toFile($time, 'timeString.txt', $statisticdir);
    //do statistics
    //Timer::timeToFile($statisticdir);
    //      Statistics::statisticsToFile($statisticdir);
    $data['triples'] = Statistics::$countArr;
    $data['extractorMeta'] = Statistics::$extractorMeta;
    $s = Timer::getElapsedSeconds();
    $t = Statistics::getTotalTriples();
    $memory = "memory_get_usage  (true ): " . memory_get_usage(true) . "\n";
    $memory .= "memory_get_usage  (false ): " . memory_get_usage(false) . "\n";
    $memory .= "memory_get_peak_usage  (true ): " . memory_get_peak_usage(true) . "\n";
    $memory .= "memory_get_peak_usage  (false ): " . memory_get_peak_usage(false) . "\n";
    $data['memory'] = $memory;
    //toFile($memory, 'memory.txt', $statisticdir);
    //echo $s."\n";
    $general = "Seconds per article: " . $s / Statistics::getTotalArticles() . "\n";
    $general .= "Articles per second: " . Statistics::getTotalArticles() / $s . "\n";
    $general .= "Articles per hour: " . Statistics::getTotalArticles() / $s * 3600 . "\n";
    $general .= "Category per second: " . Statistics::getTotalCategories() / $s . "\n";
    $general .= "Category per hour: " . Statistics::getTotalCategories() / $s * 3600 . "\n";
    $general .= "Redirect per second: " . Statistics::getTotalRedirects() / $s . "\n";
    $general .= "Redirect per hour: " . Statistics::getTotalRedirects() / $s * 3600 . "\n";
    $general .= "Triples per second: " . $t / $s . "\n";
    $general .= "Triples per minute: " . $t / $s * 60 . "\n";
    $general .= "Triples per hour: " . $t / $s * 3600 . "\n";
    $general .= "Triples per day: " . $t / $s * 3600 * 24 . "\n";
    $data['general'] = $general;
    $append = '';
    if (Options::isOptionSet('processID')) {
        $append = Options::$config['processID'];
    }
    $indexfile = 'index' . $append . '.html';
    toFile(Statistics::generateStatisticHTML(Options::getOption('linkeddataresourceprefix'), $language, $data), $indexfile, $statisticdir);
    Logger::info('wrote html file to ' . $statisticdir . '/' . $indexfile);
}
예제 #27
0
 private function get_next_record()
 {
     $directory = $this->path;
     sem_acquire($this->semaphoreID);
     if (Options::getOption('fastFileHandling')) {
         $file = $this->get_any_file($directory);
     } else {
         $file = $this->get_oldest_file($directory);
     }
     Logger::info(get_class($this) . ": found file: " . $file);
     $ret = file_get_contents($directory . $file);
     if ($this->debug_delete_file == false) {
         unlink($directory . $file);
     }
     sem_release($this->semaphoreID);
     return $ret;
     //return $ret;
 }
예제 #28
0
 public function start($language)
 {
     $this->language = $language;
     $this->parseHintToTripleGenerator = self::createParseHintToTripleGeneratorMap($language);
     //$this->defaultTripleGenerator = new DefaultTripleGenerator($language);
     // Initialize database connection
     if (false == Options::getOption('LiveMappingBased.useTemplateDb')) {
         $this->templateDb = new DummyTemplateDb();
     } else {
         $odbc = ODBC::getDefaultConnection();
         //$odbc = new ODBC("VOS", "dbpedia", "dbpedia");
         $this->templateDb = new TemplateDb($odbc);
     }
     // Initialize the template name filter
     $this->templateNameFilter = new AndCompoundFilter(array(new LegacyTemplateFilter(), new TemplateFilter()));
     $mediaWikiUtil = MediaWikiUtil::getInstance("http://en.wikipedia.org/wiki/");
     $this->rootTripleGenerator = new RootTripleGenerator($this->language, $this->templateNameFilter, $this->templateDb, $this->parseHintToTripleGenerator, $mediaWikiUtil);
 }
<?php

include 'dbpedia.php';
error_reporting(E_ALL);
Timer::start("main::Runtime");
// Setup the language version of Wikipedia
$language = Options::getOption('language');
$pageTitles = new AllTemplatesSqlIterator($language);
$job = new ExtractionJob(new DatabaseWikipediaCollection($language), $pageTitles);
$groupInfoboxes = new ExtractionGroup(new NullDestination());
$groupInfoboxes->addExtractor(new TemplateRedirectExtractor());
// Add the ExtractionGroups to the ExtractionJob
$job->addExtractionGroup($groupInfoboxes);
//Execute the Extraction Job
$manager = new ExtractionManager();
$manager->execute($job);
Timer::stop("main::Runtime");
Timer::printTime();
예제 #30
0
 /**
  * @param CAction $action
  * @return bool
  * @var Bootstrap Yii
  */
 public function beforeAction($action)
 {
     $this->pageSize = Options::getOption('PostOnPage');
     $cs = Yii::app()->clientScript;
     $cs->registerCssFile(Yii::app()->request->baseUrl . '/css/bootstrap.css');
     $cs->registerCssFile(Yii::app()->request->baseUrl . '/css/bootstrap-theme.css');
     $cs->registerCssFile(Yii::app()->request->baseUrl . '/css/magnific-popup.css');
     $cs->registerCssFile(Yii::app()->request->baseUrl . '/css/front.css');
     Yii::app()->clientScript->registerScriptFile(Yii::app()->assetManager->publish(Yii::getPathOfAlias('webroot') . '/js/') . '/jquery-1.11.3.min.js', CClientScript::POS_END);
     Yii::app()->clientScript->registerScriptFile(Yii::app()->assetManager->publish(Yii::getPathOfAlias('webroot') . '/js/') . '/bootstrap.min.js', CClientScript::POS_END);
     Yii::app()->clientScript->registerScriptFile(Yii::app()->assetManager->publish(Yii::getPathOfAlias('webroot') . '/js/') . '/jquery.magnific-popup.min.js', CClientScript::POS_END);
     Yii::app()->clientScript->registerScriptFile(Yii::app()->assetManager->publish(Yii::getPathOfAlias('webroot') . '/js/') . '/yiitest.js', CClientScript::POS_END);
     return parent::beforeAction($action);
 }