From: <sk...@us...> - 2008-08-19 14:28:32
|
Revision: 1100 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1100&view=rev Author: sknappe Date: 2008-08-19 14:28:27 +0000 (Tue, 19 Aug 2008) Log Message: ----------- category search is now working (you can search instances of a yago class from the navigate tree or from the classes that are displayed in an articel) using the database (its fast), fixed some minor things (unicode decoding, etc.) Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/ajax_search.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/index.php trunk/src/dbpedia-navigator/js/ajax.js trunk/src/dbpedia-navigator/processTreeMenu.php Added Paths: ----------- trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php Removed Paths: ------------- trunk/src/dbpedia-navigator/CalculatePageRank.java Deleted: trunk/src/dbpedia-navigator/CalculatePageRank.java =================================================================== --- trunk/src/dbpedia-navigator/CalculatePageRank.java 2008-08-19 14:20:39 UTC (rev 1099) +++ trunk/src/dbpedia-navigator/CalculatePageRank.java 2008-08-19 14:28:27 UTC (rev 1100) @@ -1,185 +0,0 @@ -import java.io.BufferedReader; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.Statement; - -public class CalculatePageRank { - - private final String wikilinks="../pagelinks_en.nt"; - private final String labels="../articles_label_en.nt"; - private final String categories="../yago_en.nt"; - - private void calculateLinks() - { - try{ - Statement stmt; - ResultSet rs; - int number; - - Class.forName("com.mysql.jdbc.Driver"); - - String url = - "jdbc:mysql://localhost:3306/navigator_db"; - - Connection con = DriverManager.getConnection( - url,"navigator", "dbpedia"); - - stmt = con.createStatement(); - BufferedReader in = new BufferedReader(new FileReader(wikilinks)); - - String line; - String[] split; - String name; - int i=0; - while ((line=in.readLine())!=null) - { - split=line.split(" "); - name=split[2].substring(1, split[2].length()-1); - rs=stmt.executeQuery("SELECT number FROM rank WHERE name='"+name+"'"); - if (rs.next()){ - number=rs.getInt(1); - number++; - stmt.executeUpdate("UPDATE rank SET number="+number+" WHERE name='"+name+"'"); - } - else{ - stmt.executeUpdate("INSERT INTO rank (name,number) VALUES ('"+name+"',1)"); - } - if (i%100000==0) System.out.println(i); - i++; - } - - in.close(); - con.close(); - } catch (FileNotFoundException e) - { - System.out.println("File not found"); - } catch (IOException e) - { - System.out.println("IOException"); - } catch (Exception e) - { - e.printStackTrace(); - } - } - - private void addLabels() - { - try{ - Statement stmt; - ResultSet rs; - - Class.forName("com.mysql.jdbc.Driver"); - - String url = - "jdbc:mysql://localhost:3306/navigator_db"; - - Connection con = DriverManager.getConnection( - url,"navigator", "dbpedia"); - - stmt = con.createStatement(); - BufferedReader in = new BufferedReader(new FileReader(labels)); - - String line; - String[] split; - String name; - String label; - int i=0; - while ((line=in.readLine())!=null) - { - split=line.split(">"); - name=split[0].substring(1); - label=split[2].substring(split[2].indexOf("\"")+1, split[2].lastIndexOf("\"")); - rs=stmt.executeQuery("SELECT number FROM rank WHERE name='"+name+"'"); - if (rs.next()){ - stmt.executeUpdate("UPDATE rank SET label=\""+label+"\" WHERE name='"+name+"'"); - } - else{ - stmt.executeUpdate("INSERT INTO rank (name,label) VALUES ('"+name+"',\""+label+"\")"); - } - if (i%100000==0) System.out.println(i); - i++; - } - - in.close(); - con.close(); - } catch (FileNotFoundException e) - { - System.out.println("File not found"); - } catch (IOException e) - { - System.out.println("IOException"); - } catch (Exception e) - { - e.printStackTrace(); - } - } - - private void calculateCategories() - { - try{ - Statement stmt; - - Class.forName("com.mysql.jdbc.Driver"); - - String url = - "jdbc:mysql://localhost:3306/navigator_db"; - - Connection con = DriverManager.getConnection( - url,"navigator", "dbpedia"); - - stmt = con.createStatement(); - BufferedReader in = new BufferedReader(new FileReader(categories)); - - String line; - String[] split; - String name; - String label; - String pred; - int i=0; - while ((line=in.readLine())!=null) - { - split=line.split(">"); - name=split[0].substring(1); - pred=split[1].substring(2); - if (pred.equals("http://www.w3.org/2000/01/rdf-schema#label")) - label=split[2].substring(split[2].indexOf("\"")+1, split[2].lastIndexOf("\"")); - else - label=split[2].substring(2); - if (pred.equals("http://www.w3.org/2000/01/rdf-schema#label")){ - try{ - stmt.executeUpdate("INSERT INTO categories (category,label) VALUES (\""+name+"\",\""+label+"\")"); - }catch(Exception e) - {} - } - else{ - stmt.executeUpdate("UPDATE rank SET category=\""+label+"\" WHERE name=\""+name+"\""); - } - if (i%100000==0) System.out.println(i); - i++; - } - - in.close(); - con.close(); - } catch (FileNotFoundException e) - { - System.out.println("File not found"); - } catch (IOException e) - { - System.out.println("IOException"); - } catch (Exception e) - { - e.printStackTrace(); - } - } - - public static void main(String[] args){ - CalculatePageRank cal=new CalculatePageRank(); - //cal.calculateLinks(); - //cal.addLabels(); - cal.calculateCategories(); - } -} \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-08-19 14:20:39 UTC (rev 1099) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-08-19 14:28:27 UTC (rev 1100) @@ -47,9 +47,15 @@ // goal: display the data in a nice (DBpedia specific way), maybe similar to // dbpedia.org/search + //BUILD ARTICLE TITLE + if (strlen($triples['http://www.w3.org/2000/01/rdf-schema#label'][0]['value'])>0) + $artTitle=$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]['value']; + else + $artTitle=urldecode(str_replace("_"," ",substr (strrchr ($url, "/"), 1))); + // display a picture if there is one if(isset($triples['http://xmlns.com/foaf/0.1/depiction'])) - $content.='<img src="'.$triples['http://xmlns.com/foaf/0.1/depiction'][0]['value'].'" alt="Picture of '.$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]['value'].'" style="float:right; max-width:200px;" \>'; + $content.='<img src="'.$triples['http://xmlns.com/foaf/0.1/depiction'][0]['value'].'" alt="Picture of '.$artTitle.'" style="float:right; max-width:200px;" \>'; //display where it was redirected from, if it was redirected $redirect=""; @@ -104,9 +110,38 @@ $long=""; } - //BUILD ARTICLE TITLE - $artTitle=$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]['value']; + //display only one birthdate + $birthdates=array("http://dbpedia.org/property/dateOfBirth","http://dbpedia.org/property/birth"); + $date=false; + foreach ($birthdates as $dates){ + if ($date) unset($triples[$dates]); + if (isset($triples[$dates])&&!$date) $date=true; + } + //display foreign wiki pages + $languages=array('Deutsch'=>'http://dbpedia.org/property/wikipage-de' + ,'Espa%C3%B1ol'=>'http://dbpedia.org/property/wikipage-es' + ,'suomi'=>'http://dbpedia.org/property/wikipage-fi' + ,'Fran%C3%A7ais'=>'http://dbpedia.org/property/wikipage-fr' + ,'Italiano'=>'http://dbpedia.org/property/wikipage-it' + ,'%E6%97%A5%E6%9C%AC%E8%AA%9E'=>'http://dbpedia.org/property/wikipage-ja' + ,'Nederlands'=>'http://dbpedia.org/property/wikipage-nl' + ,'%E2%80%AANorsk (bokm%C3%A5l)'=>'http://dbpedia.org/property/wikipage-no' + ,'Polski'=>'http://dbpedia.org/property/wikipage-pl' + ,'Portugu%C3%AAs'=>'http://dbpedia.org/property/wikipage-pt' + ,'%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9'=>'http://dbpedia.org/property/wikipage-ru' + ,'Svenska'=>'http://dbpedia.org/property/wikipage-sv' + ,'%E4%B8%AD%E6%96%87'=>'http://dbpedia.org/property/wikipage-zh'); + + $pages=""; + foreach ($languages as $key=>$value){ + if (isset($triples[$value])){ + $pages.='<tr><td>'.urldecode($key).': </td><td><a href="'.$triples[$value][0]['value'].'" target="_blank">'.urldecode($triples[$value][0]['value']).'</a></td></tr>'; + unset($triples[$value]); + } + } + if (strlen($pages)>0) $content.='<br/><hr><h4>Wikipedia articles in different languages</h4><br/><table border="0">'.$pages.'</table>'; + // filter out uninteresting properties and properties which // have already been displayed unset($triples['http://xmlns.com/foaf/0.1/page']); @@ -121,11 +156,21 @@ unset($triples['http://www.w3.org/2004/02/skos/core#subject']); unset($triples['http://www.w3.org/2000/01/rdf-schema#label']); unset($triples['http://www.w3.org/2000/01/rdf-schema#comment']); + unset($triples['http://dbpedia.org/property/latSec']); + unset($triples['http://dbpedia.org/property/lonSec']); + unset($triples['http://dbpedia.org/property/lonDeg']); + unset($triples['http://dbpedia.org/property/latMin']); + unset($triples['http://dbpedia.org/property/lonMin']); + unset($triples['http://dbpedia.org/property/latDeg']); + unset($triples['http://dbpedia.org/property/lonMin']); - $content.='<br/><hr><h4>Remaining Triples</h4><br/>'; - // display the remaining properties as list which can be used for further navigation - $content .= get_triple_table($triples); + if (count($triples)>0){ + $content.='<br/><hr><h4>Remaining Triples</h4><br/>'; + + // display the remaining properties as list which can be used for further navigation + $content .= get_triple_table($triples); + } //Restart the Session session_start(); Added: trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-08-19 14:28:27 UTC (rev 1100) @@ -0,0 +1,35 @@ +<?php + include('helper_functions.php'); + + $category=$_POST['category']; + $label=$_POST['label']; + $number=$_POST['number']; + + //initialise content + $content=""; + $bestsearches=""; + + mysql_connect('localhost','navigator','dbpedia'); + mysql_select_db("navigator_db"); + $query="SELECT name, label FROM rank WHERE category='$category' ORDER BY number DESC LIMIT ".$number; + $res=mysql_query($query); + $bestsearches=""; + if (mysql_num_rows($res)>0){ + $names=array(); + $labels=array(); + while ($result=mysql_fetch_array($res)){ + $labels[]=$result['label']; + $names[]=$result['name']; + } + $content.=getCategoryResultsTable($names,$labels,$category,$label,$number); + $bestsearches=getBestSearches($names,$labels); + } + else + $content.="Your Search brought no results."; + + print $content; + print '$$'; + print "Searchresult for Category \"".$label."\""; + print '$$'; + print $bestsearches; +?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_search.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_search.php 2008-08-19 14:20:39 UTC (rev 1099) +++ trunk/src/dbpedia-navigator/ajax_search.php 2008-08-19 14:28:27 UTC (rev 1100) @@ -4,13 +4,7 @@ $label=$_POST['label']; $list=$_POST['list']; $number=$_POST['number']; - session_start(); - $id=$_SESSION['id']; - $ksID=$_SESSION['ksID']; - session_write_close(); - - setRunning($id,"true"); - + //get parts of the list $checkedInstances=preg_split("[,]",$list,-1,PREG_SPLIT_NO_EMPTY); Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-08-19 14:20:39 UTC (rev 1099) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-08-19 14:28:27 UTC (rev 1100) @@ -68,8 +68,9 @@ { $name=$names[$i*25+$j]; $label=$labels[$i*25+$j]; + if (strlen($label)==0) $label=urldecode(str_replace("_"," ",substr (strrchr ($name, "/"), 1))); $class=$classes[$i*25+$j]; - $ret.='<p style="display:'.$display.'"> '.($i*25+$j+1).'. <a href="" class="'.$class.'" onclick="get_article(\'label='.$name.'&cache=-1\');return false;">'.$label.'</a></p>'; + $ret.='<p style="display:'.$display.'"> '.($i*25+$j+1).'. <a href="" class="'.$class.'" onclick="get_article(\'label='.$name.'&cache=-1\');return false;">'.utf8_to_html($label).'</a></p>'; } $i++; $display="none"; @@ -88,6 +89,61 @@ return $ret; } +function utf8_to_html($string) +{ + $string=str_replace("u00C4","Ä",$string); + $string=str_replace("u00D6","Ö",$string); + $string=str_replace("u00DC","Ü",$string); + $string=str_replace("u00E4","ä",$string); + $string=str_replace("u00F6","ö",$string); + $string=str_replace("u00FC","ü",$string); + $string=str_replace("u0161","š",$string); + + return $string; +} + +function getCategoryResultsTable($names,$labels,$category,$catlabel,$number) +{ + $ret="<p>These are your Searchresults. Show best "; + for ($k=10;$k<125;){ + $ret.="<a href=\"#\" onclick=\"getSubjectsFromCategory('category=".$category."&label=".$catlabel."&number=".$k."');return false;\""; + if ($k==$number) $ret.=" style=\"text-decoration:none;\""; + else $ret.=" style=\"text-decoration:underline;\""; + $ret.=">".($k)."</a>"; + if ($k!=100) $ret.=" | "; + if($k==10) $k=25; + else $k=$k+25; + } + $ret.="</p><br/>"; + $i=0; + $display="block"; + $ret.="<div id=\"results\">"; + while($i*25<count($names)) + { + for ($j=0;($j<25)&&(($i*25+$j)<count($names));$j++) + { + $name=$names[$i*25+$j]; + $label=$labels[$i*25+$j]; + if (strlen($label)==0) $label=urldecode(str_replace("_"," ",substr (strrchr ($name, "/"), 1))); + $ret.='<p style="display:'.$display.'"> '.($i*25+$j+1).'. <a class="all" href="" onclick="get_article(\'label='.$name.'&cache=-1\');return false;">'.utf8_to_html($label).'</a></p>'; + } + $i++; + $display="none"; + } + $ret.='<input type="hidden" id="hidden_class" value="all"/><input type="hidden" id="hidden_number" value="0"/></div><br/><p style="width:100%;text-align:center;" id="sitenumbers">'; + for ($k=0;$k<$i;$k++){ + $ret.="<span>"; + if ($k!=0) $ret.=" | "; + $ret.="<a href=\"#\" onclick=\"document.getElementById('hidden_number').value='".(25*$k)."';show_results(document.getElementById('hidden_class').value,".(25*$k).");\""; + if ($k==0) $ret.=" style=\"text-decoration:none;\""; + else $ret.=" style=\"text-decoration:underline;\""; + $ret.=">".($k+1)."</a>"; + $ret.="</span>"; + } + $ret.="</p>"; + return $ret; +} + function getBestSearches($names,$labels) { $ret="<div id=\"best-results\">"; @@ -95,7 +151,8 @@ { $name=$names[$j]; $label=$labels[$j]; - $ret.=' '.($j+1).'. <a href="" onclick="get_article(\'label='.$name.'&cache=-1\');return false;">'.$label.'</a><br/>'; + if (strlen($label)==0) $label=urldecode(str_replace("_"," ",substr (strrchr ($name, "/"), 1))); + $ret.=' '.($j+1).'. <a href="" onclick="get_article(\'label='.$name.'&cache=-1\');return false;">'.utf8_to_html($label).'</a><br/>'; } $ret.="</div>"; return $ret; @@ -117,17 +174,17 @@ function get_triple_table($triples) { - $table = '<table border="0"><tr><td>predicate</td><td>object</td></tr>'; + $table = '<table border="0"><tr><td><b>Predicate</b></td><td><b>Object</b></td></tr>'; $i=1; foreach($triples as $predicate=>$object) { if ($i>0) $backgroundcolor="eee"; else $backgroundcolor="ffffff"; - $table .= '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'">'.nicePredicate($predicate).'</a></td>'; + $table .= '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'" target="_blank">'.nicePredicate($predicate).'</a></td>'; $table .= '<td><ul>'; foreach($object as $element) { if ($element['type']=="uri"){ - if (strpos($element['value'],"http://dbpedia.org/resource/")===0&&substr_count($element['value'],"/")==4) $table .= '<li><a href="#" onclick="get_article(\'label='.$element['value'].'&cache=-1\');return false;">'.$element['value'].'</a></li>'; - else $table .= '<li><a href="'.$element['value'].'" target="_blank">'.$element['value'].'</a></li>'; + if (strpos($element['value'],"http://dbpedia.org/resource/")===0&&substr_count($element['value'],"/")==4) $table .= '<li><a href="#" onclick="get_article(\'label='.$element['value'].'&cache=-1\');return false;">'.urldecode($element['value']).'</a></li>'; + else $table .= '<li><a href="'.$element['value'].'" target="_blank">'.urldecode($element['value']).'</a></li>'; } else $table .= '<li>'.$element['value'].'</li>'; } @@ -161,32 +218,41 @@ case "http://www.w3.org/2003/01/geo/wgs84_pos": $namespace="geo"; break; case "http://www.w3.org/2004/02/skos/core": $namespace="skos"; + break; + case "http://www.georss.org/georss/point": $namespace="georss"; break; } - return $namespace.':'.$name; + //fl\xE4che has strange url + $name=str_replace('fl_percent_C3_percent_A4che','fl%C3%A4che',$name); + return $namespace.':'.urldecode($name); } function formatClassArray($ar) { - if ($ar[0]['value']!="http://xmlns.com/foaf/0.1/Person") $string = formatClass($ar[0]['value']); - for($i=1; $i<count($ar); $i++) { - if ($ar[0]['value']!="http://xmlns.com/foaf/0.1/Person"||$i>1) $string .= ', ' . formatClass($ar[$i]['value']); - else $string .= formatClass($ar[$i]['value']); + mysql_connect('localhost','navigator','dbpedia'); + mysql_select_db("navigator_db"); + $string=""; + for($i=0; $i<count($ar); $i++) { + $query="SELECT label FROM categories WHERE category='".$ar[$i]['value']."' LIMIT 1"; + $res=mysql_query($query); + $result=mysql_fetch_array($res); + if ($ar[$i]['value']!="http://xmlns.com/foaf/0.1/Person"&&strlen($string)>0) $string .= ', ' . formatClass($ar[$i]['value'],$result['label']); + else if ($ar[$i]['value']!="http://xmlns.com/foaf/0.1/Person"&&strlen($string)==0) $string .= formatClass($ar[$i]['value'],$result['label']); } return $string; } // format a class nicely, i.e. link to it and possibly display // it in a better way -function formatClass($className) { +function formatClass($className,$label) { $yagoPrefix = 'http://dbpedia.org/class/yago/'; if(substr($className,0,30)==$yagoPrefix) { - return '<a href="'.$className.'">'.substr($className,30).'</a>'; + return '<a href="#" onclick="getSubjectsFromCategory(\'category='.$className.'&label='.$label.'&number=10\');">'.$label.'</a>'; // DBpedia is Linked Data, so it makes always sense to link it // ToDo: instead of linking to other pages, the resource should better // be openened within DBpedia Navigator } else if(substr($className,0,14)=='http://dbpedia') { - return '<a href="'.$className.'">'.$className.'</a>'; + return '<a href="'.$className.'" target="_blank">'.$className.'</a>'; } else { return $className; } Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-08-19 14:20:39 UTC (rev 1099) +++ trunk/src/dbpedia-navigator/index.php 2008-08-19 14:28:27 UTC (rev 1100) @@ -110,7 +110,8 @@ tree.setOnClickHandler(doOnClick); function doOnClick(nodeId){ var myUrl = tree.getUserData(nodeId,"myurl"); - getSubjectsFromConcept('concept='+myUrl); + var myLabel = tree.getUserData(nodeId,"mylabel"); + getSubjectsFromCategory('category='+myUrl+'&label='+myLabel+'&number=10'); } function myErrorHandler(type, desc, erData){ alert('An error occured while trying to navigate through Class Tree.\nPlease try again later.'); @@ -152,19 +153,19 @@ <div id="rightSidebar"> <div class="box"> - <div class="boxtitlewithbutton" id="positivesboxtitle">search relevant <a href="#"><img src="<?php print $path;?>images/remove.png" onclick="clearPositives()" /></a> </div> + <div class="boxtitlewithbutton" id="positivesboxtitle" style="cursor:help;" title="The shown articles are considered when generating navigation tips.">search relevant <a href="#"><img src="<?php print $path;?>images/remove.png" onclick="clearPositives()" title="Delete all articles of interest."/></a> </div> <div class="boxcontent" id="Positives"> </div> <!-- boxcontent --> </div> <!-- box --> <div class="box"> - <div class="boxtitlewithbutton" id="negativesboxtitle">not relevant <a href="#"><img src="<?php print $path;?>images/remove.png" onclick="clearNegatives()" /></a> </div> + <div class="boxtitlewithbutton" id="negativesboxtitle" style="cursor:help;" title="The shown articles are avoided when generating navigation tips.">not relevant <a href="#"><img src="<?php print $path;?>images/remove.png" onclick="clearNegatives()" title="Delete all avoided articles."/></a> </div> <div class="boxcontent" id="Negatives"> </div> <!-- boxcontent --> </div> <!-- box --> <div class="box" id="LastArticlesBox" style="display:none"> - <div class="boxtitle">Articles Last Viewed</div> + <div class="boxtitle" style="cursor:help;" title="Up to 5 articles, that were last displayed, are shown here.">Articles Last Viewed</div> <div class="boxcontent" id="lastarticles"> </div> <!-- boxcontent --> </div> <!-- box --> Modified: trunk/src/dbpedia-navigator/js/ajax.js =================================================================== --- trunk/src/dbpedia-navigator/js/ajax.js 2008-08-19 14:20:39 UTC (rev 1099) +++ trunk/src/dbpedia-navigator/js/ajax.js 2008-08-19 14:28:27 UTC (rev 1100) @@ -295,28 +295,58 @@ XhrObj.send(); } - function getSubjectsFromConcept(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } +function getSubjectsFromConcept(param) +{ + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } - XhrObj.open("POST",'ajax_get_subjects_from_concept.php'); + XhrObj.open("POST",'ajax_get_subjects_from_concept.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('articlecontent').innerHTML=response[0]; + document.getElementById('ArticleTitle').innerHTML=response[1]; + } + } - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('articlecontent').innerHTML=response[0]; - document.getElementById('ArticleTitle').innerHTML=response[1]; - } + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); +} + +function getSubjectsFromCategory(param) +{ + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_get_subjects_from_category.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('articlecontent').innerHTML=response[0]; + document.getElementById('ArticleTitle').innerHTML=response[1]; + if (response[2].length>0){ + document.getElementById('searchcontent').innerHTML=response[2]; + document.getElementById('SearchResultBox').style.display='block'; } + } + } - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } \ No newline at end of file + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); +} \ No newline at end of file Modified: trunk/src/dbpedia-navigator/processTreeMenu.php =================================================================== --- trunk/src/dbpedia-navigator/processTreeMenu.php 2008-08-19 14:20:39 UTC (rev 1099) +++ trunk/src/dbpedia-navigator/processTreeMenu.php 2008-08-19 14:28:27 UTC (rev 1100) @@ -17,7 +17,7 @@ foreach ($categories as $category){ if ($category['subclasses']=="0") $child=0; else $child=1; - print("<item child=\"".$child."\" id=\"".$category['value']."\" text=\"".$category['label']."\"><userdata name=\"myurl\">".$category['value']."</userdata></item>"); + print("<item child=\"".$child."\" id=\"".$category['value']."\" text=\"".$category['label']."\"><userdata name=\"myurl\">".$category['value']."</userdata><userdata name=\"mylabel\">".$category['label']."</userdata></item>"); } } print("</tree>"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |