app/DoctrineMigrations/Version20140129151724.php
changeset 110 7602e5ca9c30
parent 109 fc56f9e28cdb
child 113 e4f8c2479e78
--- a/app/DoctrineMigrations/Version20140129151724.php	Fri Jan 31 16:08:50 2014 +0100
+++ b/app/DoctrineMigrations/Version20140129151724.php	Mon Feb 03 12:28:21 2014 +0100
@@ -28,10 +28,11 @@
         
         // First step : we populate the dbpedia uris thanks to the dbpedia-owl:wikiPageID
         echo "\nFIRST STEP";
-        $query = $em->createQuery('SELECT t FROM WikiTagBundle:Tag t ORDER BY t.label ASC');//->setMaxResults(240)->setFirstResult(500);
+        $query = $em->createQuery('SELECT t FROM WikiTagBundle:Tag t WHERE t.wikipediaPageId IS NOT NULL ORDER BY t.label ASC');//->setMaxResults(240)->setFirstResult(500);
         $tags = $query->getResult();
         $i = 1;
         $nb_set = 0;
+        echo "\n".count($tags)." tags to search.";
         foreach($tags as $tag){
         	$l = $tag->getLabel();
         	$uri = WikiTagUtils::getDbpediaUri($tag->getWikipediaPageId(), [], false, "pageid");
@@ -53,10 +54,11 @@
         
         // Second step : we populate the dbpedia uris not found thanks to the foaf:isPrimaryTopicOf
         echo "\nSECOND STEP";
-        $query = $em->createQuery('SELECT t FROM WikiTagBundle:Tag t WHERE (t.dbpediaUri=\'\' OR t.dbpediaUri IS NULL) ORDER BY t.label ASC');//->setMaxResults(240);
+        $query = $em->createQuery('SELECT t FROM WikiTagBundle:Tag t WHERE (t.wikipediaUrl!=\'\' AND t.wikipediaUrl IS NOT NULL AND (t.dbpediaUri=\'\' OR t.dbpediaUri IS NULL)) ORDER BY t.label ASC');//->setMaxResults(240);
         $tags = $query->getResult();
         $i = 1;
         $nb_set = 0;
+        echo "\n".count($tags)." tags to search.";
         foreach($tags as $tag){
         	$l = $tag->getLabel();
         	$uri = WikiTagUtils::getDbpediaUri($tag->getWikipediaUrl(), [], false, "wikiurl");
@@ -78,10 +80,11 @@
         
         // Third step : we populate the dbpedia uris not found thanks to the rdfs:label
         echo "\nTHIRD STEP";
-        $query = $em->createQuery('SELECT t FROM WikiTagBundle:Tag t WHERE (t.dbpediaUri=\'\' OR t.dbpediaUri IS NULL) ORDER BY t.label ASC');//->setMaxResults(240);
+        $query = $em->createQuery('SELECT t FROM WikiTagBundle:Tag t WHERE (t.wikipediaUrl!=\'\' AND t.wikipediaUrl IS NOT NULL AND (t.dbpediaUri=\'\' OR t.dbpediaUri IS NULL)) ORDER BY t.label ASC');//->setMaxResults(240);
         $tags = $query->getResult();
         $i = 1;
         $nb_set = 0;
+        echo "\n".count($tags)." tags to search.";
         foreach($tags as $tag){
         	$l = $tag->getLabel();
         	$uri = WikiTagUtils::getDbpediaUri($tag->getLabel(), [], false);