equal
deleted
inserted
replaced
26 // Avoid php annoying memory leaks |
26 // Avoid php annoying memory leaks |
27 $em->getConnection()->getConfiguration()->setSQLLogger(null); |
27 $em->getConnection()->getConfiguration()->setSQLLogger(null); |
28 |
28 |
29 // First step : we populate the dbpedia uris thanks to the dbpedia-owl:wikiPageID |
29 // First step : we populate the dbpedia uris thanks to the dbpedia-owl:wikiPageID |
30 echo "\nFIRST STEP"; |
30 echo "\nFIRST STEP"; |
31 $query = $em->createQuery('SELECT t FROM WikiTagBundle:Tag t ORDER BY t.label ASC');//->setMaxResults(240)->setFirstResult(500); |
31 $query = $em->createQuery('SELECT t FROM WikiTagBundle:Tag t WHERE t.wikipediaPageId IS NOT NULL ORDER BY t.label ASC');//->setMaxResults(240)->setFirstResult(500); |
32 $tags = $query->getResult(); |
32 $tags = $query->getResult(); |
33 $i = 1; |
33 $i = 1; |
34 $nb_set = 0; |
34 $nb_set = 0; |
|
35 echo "\n".count($tags)." tags to search."; |
35 foreach($tags as $tag){ |
36 foreach($tags as $tag){ |
36 $l = $tag->getLabel(); |
37 $l = $tag->getLabel(); |
37 $uri = WikiTagUtils::getDbpediaUri($tag->getWikipediaPageId(), [], false, "pageid"); |
38 $uri = WikiTagUtils::getDbpediaUri($tag->getWikipediaPageId(), [], false, "pageid"); |
38 $tag->setDbpediaUri($uri); |
39 $tag->setDbpediaUri($uri); |
39 $em->persist($tag); |
40 $em->persist($tag); |
51 echo "\nFIRST STEP : $nb_set uris found"; |
52 echo "\nFIRST STEP : $nb_set uris found"; |
52 |
53 |
53 |
54 |
54 // Second step : we populate the dbpedia uris not found thanks to the foaf:isPrimaryTopicOf |
55 // Second step : we populate the dbpedia uris not found thanks to the foaf:isPrimaryTopicOf |
55 echo "\nSECOND STEP"; |
56 echo "\nSECOND STEP"; |
56 $query = $em->createQuery('SELECT t FROM WikiTagBundle:Tag t WHERE (t.dbpediaUri=\'\' OR t.dbpediaUri IS NULL) ORDER BY t.label ASC');//->setMaxResults(240); |
57 $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); |
57 $tags = $query->getResult(); |
58 $tags = $query->getResult(); |
58 $i = 1; |
59 $i = 1; |
59 $nb_set = 0; |
60 $nb_set = 0; |
|
61 echo "\n".count($tags)." tags to search."; |
60 foreach($tags as $tag){ |
62 foreach($tags as $tag){ |
61 $l = $tag->getLabel(); |
63 $l = $tag->getLabel(); |
62 $uri = WikiTagUtils::getDbpediaUri($tag->getWikipediaUrl(), [], false, "wikiurl"); |
64 $uri = WikiTagUtils::getDbpediaUri($tag->getWikipediaUrl(), [], false, "wikiurl"); |
63 $tag->setDbpediaUri($uri); |
65 $tag->setDbpediaUri($uri); |
64 $em->persist($tag); |
66 $em->persist($tag); |
76 echo "\nSECOND STEP : $nb_set uris found"; |
78 echo "\nSECOND STEP : $nb_set uris found"; |
77 |
79 |
78 |
80 |
79 // Third step : we populate the dbpedia uris not found thanks to the rdfs:label |
81 // Third step : we populate the dbpedia uris not found thanks to the rdfs:label |
80 echo "\nTHIRD STEP"; |
82 echo "\nTHIRD STEP"; |
81 $query = $em->createQuery('SELECT t FROM WikiTagBundle:Tag t WHERE (t.dbpediaUri=\'\' OR t.dbpediaUri IS NULL) ORDER BY t.label ASC');//->setMaxResults(240); |
83 $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); |
82 $tags = $query->getResult(); |
84 $tags = $query->getResult(); |
83 $i = 1; |
85 $i = 1; |
84 $nb_set = 0; |
86 $nb_set = 0; |
|
87 echo "\n".count($tags)." tags to search."; |
85 foreach($tags as $tag){ |
88 foreach($tags as $tag){ |
86 $l = $tag->getLabel(); |
89 $l = $tag->getLabel(); |
87 $uri = WikiTagUtils::getDbpediaUri($tag->getLabel(), [], false); |
90 $uri = WikiTagUtils::getDbpediaUri($tag->getLabel(), [], false); |
88 $tag->setDbpediaUri($uri); |
91 $tag->setDbpediaUri($uri); |
89 $em->persist($tag); |
92 $em->persist($tag); |