--- a/Utils/WikiTagUtils.php Mon Feb 03 15:29:01 2014 +0100
+++ b/Utils/WikiTagUtils.php Tue Feb 04 11:23:12 2014 +0100
@@ -132,7 +132,7 @@
$res = $ar[0];
$pages = $ar[1];
- #we know that we have at least one answer
+ // we know that we have at least one answer
if(count($pages)>1 || count($pages)==0){
return WikiTagUtils::returnNullResult($res);
}
@@ -145,28 +145,7 @@
$revision_id = $page['lastrevid'];
- // Get the dbpedia uri by requesting dbpedia with sparkl
-
-
- /*
- // process language to extract the english label
- $english_label = null;
- if($status==Tag::$TAG_URL_STATUS_DICT["match"] || $status==Tag::$TAG_URL_STATUS_DICT["redirection"]){
- if(array_key_exists("langlinks", $page)){
- foreach ($page["langlinks"] as $ar) {
- if($ar["lang"]=="en"){
- $english_label = $ar["*"];
- break;
- }
- }
- }
- }
- // We create the dbpedia uri.
- $dbpedia_uri = null;
- if($english_label!=null && strpos($english_label, '#')===false){
- $dbpedia_uri = WikiTagUtils::getDbpediaUri($english_label);
- }
- */
+ // Get the dbpedia uri by requesting dbpedia with sparql
$dbpedia_uri = WikiTagUtils::getDbpediaUri($new_label);
$wp_response = array(
@@ -286,6 +265,7 @@
// Get lang from url
$dbp_url = $GLOBALS["kernel"]->getContainer()->getParameter("wiki_tag.url_templates")["dbpedia_sparql"];
$lang = substr($dbp_url, 7, 2);
+ // filter with regexp to avoid results with "category:LABEL" or other "abc:LABEL"
$query = 'select distinct * where { ?s rdfs:label "'.$label.'"@'.$lang.' . FILTER (regex(?s, "^http\\\\://[^:]+$")) }';
if($req_param=="pageid"){
$query = 'select distinct * where { ?s dbpedia-owl:wikiPageID '.$label.' }';
@@ -294,10 +274,6 @@
$query = 'select distinct * where { ?s foaf:isPrimaryTopicOf <'.$label.'> }';
}
-
- // filter with regexp to avoid results with "category:LABEL" or other "abc:LABEL"
- //"query" => 'select distinct * where { ?s rdfs:label "'.$label.'"@'.$lang.' }',
- //"query" => 'select distinct * where { ?s rdfs:label "'.$label.'"@'.$lang.' . FILTER (regex(?s, "^http\\\\://[^:]+$")) }',
$params = [
"query" => $query,
"format" => 'application/json',