You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(120) |
Sep
(36) |
Oct
(116) |
Nov
(17) |
Dec
(44) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(143) |
Feb
(192) |
Mar
(74) |
Apr
(84) |
May
(105) |
Jun
(64) |
Jul
(49) |
Aug
(120) |
Sep
(159) |
Oct
(156) |
Nov
(51) |
Dec
(28) |
2009 |
Jan
(17) |
Feb
(55) |
Mar
(33) |
Apr
(57) |
May
(54) |
Jun
(28) |
Jul
(6) |
Aug
(16) |
Sep
(38) |
Oct
(30) |
Nov
(26) |
Dec
(52) |
2010 |
Jan
(7) |
Feb
(91) |
Mar
(65) |
Apr
(2) |
May
(14) |
Jun
(25) |
Jul
(38) |
Aug
(48) |
Sep
(80) |
Oct
(70) |
Nov
(75) |
Dec
(77) |
2011 |
Jan
(68) |
Feb
(53) |
Mar
(51) |
Apr
(35) |
May
(65) |
Jun
(101) |
Jul
(29) |
Aug
(230) |
Sep
(95) |
Oct
(49) |
Nov
(110) |
Dec
(63) |
2012 |
Jan
(41) |
Feb
(42) |
Mar
(25) |
Apr
(46) |
May
(51) |
Jun
(44) |
Jul
(45) |
Aug
(29) |
Sep
(12) |
Oct
(9) |
Nov
(17) |
Dec
(2) |
2013 |
Jan
(12) |
Feb
(14) |
Mar
(7) |
Apr
(16) |
May
(54) |
Jun
(27) |
Jul
(11) |
Aug
(5) |
Sep
(85) |
Oct
(27) |
Nov
(37) |
Dec
(32) |
2014 |
Jan
(8) |
Feb
(29) |
Mar
(5) |
Apr
(3) |
May
(22) |
Jun
(3) |
Jul
(4) |
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
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. |
From: <Jen...@us...> - 2008-08-19 14:20:43
|
Revision: 1099 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1099&view=rev Author: JensLehmann Date: 2008-08-19 14:20:39 +0000 (Tue, 19 Aug 2008) Log Message: ----------- fix for #1931147 Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-08-19 09:58:22 UTC (rev 1098) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-08-19 14:20:39 UTC (rev 1099) @@ -29,6 +29,7 @@ import org.apache.log4j.Level; import org.apache.log4j.Logger; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblem; @@ -52,6 +53,7 @@ import org.dllearner.refinementoperators.RhoDRDown; import org.dllearner.utilities.Files; import org.dllearner.utilities.Helper; +import org.dllearner.reasoning.ReasonerType; /** * The DL-Learner learning algorithm component for the example @@ -271,8 +273,12 @@ * @see org.dllearner.core.Component#init() */ @Override - public void init() { + public void init() throws ComponentInitException { + if(rs.getReasonerType() == ReasonerType.DIG) { + throw new ComponentInitException("DIG does not support the inferences needed in the selected learning algorithm component: " + getName()); + } + logger.setLevel(Level.toLevel(logLevel,Level.toLevel(CommonConfigOptions.logLevelDefault))); if(searchTreeFile == null) searchTreeFile = new File(defaultSearchTreeFile); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Jen...@us...> - 2008-08-19 09:58:27
|
Revision: 1098 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1098&view=rev Author: JensLehmann Date: 2008-08-19 09:58:22 +0000 (Tue, 19 Aug 2008) Log Message: ----------- updated PHP example to show how to ignore a concept Modified Paths: -------------- trunk/src/php-examples/LearningSimple.php Modified: trunk/src/php-examples/LearningSimple.php =================================================================== --- trunk/src/php-examples/LearningSimple.php 2008-08-18 20:35:55 UTC (rev 1097) +++ trunk/src/php-examples/LearningSimple.php 2008-08-19 09:58:22 UTC (rev 1098) @@ -42,7 +42,7 @@ // load owl file in DIG reasoner (you need a running DIG reasoner) $id = $client->generateID(); $ksID = $client->addKnowledgeSource($id, "owlfile", $ontology); -$rID = $client->setReasoner($id, "owlapi"); +$rID = $client->setReasoner($id, "fastInstanceChecker"); // create a learning problem $posExamples = array('http://example.com/father#stefan', @@ -56,7 +56,9 @@ $client->setNegativeExamples($id, $negExamples); // choose refinement operator approach -$client->setLearningAlgorithm($id, "refinement"); +$la_id = $client->setLearningAlgorithm($id, "refexamples"); +// you can add the following to apply a config option to a component, e.g. ignore a concept +$client->applyConfigEntryStringArray($id, $la_id, "ignoredConcepts", array('http://example.com/father#female')); $client->initAll($id); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-08-18 20:36:05
|
Revision: 1097 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1097&view=rev Author: kurzum Date: 2008-08-18 20:35:55 +0000 (Mon, 18 Aug 2008) Log Message: ----------- improved sparql aquisition almost there Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitorImproved.java trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java Modified: trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitorImproved.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitorImproved.java 2008-08-18 15:42:55 UTC (rev 1096) +++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitorImproved.java 2008-08-18 20:35:55 UTC (rev 1097) @@ -19,13 +19,22 @@ */ package org.dllearner.kb.aquisitors; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.SortedSet; +import java.util.TreeSet; import org.apache.log4j.Logger; import org.dllearner.kb.sparql.SPARQLTasks; import org.dllearner.kb.sparql.SparqlQueryMaker; import org.dllearner.utilities.datastructures.RDFNodeTuple; +import com.hp.hpl.jena.query.ResultSetFormatter; +import com.hp.hpl.jena.rdf.model.RDFNode; +import com.hp.hpl.jena.sparql.core.ResultBinding; +import com.hp.hpl.jena.sparql.resultset.ResultSetRewindable; + /** * Can execute different queries. * @@ -36,23 +45,81 @@ @SuppressWarnings("unused") private static Logger logger = Logger.getLogger(SparqlTupelAquisitorImproved.class); + private Map<String,SortedSet<RDFNodeTuple>> resources = new HashMap<String, SortedSet<RDFNodeTuple>>(); + int recursionDepth; - public SparqlTupelAquisitorImproved(SparqlQueryMaker sparqlQueryMaker, SPARQLTasks sparqlTasks) { + public SparqlTupelAquisitorImproved(SparqlQueryMaker sparqlQueryMaker, SPARQLTasks sparqlTasks, int recursionDepth) { super(sparqlQueryMaker, sparqlTasks); + this.recursionDepth = recursionDepth; } // standard query get a tupels (p,o) for subject s +// standard query get a tupels (p,o) for subject s @Override public SortedSet<RDFNodeTuple> getTupelForResource(String uri) { + checkURIforValidity(uri); + String sparqlQueryString = ""; + String pred = "predicate"; + String obj = "object"; - throw new RuntimeException("not implemented yet"); - + // getQuery + if (classMode) { + + + sparqlQueryString = sparqlQueryMaker.makeClassQueryUsingFilters(uri); + return sparqlTasks.queryAsRDFNodeTuple(sparqlQueryString, pred, obj); + } + + SortedSet<RDFNodeTuple> cachedSet = resources.get(uri); + if(cachedSet!=null) { + return cachedSet; + } + + //SortedSet<RDFNodeTuple> tmp = new TreeSet<RDFNodeTuple>(); + sparqlQueryString = sparqlQueryMaker.makeSubjectQueryLevel(uri, recursionDepth); + ResultSetRewindable rsw= sparqlTasks.queryAsResultSet(sparqlQueryString); + @SuppressWarnings("unchecked") + List<ResultBinding> l = ResultSetFormatter.toList(rsw); + rsw.reset(); + + int resultsetcount = 0; + int i = 0; + for (ResultBinding binding : l) { + i=0; + RDFNode nextURI = binding.get(obj+i); + add(uri, new RDFNodeTuple(binding.get(pred+i), nextURI )); + + for (i=1; i < recursionDepth; i++) { + RDFNode tmpURI = binding.get(obj+i); + add(nextURI.toString(), new RDFNodeTuple(binding.get(pred+i),tmpURI)); + logger.trace("For: "+nextURI.toString()+ " added :"+resources.get(nextURI.toString())); + nextURI = tmpURI; + } + + resultsetcount++; + } + + if(resultsetcount>999) { + logger.warn("SparqlTupelAquisitor retrieved more than 1000 results, there might some be missing"); + } + return resources.get(uri); + + //return sparqlTasks.queryAsRDFNodeTuple(sparqlQueryString, pred, obj); } - - + private void add(String uri, RDFNodeTuple tuple){ + SortedSet<RDFNodeTuple> set = resources.get(uri); + if(set==null){ + set = new TreeSet<RDFNodeTuple>(); + set.add(tuple); + resources.put(uri, set ); + }else { + set.add(tuple); + } + } + } Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java 2008-08-18 15:42:55 UTC (rev 1096) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java 2008-08-18 20:35:55 UTC (rev 1097) @@ -59,7 +59,7 @@ for (String str : s) { nt.append(str + "\n"); } - System.out.println("sizeofStringBuffer"+nt.length()); + logger.info("sizeofStringBuffer"+nt.length()); return nt.toString(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-08-18 15:42:58
|
Revision: 1096 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1096&view=rev Author: sknappe Date: 2008-08-18 15:42:55 +0000 (Mon, 18 Aug 2008) Log Message: ----------- now links in the tripel list can be used to see other articles, for example Angela Merkel->birthplace leads to the article Germany Modified Paths: -------------- trunk/src/dbpedia-navigator/helper_functions.php Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-08-18 15:33:18 UTC (rev 1095) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-08-18 15:42:55 UTC (rev 1096) @@ -125,7 +125,10 @@ $table .= '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'">'.nicePredicate($predicate).'</a></td>'; $table .= '<td><ul>'; foreach($object as $element) { - if ($element['type']=="uri") $table .= '<li><a href="'.$element['value'].'" target="_blank">'.$element['value'].'</a></li>'; + 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>'; + } else $table .= '<li>'.$element['value'].'</li>'; } $table .= '</ul></td>'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-08-18 15:33:24
|
Revision: 1095 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1095&view=rev Author: sknappe Date: 2008-08-18 15:33:18 +0000 (Mon, 18 Aug 2008) Log Message: ----------- changed look of articel, added some helpful tooltips, added best search results on left side, last articles is working, changed error messages and some other stuff Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php 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 Added Paths: ----------- trunk/src/dbpedia-navigator/images/dbpedia-favicon.ico trunk/src/dbpedia-navigator/images/flickr.png trunk/src/dbpedia-navigator/js/ trunk/src/dbpedia-navigator/js/ajax.js Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-08-15 17:55:39 UTC (rev 1094) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-08-18 15:33:18 UTC (rev 1095) @@ -129,10 +129,11 @@ function getTriples($uri) { + //i am filtering the references out at the moment, because they are causing errors with URL with ...&profile=bla, the XMLParser thinks &profile is a HTML-Entitie and misses the ; $query="SELECT ?pred ?obj ". "WHERE {{<".$uri."> ?pred ?obj.Filter(!regex(str(?pred),'http://dbpedia.org/property/reference'))}UNION{<".$uri."> <http://dbpedia.org/property/redirect> ?Conc.?Conc ?pred ?obj.Filter(!regex(str(?pred),'http://dbpedia.org/property/reference'))}}"; $result=json_decode($this->getSparqlResultThreaded($query),true); - if (count($result['results']['bindings'])==0) throw new Exception("Your query brought no result. The Label-Search is started."); + if (count($result['results']['bindings'])==0) throw new Exception("An article with that name does not exist. The Search is started ..."); $ret=array(); foreach ($result['results']['bindings'] as $results){ $value=$results['obj']; @@ -181,6 +182,8 @@ return $result; } + //at the moment the subject search uses a database, so this function is not needed + /* function getSubjects($label,$checkedInstances) { $offset=1; @@ -235,7 +238,7 @@ $return['tagcloud']=$tagcloud; $return['tagcloudlabel']=$tagcloudLabel; return $return; - } + }*/ function getSubjectsFromConcept($concept) { Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-08-15 17:55:39 UTC (rev 1094) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-08-18 15:33:18 UTC (rev 1095) @@ -5,6 +5,8 @@ $subject=$_POST['label']; $fromCache=$_POST['cache']; + if (isset($_POST['path'])) $path=$_POST['path']; + else $path=""; if (isset($_SESSION['articles'])) $articles=$_SESSION['articles']; $id=$_SESSION['id']; @@ -19,7 +21,7 @@ if (isset($articles)){ foreach ($articles as $key => $value) { - if ($value['subject']==$subject){ + if ($value['uri']==$uri){ $fromCache=$key; break; } @@ -32,7 +34,6 @@ $artTitle=""; //get the article - //if $fromCache is -2, no new SearchResults should be processed //if $fromCache is -1, everything is normal //if $fromCache is >=0, the article is taken out of the cache if ($fromCache<0) { @@ -48,7 +49,7 @@ // 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 '.$subject.'" style="float:right; max-width:200px;" \>'; + $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;" \>'; //display where it was redirected from, if it was redirected $redirect=""; @@ -62,38 +63,47 @@ // give the link to the corresponding Wikipedia article if(isset($triples['http://xmlns.com/foaf/0.1/page'])) - $content .= '<p><img src="'.$_GET['path'].'images/wikipedia_favicon.png" alt="Wikipedia" /> <a href="'.$triples['http://xmlns.com/foaf/0.1/page'][0]['value'].'">view Wikipedia article</a>, '; - $content .= '<a href="'.$uri.'">view DBpedia resource description</a></p>'; - + $content .= '<p><img src="'.$path.'images/wikipedia_favicon.png" alt="Wikipedia" style="max-width:20px;" /> <a href="#" onclick="window.open(\''.getPrintableURL($triples['http://xmlns.com/foaf/0.1/page'][0]['value']).'\',\'Wikiwindow\',\'width=800,height=500,top=50,left=50,scrollbars=yes\');">view Wikipedia article</a>, '; + $content .= '<img src="'.$path.'images/dbpedia-favicon.ico" alt="DBpedia" style="max-width:20px;"/> <a href="#" onclick="window.open(\''.$uri.'\',\'Wikiwindow\',\'width=800,height=500,top=50,left=50,scrollbars=yes\');">view DBpedia resource description</a>'; + //display photo collection, if there is one + if (isset($triples['http://dbpedia.org/property/hasPhotoCollection'])){ + $content.=', <img src="'.$path.'images/flickr.png" alt="Flickr" style="max-width:20px;" /> <a href="#" onclick="window.open(\''.$triples['http://dbpedia.org/property/hasPhotoCollection'][0]['value'].'\',\'Wikiwindow\',\'width=800,height=500,top=50,left=50,scrollbars=yes\');">view photo collection</a></p>'; + } + + $content.='<br/><hr><h4>Classes and Categories</h4><br/>'; + // display a list of classes if(isset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'])) - $content .= '<p>classes: '.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; - - if(isset($triples['http://dbpedia.org/property/reference'])) { + $content .= '<p>Yago classes: '.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; + + //skos-subjects + if (isset($triples['http://www.w3.org/2004/02/skos/core#subject'])){ + $content .= '<br/><p>Skos categories: <ul>'; + foreach($triples['http://www.w3.org/2004/02/skos/core#subject'] as $skos) + $content .= '<li><a href="'.$skos['value'].'">'.$skos['value'].'</a></li>'; + $content .= '</ul></p>'; + } + + //not used at the moment + /*if(isset($triples['http://dbpedia.org/property/reference'])) { $content .= '<p>references: <ul>'; foreach($triples['http://dbpedia.org/property/reference'] as $reference) $content .= '<li><a href="'.$reference['value'].'">'.$reference['value'].'</a></li>'; $content .= '</ul></p>'; - } + }*/ //display a Google Map if Geo-koordinates are available if (isset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'])&&isset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'])){ - $content.="<br/><img src=\"".$_GET['path']."images/mobmaps_googlemapsicon.jpg\" alt=\"Google Maps\" style=\"max-width:25px;\" /> <a href=\"\" onClick=\"loadGoogleMap(".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'][0]['value'].",".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'][0]['value'].",'".$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]['value']."');return false;\">Toggle a map of the location</a><br/><br/><div id=\"map\" style=\"width: 500px; height: 300px;display:none;\"></div>"; + $content.='<br/><hr><h4>Map of the location</h4><br/>'; + $content.='<div id="map" style="width: 500px; height: 300px;margin-left:30px;"></div>'; + $lat=$triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'][0]['value']; + $long=$triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'][0]['value']; } - - //display photo collection, if there is one - if (isset($triples['http://dbpedia.org/property/hasPhotoCollection'])){ - $content.="<br/><img src=\"".$_GET['path']."images/flickr.jpg\" alt=\"Flickr\" style=\"max-width:25px;\" /> <a href=\"".$triples['http://dbpedia.org/property/hasPhotoCollection'][0]['value']."\">view a photo collection</a><br/>"; + else{ + $lat=""; + $long=""; } - //skos-subjects - if (isset($triples['http://www.w3.org/2004/02/skos/core#subject'])){ - $content .= '<br/><p>skos subjects: <ul>'; - foreach($triples['http://www.w3.org/2004/02/skos/core#subject'] as $skos) - $content .= '<li><a href="'.$skos['value'].'">'.$skos['value'].'</a></li>'; - $content .= '</ul></p>'; - } - //BUILD ARTICLE TITLE $artTitle=$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]['value']; @@ -110,15 +120,18 @@ unset($triples['http://dbpedia.org/property/hasPhotoCollection']); 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']); + $content.='<br/><hr><h4>Remaining Triples</h4><br/>'; + // display the remaining properties as list which can be used for further navigation - $content .= '<br/><br/><br/>'.get_triple_table($triples); + $content .= get_triple_table($triples); //Restart the Session session_start(); //store article in session, to navigate between last 5 articles quickly - $contentArray=array('content' => $content,'subject' => $artTitle); + $contentArray=array('content' => $content,'subject' => $artTitle,'uri' => $uri); if (!isset($_SESSION['nextArticle'])){ $_SESSION['nextArticle']=0; $_SESSION['articles']=array(); @@ -146,8 +159,7 @@ } catch (Exception $e) { $content=$e->getMessage(); - $artTitle="No Result"; - //$objResponse->call('xajax_getsubjects',$subject); + $artTitle="Article not found"; } } else { @@ -161,7 +173,7 @@ if (isset($_SESSION['articles'])){ foreach ($_SESSION['articles'] as $key => $value) { - $lastArticles.="<a href=\"\" onclick=\"xajax_getarticle('',".$key.");return false;\">".$value['subject']."</a><br/>"; + $lastArticles.="<a href=\"\" onclick=\"get_article('label=&cache=".$key."');return false;\">".$value['subject']."</a><br/>"; } } @@ -176,7 +188,11 @@ print '$$'; print $interests[0]; print '$$'; - print $interests[1]; + print $interests[1]; + print '$$'; + print $lat; + print '$$'; + print $long; //$objResponse->call('xajax_learnConcept'); ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_search.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_search.php 2008-08-15 17:55:39 UTC (rev 1094) +++ trunk/src/dbpedia-navigator/ajax_search.php 2008-08-18 15:33:18 UTC (rev 1095) @@ -21,33 +21,41 @@ mysql_select_db("navigator_db"); $query="SELECT name, label, category FROM rank WHERE MATCH (label) AGAINST ('$label') ORDER BY number DESC LIMIT ".$number; $res=mysql_query($query); - $names=array(); - $labels=array(); - $classes=array(); - $tags=array(); - $catlabels=array(); - while ($result=mysql_fetch_array($res)){ - $labels[]=$result['label']; - $names[]=$result['name']; - if (!isset($result['category'])){ - $result['category']="NoCategory"; - $result2['label']="No Category"; + $bestsearches=""; + if (mysql_num_rows($res)>0){ + $names=array(); + $labels=array(); + $classes=array(); + $tags=array(); + $catlabels=array(); + while ($result=mysql_fetch_array($res)){ + $labels[]=$result['label']; + $names[]=$result['name']; + if (!isset($result['category'])){ + $result['category']="NoCategory"; + $result2['label']="No Category"; + } + else + { + $query="SELECT label FROM categories WHERE category='".$result['category']."' LIMIT 1"; + $res2=mysql_query($query); + $result2=mysql_fetch_array($res2); + } + $classes[]=$result['category']; + if (!isset($tags[$result['category']])) $tags[$result['category']]=1; + else $tags[$result['category']]++; + if (!isset($catlabels[$result['category']])) $catlabels[$result['category']]=$result2['label']; } - else - { - $query="SELECT label FROM categories WHERE category='".$result['category']."' LIMIT 1"; - $res2=mysql_query($query); - $result2=mysql_fetch_array($res2); - } - $classes[]=$result['category']; - if (!isset($tags[$result['category']])) $tags[$result['category']]=1; - else $tags[$result['category']]++; - if (!isset($catlabels[$result['category']])) $catlabels[$result['category']]=$result2['label']; + $content.=getTagCloud($tags,$catlabels); + $content.=getResultsTable($names,$labels,$classes,$number); + $bestsearches=getBestSearches($names,$labels); } - $content.=getTagCloud($tags,$catlabels); - $content.=getResultsTable($names,$labels,$classes,$number); + else + $content.="Your Search brought no results."; print $content; print '$$'; print "Searchresult for \"".$label."\""; + print '$$'; + print $bestsearches; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-08-15 17:55:39 UTC (rev 1094) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-08-18 15:33:18 UTC (rev 1095) @@ -88,6 +88,25 @@ return $ret; } +function getBestSearches($names,$labels) +{ + $ret="<div id=\"best-results\">"; + for ($j=0;($j<10)&&$j<count($names);$j++) + { + $name=$names[$j]; + $label=$labels[$j]; + $ret.=' '.($j+1).'. <a href="" onclick="get_article(\'label='.$name.'&cache=-1\');return false;">'.$label.'</a><br/>'; + } + $ret.="</div>"; + return $ret; +} + +function getPrintableURL($url) +{ + $parts=explode('/',$url); + return $parts[0].'//'.$parts[2].'/w/index.php?title='.$parts[4].'&printable=yes'; +} + function setRunning($id,$running) { if(!is_dir("temp")) mkdir("temp"); @@ -106,7 +125,7 @@ $table .= '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'">'.nicePredicate($predicate).'</a></td>'; $table .= '<td><ul>'; foreach($object as $element) { - if ($element['type']=="uri") $table .= '<li><a href="'.$element['value'].'">'.$element['value'].'</a></li>'; + if ($element['type']=="uri") $table .= '<li><a href="'.$element['value'].'" target="_blank">'.$element['value'].'</a></li>'; else $table .= '<li>'.$element['value'].'</li>'; } $table .= '</ul></td>'; @@ -146,9 +165,10 @@ } function formatClassArray($ar) { - $string = formatClass($ar[0]['value']); + if ($ar[0]['value']!="http://xmlns.com/foaf/0.1/Person") $string = formatClass($ar[0]['value']); for($i=1; $i<count($ar); $i++) { - $string .= ', ' . formatClass($ar[$i]['value']); + if ($ar[0]['value']!="http://xmlns.com/foaf/0.1/Person"||$i>1) $string .= ', ' . formatClass($ar[$i]['value']); + else $string .= formatClass($ar[$i]['value']); } return $string; } @@ -179,14 +199,15 @@ function show_Interests($sess) { + $ret=array(); + $ret[0]=""; + $ret[1]=""; if (isset($sess['positive'])) foreach($sess['positive'] as $name=>$lab){ - $ret[0]=$lab." <a href=\"\" onclick=\"toNegative('subject=".$name."&label=".$lab."');return false;\"><img src=\"".$_GET['path']."images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"removePosInterest('subject=".$name."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; + $ret[0].=$lab." <a href=\"\" onclick=\"toNegative('subject=".$name."&label=".$lab."');return false;\"><img src=\"".$_GET['path']."images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"removePosInterest('subject=".$name."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; } - else $ret[0]=""; if (isset($sess['negative'])) foreach($sess['negative'] as $name=>$lab){ - $ret[1]=$lab." <a href=\"\" onclick=\"toPositive('subject=".$name."&label=".$lab."');return false;\"><img src=\"".$_GET['path']."images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"removeNegInterest('subject=".$name."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; + $ret[1].=$lab." <a href=\"\" onclick=\"toPositive('subject=".$name."&label=".$lab."');return false;\"><img src=\"".$_GET['path']."images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"removeNegInterest('subject=".$name."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; } - else $ret[1]=""; return $ret; } Property changes on: trunk/src/dbpedia-navigator/images/dbpedia-favicon.ico ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/src/dbpedia-navigator/images/flickr.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-08-15 17:55:39 UTC (rev 1094) +++ trunk/src/dbpedia-navigator/index.php 2008-08-18 15:33:18 UTC (rev 1095) @@ -17,18 +17,18 @@ require_once('Settings.php'); $settings=new Settings(); -/* + //what happens onLoad -$onLoad="onLoad=\""; +$onLoad="onLoad=\"document.getElementById('label').focus();"; if (isset($_GET['resource'])){ - $onLoad.="xajax_getarticle('".$_GET['resource']."',-1);"; + $onLoad.="get_article('label=".$_GET['resource']."&cache=-1');"; unset($_GET['resource']); } else if (isset($_SESSION['currentArticle'])){ - $onLoad.="xajax_getarticle('',".$_SESSION['currentArticle'].");"; + $onLoad.="get_article('label=&cache=".$_SESSION['currentArticle']."');"; } $onLoad.="\""; -*/ + echo '<?xml version="1.0" encoding="UTF-8"?>'; ?> @@ -45,351 +45,31 @@ type="text/javascript"></script> <script src="<?php print $path;?>treemenu/dhtmlxcommon.js"></script> <script src="<?php print $path;?>treemenu/dhtmlxtree.js"></script> + <script src="<?php print $path;?>js/ajax.js"></script> <script type="text/javascript"> - function showdiv(id){ - document.getElementById(id).style.display='block'; - } - - function hidediv(id) { - document.getElementById(id).style.display='none'; - } - + function setRunning(running) + { + if (running) document.getElementById('Loading').style.display='inline'; + else document.getElementById('Loading').style.display='none'; + } + function loadGoogleMap(Lat,Lng,Label) { - if (document.getElementById("map").style.display=="none"){ - document.getElementById("map").style.display='block'; - if (GBrowserIsCompatible()) { - // Create and Center a Map - var map = new GMap2(document.getElementById("map")); - map.setCenter(new GLatLng(Lat, Lng), 12); - map.addControl(new GLargeMapControl()); - map.addControl(new GMapTypeControl()); - var marker=new GMarker(new GLatLng(Lat, Lng)); - GEvent.addListener(marker, "click", function() { - marker.openInfoWindowHtml(Label); - }); - map.addOverlay(marker); - } - } - else { - document.getElementById("map").style.display='none'; + if (GBrowserIsCompatible()) { + // Create and Center a Map + var map = new GMap2(document.getElementById("map")); + map.setCenter(new GLatLng(Lat, Lng), 12); + map.addControl(new GLargeMapControl()); + map.addControl(new GMapTypeControl()); + var marker=new GMarker(new GLatLng(Lat, Lng)); + map.addOverlay(marker); } } - - function search_it(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_search.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.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function get_article(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_get_article.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]; - document.getElementById('lastarticles').innerHTML=response[2]; - document.getElementById('Positives').innerHTML=response[3]; - document.getElementById('Negatives').innerHTML=response[4]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function show_results(class, number) - { - var links=document.getElementById('results').getElementsByTagName('p'); - var j=0; - for (var i=0;i<links.length;i++){ - if (links[i].getElementsByTagName('a')[0].className==class||class=='all'){ - if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; - else links[i].style.display='none'; - j++; - } - else links[i].style.display='none'; - } - if (j<number){ - show_results(class,0); - return; - } - - var sitenumbers=document.getElementById('sitenumbers').getElementsByTagName('span'); - for (var i=0;i<sitenumbers.length;i++){ - if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25==number) sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='none'; - else sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='underline'; - if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25>=j) - sitenumbers[i].style.display='none'; - else - sitenumbers[i].style.display='inline'; - } - } - - function toPositive(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_to_positive.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('Positives').innerHTML=response[0]; - document.getElementById('Negatives').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function toNegative(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_to_negative.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('Positives').innerHTML=response[0]; - document.getElementById('Negatives').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function clearPositives() - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_clear_positives.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - document.getElementById('Positives').innerHTML = XhrObj.responseText; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(); - } - - function clearNegatives() - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_clear_negatives.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - document.getElementById('Negatives').innerHTML = XhrObj.responseText; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(); - } - - function removePosInterest(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_remove_pos_interest.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('Positives').innerHTML=response[0]; - document.getElementById('Negatives').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function removeNegInterest(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_remove_neg_interest.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('Positives').innerHTML=response[0]; - document.getElementById('Negatives').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function learnConcept() - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_learn_concepts.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('conceptlink').innerHTML=response[0]; - document.getElementById('ConceptInformation').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(); - } - - function stopServerCall() - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_stop_server_call.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(); - } - - 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.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); - } </script> </head> - <body> + <body <?php print $onLoad;?>> <!-- <h1>DBpedia Navigator</h1> --> -<div><table border="0" width="100%"><tr><td width="35%"><img src="<?php print $path;?>images/dbpedia_navigator.png" alt="DBpedia Navigator" style="padding:5px" /></td><td width="50%"><span id="conceptlink"></span></td><td width="15%"><span id="Loading" style="display:none">Server Call... <img src="<?php print $path;?>images/remove.png" onclick="xajax_stopServerCall();return false;" /></span></td></tr></table></div> +<div><table border="0" width="100%"><tr><td width="35%"><img src="<?php print $path;?>images/dbpedia_navigator.png" alt="DBpedia Navigator" style="padding:5px" /></td><td width="50%"><span id="conceptlink"></span></td><td width="15%"><span id="Loading" style="display:none">Server Call... <a href=""><img src="<?php print $path;?>images/remove.png" onclick="stopServerCall();return false;" /></a></span></td></tr></table></div> <div id="layer" style="display:none"> <div id="layerContent" style="display:none"></div> </div> @@ -398,26 +78,26 @@ <div id="leftSidebar"> <div class="box"> - <div class="boxtitle">Search DBpedia</div> + <div class="boxtitle" style="cursor:help;" title="Show an article or search for several articles in the DBpedia database.">Search DBpedia</div> <div class="boxcontent" id="search"> <!-- Search:<br/> --> - <form onSubmit="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;"> - <input type="text" name="label" id="label" /><br/> - <input type="button" value="Article" class="button" onclick="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;" /> <input type="button" value="Search" class="button" onclick="var list=tree.getAllChecked();search_it('label='+document.getElementById('label').value+'&list='+list+'&number=10');return false;" /> + <form onsubmit="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;"> + <input type="text" name="label" id="label"/><br/> + <input type="button" value="Article" class="button" onclick="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;" title="Search an article with that name."/> <input type="button" value="Search" class="button" onclick="var list=tree.getAllChecked();search_it('label='+document.getElementById('label').value+'&list='+list+'&number=10');return false;" title="Search a number of articles related to that name."/> <!-- <input type="button" value="Fulltext" class="button" onclick=""/> --> </form> </div> <!-- boxcontent --> </div> <!-- box --> <div class="box" id="SearchResultBox" style="display:none"> - <div class="boxtitle">Search Results</div> + <div class="boxtitle" style="cursor:help;" title="The best 10 Search Results are shown here.">Search Results</div> <div class="boxcontent"> <div id="searchcontent" style="display:block"></div> </div> <!-- boxcontent --> </div> <!-- box --> <div class="box" id="NavigationBox"> - <div class="boxtitle">Navigate</div> + <div class="boxtitle" style="cursor:help;" title="Navigate through the Class hierarchy and show instances of that class.">Navigate</div> <div class="boxcontent"> <div id="treeboxbox_tree" style="height:218px;overflow:auto;"> </div> @@ -430,8 +110,12 @@ tree.setOnClickHandler(doOnClick); function doOnClick(nodeId){ var myUrl = tree.getUserData(nodeId,"myurl"); - xajax_getSubjectsFromConcept(myUrl); + getSubjectsFromConcept('concept='+myUrl); } + function myErrorHandler(type, desc, erData){ + alert('An error occured while trying to navigate through Class Tree.\nPlease try again later.'); + } + dhtmlxError.catchError("ALL",myErrorHandler); tree.setXMLAutoLoading("processTreeMenu.php"); tree.loadXML("processTreeMenu.php?id=0"); </script> @@ -549,7 +233,7 @@ <div class="boxtitle">Detailed Concept Information</div> <div class="boxcontent" id="ConceptInformation"></div> </div> - + </body> </html> \ No newline at end of file Added: trunk/src/dbpedia-navigator/js/ajax.js =================================================================== --- trunk/src/dbpedia-navigator/js/ajax.js (rev 0) +++ trunk/src/dbpedia-navigator/js/ajax.js 2008-08-18 15:33:18 UTC (rev 1095) @@ -0,0 +1,322 @@ +function search_it(param) +{ + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_search.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); +} + +function get_article(param) +{ + setRunning(true); + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_get_article.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]; + document.getElementById('lastarticles').innerHTML=response[2]; + document.getElementById('Positives').innerHTML=response[3]; + document.getElementById('Negatives').innerHTML=response[4]; + setRunning(false); + if (response[1]=='Article not found'){ + setTimeout("var list=tree.getAllChecked();search_it('label='+document.getElementById('label').value+'&list='+list+'&number=10')",2000); + } + else + document.getElementById('LastArticlesBox').style.display='block'; + } + if (response[5].length>0&&response[6].length>0) + loadGoogleMap(response[5],response[6],''+response[1]); + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); +} + +function show_results(class, number) +{ + var links=document.getElementById('results').getElementsByTagName('p'); + var j=0; + for (var i=0;i<links.length;i++){ + if (links[i].getElementsByTagName('a')[0].className==class||class=='all'){ + if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; + else links[i].style.display='none'; + j++; + } + else links[i].style.display='none'; + } + if (j<number){ + show_results(class,0); + return; + } + + var sitenumbers=document.getElementById('sitenumbers').getElementsByTagName('span'); + for (var i=0;i<sitenumbers.length;i++){ + if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25==number) sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='none'; + else sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='underline'; + if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25>=j) + sitenumbers[i].style.display='none'; + else + sitenumbers[i].style.display='inline'; + } +} + +function toPositive(param) +{ + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_to_positive.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); +} + +function toNegative(param) +{ + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_to_negative.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); +} + + function clearPositives() + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_clear_positives.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + document.getElementById('Positives').innerHTML = XhrObj.responseText; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); + } + + function clearNegatives() + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_clear_negatives.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + document.getElementById('Negatives').innerHTML = XhrObj.responseText; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); + } + + function removePosInterest(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_remove_pos_interest.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + + function removeNegInterest(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_remove_neg_interest.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + + function learnConcept() + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_learn_concepts.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('conceptlink').innerHTML=response[0]; + document.getElementById('ConceptInformation').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); + } + + function stopServerCall() + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_stop_server_call.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); + } + + 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.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); + } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-08-15 17:55:47
|
Revision: 1094 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1094&view=rev Author: kurzum Date: 2008-08-15 17:55:39 +0000 (Fri, 15 Aug 2008) Log Message: ----------- added support fo datatypes, some options from the *.conf files might not work. everything else should be fine Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java trunk/src/dl-learner/org/dllearner/kb/extraction/LiteralNode.java trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorOtherRule.java trunk/src/dl-learner/org/dllearner/test/TestOneQueryForMusicRecommender.java trunk/src/dl-learner/org/dllearner/test/TripleTypeTest.java trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/kb/extraction/DatatypePropertyNode.java trunk/src/dl-learner/org/dllearner/kb/extraction/ObjectPropertyNode.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java 2008-08-15 15:39:55 UTC (rev 1093) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java 2008-08-15 17:55:39 UTC (rev 1094) @@ -24,6 +24,7 @@ import java.util.SortedSet; import java.util.TreeSet; +import org.apache.log4j.Logger; import org.dllearner.kb.aquisitors.TupelAquisitor; import org.dllearner.kb.manipulator.Manipulator; import org.dllearner.utilities.datastructures.RDFNodeTuple; @@ -35,7 +36,13 @@ * @author Sebastian Hellmann */ public class ClassNode extends Node { - SortedSet<PropertyNode> properties = new TreeSet<PropertyNode>(); + + @SuppressWarnings("unused") + private static Logger logger = Logger + .getLogger(ClassNode.class); + + SortedSet<ObjectPropertyNode> classProperties = new TreeSet<ObjectPropertyNode>(); + SortedSet<DatatypePropertyNode> datatypeProperties = new TreeSet<DatatypePropertyNode>(); public ClassNode(String uri) { super(uri); @@ -50,54 +57,50 @@ newTuples = manipulator.manipulate(this, newTuples); List<Node> newNodes = new ArrayList<Node>(); + Node tmp; for (RDFNodeTuple tuple : newTuples) { - try { - String property = tuple.a.toString(); - // substitute rdf:type with owl:subclassof - if (property.equals(OWLVocabulary.RDF_TYPE) || property.equals(OWLVocabulary.RDFS_SUBCLASS_OF)) { - ClassNode tmp = new ClassNode(tuple.b.toString()); - properties.add(new PropertyNode( OWLVocabulary.RDFS_SUBCLASS_OF, this, tmp)); - newNodes.add(tmp); - } else { - // further expansion stops here - // Nodes.add(tmp); is missing on purpose - ClassNode tmp = new ClassNode(tuple.b.toString()); - properties.add(new PropertyNode(tuple.a.toString(), this, tmp)); - // System.out.println(m.blankNodeIdentifier); - // System.out.println("XXXXX"+t.b); - - // if o is a blank node expand further - // TODO this needs a lot more work - - // Nodes.add(tmp); - } - - - - - } catch (Exception e) { - System.out.println("ClassNode"); - e.printStackTrace(); - } + if((tmp = processTuple(tuple))!= null) { + newNodes.add(tmp); + } } return newNodes; } + + public Node processTuple( RDFNodeTuple tuple) { + try { + String property = tuple.a.toString(); + if(tuple.b.isLiteral()) { + datatypeProperties.add(new DatatypePropertyNode(tuple.a.toString(), this, new LiteralNode(tuple.b) )); + return null; + }else if(tuple.b.isAnon()){ + logger.warn("blanknodes not supported as of now"+ this +"in tuple" + tuple); + return null; + // substitute rdf:type with owl:subclassof + }else if (property.equals(OWLVocabulary.RDF_TYPE) || property.equals(OWLVocabulary.RDFS_SUBCLASS_OF)) { + ClassNode tmp = new ClassNode(tuple.b.toString()); + classProperties.add(new ObjectPropertyNode( OWLVocabulary.RDFS_SUBCLASS_OF, this, tmp)); + return tmp; + } else { + // further expansion stops here + ClassNode tmp = new ClassNode(tuple.b.toString()); + classProperties.add(new ObjectPropertyNode(tuple.a.toString(), this, tmp)); + // return tmp; is missing on purpose + } + } catch (Exception e) { + logger.warn("Problem with: " + this + " in tuple " + tuple); + e.printStackTrace(); + + } + return null; + } // gets the types for properties recursively @Override public void expandProperties(TupelAquisitor tupelAquisitor, Manipulator manipulator) { } - @Override - public List<Node> getAllNodesAsList(List<Node> l){ - l.add(this); - for (PropertyNode props : properties) { - l.addAll(props.getB().getAllNodesAsList(l)); - } - - return l; - } + /* * (non-Javadoc) * @@ -105,16 +108,20 @@ */ @Override public SortedSet<String> toNTriple() { - SortedSet<String> s = new TreeSet<String>(); - s.add("<" + this.uri + "><" + OWLVocabulary.RDF_TYPE + "><" + OWLVocabulary.OWL_CLASS + ">."); + SortedSet<String> returnSet = new TreeSet<String>(); + returnSet.add("<" + this.uri + "><" + OWLVocabulary.RDF_TYPE + "><" + OWLVocabulary.OWL_CLASS + ">."); - for (PropertyNode one : properties) { - s.add("<" + this.uri + "><" + one.getURI() + "><" + for (ObjectPropertyNode one : classProperties) { + returnSet.add("<" + this.uri + "><" + one.getURI() + "><" + one.getB().getURI() + ">."); - s.addAll(one.getB().toNTriple()); + returnSet.addAll(one.getB().toNTriple()); } + for (DatatypePropertyNode one : datatypeProperties) { + returnSet.add("<" + uri + "><" + one.getURI() + "> " + one.getNTripleFormOfB() + + " ."); + } - return s; + return returnSet; } @Override Added: trunk/src/dl-learner/org/dllearner/kb/extraction/DatatypePropertyNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/DatatypePropertyNode.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/DatatypePropertyNode.java 2008-08-15 17:55:39 UTC (rev 1094) @@ -0,0 +1,101 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.kb.extraction; + +import java.util.List; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.dllearner.kb.aquisitors.TupelAquisitor; +import org.dllearner.kb.manipulator.Manipulator; +import org.dllearner.utilities.owl.OWLVocabulary; + +/** + * Property node, has connection to a and b part + * + * @author Sebastian Hellmann + * + */ + +public class DatatypePropertyNode extends Node { + + // the a and b part of a property + private Node a; + private LiteralNode b; + + + public DatatypePropertyNode(String uri, Node a, LiteralNode b) { + super(uri); + // this.type = "property"; + this.a = a; + this.b = b; + } + + // Property Nodes are normally not expanded, + // this function is never called + @Override + public List<Node> expand(TupelAquisitor tupelAquisitor, Manipulator manipulator) { + return null; + } + + // gets the types for properties recursively + @Override + public void expandProperties(TupelAquisitor tupelAquisitor, Manipulator manipulator) { + } + + + + public Node getA() { + return a; + } + + public Node getB() { + return b; + } + + public String getNTripleFormOfB() { + return b.getNTripleForm(); + } + + @Override + public SortedSet<String> toNTriple() { + SortedSet<String> s = new TreeSet<String>(); + s.add("<" + uri + "><" + OWLVocabulary.RDF_TYPE + "><" + + OWLVocabulary.OWL_DATATYPPROPERTY + ">."); + + return s; + } + + //TODO check + @Override + public boolean equals(Node n) { + if (this.uri.equals(n.uri)) { + return true; + }else { + return false; + } + } + + @Override + public int compareTo(Node n) { + return super.compareTo(n); + } + +} Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java 2008-08-15 15:39:55 UTC (rev 1093) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java 2008-08-15 17:55:39 UTC (rev 1094) @@ -38,13 +38,16 @@ */ public class InstanceNode extends Node { + @SuppressWarnings("unused") private static Logger logger = Logger .getLogger(InstanceNode.class); private SortedSet<ClassNode> classes = new TreeSet<ClassNode>(); //SortedSet<StringTuple> datatypes = new TreeSet<StringTuple>(); - private SortedSet<PropertyNode> properties = new TreeSet<PropertyNode>(); + private SortedSet<ObjectPropertyNode> objectProperties = new TreeSet<ObjectPropertyNode>(); + private SortedSet<DatatypePropertyNode> datatypeProperties = new TreeSet<DatatypePropertyNode>(); + public InstanceNode(String uri) { super(uri); @@ -60,54 +63,48 @@ List<Node> newNodes = new ArrayList<Node>(); + Node tmp; for (RDFNodeTuple tuple : newTuples) { - //QUALITY: needs proper handling of ressource, could be done one step lower in the onion - if(!tuple.b.toString().startsWith("http:"))continue; -// basically : if p is rdf:type then o is a class - // else it is an instance - try { - if (tuple.a.toString().equals(OWLVocabulary.RDF_TYPE)) { - ClassNode tmp = new ClassNode(tuple.b.toString()); - classes.add(tmp); - newNodes.add(tmp); - } else { - InstanceNode tmp = new InstanceNode(tuple.b.toString()); - properties.add(new PropertyNode(tuple.a.toString(), this, tmp)); - newNodes.add(tmp); - - } - } catch (Exception e) { - System.out.println("Problem with: " + tuple); - e.printStackTrace(); - } - - - + if((tmp = processTuple(tuple))!= null) { + newNodes.add(tmp); + } }//endfor expanded = true; return newNodes; - } - @Override - public List<Node> getAllNodesAsList(List<Node> l){ - l.add(this); - logger.trace(this+"\nclasses: "+classes.size()+"\nrelInstances: "+properties.size()); - for (ClassNode clazz : classes) { - l.addAll(clazz.getAllNodesAsList(l)); + public Node processTuple( RDFNodeTuple tuple) { + try { + if(tuple.b.isLiteral()) { + datatypeProperties.add(new DatatypePropertyNode(tuple.a.toString(), this, new LiteralNode(tuple.b) )); + return null; + }else if(tuple.b.isAnon()){ + logger.warn("blanknodes not supported as of now"+ this +"in tuple" + tuple); + return null; + + // basically : if p is rdf:type then o is a class + // else it is an instance + }else if (tuple.a.toString().equals(OWLVocabulary.RDF_TYPE)) { + ClassNode tmp = new ClassNode(tuple.b.toString()); + classes.add(tmp); + return tmp; + } else { + InstanceNode tmp = new InstanceNode(tuple.b.toString()); + objectProperties.add(new ObjectPropertyNode(tuple.a.toString(), this, tmp)); + return tmp; + } + } catch (Exception e) { + System.out.println("Problem with: " + tuple); + e.printStackTrace(); + return null; } - for (PropertyNode props : properties) { - l.addAll(props.getB().getAllNodesAsList(l)); - } - - return l; } - + // gets the types for properties recursively @Override public void expandProperties(TupelAquisitor tupelAquisitor, Manipulator manipulator) { - for (PropertyNode one : properties) { + for (ObjectPropertyNode one : objectProperties) { one.expandProperties(tupelAquisitor, manipulator); } @@ -121,12 +118,17 @@ returnSet.add("<" + uri + "><" + OWLVocabulary.RDF_TYPE + "><" + one.getURI() + ">."); returnSet.addAll(one.toNTriple()); } - for (PropertyNode one : properties) { + for (ObjectPropertyNode one : objectProperties) { returnSet.add("<" + uri + "><" + one.getURI() + "><" + one.getB().getURI() + ">."); returnSet.addAll(one.toNTriple()); returnSet.addAll(one.getB().toNTriple()); } + + for (DatatypePropertyNode one : datatypeProperties) { + returnSet.add("<" + uri + "><" + one.getURI() + "> " + one.getNTripleFormOfB() + + " ."); + } return returnSet; } Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/LiteralNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/LiteralNode.java 2008-08-15 15:39:55 UTC (rev 1093) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/LiteralNode.java 2008-08-15 17:55:39 UTC (rev 1094) @@ -28,6 +28,9 @@ import org.dllearner.kb.aquisitors.TupelAquisitor; import org.dllearner.kb.manipulator.Manipulator; +import com.hp.hpl.jena.rdf.model.Literal; +import com.hp.hpl.jena.rdf.model.RDFNode; + /** * A node in the graph that is a Literal. * @@ -36,6 +39,8 @@ */ public class LiteralNode extends Node { + private Literal l; + @SuppressWarnings("unused") private static Logger logger = Logger .getLogger(LiteralNode.class); @@ -46,6 +51,11 @@ // this.type = "instance"; } + + public LiteralNode(RDFNode node) { + super(node.toString()); + l = (Literal) node; + } // expands all directly connected nodes @Override @@ -53,11 +63,7 @@ return new ArrayList<Node>(); } - @Override - public List<Node> getAllNodesAsList(List<Node> l){ - l.add(this); - return l; - } + // gets the types for properties recursively @Override @@ -74,5 +80,21 @@ return super.compareTo(n); // } + + + public String getNTripleForm() { + String quote = "\\\""; + quote = """; + String retVal = l.getLexicalForm(); + retVal = retVal.replaceAll("\n", "\\n"); + retVal = retVal.replaceAll("\"", quote); + retVal = "\""+retVal+"\""; + if(l.getDatatypeURI()!=null) { + return retVal +"^^<"+l.getDatatypeURI()+">"; + }else { + return retVal+((l.getLanguage().length()==0)?"":"@"+l.getLanguage()); + } + + } } Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java 2008-08-15 15:39:55 UTC (rev 1093) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java 2008-08-15 17:55:39 UTC (rev 1094) @@ -83,7 +83,7 @@ return uri; } - public abstract List<Node> getAllNodesAsList(List<Node> l); + public boolean equals(Node n) { if (this.uri.equals(n.uri)) Copied: trunk/src/dl-learner/org/dllearner/kb/extraction/ObjectPropertyNode.java (from rev 1093, trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/ObjectPropertyNode.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/ObjectPropertyNode.java 2008-08-15 17:55:39 UTC (rev 1094) @@ -0,0 +1,118 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.kb.extraction; + +import java.util.List; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.dllearner.kb.aquisitors.TupelAquisitor; +import org.dllearner.kb.manipulator.Manipulator; +import org.dllearner.utilities.datastructures.RDFNodeTuple; +import org.dllearner.utilities.owl.OWLVocabulary; + +/** + * Property node, has connection to a and b part + * + * @author Sebastian Hellmann + * + */ + +public class ObjectPropertyNode extends Node { + + // the a and b part of a property + private Node a; + private Node b; + // specialtypes like owl:symmetricproperty + private SortedSet<String> specialTypes; + + public ObjectPropertyNode(String uri, Node a, Node b) { + super(uri); + // this.type = "property"; + this.a = a; + this.b = b; + this.specialTypes = new TreeSet<String>(); + } + + // Property Nodes are normally not expanded, + // this function is never called + @Override + public List<Node> expand(TupelAquisitor tupelAquisitor, Manipulator manipulator) { + return null; + } + + // gets the types for properties recursively + @Override + public void expandProperties(TupelAquisitor tupelAquisitor, Manipulator manipulator) { + b.expandProperties(tupelAquisitor, manipulator); + SortedSet<RDFNodeTuple> newTypes = tupelAquisitor.getTupelForResource(uri); + for (RDFNodeTuple tuple : newTypes) { + try { + if (tuple.a.equals(OWLVocabulary.RDF_TYPE)) { + specialTypes.add(tuple.b.toString()); + } + } catch (Exception e) { + System.out.println(tuple); + e.printStackTrace(); + } + } + + } + + + + + public Node getA() { + return a; + } + + public Node getB() { + return b; + } + + @Override + public SortedSet<String> toNTriple() { + SortedSet<String> s = new TreeSet<String>(); + s.add("<" + uri + "><" + OWLVocabulary.RDF_TYPE + "><" + + OWLVocabulary.OWL_OBJECTPROPERTY + ">."); + for (String one : specialTypes) { + s.add("<" + uri + "><" + OWLVocabulary.RDF_TYPE + "><" + + one + ">."); + } + + return s; + } + + //TODO check + @Override + public boolean equals(Node n) { + if (this.uri.equals(n.uri)) { + return true; + }else { + return false; + } + } + + @Override + public int compareTo(Node n) { + return super.compareTo(n); + } + +} Property changes on: trunk/src/dl-learner/org/dllearner/kb/extraction/ObjectPropertyNode.java ___________________________________________________________________ Added: svn:mergeinfo + Deleted: trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java 2008-08-15 15:39:55 UTC (rev 1093) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java 2008-08-15 17:55:39 UTC (rev 1094) @@ -1,121 +0,0 @@ -/** - * Copyright (C) 2007-2008, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.kb.extraction; - -import java.util.List; -import java.util.SortedSet; -import java.util.TreeSet; - -import org.dllearner.kb.aquisitors.TupelAquisitor; -import org.dllearner.kb.manipulator.Manipulator; -import org.dllearner.utilities.datastructures.RDFNodeTuple; -import org.dllearner.utilities.owl.OWLVocabulary; - -/** - * Property node, has connection to a and b part - * - * @author Sebastian Hellmann - * - */ - -public class PropertyNode extends Node { - - // the a and b part of a property - private Node a; - private Node b; - // specialtypes like owl:symmetricproperty - private SortedSet<String> specialTypes; - - public PropertyNode(String uri, Node a, Node b) { - super(uri); - // this.type = "property"; - this.a = a; - this.b = b; - this.specialTypes = new TreeSet<String>(); - } - - // Property Nodes are normally not expanded, - // this function is never called - @Override - public List<Node> expand(TupelAquisitor tupelAquisitor, Manipulator manipulator) { - return null; - } - - // gets the types for properties recursively - @Override - public void expandProperties(TupelAquisitor tupelAquisitor, Manipulator manipulator) { - b.expandProperties(tupelAquisitor, manipulator); - SortedSet<RDFNodeTuple> newTypes = tupelAquisitor.getTupelForResource(uri); - for (RDFNodeTuple tuple : newTypes) { - try { - if (tuple.a.equals(OWLVocabulary.RDF_TYPE)) { - specialTypes.add(tuple.b.toString()); - } - } catch (Exception e) { - System.out.println(tuple); - e.printStackTrace(); - } - } - - } - - @Override - public List<Node> getAllNodesAsList(List<Node> l){ - throw new RuntimeException("PropertyNode.getAllNodesAsList() should never be called"); - } - - - public Node getA() { - return a; - } - - public Node getB() { - return b; - } - - @Override - public SortedSet<String> toNTriple() { - SortedSet<String> s = new TreeSet<String>(); - s.add("<" + uri + "><" + OWLVocabulary.RDF_TYPE + "><" - + OWLVocabulary.OWL_OBJECTPROPERTY + ">."); - for (String one : specialTypes) { - s.add("<" + uri + "><" + OWLVocabulary.RDF_TYPE + "><" - + one + ">."); - } - - return s; - } - - //TODO check - @Override - public boolean equals(Node n) { - if (this.uri.equals(n.uri)) { - return true; - }else { - return false; - } - } - - @Override - public int compareTo(Node n) { - return super.compareTo(n); - } - -} Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorOtherRule.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorOtherRule.java 2008-08-15 15:39:55 UTC (rev 1093) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorOtherRule.java 2008-08-15 17:55:39 UTC (rev 1094) @@ -21,11 +21,11 @@ import java.util.SortedSet; - import org.dllearner.kb.extraction.Node; import org.dllearner.utilities.datastructures.RDFNodeTuple; import org.dllearner.utilities.owl.OWLVocabulary; +import com.hp.hpl.jena.rdf.model.Literal; import com.hp.hpl.jena.rdf.model.RDFNode; import com.hp.hpl.jena.rdf.model.impl.ResourceImpl; @@ -53,14 +53,16 @@ //TODO this doesn't work, because it is unclear what toString() method returns - if (tuple.a.toString().equals("http://www.w3.org/2003/01/geo/wgs84_pos#lat")){ - lat=Float.parseFloat(tuple.b.toString().substring(0,tuple.b.toString().indexOf("^^"))); + if (tuple.a.toString().equals("http://www.w3.org/2003/01/geo/wgs84_pos#lat") && tuple.b.isLiteral()){ + lat = ((Literal) tuple.b).getFloat(); + //lat=Float.parseFloat(tuple.b.toString().substring(0,tuple.b.toString().indexOf("^^"))); } - if (tuple.a.toString().equals("http://www.w3.org/2003/01/geo/wgs84_pos#long")) { - lng=Float.parseFloat(tuple.b.toString().substring(0,tuple.b.toString().indexOf("^^"))); + if (tuple.a.toString().equals("http://www.w3.org/2003/01/geo/wgs84_pos#long") && tuple.b.isLiteral()) { + lng = ((Literal) tuple.b).getFloat(); + //lng=Float.parseFloat(tuple.b.toString().substring(0,tuple.b.toString().indexOf("^^"))); } - } + }//end for if (clazz.toString().equals("http://dbpedia.org/class/yago/City108524735")){ String newType = getTypeToCoordinates(lat, lng); tuples.add(new RDFNodeTuple(new ResourceImpl(OWLVocabulary.RDF_TYPE),new ResourceImpl(newType))); Modified: trunk/src/dl-learner/org/dllearner/test/TestOneQueryForMusicRecommender.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/TestOneQueryForMusicRecommender.java 2008-08-15 15:39:55 UTC (rev 1093) +++ trunk/src/dl-learner/org/dllearner/test/TestOneQueryForMusicRecommender.java 2008-08-15 17:55:39 UTC (rev 1094) @@ -53,6 +53,7 @@ ResultSet rs = ResultSetFactory.fromXML(xml); + @SuppressWarnings("unchecked") List<ResultBinding> l = ResultSetFormatter.toList(rs); for (ResultBinding binding : l) { Modified: trunk/src/dl-learner/org/dllearner/test/TripleTypeTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/TripleTypeTest.java 2008-08-15 15:39:55 UTC (rev 1093) +++ trunk/src/dl-learner/org/dllearner/test/TripleTypeTest.java 2008-08-15 17:55:39 UTC (rev 1094) @@ -23,6 +23,7 @@ SPARQLTasks st = new SPARQLTasks (Cache.getDefaultCache(), SparqlEndpoint.getEndpointDBpedia()); ResultSetRewindable rsw = st.queryAsResultSet(sparqlQueryString); + @SuppressWarnings("unchecked") List<ResultBinding> l = ResultSetFormatter.toList(rsw); for (ResultBinding binding : l) { Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java 2008-08-15 15:39:55 UTC (rev 1093) +++ trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java 2008-08-15 17:55:39 UTC (rev 1094) @@ -28,6 +28,7 @@ public static final String OWL_SAME_AS = "http://www.w3.org/2002/07/owl#sameAs"; public static final String OWL_OBJECTPROPERTY = "http://www.w3.org/2002/07/owl#ObjectProperty"; + public static final String OWL_DATATYPPROPERTY = "http://www.w3.org/2002/07/owl#DataTypeProperty"; public static final String OWL_CLASS = "http://www.w3.org/2002/07/owl#Class"; public static final String OWL_THING = "http://www.w3.org/2002/07/owl#Thing"; //OWL2 Namespace: http://www.w3.org/2006/12/owl2# This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-08-15 15:40:06
|
Revision: 1093 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1093&view=rev Author: kurzum Date: 2008-08-15 15:39:55 +0000 (Fri, 15 Aug 2008) Log Message: ----------- headers small changes Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/aquisitors/LinkedDataTupelAquisitor.java trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitor.java trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitorImproved.java trunk/src/dl-learner/org/dllearner/kb/aquisitors/TupelAquisitor.java trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java trunk/src/dl-learner/org/dllearner/kb/extraction/Configuration.java trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java trunk/src/dl-learner/org/dllearner/kb/manipulator/DBPediaNavigatorCityLocatorRule.java trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorOtherRule.java trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java trunk/src/dl-learner/org/dllearner/kb/manipulator/Rule.java trunk/src/dl-learner/org/dllearner/kb/manipulator/SimpleObjectFilterRule.java trunk/src/dl-learner/org/dllearner/kb/manipulator/SimplePredicateFilterRule.java trunk/src/dl-learner/org/dllearner/kb/manipulator/TypeFilterRule.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlEndpoint.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertRDFS.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryException.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java trunk/src/dl-learner/org/dllearner/test/SparqlExtractionTest.java trunk/src/dl-learner/org/dllearner/utilities/JamonMonitorLogger.java trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/kb/extraction/LiteralNode.java Modified: trunk/src/dl-learner/org/dllearner/kb/aquisitors/LinkedDataTupelAquisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/aquisitors/LinkedDataTupelAquisitor.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/LinkedDataTupelAquisitor.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -19,7 +19,6 @@ */ package org.dllearner.kb.aquisitors; -import java.net.URI; import java.util.SortedSet; import org.apache.log4j.Logger; @@ -46,7 +45,7 @@ // standard query get a tupels (p,o) for subject s @Override - public SortedSet<RDFNodeTuple> getTupelForResource(URI uri) { + public SortedSet<RDFNodeTuple> getTupelForResource(String uri) { throw new RuntimeException("Not Implemented yet"); Modified: trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitor.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitor.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -19,7 +19,6 @@ */ package org.dllearner.kb.aquisitors; -import java.net.URI; import java.util.SortedSet; import org.apache.log4j.Logger; @@ -52,17 +51,17 @@ // standard query get a tupels (p,o) for subject s @Override - public SortedSet<RDFNodeTuple> getTupelForResource(URI uri) { + public SortedSet<RDFNodeTuple> getTupelForResource(String uri) { + checkURIforValidity(uri); - String pred = "predicate"; String obj = "object"; String sparqlQueryString = ""; // getQuery if (classMode) { - sparqlQueryString = sparqlQueryMaker.makeClassQueryUsingFilters(uri.toString()); + sparqlQueryString = sparqlQueryMaker.makeClassQueryUsingFilters(uri); }else { - sparqlQueryString = sparqlQueryMaker.makeSubjectQueryUsingFilters(uri.toString()); + sparqlQueryString = sparqlQueryMaker.makeSubjectQueryUsingFilters(uri); } Modified: trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitorImproved.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitorImproved.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitorImproved.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -19,7 +19,6 @@ */ package org.dllearner.kb.aquisitors; -import java.net.URI; import java.util.SortedSet; import org.apache.log4j.Logger; @@ -46,7 +45,7 @@ // standard query get a tupels (p,o) for subject s @Override - public SortedSet<RDFNodeTuple> getTupelForResource(URI uri) { + public SortedSet<RDFNodeTuple> getTupelForResource(String uri) { throw new RuntimeException("not implemented yet"); Modified: trunk/src/dl-learner/org/dllearner/kb/aquisitors/TupelAquisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/aquisitors/TupelAquisitor.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/TupelAquisitor.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -22,6 +22,7 @@ import java.net.URI; import java.util.SortedSet; +import org.apache.log4j.Logger; import org.dllearner.utilities.datastructures.RDFNodeTuple; /** @@ -35,9 +36,13 @@ */ public abstract class TupelAquisitor { + + private static Logger logger = Logger.getLogger(TupelAquisitor.class); + protected boolean classMode = false; + private boolean uriDebugCheck = true; - public abstract SortedSet<RDFNodeTuple> getTupelForResource(URI u); + public abstract SortedSet<RDFNodeTuple> getTupelForResource(String uri); public void setClassMode(boolean classMode) { this.classMode = classMode; @@ -46,6 +51,17 @@ public boolean isClassMode() { return classMode; } + + protected boolean checkURIforValidity(String uri){ + if(uriDebugCheck) return true; + try{ + new URI(uri); + }catch (Exception e) { + logger.warn("Exception while validating uri: "+uri); + return false; + } + return true; + } } Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007, Sebastian Hellmann + * Copyright (C) 2007-2008, Jens Lehmann * * This file is part of DL-Learner. * @@ -19,7 +19,6 @@ */ package org.dllearner.kb.extraction; -import java.net.URI; import java.util.ArrayList; import java.util.List; import java.util.SortedSet; @@ -38,8 +37,8 @@ public class ClassNode extends Node { SortedSet<PropertyNode> properties = new TreeSet<PropertyNode>(); - public ClassNode(URI u) { - super(u); + public ClassNode(String uri) { + super(uri); } // expands all directly connected nodes @@ -56,15 +55,14 @@ String property = tuple.a.toString(); // substitute rdf:type with owl:subclassof if (property.equals(OWLVocabulary.RDF_TYPE) || property.equals(OWLVocabulary.RDFS_SUBCLASS_OF)) { - ClassNode tmp = new ClassNode(new URI(tuple.b.toString())); - properties.add(new PropertyNode(new URI( OWLVocabulary.RDFS_SUBCLASS_OF), this, - tmp)); + ClassNode tmp = new ClassNode(tuple.b.toString()); + properties.add(new PropertyNode( OWLVocabulary.RDFS_SUBCLASS_OF, this, tmp)); newNodes.add(tmp); } else { // further expansion stops here // Nodes.add(tmp); is missing on purpose - ClassNode tmp = new ClassNode(new URI(tuple.b.toString())); - properties.add(new PropertyNode(new URI(tuple.a.toString()), this, tmp)); + ClassNode tmp = new ClassNode(tuple.b.toString()); + properties.add(new PropertyNode(tuple.a.toString(), this, tmp)); // System.out.println(m.blankNodeIdentifier); // System.out.println("XXXXX"+t.b); Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/Configuration.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/Configuration.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/Configuration.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007, Sebastian Hellmann + * Copyright (C) 2007-2008, Jens Lehmann * * This file is part of DL-Learner. * Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007, Sebastian Hellmann + * Copyright (C) 2007-2008, Jens Lehmann * * This file is part of DL-Learner. * @@ -19,7 +19,6 @@ */ package org.dllearner.kb.extraction; -import java.net.URI; import java.util.ArrayList; import java.util.List; import java.util.SortedSet; @@ -47,16 +46,16 @@ this.configuration = Configuration; } - public Node getFirstNode(URI u) { - return new InstanceNode(u); + public Node getFirstNode(String uri) { + return new InstanceNode(uri); } - public List<Node> expandAll(URI[] uris, TupelAquisitor tupelAquisitor) { - List<Node> v = new ArrayList<Node>(); - for (URI oneURI : uris) { - v.add(expandNode(oneURI, tupelAquisitor)); + public List<Node> expandAll(String[] uris, TupelAquisitor tupelAquisitor) { + List<Node> nodeList = new ArrayList<Node>(); + for (String oneURI : uris) { + nodeList.add(expandNode(oneURI, tupelAquisitor)); } - return v; + return nodeList; } /** @@ -68,7 +67,7 @@ * @param typedSparqlQuery * @return */ - public Node expandNode(URI uri, TupelAquisitor tupelAquisitor) { + public Node expandNode(String uri, TupelAquisitor tupelAquisitor) { SimpleClock sc = new SimpleClock(); Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007, Sebastian Hellmann + * Copyright (C) 2007-2008, Jens Lehmann * * This file is part of DL-Learner. * @@ -19,7 +19,6 @@ */ package org.dllearner.kb.extraction; -import java.net.URI; import java.util.ArrayList; import java.util.List; import java.util.SortedSet; @@ -46,9 +45,8 @@ //SortedSet<StringTuple> datatypes = new TreeSet<StringTuple>(); private SortedSet<PropertyNode> properties = new TreeSet<PropertyNode>(); - public InstanceNode(URI u) { - super(u); - // this.type = "instance"; + public InstanceNode(String uri) { + super(uri); } @@ -59,8 +57,7 @@ SortedSet<RDFNodeTuple> newTuples = tupelAquisitor.getTupelForResource(uri); // see Manipulator newTuples = manipulator.manipulate(this, newTuples); - //s=m.check(s, this); - // System.out.println("fffffff"+m); + List<Node> newNodes = new ArrayList<Node>(); for (RDFNodeTuple tuple : newTuples) { @@ -71,12 +68,12 @@ // else it is an instance try { if (tuple.a.toString().equals(OWLVocabulary.RDF_TYPE)) { - ClassNode tmp = new ClassNode(new URI(tuple.b.toString())); + ClassNode tmp = new ClassNode(tuple.b.toString()); classes.add(tmp); newNodes.add(tmp); } else { - InstanceNode tmp = new InstanceNode(new URI(tuple.b.toString())); - properties.add(new PropertyNode(new URI(tuple.a.toString()), this, tmp)); + InstanceNode tmp = new InstanceNode(tuple.b.toString()); + properties.add(new PropertyNode(tuple.a.toString(), this, tmp)); newNodes.add(tmp); } Added: trunk/src/dl-learner/org/dllearner/kb/extraction/LiteralNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/LiteralNode.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/LiteralNode.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -0,0 +1,78 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.kb.extraction; + +import java.util.ArrayList; +import java.util.List; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.apache.log4j.Logger; +import org.dllearner.kb.aquisitors.TupelAquisitor; +import org.dllearner.kb.manipulator.Manipulator; + +/** + * A node in the graph that is a Literal. + * + * @author Sebastian Hellmann + * + */ +public class LiteralNode extends Node { + + @SuppressWarnings("unused") + private static Logger logger = Logger + .getLogger(LiteralNode.class); + + + public LiteralNode(String uri) { + super(uri); + // this.type = "instance"; + + } + + // expands all directly connected nodes + @Override + public List<Node> expand(TupelAquisitor tupelAquisitor, Manipulator manipulator) { + return new ArrayList<Node>(); + } + + @Override + public List<Node> getAllNodesAsList(List<Node> l){ + l.add(this); + return l; + } + + // gets the types for properties recursively + @Override + public void expandProperties(TupelAquisitor tupelAquisitor, Manipulator manipulator) { + } + + @Override + public SortedSet<String> toNTriple() { + return new TreeSet<String>(); + } + + @Override + public int compareTo(Node n) { + return super.compareTo(n); + // + } + +} Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007, Sebastian Hellmann + * Copyright (C) 2007-2008, Jens Lehmann * * This file is part of DL-Learner. * @@ -19,7 +19,6 @@ */ package org.dllearner.kb.extraction; -import java.net.URI; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -50,10 +49,9 @@ } - public String extract(URI uri) { - // this.TypedSparqlQuery.query(uri); - // System.out.println(ExtractionAlgorithm.getFirstNode(uri)); - System.out.println("Start extracting"); + public String extract(String uri) { + + logger.info("Start extracting"); Node n = extractionAlgorithm.expandNode(uri, configuration.getTupelAquisitor()); SortedSet<String> s = n.toNTriple(); @@ -77,8 +75,7 @@ logger.info("Progress: "+progress+" of "+instances.size()+" finished: "+one); //} try { - Node n = extractionAlgorithm.expandNode(new URI(one), - configuration.getTupelAquisitor()); + Node n = extractionAlgorithm.expandNode(one, configuration.getTupelAquisitor()); tripleCollector.addAll(n.toNTriple()); } catch (Exception e) { e.printStackTrace(); Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007, Sebastian Hellmann + * Copyright (C) 2007-2008, Jens Lehmann * * This file is part of DL-Learner. * @@ -19,7 +19,6 @@ */ package org.dllearner.kb.extraction; -import java.net.URI; import java.util.List; import java.util.SortedSet; @@ -38,11 +37,11 @@ - protected URI uri; + protected String uri; // protected String type; protected boolean expanded = false; - public Node(URI uri) { + public Node(String uri) { this.uri = uri; } @@ -80,7 +79,7 @@ } - public URI getURI() { + public String getURI() { return uri; } Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007, Sebastian Hellmann + * Copyright (C) 2007-2008, Jens Lehmann * * This file is part of DL-Learner. * @@ -19,7 +19,6 @@ */ package org.dllearner.kb.extraction; -import java.net.URI; import java.util.List; import java.util.SortedSet; import java.util.TreeSet; @@ -44,7 +43,7 @@ // specialtypes like owl:symmetricproperty private SortedSet<String> specialTypes; - public PropertyNode(URI uri, Node a, Node b) { + public PropertyNode(String uri, Node a, Node b) { super(uri); // this.type = "property"; this.a = a; Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/DBPediaNavigatorCityLocatorRule.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/DBPediaNavigatorCityLocatorRule.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/DBPediaNavigatorCityLocatorRule.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.kb.manipulator; import java.util.HashMap; Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorOtherRule.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorOtherRule.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorOtherRule.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007, Sebastian Hellmann + * Copyright (C) 2007-2008, Jens Lehmann * * This file is part of DL-Learner. * Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007, Sebastian Hellmann + * Copyright (C) 2007-2008, Jens Lehmann * * This file is part of DL-Learner. * @@ -27,6 +27,7 @@ import org.dllearner.kb.extraction.InstanceNode; import org.dllearner.kb.extraction.Node; import org.dllearner.kb.manipulator.Rule.Months; +import org.dllearner.utilities.JamonMonitorLogger; import org.dllearner.utilities.datastructures.RDFNodeTuple; import org.dllearner.utilities.owl.OWLVocabulary; @@ -54,10 +55,11 @@ * triple */ public SortedSet<RDFNodeTuple> manipulate( Node node, SortedSet<RDFNodeTuple> tuples) { - + JamonMonitorLogger.getTimeMonitor(Manipulator.class, "Time for Rules").start(); for (Rule rule : rules) { tuples = rule.applyRule(node, tuples); } + JamonMonitorLogger.getTimeMonitor(Manipulator.class, "Time for Rules").stop(); return tuples; } Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/Rule.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/Rule.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/Rule.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.kb.manipulator; import java.util.ArrayList; Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/SimpleObjectFilterRule.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/SimpleObjectFilterRule.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/SimpleObjectFilterRule.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.kb.manipulator; import java.util.SortedSet; Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/SimplePredicateFilterRule.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/SimplePredicateFilterRule.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/SimplePredicateFilterRule.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.kb.manipulator; import java.util.SortedSet; Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/TypeFilterRule.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/TypeFilterRule.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/TypeFilterRule.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.kb.manipulator; import java.util.SortedSet; Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlEndpoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlEndpoint.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlEndpoint.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007, Sebastian Hellmann + * Copyright (C) 2007-2008, Jens Lehmann * * This file is part of DL-Learner. * Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertRDFS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertRDFS.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertRDFS.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007, Sebastian Hellmann + * Copyright (C) 2007-2008, Jens Lehmann * * This file is part of DL-Learner. * Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryException.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryException.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryException.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.kb.sparql; public class SparqlQueryException extends Exception{ Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -238,7 +238,7 @@ else if (name.equalsIgnoreCase("YAGOSPECIALHIERARCHY")) return getYagoSpecialHierarchyFilter(); else if (name.equalsIgnoreCase("TEST")) - return test(); + return getTestFilter(); else if (name.equalsIgnoreCase("DBPEDIA-NAVIGATOR")) return getDBpediaNavigatorFilter(); else @@ -345,9 +345,9 @@ return sqm; } - public static SparqlQueryMaker test() { - SparqlQueryMaker sqm = new SparqlQueryMaker("forbid", new TreeSet<String>(), new TreeSet<String>(), false); - + public static SparqlQueryMaker getTestFilter() { + SparqlQueryMaker sqm = new SparqlQueryMaker("forbid", new TreeSet<String>(), new TreeSet<String>(), true); + sqm.combineWith(getAllowYAGOFilter()); return sqm; } Modified: trunk/src/dl-learner/org/dllearner/test/SparqlExtractionTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/SparqlExtractionTest.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/test/SparqlExtractionTest.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -21,7 +21,6 @@ import java.io.File; import java.io.FileWriter; -import java.net.URI; import org.apache.log4j.ConsoleAppender; import org.apache.log4j.Level; @@ -34,6 +33,7 @@ import org.dllearner.kb.sparql.SPARQLTasks; import org.dllearner.kb.sparql.SparqlQueryMaker; import org.dllearner.scripts.NT2RDF; +import org.dllearner.utilities.JamonMonitorLogger; /** * Test class, uses the whole thing @@ -63,7 +63,7 @@ // URI u = new URI(test); Manager m = new Manager(); Configuration conf = new Configuration ( - new SparqlTupelAquisitor(SparqlQueryMaker.getAllowYAGOFilter(), SPARQLTasks.getPredefinedSPARQLTasksWithCache("DBPEDIA")), + new SparqlTupelAquisitor(SparqlQueryMaker.getTestFilter(), SPARQLTasks.getPredefinedSPARQLTasksWithCache("DBPEDIA")), Manipulator.getDefaultManipulator(), 1, true, @@ -72,14 +72,16 @@ ); m.useConfiguration(conf); - URI u2 = new URI("http://dbpedia.org/resource/Angela_Merkel"); + String u2 = "http://dbpedia.org/resource/Angela_Merkel"; - String filename = System.currentTimeMillis() + ".nt"; + String filename = "cache/"+System.currentTimeMillis() + ".nt"; FileWriter fw = new FileWriter(new File(filename), true); fw.write(m.extract(u2)); fw.flush(); fw.close(); NT2RDF.convertNT2RDF(filename); + + JamonMonitorLogger.printAllSortedByLabel(); } catch (Exception e) { e.printStackTrace(); Modified: trunk/src/dl-learner/org/dllearner/utilities/JamonMonitorLogger.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/JamonMonitorLogger.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/utilities/JamonMonitorLogger.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.utilities; import java.util.Iterator; @@ -7,6 +26,7 @@ import java.util.TreeSet; import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent; +import org.dllearner.kb.manipulator.Manipulator; import org.dllearner.kb.sparql.Cache; import org.dllearner.kb.sparql.SparqlQuery; @@ -66,10 +86,10 @@ retval= "Sparql:"; } else if (clazz == Cache.class) { retval= "Sparql:"; - } else if (clazz == Cache.class) { - retval= "Sparql:"; - } else if (clazz == SparqlQuery.class) { + }else if (clazz == SparqlQuery.class) { retval= "sparql:"; + } else if (clazz == Manipulator.class) { + retval= "extraction:"; } else if (clazz == SparqlQuery.class) { retval= "sparql:"; } else if (clazz == SparqlQuery.class) { @@ -78,8 +98,6 @@ retval= "sparql:"; } else if (clazz == SparqlQuery.class) { retval= "sparql:"; - } else if (clazz == SparqlQuery.class) { - retval= "sparql:"; } else if (clazz == ExampleBasedROLComponent.class) { retval= "Learning:"; } else if (clazz == SparqlQuery.class) { Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java 2008-08-15 14:50:53 UTC (rev 1092) +++ trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java 2008-08-15 15:39:55 UTC (rev 1093) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.utilities.owl; public class OWLVocabulary { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-08-15 14:51:00
|
Revision: 1092 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1092&view=rev Author: kurzum Date: 2008-08-15 14:50:53 +0000 (Fri, 15 Aug 2008) Log Message: ----------- code improvements Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java trunk/src/dl-learner/org/dllearner/kb/extraction/Configuration.java trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java trunk/src/dl-learner/org/dllearner/test/SparqlExtractionTest.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java trunk/src/dl-learner/org/dllearner/kb/old/ Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java 2008-08-15 13:53:47 UTC (rev 1091) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java 2008-08-15 14:50:53 UTC (rev 1092) @@ -89,6 +89,16 @@ @Override public void expandProperties(TupelAquisitor tupelAquisitor, Manipulator manipulator) { } + + @Override + public List<Node> getAllNodesAsList(List<Node> l){ + l.add(this); + for (PropertyNode props : properties) { + l.addAll(props.getB().getAllNodesAsList(l)); + } + + return l; + } /* * (non-Javadoc) Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/Configuration.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/Configuration.java 2008-08-15 13:53:47 UTC (rev 1091) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/Configuration.java 2008-08-15 14:50:53 UTC (rev 1092) @@ -30,15 +30,13 @@ */ public class Configuration { - //public SPARQLTasks sparqlTasks; - //private SparqlEndpoint endpoint; - //private SparqlQueryMaker sparqlQueryMaker; private Manipulator manipulator; private TupelAquisitor tupelAquisitor; // the following needs to be moved to // class extraction algorithm or manipulator + private boolean optimizeForDLLearner = true; private int recursiondepth; private boolean getAllSuperClasses = true; private boolean closeAfterRecursion = true; @@ -93,15 +91,12 @@ return tupelAquisitor; } - /* - public Configuration changeQueryType(SparqlQueryMaker sqm) { - // TODO must clone here - return new Configuration(this.endpoint, sqm, this.manipulator, - this.recursiondepth, this.getAllSuperClasses, - this.closeAfterRecursion, this.cacheDir); - }*/ + public boolean isOptimizeForDLLearner() { + return optimizeForDLLearner; + } + Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java 2008-08-15 13:53:47 UTC (rev 1091) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java 2008-08-15 14:50:53 UTC (rev 1092) @@ -27,6 +27,7 @@ import org.apache.log4j.Logger; import org.dllearner.kb.aquisitors.TupelAquisitor; +import org.dllearner.utilities.statistics.SimpleClock; /** * This class is used to extract the information . @@ -36,19 +37,14 @@ public class ExtractionAlgorithm { private Configuration configuration; - //private Manipulators manipulator; - //private int recursionDepth = 1; - // private boolean getAllSuperClasses = true; - // private boolean closeAfterRecursion = true; + private SortedSet<String> alreadyQueriedSuperClasses = new TreeSet<String>(); + + private static Logger logger = Logger .getLogger(ExtractionAlgorithm.class); public ExtractionAlgorithm(Configuration Configuration) { this.configuration = Configuration; - //this.manipulator = Configuration.getManipulator(); - //this.recursionDepth = Configuration.getRecursiondepth(); - // this.getAllSuperClasses = Configuration.isGetAllSuperClasses(); - // this.closeAfterRecursion=Configuration.isCloseAfterRecursion(); } public Node getFirstNode(URI u) { @@ -73,115 +69,106 @@ * @return */ public Node expandNode(URI uri, TupelAquisitor tupelAquisitor) { - //System.out.println(uri.toString()); - //System.out.println(manipulator); - //System.out.println(this.configuration); - long time = System.currentTimeMillis(); + + SimpleClock sc = new SimpleClock(); - Node n = getFirstNode(uri); - logger.info(n); - List<Node> initialNodes = new ArrayList<Node>(); - initialNodes.add(n); - logger.info("StartVector: " + initialNodes); - // n.expand(tsp, this.Manipulator); - // Vector<Node> second= - for (int x = 1; x <= configuration.getRecursiondepth(); x++) { + Node seedNode = getFirstNode(uri); + List<Node> newNodes = new ArrayList<Node>(); + List<Node> collectNodes = new ArrayList<Node>(); + List<Node> tmp = new ArrayList<Node>(); + + + logger.info(seedNode); + newNodes.add(seedNode); + logger.info("Starting Nodes: " + newNodes); - List<Node> tmp = new ArrayList<Node>(); - while (!initialNodes.isEmpty()) { - Node tmpNode = initialNodes.remove(0); - logger.info("Expanding " + tmpNode); - // System.out.println(this.Manipulator); + + for (int x = 0; x < configuration.getRecursiondepth(); x++) { + + sc.reset(); + while (!newNodes.isEmpty()) { + Node nextNode = newNodes.remove(0); + logger.info("Expanding " + nextNode); // these are the new not expanded nodes // the others are saved in connection with the original node - List<Node> tmpNodeList = tmpNode.expand(tupelAquisitor, - configuration.getManipulator()); + tmp.addAll(nextNode.expand(tupelAquisitor, + configuration.getManipulator())); //System.out.println(tmpVec); - tmp.addAll(tmpNodeList); + } - //CAVE: possible error here - initialNodes = tmp; - logger.info("Recursion counter: " + x + " with " + initialNodes.size() - + " Nodes remaining, needed: " - + (System.currentTimeMillis() - time) + "ms"); - time = System.currentTimeMillis(); + collectNodes.addAll(tmp); + newNodes.addAll(tmp); + tmp.clear(); + + logger.info("Recursion counter: " + x + " with " + newNodes.size() + + " Nodes remaining, " + sc.getAndSet("")); } - SortedSet<String> hadAlready = new TreeSet<String>(); - - //p(configuration.toString()); // gets All Class Nodes and expands them further if (configuration.isGetAllSuperClasses()) { - logger.info("Get all superclasses"); - // Set<Node> classes = new TreeSet<Node>(); - List<Node> classes = new ArrayList<Node>(); - List<Node> instances = new ArrayList<Node>(); + expandAllSuperClassesOfANode(collectNodes, tupelAquisitor); + } + + return seedNode; - for (Node one : initialNodes) { - if (one instanceof ClassNode) { - classes.add(one); - } - if (one instanceof InstanceNode) { - instances.add(one); - } + } + + private void expandAllSuperClassesOfANode(List<Node> allNodes, TupelAquisitor tupelAquisitor) { + logger.info("Get all superclasses"); + + + List<Node> classes = new ArrayList<Node>(); + List<Node> instances = new ArrayList<Node>(); + for (Node one : allNodes) { + if (one instanceof ClassNode) { + classes.add(one); } - // System.out.println(instances.size()); - //TODO LinkedData incompatibility - //TupelAquisitor tupelAquisitorClasses = configuration.sparqlTupelAquisitorClasses; - //XXX this should be solved in a better way - tupelAquisitor.setClassMode(true); - if (configuration.isCloseAfterRecursion()) { - while (!instances.isEmpty()) { - logger.trace("Getting classes for remaining instances: " - + instances.size()); - Node next = instances.remove(0); - logger.trace("Getting classes for: " + next); - classes.addAll(next.expand(tupelAquisitor, configuration.getManipulator())); - if (classes.size() >= configuration.getBreakSuperClassesAfter()) { - break; - } - } + if (one instanceof InstanceNode) { + instances.add(one); } - //XXX this should be solved in a better way - tupelAquisitor.setClassMode(false); - - List<Node> tmp = new ArrayList<Node>(); - int i = 0; - while (!classes.isEmpty()) { - logger.trace("Remaining classes: " + classes.size()); - // Iterator<Node> it=classes.iterator(); - // Node next =(Node) it.next(); - // classes.remove(next); - Node next = classes.remove(0); - if (!hadAlready.contains(next.getURI().toString())) { - logger.trace("Getting SuperClass for: " + next); - // System.out.println(hadAlready.size()); - hadAlready.add(next.getURI().toString()); - tmp = next.expand(tupelAquisitor, configuration.getManipulator()); - classes.addAll(tmp); - tmp = new ArrayList<Node>(); - // if(i % 50==0)System.out.println("got "+i+" extra classes, - // max: "+manipulator.breakSuperClassRetrievalAfter); - i++; - if (i >= configuration.getBreakSuperClassesAfter()) { - break; - } - } - // System.out.println("Skipping"); + } + + //TODO LinkedData incompatibility + + tupelAquisitor.setClassMode(true); + if (configuration.isCloseAfterRecursion()) { + while (!instances.isEmpty()) { + logger.trace("Getting classes for remaining instances: " + + instances.size()); + Node next = instances.remove(0); + logger.trace("Getting classes for: " + next); + classes.addAll(next.expand(tupelAquisitor, configuration.getManipulator())); + if (classes.size() >= configuration.getBreakSuperClassesAfter()) { + break; + }//endif + }//endwhile + }//endif + tupelAquisitor.setClassMode(false); + + + + int i = 0; + while (!classes.isEmpty()) { + logger.trace("Remaining classes: " + classes.size()); + Node next = classes.remove(0); + if (!alreadyQueriedSuperClasses.contains(next.getURI().toString())) { + logger.trace("Getting Superclasses for: " + next); + alreadyQueriedSuperClasses.add(next.getURI().toString()); + classes.addAll(next.expand(tupelAquisitor, configuration.getManipulator())); + + if (i > configuration.getBreakSuperClassesAfter()) { + break; + }//endinnerif + i++; + }//endouterif - // if - // (classes.size()>=manipulator.breakSuperClassRetrievalAfter){break;} - - } - // System.out.println((System.currentTimeMillis()-time)+""); - + }//endwhile + if(!configuration.isOptimizeForDLLearner()){ + alreadyQueriedSuperClasses.clear(); } - return n; } - - } Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java 2008-08-15 13:53:47 UTC (rev 1091) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java 2008-08-15 14:50:53 UTC (rev 1092) @@ -25,6 +25,7 @@ import java.util.SortedSet; import java.util.TreeSet; +import org.apache.log4j.Logger; import org.dllearner.kb.aquisitors.TupelAquisitor; import org.dllearner.kb.manipulator.Manipulator; import org.dllearner.utilities.datastructures.RDFNodeTuple; @@ -37,6 +38,9 @@ * */ public class InstanceNode extends Node { + + private static Logger logger = Logger + .getLogger(InstanceNode.class); private SortedSet<ClassNode> classes = new TreeSet<ClassNode>(); //SortedSet<StringTuple> datatypes = new TreeSet<StringTuple>(); @@ -88,6 +92,20 @@ return newNodes; } + + @Override + public List<Node> getAllNodesAsList(List<Node> l){ + l.add(this); + logger.trace(this+"\nclasses: "+classes.size()+"\nrelInstances: "+properties.size()); + for (ClassNode clazz : classes) { + l.addAll(clazz.getAllNodesAsList(l)); + } + for (PropertyNode props : properties) { + l.addAll(props.getB().getAllNodesAsList(l)); + } + + return l; + } // gets the types for properties recursively @Override Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java 2008-08-15 13:53:47 UTC (rev 1091) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java 2008-08-15 14:50:53 UTC (rev 1092) @@ -102,47 +102,9 @@ return nt.toString(); } -/* public void addPredicateFilter(String str) { - this.configuration.getSparqlQueryMaker().addPredicateFilter(str); - } -*/ public Configuration getConfiguration() { return configuration; } - /* - * public void calculateSubjects(String label, int limit) { - * System.out.println("SparqlModul: Collecting Subjects"); - * oldSparqlOntologyCollector oc = new oldSparqlOntologyCollector(url); try { - * subjects = oc.getSubjectsFromLabel(label, limit); } catch (IOException e) { - * subjects = new String[1]; subjects[0] = "[Error]Sparql Endpoint could not - * be reached."; } System.out.println("SparqlModul: ****Finished"); } - * - * /** TODO SparqlOntologyCollector needs to be removed @param subject - */ - /* - * public void calculateTriples(String subject) { - * System.out.println("SparqlModul: Collecting Triples"); - * oldSparqlOntologyCollector oc = new oldSparqlOntologyCollector(url); try { - * triples = oc.collectTriples(subject); } catch (IOException e) { triples = - * new String[1]; triples[0] = "[Error]Sparql Endpoint could not be - * reached."; } System.out.println("SparqlModul: ****Finished"); } - */ - /** - * TODO SparqlOntologyCollector needs to be removed - * - * @param concept - */ - - /* - * public void calculateConceptSubjects(String concept) { - * System.out.println("SparqlModul: Collecting Subjects"); - * oldSparqlOntologyCollector oc = new oldSparqlOntologyCollector(url); try { - * conceptSubjects = oc.getSubjectsFromConcept(concept); } catch - * (IOException e) { conceptSubjects = new String[1]; conceptSubjects[0] = - * "[Error]Sparql Endpoint could not be reached."; } - * System.out.println("SparqlModul: ****Finished"); } - */ - } \ No newline at end of file Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java 2008-08-15 13:53:47 UTC (rev 1091) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java 2008-08-15 14:50:53 UTC (rev 1092) @@ -83,6 +83,8 @@ public URI getURI() { return uri; } + + public abstract List<Node> getAllNodesAsList(List<Node> l); public boolean equals(Node n) { if (this.uri.equals(n.uri)) Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java 2008-08-15 13:53:47 UTC (rev 1091) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java 2008-08-15 14:50:53 UTC (rev 1092) @@ -76,6 +76,12 @@ } } + + @Override + public List<Node> getAllNodesAsList(List<Node> l){ + throw new RuntimeException("PropertyNode.getAllNodesAsList() should never be called"); + } + public Node getA() { return a; Deleted: trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java 2008-08-15 13:53:47 UTC (rev 1091) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java 2008-08-15 14:50:53 UTC (rev 1092) @@ -1,207 +0,0 @@ -/** - * Copyright (C) 2007, Sebastian Hellmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.kb.manipulator; - -import java.util.ArrayList; -import java.util.List; -import java.util.SortedSet; - -import org.dllearner.kb.extraction.ClassNode; -import org.dllearner.kb.extraction.InstanceNode; -import org.dllearner.kb.extraction.Node; -import org.dllearner.kb.manipulator.Rule.Months; -import org.dllearner.utilities.datastructures.RDFNodeTuple; -import org.dllearner.utilities.owl.OWLVocabulary; - -/** - * Used to manipulate retrieved tupels, identify blanknodes, etc. - * - * @author Sebastian Hellmann - * - */ -public class Manipulator { - - private List<Rule> rules = new ArrayList<Rule>(); - - private Manipulator() { - } - - public Manipulator(List<Rule> rules) { - for (Rule rule : rules) { - addRule(rule); - } - } - - /** - * this checks for consistency and manipulates the tuples, before they get - * triple - */ - public SortedSet<RDFNodeTuple> manipulate( Node node, SortedSet<RDFNodeTuple> tuples) { - - for (Rule rule : rules) { - tuples = rule.applyRule(node, tuples); - } - return tuples; - } - - - - public static Manipulator getManipulatorByName(String predefinedManipulator) - { - if (predefinedManipulator.equalsIgnoreCase("DBPEDIA-NAVIGATOR")) { - return getDBpediaNavigatorManipulator(); - - } else if(predefinedManipulator.equalsIgnoreCase("DEFAULT")){ - return getDefaultManipulator(); - } - else { - //QUALITY maybe not the best, - return getDefaultManipulator(); - } - } - - public static Manipulator getDBpediaNavigatorManipulator(){ - Manipulator m = new Manipulator(); - m.addRule(new DBPediaNavigatorCityLocatorRule(Months.JANUARY)); - m.addRule(new DBpediaNavigatorOtherRule(Months.DECEMBER)); - return m; - } - - public static Manipulator getDefaultManipulator(){ - Manipulator m = new Manipulator(); - m.addDefaultRules(Months.DECEMBER); - return m; - } - - //HACK -// if(t.a.equals("http://www.holygoat.co.uk/owl/redwood/0.1/tags/taggedWithTag")) { -// //hackGetLabel(t.b); -// -// } - - // GovTrack hack - // => we convert a string literal to a URI - // => TODO: introduce an option for converting literals for certain - // properties into URIs -// String sp = "http://purl.org/dc/elements/1.1/subject"; -// if(t.a.equals(sp)) { -// System.out.println(t); -// System.exit(0); -// } - - - private void addDefaultRules(Months month){ - - addRule(new TypeFilterRule(month, OWLVocabulary.RDF_TYPE, OWLVocabulary.OWL_CLASS,ClassNode.class.getCanonicalName() )) ; - addRule(new TypeFilterRule(month, OWLVocabulary.RDF_TYPE, OWLVocabulary.OWL_THING,InstanceNode.class.getCanonicalName() )) ; - addRule(new TypeFilterRule(month, "", OWLVocabulary.OWL_CLASS, ClassNode.class.getCanonicalName()) ) ; - } - - public synchronized void addRule(Rule newRule){ - rules.add(newRule); - List<Rule> l = new ArrayList<Rule>(); - - for (Months month : Rule.MONTHS) { - for (Rule rule : rules) { - if(rule.month.equals(month)) { - l.add(rule); - } - } - - } - rules = l; - } - - - - /* - private RDFNodeTuple manipulateTuple(String subject, RDFNodeTuple tuple) { - - for (int i = 0; i < replacementRules.size(); i++) { - ReplacementRule replace = replacementRules.get(i); - tuple = replace.applyRule(subject, tuple); - } - return tuple; - }*/ - - /*private String hackGetLabel(String resname){ - String query="" + - "SELECT ?o \n" + - "WHERE { \n" + - "<"+resname+"> "+ " <http://www.holygoat.co.uk/owl/redwood/0.1/tags/tagName> ?o " + - "}"; - - System.out.println(query); - //http://dbtune.org/musicbrainz/sparql?query= - //SELECT ?o WHERE { <http://dbtune.org/musicbrainz/resource/tag/1391> <http://www.holygoat.co.uk/owl/redwood/0.1/tags/tagName> ?o } - SparqlQuery s=new SparqlQuery(query,SparqlEndpoint.EndpointMusicbrainz()); - ResultSet rs=s.send(); - while (rs.hasNext()){ - rs.nextBinding(); - } - //System.out.println("AAA"+s.getAsXMLString(s.send()) ); - return ""; - }*/ - - /*private void replacePredicate(StringTuple t) { - for (StringTuple rep : replacePredicate) { - if (rep.a.equals(t.a)) { - t.a = rep.b; - } - } -} - -private void replaceObject(StringTuple t) { - for (StringTuple rep : replaceObject) { - if (rep.a.equals(t.a)) { - t.a = rep.b; - } - } -}*/ - - - - /* - // remove <rdf:type, owl:class> - // this is done to avoid transformation to owl:subclassof - if (t.a.equals(type) && t.b.equals(classns) - && node instanceof ClassNode) { - toRemove.add(t); - } - - // all with type class - if (t.b.equals(classns) && node instanceof ClassNode) { - toRemove.add(t); - } - - // remove all instances with owl:type thing - if (t.a.equals(type) && t.b.equals(thing) - && node instanceof InstanceNode) { - toRemove.add(t); - } - - } - tuples.removeAll(toRemove); - - return tuples; -} -*/ - -} Copied: trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java (from rev 1084, trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java 2008-08-15 14:50:53 UTC (rev 1092) @@ -0,0 +1,152 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.kb.manipulator; + +import java.util.ArrayList; +import java.util.List; +import java.util.SortedSet; + +import org.dllearner.kb.extraction.ClassNode; +import org.dllearner.kb.extraction.InstanceNode; +import org.dllearner.kb.extraction.Node; +import org.dllearner.kb.manipulator.Rule.Months; +import org.dllearner.utilities.datastructures.RDFNodeTuple; +import org.dllearner.utilities.owl.OWLVocabulary; + +/** + * Used to manipulate retrieved tupels, identify blanknodes, etc. + * + * @author Sebastian Hellmann + * + */ +public class Manipulator { + + private List<Rule> rules = new ArrayList<Rule>(); + + private Manipulator() { + } + + public Manipulator(List<Rule> rules) { + for (Rule rule : rules) { + addRule(rule); + } + } + + /** + * this checks for consistency and manipulates the tuples, before they get + * triple + */ + public SortedSet<RDFNodeTuple> manipulate( Node node, SortedSet<RDFNodeTuple> tuples) { + + for (Rule rule : rules) { + tuples = rule.applyRule(node, tuples); + } + return tuples; + } + + + + public static Manipulator getManipulatorByName(String predefinedManipulator) + { + if (predefinedManipulator.equalsIgnoreCase("DBPEDIA-NAVIGATOR")) { + return getDBpediaNavigatorManipulator(); + + } else if(predefinedManipulator.equalsIgnoreCase("DEFAULT")){ + return getDefaultManipulator(); + } + else { + //QUALITY maybe not the best, + return getDefaultManipulator(); + } + } + + public static Manipulator getDBpediaNavigatorManipulator(){ + Manipulator m = new Manipulator(); + m.addRule(new DBPediaNavigatorCityLocatorRule(Months.JANUARY)); + m.addRule(new DBpediaNavigatorOtherRule(Months.DECEMBER)); + return m; + } + + public static Manipulator getDefaultManipulator(){ + Manipulator m = new Manipulator(); + m.addDefaultRules(Months.DECEMBER); + return m; + } + + //HACK +// if(t.a.equals("http://www.holygoat.co.uk/owl/redwood/0.1/tags/taggedWithTag")) { +// //hackGetLabel(t.b); +// +// } + + // GovTrack hack + // => we convert a string literal to a URI + // => TODO: introduce an option for converting literals for certain + // properties into URIs +// String sp = "http://purl.org/dc/elements/1.1/subject"; +// if(t.a.equals(sp)) { +// System.out.println(t); +// System.exit(0); +// } + + + private void addDefaultRules(Months month){ + + addRule(new TypeFilterRule(month, OWLVocabulary.RDF_TYPE, OWLVocabulary.OWL_CLASS,ClassNode.class.getCanonicalName() )) ; + addRule(new TypeFilterRule(month, OWLVocabulary.RDF_TYPE, OWLVocabulary.OWL_THING,InstanceNode.class.getCanonicalName() )) ; + addRule(new TypeFilterRule(month, "", OWLVocabulary.OWL_CLASS, ClassNode.class.getCanonicalName()) ) ; + } + + public synchronized void addRule(Rule newRule){ + rules.add(newRule); + List<Rule> l = new ArrayList<Rule>(); + + for (Months month : Rule.MONTHS) { + for (Rule rule : rules) { + if(rule.month.equals(month)) { + l.add(rule); + } + } + + } + rules = l; + } + + + /*private String hackGetLabel(String resname){ + String query="" + + "SELECT ?o \n" + + "WHERE { \n" + + "<"+resname+"> "+ " <http://www.holygoat.co.uk/owl/redwood/0.1/tags/tagName> ?o " + + "}"; + + System.out.println(query); + //http://dbtune.org/musicbrainz/sparql?query= + //SELECT ?o WHERE { <http://dbtune.org/musicbrainz/resource/tag/1391> <http://www.holygoat.co.uk/owl/redwood/0.1/tags/tagName> ?o } + SparqlQuery s=new SparqlQuery(query,SparqlEndpoint.EndpointMusicbrainz()); + ResultSet rs=s.send(); + while (rs.hasNext()){ + rs.nextBinding(); + } + //System.out.println("AAA"+s.getAsXMLString(s.send()) ); + return ""; + }*/ + +} Property changes on: trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java ___________________________________________________________________ Added: svn:mergeinfo + Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java 2008-08-15 13:53:47 UTC (rev 1091) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java 2008-08-15 14:50:53 UTC (rev 1092) @@ -216,15 +216,25 @@ assembled = false; predicateFilterList.add(newFilter); } + + public void addObjectFilter(String newFilter) { + assembled = false; + objectFilterList.add(newFilter); + } + + public void combineWith(SparqlQueryMaker sqm){ + predicateFilterList.addAll(sqm.predicateFilterList); + objectFilterList.addAll(sqm.objectFilterList); + } public static SparqlQueryMaker getSparqlQueryMakerByName(String name) { if (name.equalsIgnoreCase("YAGO")) - return getYAGOFilter(); + return getAllowYAGOFilter(); else if (name.equalsIgnoreCase("SKOS")) - return getSKOSFilter(); + return getAllowSKOSFilter(); else if (name.equalsIgnoreCase("YAGOSKOS")) - return getYAGOSKOS(); + return getAllowYAGOandSKOSFilter(); else if (name.equalsIgnoreCase("YAGOSPECIALHIERARCHY")) return getYagoSpecialHierarchyFilter(); else if (name.equalsIgnoreCase("TEST")) @@ -234,160 +244,111 @@ else return null; } + + private void addFiltersForDBpediaSKOS() { + addPredicateFilter("http://www.w3.org/2004/02/skos/core"); + addObjectFilter("http://www.w3.org/2004/02/skos/core"); + addObjectFilter("http://dbpedia.org/resource/Category:"); + addObjectFilter("http://dbpedia.org/resource/Template"); + } + private void addFiltersForYago() { + addObjectFilter("http://dbpedia.org/class/yago"); + + } + private void addFiltersForOWLSameAs() { + addPredicateFilter("http://www.w3.org/2002/07/owl#sameAs"); + } + private void addFiltersForFOAF() { + addPredicateFilter("http://xmlns.com/foaf/0.1/"); + addObjectFilter("http://xmlns.com/foaf/0.1/"); + + } + + private void addFiltersForWordNet() { + addObjectFilter("http://www.w3.org/2006/03/wn/wn20/instances/synset"); + + } + private void addFiltersForGeonames() { + addObjectFilter("http://www.geonames.org"); + + } + private void addFiltersForFlickrwrappr() { + addObjectFilter("http://www4.wiwiss.fu-berlin.de/flickrwrappr"); + + } + + private void addFiltersForDBpedia() { + addPredicateFilter("http://dbpedia.org/property/reference"); + addPredicateFilter("http://dbpedia.org/property/website"); + addPredicateFilter("http://dbpedia.org/property/wikipage"); + addPredicateFilter("http://dbpedia.org/property/wikiPageUsesTemplate"); + addPredicateFilter("http://dbpedia.org/property/relatedInstance"); + addPredicateFilter("http://dbpedia.org/property/owner"); + addPredicateFilter("http://dbpedia.org/property/standard"); + addObjectFilter("http://upload.wikimedia.org/wikipedia/commons"); + addObjectFilter("http://upload.wikimedia.org/wikipedia"); + } + + public static SparqlQueryMaker getAllowSKOSFilter() { + SparqlQueryMaker sqm = new SparqlQueryMaker("forbid", new TreeSet<String>(), new TreeSet<String>(), false); + sqm.combineWith(getAllowYAGOandSKOSFilter()); + sqm.addFiltersForYago(); + + sqm.addPredicateFilter("http://www.w3.org/2004/02/skos/core#narrower"); + sqm.addObjectFilter("http://dbpedia.org/resource/Template"); + + return sqm; + } - public static SparqlQueryMaker getYAGOFilter() { - SortedSet<String> pred = new TreeSet<String>(); - pred.add("http://www.w3.org/2004/02/skos/core"); - pred.add("http://www.w3.org/2002/07/owl#sameAs"); - pred.add("http://xmlns.com/foaf/0.1/"); - pred.add("http://dbpedia.org/property/reference"); - pred.add("http://dbpedia.org/property/website"); - pred.add("http://dbpedia.org/property/wikipage"); - pred.add("http://dbpedia.org/property/wikiPageUsesTemplate"); - pred.add("http://dbpedia.org/property/relatedInstance"); - pred.add("http://dbpedia.org/property/owner"); - pred.add("http://dbpedia.org/property/standard"); - - SortedSet<String> obj = new TreeSet<String>(); - // obj.add("http://dbpedia.org/resource/Category:Wikipedia_"); - // obj.add("http://dbpedia.org/resource/Category:Articles_"); - obj.add("http://dbpedia.org/resource/Category:"); - obj.add("http://dbpedia.org/resource/Template"); - obj.add("http://xmlns.com/foaf/0.1/"); - obj.add("http://upload.wikimedia.org/wikipedia/commons"); - obj.add("http://upload.wikimedia.org/wikipedia"); - obj.add("http://www.geonames.org"); - obj.add("http://www.w3.org/2006/03/wn/wn20/instances/synset"); - obj.add("http://www4.wiwiss.fu-berlin.de/flickrwrappr"); - obj.add("http://www.w3.org/2004/02/skos/core"); - - return new SparqlQueryMaker("forbid", obj, pred, false); + public static SparqlQueryMaker getAllowYAGOFilter() { + SparqlQueryMaker sqm = new SparqlQueryMaker("forbid", new TreeSet<String>(), new TreeSet<String>(), false); + sqm.combineWith(getAllowYAGOandSKOSFilter()); + sqm.addFiltersForDBpediaSKOS(); + return sqm; } public static SparqlQueryMaker getDBpediaNavigatorFilter() { - SortedSet<String> pred = new TreeSet<String>(); - pred.add("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"); - pred.add("http://www.w3.org/2000/01/rdf-schema#subClassOf"); - pred.add("http://www.w3.org/2003/01/geo/wgs84_pos#lat"); - pred.add("http://www.w3.org/2003/01/geo/wgs84_pos#long"); + SparqlQueryMaker sqm = new SparqlQueryMaker("allow", new TreeSet<String>(), new TreeSet<String>(), false); + sqm.addPredicateFilter("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"); + sqm.addPredicateFilter("http://www.w3.org/2000/01/rdf-schema#subClassOf"); + sqm.addPredicateFilter("http://www.w3.org/2003/01/geo/wgs84_pos#lat"); + sqm.addPredicateFilter("http://www.w3.org/2003/01/geo/wgs84_pos#long"); // pred.add("http://dbpedia.org/property/wikipage"); // pred.add("http://dbpedia.org/property/wikiPageUsesTemplate"); // pred.add("http://dbpedia.org/property/relatedInstance"); // pred.add("http://dbpedia.org/property/owner"); // pred.add("http://dbpedia.org/property/standard"); - return new SparqlQueryMaker("allow", new TreeSet<String>(), pred, true); + return sqm; } public static SparqlQueryMaker getYagoSpecialHierarchyFilter() { - SortedSet<String> pred = new TreeSet<String>(); - pred.add("http://www.w3.org/2004/02/skos/core"); - pred.add("http://www.w3.org/2002/07/owl#sameAs"); - pred.add("http://xmlns.com/foaf/0.1/"); - - pred.add("http://dbpedia.org/property/reference"); - pred.add("http://dbpedia.org/property/website"); - pred.add("http://dbpedia.org/property/wikipage"); - pred.add("http://dbpedia.org/property/wikiPageUsesTemplate"); - pred.add("http://dbpedia.org/property/relatedInstance"); - pred.add("http://dbpedia.org/property/monarch"); - - SortedSet<String> obj = new TreeSet<String>(); - obj.add("http://dbpedia.org/resource/Category:Wikipedia_"); - obj.add("http://dbpedia.org/resource/Category:Articles_"); - obj.add("http://dbpedia.org/resource/Template"); - obj.add("http://xmlns.com/foaf/0.1/"); - obj.add("http://upload.wikimedia.org/wikipedia/commons"); - obj.add("http://upload.wikimedia.org/wikipedia"); - obj.add("http://www.geonames.org"); - obj.add("http://www.w3.org/2006/03/wn/wn20/instances/synset"); - obj.add("http://www4.wiwiss.fu-berlin.de/flickrwrappr"); - obj.add("http://www.w3.org/2004/02/skos/core"); - - return new SparqlQueryMaker("forbid", obj, pred, false); + SparqlQueryMaker sqm = new SparqlQueryMaker("forbid", new TreeSet<String>(), new TreeSet<String>(), false); + sqm.combineWith(getAllowYAGOFilter()); + sqm.addPredicateFilter("http://dbpedia.org/property/monarch"); + return sqm; } - public static SparqlQueryMaker getSKOSFilter() { - SortedSet<String> pred = new TreeSet<String>(); - // pred.add("http://www.w3.org/2004/02/skos/core"); - pred.add("http://www.w3.org/2002/07/owl#sameAs"); - pred.add("http://xmlns.com/foaf/0.1/"); - pred.add("http://dbpedia.org/property/reference"); - pred.add("http://dbpedia.org/property/website"); - pred.add("http://dbpedia.org/property/wikipage"); - pred.add("http://www.w3.org/2004/02/skos/core#narrower"); - pred.add("http://dbpedia.org/property/wikiPageUsesTemplate"); - SortedSet<String> obj = new TreeSet<String>(); - // obj.add("http://dbpedia.org/resource/Category:Wikipedia_"); - // obj.add("http://dbpedia.org/resource/Category:Articles_"); - obj.add("http://xmlns.com/foaf/0.1/"); - obj.add("http://upload.wikimedia.org/wikipedia/commons"); - obj.add("http://upload.wikimedia.org/wikipedia"); + public static SparqlQueryMaker getAllowYAGOandSKOSFilter() { + SparqlQueryMaker sqm = new SparqlQueryMaker("forbid", new TreeSet<String>(), new TreeSet<String>(), false); + sqm.addFiltersForFOAF(); + sqm.addFiltersForDBpedia(); - obj.add("http://www.geonames.org"); - obj.add("http://www.w3.org/2006/03/wn/wn20/instances/synset"); - obj.add("http://www4.wiwiss.fu-berlin.de/flickrwrappr"); - - obj.add("http://dbpedia.org/class/yago"); - obj.add("http://dbpedia.org/resource/Template"); - - return new SparqlQueryMaker("forbid", obj, pred, false); + sqm.addFiltersForGeonames(); + sqm.addFiltersForWordNet(); + sqm.addFiltersForFlickrwrappr(); + sqm.addFiltersForOWLSameAs(); + + sqm.addPredicateFilter("http://www.w3.org/2004/02/skos/core#narrower"); + sqm.addObjectFilter("http://dbpedia.org/resource/Template"); + return sqm; } - public static SparqlQueryMaker getYAGOSKOS() { - SortedSet<String> pred = new TreeSet<String>(); - // pred.add("http://www.w3.org/2004/02/skos/core"); - pred.add("http://www.w3.org/2002/07/owl#sameAs"); - pred.add("http://xmlns.com/foaf/0.1/"); - - pred.add("http://dbpedia.org/property/reference"); - pred.add("http://dbpedia.org/property/website"); - pred.add("http://dbpedia.org/property/wikipage"); - // pred.add("http://www.w3.org/2004/02/skos/core#narrower"); - pred.add("http://dbpedia.org/property/wikiPageUsesTemplate"); - - SortedSet<String> obj = new TreeSet<String>(); - // obj.add("http://dbpedia.org/resource/Category:Wikipedia_"); - // obj.add("http://dbpedia.org/resource/Category:Articles_"); - obj.add("http://xmlns.com/foaf/0.1/"); - obj.add("http://upload.wikimedia.org/wikipedia/commons"); - obj.add("http://upload.wikimedia.org/wikipedia"); - - obj.add("http://www.geonames.org"); - obj.add("http://www.w3.org/2006/03/wn/wn20/instances/synset"); - obj.add("http://www4.wiwiss.fu-berlin.de/flickrwrappr"); - - // obj.add("http://dbpedia.org/class/yago"); - obj.add("http://dbpedia.org/resource/Template"); - - return new SparqlQueryMaker("forbid", obj, pred, false); - } - public static SparqlQueryMaker test() { - SortedSet<String> pred = new TreeSet<String>(); - pred.add("http://www.w3.org/2004/02/skos/core"); - pred.add("http://www.w3.org/2002/07/owl#sameAs"); - pred.add("http://xmlns.com/foaf/0.1/"); - // pred.add("http://dbpedia.org/property/reference"); - // pred.add("http://dbpedia.org/property/website"); - // pred.add("http://dbpedia.org/property/wikipage"); - pred.add("http://dbpedia.org/property/wikiPageUsesTemplate"); - pred.add("http://dbpedia.org/property/relatedInstance"); - - SortedSet<String> obj = new TreeSet<String>(); - // obj.add("http://dbpedia.org/resource/Category:Wikipedia_"); - // obj.add("http://dbpedia.org/resource/Category:Articles_"); - obj.add("http://dbpedia.org/resource/Category:"); - obj.add("http://dbpedia.org/resource/Template"); - obj.add("http://xmlns.com/foaf/0.1/"); - obj.add("http://upload.wikimedia.org/wikipedia/commons"); - obj.add("http://upload.wikimedia.org/wikipedia"); - obj.add("http://www.geonames.org"); - obj.add("http://www.w3.org/2006/03/wn/wn20/instances/synset"); - obj.add("http://www4.wiwiss.fu-berlin.de/flickrwrappr"); - obj.add("http://www.w3.org/2004/02/skos/core"); - return new SparqlQueryMaker("forbid", obj, pred, false); + SparqlQueryMaker sqm = new SparqlQueryMaker("forbid", new TreeSet<String>(), new TreeSet<String>(), false); + + return sqm; } public static void main(String[] args) { @@ -402,53 +363,5 @@ } - /* - * private String internalFilterAssemblySubject() { - * - * boolean emptyPredicateFilter = getPredicateFilterList().isEmpty(); - * boolean emptyObjectFilter = getObjectFilterList().isEmpty(); - * - * String filterString = ""; if (!isLiterals()) { filterString += - * "(!isLiteral(?object))"; if (!getPredicateFilterList().isEmpty()) { - * filterString += "&&("; } - * } else if (!emptyPredicateFilter) { filterString += "("; } boolean - * firstRun = true; for (String p : getPredicateFilterList()) { filterString += - * lineend; filterString += (firstRun) ? handlePredicate(p).substring(2) : - * handlePredicate(p); firstRun = false; } if (!emptyPredicateFilter) { - * filterString += ")"; } if ((!emptyPredicateFilter || !isLiterals()) && - * !emptyObjectFilter) { filterString += "&&("; }else if - * (!emptyObjectFilter) { filterString += "("; } - * - * firstRun = true; for (String o : getObjectFilterList()) { filterString += - * lineend; filterString += (firstRun) ? handleObject(o).substring(2) : - * handleObject(o) ; firstRun = false; } if (!emptyObjectFilter){ - * filterString += ")"; } - * - * return filterString; } - */ - /* - * private String filterSubject(String ns) { return "&&( - * !regex(str(?subject), '" + ns + "') )"; } - * - * - * private String handlePredicate (String ns) { return (isAllowMode()) ? - * allowPredicate(ns) : filterPredicate(ns) ; } - * - * private String handleObject (String ns) { return (isAllowMode()) ? - * allowObject(ns) : filterObject(ns) ; } - * - * private static String filterPredicate(String ns) { return "&&( - * !regex(str(?predicate), '" + ns + "') )"; } - * - * private static String filterObject(String ns) { return "&&( - * !regex(str(?object), '" + ns + "') )"; } - * - * private static String allowPredicate(String ns) { return "||( - * regex(str(?predicate), '" + ns + "') )"; } - * - * private static String allowObject(String ns) { return "||( - * regex(str(?object), '" + ns + "') )"; } - */ - } Modified: trunk/src/dl-learner/org/dllearner/test/SparqlExtractionTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/SparqlExtractionTest.java 2008-08-15 13:53:47 UTC (rev 1091) +++ trunk/src/dl-learner/org/dllearner/test/SparqlExtractionTest.java 2008-08-15 14:50:53 UTC (rev 1092) @@ -23,6 +23,10 @@ import java.io.FileWriter; import java.net.URI; +import org.apache.log4j.ConsoleAppender; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.apache.log4j.SimpleLayout; import org.dllearner.kb.aquisitors.SparqlTupelAquisitor; import org.dllearner.kb.extraction.Configuration; import org.dllearner.kb.extraction.Manager; @@ -38,17 +42,28 @@ * */ public class SparqlExtractionTest { + + private static Logger logger = Logger.getRootLogger(); + public static void main(String[] args) { System.out.println("Start"); +// create logger (a simple logger which outputs + // its messages to the console) + SimpleLayout layout = new SimpleLayout(); + ConsoleAppender consoleAppender = new ConsoleAppender(layout); + logger.removeAllAppenders(); + logger.addAppender(consoleAppender); + logger.setLevel(Level.TRACE); + // String test2 = "http://www.extraction.org/config#dbpediatest"; // String test = "http://www.extraction.org/config#localjoseki"; try { // URI u = new URI(test); Manager m = new Manager(); Configuration conf = new Configuration ( - new SparqlTupelAquisitor(SparqlQueryMaker.getYAGOFilter(), SPARQLTasks.getPredefinedSPARQLTasksWithCache("DBPEDIA")), + new SparqlTupelAquisitor(SparqlQueryMaker.getAllowYAGOFilter(), SPARQLTasks.getPredefinedSPARQLTasksWithCache("DBPEDIA")), Manipulator.getDefaultManipulator(), 1, true, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-08-15 13:53:50
|
Revision: 1091 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1091&view=rev Author: sknappe Date: 2008-08-15 13:53:47 +0000 (Fri, 15 Aug 2008) Log Message: ----------- added database schema for the database that is afterwords filled with data by CalculatePageRank.java Script Added Paths: ----------- trunk/src/dbpedia-navigator/localhost.sql Added: trunk/src/dbpedia-navigator/localhost.sql =================================================================== --- trunk/src/dbpedia-navigator/localhost.sql (rev 0) +++ trunk/src/dbpedia-navigator/localhost.sql 2008-08-15 13:53:47 UTC (rev 1091) @@ -0,0 +1,50 @@ +-- phpMyAdmin SQL Dump +-- version 2.9.1 +-- http://www.phpmyadmin.net +-- +-- Host: localhost +-- Erstellungszeit: 15. August 2008 um 15:51 +-- Server Version: 5.0.67 +-- PHP-Version: 5.2.5 +-- +-- Datenbank: `navigator_db` +-- +CREATE DATABASE `navigator_db` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; +USE `navigator_db`; + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `categories` +-- + +CREATE TABLE `categories` ( + `category` varchar(330) NOT NULL, + `label` varchar(330) NOT NULL, + PRIMARY KEY (`category`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Daten für Tabelle `categories` +-- + + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `rank` +-- + +CREATE TABLE `rank` ( + `name` varchar(330) NOT NULL, + `number` int(8) NOT NULL default '0', + `label` varchar(330) default NULL, + `category` varchar(330) default NULL, + PRIMARY KEY (`name`), + FULLTEXT KEY `Label` (`label`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Daten für Tabelle `rank` +-- + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-08-15 13:44:42
|
Revision: 1090 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1090&view=rev Author: sknappe Date: 2008-08-15 13:44:39 +0000 (Fri, 15 Aug 2008) Log Message: ----------- added other functions (stop server call and get subjects from concept) Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_learn_concepts.php trunk/src/dbpedia-navigator/index.php Added Paths: ----------- trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php trunk/src/dbpedia-navigator/ajax_stop_server_call.php Added: trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-08-15 13:44:39 UTC (rev 1090) @@ -0,0 +1,27 @@ +<?php + include('helper_functions.php'); + + $concept=$_POST['concept']; + + session_start(); + $id=$_SESSION['id']; + $ksID=$_SESSION['ksID']; + session_write_close(); + + setRunning($id,"true"); + + $concept=html_entity_decode($concept); + $content=""; + try{ + require_once("DLLearnerConnection.php"); + $sc=new DLLearnerConnection($id,$ksID); + $subjects=$sc->getSubjectsFromConcept($concept); + $content.=getResultsTable($subjects); + } catch (Exception $e){ + $content=$e->getMessage(); + } + + print $content; + print '$$'; + print "Instances for Concept ".$concept; +?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-08-15 13:33:38 UTC (rev 1089) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-08-15 13:44:39 UTC (rev 1090) @@ -1,4 +1,6 @@ <?php + include('helper_functions.php'); + session_start(); if (isset($_SESSION['positive'])) $positives=$_SESSION['positive']; Added: trunk/src/dbpedia-navigator/ajax_stop_server_call.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_stop_server_call.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_stop_server_call.php 2008-08-15 13:44:39 UTC (rev 1090) @@ -0,0 +1,8 @@ +<?php + include('helper_functions.php'); + + session_start(); + $id=$_SESSION['id']; + session_write_close(); + setRunning($id,"false"); +?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-08-15 13:33:38 UTC (rev 1089) +++ trunk/src/dbpedia-navigator/index.php 2008-08-15 13:44:39 UTC (rev 1090) @@ -335,6 +335,55 @@ XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); XhrObj.send(); } + + function stopServerCall() + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_stop_server_call.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); + } + + 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.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); + } </script> </head> <body> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-08-15 13:33:40
|
Revision: 1089 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1089&view=rev Author: sknappe Date: 2008-08-15 13:33:38 +0000 (Fri, 15 Aug 2008) Log Message: ----------- added learning concepts Modified Paths: -------------- trunk/src/dbpedia-navigator/index.php Added Paths: ----------- trunk/src/dbpedia-navigator/ajax_learn_concepts.php Added: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-08-15 13:33:38 UTC (rev 1089) @@ -0,0 +1,47 @@ +<?php + session_start(); + + if (isset($_SESSION['positive'])) $positives=$_SESSION['positive']; + if (isset($_SESSION['negative'])) $negatives=$_SESSION['negative']; + $id=$_SESSION['id']; + $ksID=$_SESSION['ksID']; + session_write_close(); + setRunning($id,"true"); + $concept=""; + $conceptinformation=""; + if (isset($positives)) + { + $posArray=array(); + foreach ($positives as $name=>$lab) + $posArray[]=$name; + $negArray=array(); + if (isset($negatives)) + foreach ($negatives as $name=>$lab) + $negArray[]=$name; + + require_once("DLLearnerConnection.php"); + $sc=new DLLearnerConnection($id, $ksID); + try{ + $concepts=$sc->getConceptFromExamples($posArray,$negArray); + $conceptDepth=$sc->getConceptDepth(); + $conceptArity=$sc->getConceptArity(); + + $concept.="<table border=0>\n"; + $i=1; + foreach ($concepts as $con){ + $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('concept=".$con."');return false;\" onMouseOver=\"showdiv('div".$i."');showdiv('ConceptBox');\" onMouseOut=\"hidediv('div".$i."');hidediv('ConceptBox');\" />".$con."</a></td></tr>"; + //put information about concepts in divs + $conceptinformation.="<div id=\"div".$i."\" style=\"display:none\">Concept Depth: ".$conceptDepth[$i-1]."<br/>Concept Arity: ".$conceptArity[$i-1]."<br/>Concept Length: ".$sc->getConceptLength($con)."</div>"; + $i++; + } + $concept.="</table>"; + } catch(Exception $e){ + $concept.=$e->getMessage(); + } + } + else $concept="You must choose at least one positive example."; + + print $concept; + print '$$'; + print $conceptinformation; +?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-08-15 13:20:59 UTC (rev 1088) +++ trunk/src/dbpedia-navigator/index.php 2008-08-15 13:33:38 UTC (rev 1089) @@ -309,6 +309,32 @@ XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); XhrObj.send(param); } + + function learnConcept() + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_learn_concepts.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('conceptlink').innerHTML=response[0]; + document.getElementById('ConceptInformation').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); + } </script> </head> <body> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-08-15 13:21:03
|
Revision: 1088 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1088&view=rev Author: sknappe Date: 2008-08-15 13:20:59 +0000 (Fri, 15 Aug 2008) Log Message: ----------- added wsdl and xsd files Added Paths: ----------- trunk/src/dbpedia-navigator/def0.xsd trunk/src/dbpedia-navigator/def1.xsd trunk/src/dbpedia-navigator/main.wsdl Added: trunk/src/dbpedia-navigator/def0.xsd =================================================================== --- trunk/src/dbpedia-navigator/def0.xsd (rev 0) +++ trunk/src/dbpedia-navigator/def0.xsd 2008-08-15 13:20:59 UTC (rev 1088) @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:tns="http://server.dllearner.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://server.dllearner.org/" version="1.0"> + + <xs:element name="ClientNotKnownException" type="tns:ClientNotKnownException"></xs:element> + + <xs:element name="ComponentInitException" type="tns:ComponentInitException"></xs:element> + + <xs:element name="ConfigOptionTypeException" type="tns:ConfigOptionTypeException"></xs:element> + + <xs:element name="LearningProblemUnsupportedException" type="tns:LearningProblemUnsupportedException"></xs:element> + + <xs:element name="ParseException" type="tns:ParseException"></xs:element> + + <xs:element name="SparqlQueryException" type="tns:SparqlQueryException"></xs:element> + + <xs:element name="UnknownComponentException" type="tns:UnknownComponentException"></xs:element> + + <xs:complexType name="ParseException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="ClientNotKnownException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="SparqlQueryException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="UnknownComponentException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="ConfigOptionTypeException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="ComponentInitException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="LearningProblemUnsupportedException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> +</xs:schema> \ No newline at end of file Added: trunk/src/dbpedia-navigator/def1.xsd =================================================================== --- trunk/src/dbpedia-navigator/def1.xsd (rev 0) +++ trunk/src/dbpedia-navigator/def1.xsd 2008-08-15 13:20:59 UTC (rev 1088) @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://jaxb.dev.java.net/array" version="1.0"> + + <xs:complexType final="#all" name="stringArray"> + <xs:sequence> + <xs:element nillable="true" maxOccurs="unbounded" name="item" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType final="#all" name="intArray"> + <xs:sequence> + <xs:element nillable="true" maxOccurs="unbounded" name="item" type="xs:int" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> +</xs:schema> \ No newline at end of file Added: trunk/src/dbpedia-navigator/main.wsdl =================================================================== --- trunk/src/dbpedia-navigator/main.wsdl (rev 0) +++ trunk/src/dbpedia-navigator/main.wsdl 2008-08-15 13:20:59 UTC (rev 1088) @@ -0,0 +1,1318 @@ +<?xml version="1.0" encoding="UTF-8"?><definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://server.dllearner.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://server.dllearner.org/" name="DLLearnerWSService"> + <types> + <xsd:schema> + <xsd:import schemaLocation="def0.xsd" namespace="http://server.dllearner.org/"></xsd:import> + </xsd:schema> + <xsd:schema> + <xsd:import schemaLocation="def1.xsd" namespace="http://jaxb.dev.java.net/array"></xsd:import> + </xsd:schema> + </types> + <message name="getBuild"></message> + <message name="getBuildResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="generateID"></message> + <message name="generateIDResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="getKnowledgeSources"></message> + <message name="getKnowledgeSourcesResponse"> + <part xmlns:ns1="http://jaxb.dev.java.net/array" name="return" type="ns1:stringArray"></part> + </message> + <message name="getReasoners"></message> + <message name="getReasonersResponse"> + <part xmlns:ns2="http://jaxb.dev.java.net/array" name="return" type="ns2:stringArray"></part> + </message> + <message name="getLearningProblems"></message> + <message name="getLearningProblemsResponse"> + <part xmlns:ns3="http://jaxb.dev.java.net/array" name="return" type="ns3:stringArray"></part> + </message> + <message name="getLearningAlgorithms"></message> + <message name="getLearningAlgorithmsResponse"> + <part xmlns:ns4="http://jaxb.dev.java.net/array" name="return" type="ns4:stringArray"></part> + </message> + <message name="getConfigOptions"> + <part name="arg0" type="xsd:string"></part> + <part name="arg1" type="xsd:boolean"></part> + </message> + <message name="getConfigOptionsResponse"> + <part xmlns:ns5="http://jaxb.dev.java.net/array" name="return" type="ns5:stringArray"></part> + </message> + <message name="UnknownComponentException"> + <part element="tns:UnknownComponentException" name="fault"></part> + </message> + <message name="addKnowledgeSource"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="addKnowledgeSourceResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="ClientNotKnownException"> + <part element="tns:ClientNotKnownException" name="fault"></part> + </message> + <message name="removeKnowledgeSource"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="removeKnowledgeSourceResponse"></message> + <message name="setReasoner"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="setReasonerResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="setLearningProblem"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="setLearningProblemResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="setLearningAlgorithm"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="setLearningAlgorithmResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="LearningProblemUnsupportedException"> + <part element="tns:LearningProblemUnsupportedException" name="fault"></part> + </message> + <message name="initAll"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="initAllResponse"></message> + <message name="ComponentInitException"> + <part element="tns:ComponentInitException" name="fault"></part> + </message> + <message name="learn"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="learnResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="learnDescriptionsEvaluated"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="learnDescriptionsEvaluatedResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="getCurrentlyBestEvaluatedDescriptions"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="getCurrentlyBestEvaluatedDescriptionsResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="learnThreaded"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="learnThreadedResponse"></message> + <message name="getCurrentlyBestConcept"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="getCurrentlyBestConceptResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="getCurrentlyBestConcepts"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getCurrentlyBestConceptsResponse"> + <part xmlns:ns6="http://jaxb.dev.java.net/array" name="return" type="ns6:stringArray"></part> + </message> + <message name="isAlgorithmRunning"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="isAlgorithmRunningResponse"> + <part name="return" type="xsd:boolean"></part> + </message> + <message name="setPositiveExamples"> + <part name="arg0" type="xsd:int"></part> + <part xmlns:ns7="http://jaxb.dev.java.net/array" name="arg1" type="ns7:stringArray"></part> + </message> + <message name="setPositiveExamplesResponse"></message> + <message name="setNegativeExamples"> + <part name="arg0" type="xsd:int"></part> + <part xmlns:ns8="http://jaxb.dev.java.net/array" name="arg1" type="ns8:stringArray"></part> + </message> + <message name="setNegativeExamplesResponse"></message> + <message name="applyConfigEntryInt"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + <part name="arg3" type="xsd:int"></part> + </message> + <message name="applyConfigEntryIntResponse"></message> + <message name="applyConfigEntryString"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + <part name="arg3" type="xsd:string"></part> + </message> + <message name="applyConfigEntryStringResponse"></message> + <message name="applyConfigEntryStringArray"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + <part xmlns:ns9="http://jaxb.dev.java.net/array" name="arg3" type="ns9:stringArray"></part> + </message> + <message name="applyConfigEntryStringArrayResponse"></message> + <message name="applyConfigEntryBoolean"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + <part name="arg3" type="xsd:boolean"></part> + </message> + <message name="applyConfigEntryBooleanResponse"></message> + <message name="getConfigOptionValueStringArray"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueStringArrayResponse"> + <part xmlns:ns10="http://jaxb.dev.java.net/array" name="return" type="ns10:stringArray"></part> + </message> + <message name="ConfigOptionTypeException"> + <part element="tns:ConfigOptionTypeException" name="fault"></part> + </message> + <message name="getConfigOptionValueString"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueStringResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueDouble"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueDoubleResponse"> + <part name="return" type="xsd:double"></part> + </message> + <message name="getConfigOptionValueBoolean"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueBooleanResponse"> + <part name="return" type="xsd:boolean"></part> + </message> + <message name="getConfigOptionValueInt"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueIntResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="getAtomicConcepts"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="getAtomicConceptsResponse"> + <part xmlns:ns11="http://jaxb.dev.java.net/array" name="return" type="ns11:stringArray"></part> + </message> + <message name="getSubsumptionHierarchy"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="getSubsumptionHierarchyResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="retrieval"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="retrievalResponse"> + <part xmlns:ns12="http://jaxb.dev.java.net/array" name="return" type="ns12:stringArray"></part> + </message> + <message name="ParseException"> + <part element="tns:ParseException" name="fault"></part> + </message> + <message name="getConceptLength"> + <part name="arg0" type="xsd:string"></part> + </message> + <message name="getConceptLengthResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="getAtomicRoles"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="getAtomicRolesResponse"> + <part xmlns:ns13="http://jaxb.dev.java.net/array" name="return" type="ns13:stringArray"></part> + </message> + <message name="getInstances"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="getInstancesResponse"> + <part xmlns:ns14="http://jaxb.dev.java.net/array" name="return" type="ns14:stringArray"></part> + </message> + <message name="getIndividualsForARole"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="getIndividualsForARoleResponse"> + <part xmlns:ns15="http://jaxb.dev.java.net/array" name="return" type="ns15:stringArray"></part> + </message> + <message name="getAsJSON"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="getAsJSONResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="SparqlQueryException"> + <part element="tns:SparqlQueryException" name="fault"></part> + </message> + <message name="getAsXMLString"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="getAsXMLStringResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="sparqlQueryThreaded"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="sparqlQueryThreadedResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="sparqlQuery"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="sparqlQueryResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="isSparqlQueryRunning"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="isSparqlQueryRunningResponse"> + <part name="return" type="xsd:boolean"></part> + </message> + <message name="stopSparqlThread"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="stopSparqlThreadResponse"></message> + <message name="getConceptDepth"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="getConceptDepthResponse"> + <part xmlns:ns16="http://jaxb.dev.java.net/array" name="return" type="ns16:intArray"></part> + </message> + <message name="getConceptArity"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="getConceptArityResponse"> + <part xmlns:ns17="http://jaxb.dev.java.net/array" name="return" type="ns17:intArray"></part> + </message> + <message name="SparqlRetrieval"> + <part name="arg0" type="xsd:string"></part> + </message> + <message name="SparqlRetrievalResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="getNegativeExamples"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part xmlns:ns18="http://jaxb.dev.java.net/array" name="arg2" type="ns18:stringArray"></part> + <part name="arg3" type="xsd:int"></part> + <part name="arg4" type="xsd:string"></part> + </message> + <message name="getNegativeExamplesResponse"> + <part xmlns:ns19="http://jaxb.dev.java.net/array" name="return" type="ns19:stringArray"></part> + </message> + <message name="init"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="initResponse"></message> + <message name="debug"> + <part name="arg0" type="xsd:string"></part> + </message> + <message name="debugResponse"></message> + <message name="stop"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="stopResponse"></message> + <message name="getComponents"></message> + <message name="getComponentsResponse"> + <part xmlns:ns20="http://jaxb.dev.java.net/array" name="return" type="ns20:stringArray"></part> + </message> + <portType name="DLLearnerWebService"> + <operation name="getBuild" parameterOrder=""> + <input message="tns:getBuild"></input> + <output message="tns:getBuildResponse"></output> + </operation> + <operation name="generateID" parameterOrder=""> + <input message="tns:generateID"></input> + <output message="tns:generateIDResponse"></output> + </operation> + <operation name="getKnowledgeSources" parameterOrder=""> + <input message="tns:getKnowledgeSources"></input> + <output message="tns:getKnowledgeSourcesResponse"></output> + </operation> + <operation name="getReasoners" parameterOrder=""> + <input message="tns:getReasoners"></input> + <output message="tns:getReasonersResponse"></output> + </operation> + <operation name="getLearningProblems" parameterOrder=""> + <input message="tns:getLearningProblems"></input> + <output message="tns:getLearningProblemsResponse"></output> + </operation> + <operation name="getLearningAlgorithms" parameterOrder=""> + <input message="tns:getLearningAlgorithms"></input> + <output message="tns:getLearningAlgorithmsResponse"></output> + </operation> + <operation name="getConfigOptions" parameterOrder="arg0 arg1"> + <input message="tns:getConfigOptions"></input> + <output message="tns:getConfigOptionsResponse"></output> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="addKnowledgeSource" parameterOrder="arg0 arg1 arg2"> + <input message="tns:addKnowledgeSource"></input> + <output message="tns:addKnowledgeSourceResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="removeKnowledgeSource" parameterOrder="arg0 arg1"> + <input message="tns:removeKnowledgeSource"></input> + <output message="tns:removeKnowledgeSourceResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="setReasoner" parameterOrder="arg0 arg1"> + <input message="tns:setReasoner"></input> + <output message="tns:setReasonerResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="setLearningProblem" parameterOrder="arg0 arg1"> + <input message="tns:setLearningProblem"></input> + <output message="tns:setLearningProblemResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="setLearningAlgorithm" parameterOrder="arg0 arg1"> + <input message="tns:setLearningAlgorithm"></input> + <output message="tns:setLearningAlgorithmResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:LearningProblemUnsupportedException" name="LearningProblemUnsupportedException"></fault> + </operation> + <operation name="initAll" parameterOrder="arg0"> + <input message="tns:initAll"></input> + <output message="tns:initAllResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:ComponentInitException" name="ComponentInitException"></fault> + </operation> + <operation name="learn" parameterOrder="arg0 arg1"> + <input message="tns:learn"></input> + <output message="tns:learnResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="learnDescriptionsEvaluated" parameterOrder="arg0 arg1"> + <input message="tns:learnDescriptionsEvaluated"></input> + <output message="tns:learnDescriptionsEvaluatedResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getCurrentlyBestEvaluatedDescriptions" parameterOrder="arg0 arg1"> + <input message="tns:getCurrentlyBestEvaluatedDescriptions"></input> + <output message="tns:getCurrentlyBestEvaluatedDescriptionsResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="learnThreaded" parameterOrder="arg0"> + <input message="tns:learnThreaded"></input> + <output message="tns:learnThreadedResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getCurrentlyBestConcept" parameterOrder="arg0"> + <input message="tns:getCurrentlyBestConcept"></input> + <output message="tns:getCurrentlyBestConceptResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getCurrentlyBestConcepts" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getCurrentlyBestConcepts"></input> + <output message="tns:getCurrentlyBestConceptsResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="isAlgorithmRunning" parameterOrder="arg0"> + <input message="tns:isAlgorithmRunning"></input> + <output message="tns:isAlgorithmRunningResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="setPositiveExamples" parameterOrder="arg0 arg1"> + <input message="tns:setPositiveExamples"></input> + <output message="tns:setPositiveExamplesResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="setNegativeExamples" parameterOrder="arg0 arg1"> + <input message="tns:setNegativeExamples"></input> + <output message="tns:setNegativeExamplesResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="applyConfigEntryInt" parameterOrder="arg0 arg1 arg2 arg3"> + <input message="tns:applyConfigEntryInt"></input> + <output message="tns:applyConfigEntryIntResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="applyConfigEntryString" parameterOrder="arg0 arg1 arg2 arg3"> + <input message="tns:applyConfigEntryString"></input> + <output message="tns:applyConfigEntryStringResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="applyConfigEntryStringArray" parameterOrder="arg0 arg1 arg2 arg3"> + <input message="tns:applyConfigEntryStringArray"></input> + <output message="tns:applyConfigEntryStringArrayResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="applyConfigEntryBoolean" parameterOrder="arg0 arg1 arg2 arg3"> + <input message="tns:applyConfigEntryBoolean"></input> + <output message="tns:applyConfigEntryBooleanResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="getConfigOptionValueStringArray" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueStringArray"></input> + <output message="tns:getConfigOptionValueStringArrayResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> + <operation name="getConfigOptionValueString" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueString"></input> + <output message="tns:getConfigOptionValueStringResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> + <operation name="getConfigOptionValueDouble" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueDouble"></input> + <output message="tns:getConfigOptionValueDoubleResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> + <operation name="getConfigOptionValueBoolean" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueBoolean"></input> + <output message="tns:getConfigOptionValueBooleanResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> + <operation name="getConfigOptionValueInt" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueInt"></input> + <output message="tns:getConfigOptionValueIntResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> + <operation name="getAtomicConcepts" parameterOrder="arg0"> + <input message="tns:getAtomicConcepts"></input> + <output message="tns:getAtomicConceptsResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getSubsumptionHierarchy" parameterOrder="arg0"> + <input message="tns:getSubsumptionHierarchy"></input> + <output message="tns:getSubsumptionHierarchyResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="retrieval" parameterOrder="arg0 arg1"> + <input message="tns:retrieval"></input> + <output message="tns:retrievalResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:ParseException" name="ParseException"></fault> + </operation> + <operation name="getConceptLength" parameterOrder="arg0"> + <input message="tns:getConceptLength"></input> + <output message="tns:getConceptLengthResponse"></output> + <fault message="tns:ParseException" name="ParseException"></fault> + </operation> + <operation name="getAtomicRoles" parameterOrder="arg0"> + <input message="tns:getAtomicRoles"></input> + <output message="tns:getAtomicRolesResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getInstances" parameterOrder="arg0"> + <input message="tns:getInstances"></input> + <output message="tns:getInstancesResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getIndividualsForARole" parameterOrder="arg0 arg1"> + <input message="tns:getIndividualsForARole"></input> + <output message="tns:getIndividualsForARoleResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getAsJSON" parameterOrder="arg0 arg1"> + <input message="tns:getAsJSON"></input> + <output message="tns:getAsJSONResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:SparqlQueryException" name="SparqlQueryException"></fault> + </operation> + <operation name="getAsXMLString" parameterOrder="arg0 arg1"> + <input message="tns:getAsXMLString"></input> + <output message="tns:getAsXMLStringResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:SparqlQueryException" name="SparqlQueryException"></fault> + </operation> + <operation name="sparqlQueryThreaded" parameterOrder="arg0 arg1 arg2"> + <input message="tns:sparqlQueryThreaded"></input> + <output message="tns:sparqlQueryThreadedResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="sparqlQuery" parameterOrder="arg0 arg1 arg2"> + <input message="tns:sparqlQuery"></input> + <output message="tns:sparqlQueryResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="isSparqlQueryRunning" parameterOrder="arg0 arg1"> + <input message="tns:isSparqlQueryRunning"></input> + <output message="tns:isSparqlQueryRunningResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="stopSparqlThread" parameterOrder="arg0 arg1"> + <input message="tns:stopSparqlThread"></input> + <output message="tns:stopSparqlThreadResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getConceptDepth" parameterOrder="arg0 arg1"> + <input message="tns:getConceptDepth"></input> + <output message="tns:getConceptDepthResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getConceptArity" parameterOrder="arg0 arg1"> + <input message="tns:getConceptArity"></input> + <output message="tns:getConceptArityResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="SparqlRetrieval" parameterOrder="arg0"> + <input message="tns:SparqlRetrieval"></input> + <output message="tns:SparqlRetrievalResponse"></output> + <fault message="tns:ParseException" name="ParseException"></fault> + </operation> + <operation name="getNegativeExamples" parameterOrder="arg0 arg1 arg2 arg3 arg4"> + <input message="tns:getNegativeExamples"></input> + <output message="tns:getNegativeExamplesResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="init" parameterOrder="arg0 arg1"> + <input message="tns:init"></input> + <output message="tns:initResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ComponentInitException" name="ComponentInitException"></fault> + </operation> + <operation name="debug" parameterOrder="arg0"> + <input message="tns:debug"></input> + <output message="tns:debugResponse"></output> + </operation> + <operation name="stop" parameterOrder="arg0"> + <input message="tns:stop"></input> + <output message="tns:stopResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getComponents" parameterOrder=""> + <input message="tns:getComponents"></input> + <output message="tns:getComponentsResponse"></output> + </operation> + </portType> + <binding name="DLLearnerWebServicePortBinding" type="tns:DLLearnerWebService"> + <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"></soap:binding> + <operation name="getBuild"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="generateID"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="getKnowledgeSources"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="getReasoners"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="getLearningProblems"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="getLearningAlgorithms"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="getConfigOptions"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="addKnowledgeSource"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="removeKnowledgeSource"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="setReasoner"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="setLearningProblem"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="setLearningAlgorithm"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="LearningProblemUnsupportedException"> + <soap:fault name="LearningProblemUnsupportedException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="initAll"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="ComponentInitException"> + <soap:fault name="ComponentInitException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="learn"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="learnDescriptionsEvaluated"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getCurrentlyBestEvaluatedDescriptions"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="learnThreaded"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getCurrentlyBestConcept"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getCurrentlyBestConcepts"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="isAlgorithmRunning"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="setPositiveExamples"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="setNegativeExamples"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="applyConfigEntryInt"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="applyConfigEntryString"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="applyConfigEntryStringArray"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="applyConfigEntryBoolean"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConfigOptionValueStringArray"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConfigOptionValueString"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConfigOptionValueDouble"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConfigOptionValueBoolean"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConfigOptionValueInt"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getAtomicConcepts"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getSubsumptionHierarchy"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="retrieval"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="ParseException"> + <soap:fault name="ParseException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConceptLength"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ParseException"> + <soap:fault name="ParseException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getAtomicRoles"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getInstances"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getIndividualsForARole"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getAsJSON"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="SparqlQueryException"> + <soap:fault name="SparqlQueryException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getAsXMLString"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="SparqlQueryException"> + <soap:fault name="SparqlQueryException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="sparqlQueryThreaded"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="sparqlQuery"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="isSparqlQueryRunning"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="stopSparqlThread"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:f... [truncated message content] |
From: <sk...@us...> - 2008-08-15 13:09:40
|
Revision: 1087 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1087&view=rev Author: sknappe Date: 2008-08-15 13:09:35 +0000 (Fri, 15 Aug 2008) Log Message: ----------- renamed new index to index.php Added Paths: ----------- trunk/src/dbpedia-navigator/index.php Removed Paths: ------------- trunk/src/dbpedia-navigator/index-new.php Deleted: trunk/src/dbpedia-navigator/index-new.php =================================================================== --- trunk/src/dbpedia-navigator/index-new.php 2008-08-15 13:08:36 UTC (rev 1086) +++ trunk/src/dbpedia-navigator/index-new.php 2008-08-15 13:09:35 UTC (rev 1087) @@ -1,480 +0,0 @@ -<?php - -ini_set('error_reporting',E_ALL); -ini_set('max_execution_time',200); -ini_set("soap.wsdl_cache_enabled","1"); - -session_start(); -require_once('DLLearnerConnection.php'); -$sc=new DLLearnerConnection(); -$ids=$sc->getIDs(); -$_SESSION['id']=$ids[0]; -$_SESSION['ksID']=$ids[1]; - -if (isset($_GET['path'])) $path=$_GET['path']; -else $path=""; - -require_once('Settings.php'); -$settings=new Settings(); - -/* -//what happens onLoad -$onLoad="onLoad=\""; -if (isset($_GET['resource'])){ - $onLoad.="xajax_getarticle('".$_GET['resource']."',-1);"; - unset($_GET['resource']); -} -else if (isset($_SESSION['currentArticle'])){ - $onLoad.="xajax_getarticle('',".$_SESSION['currentArticle'].");"; -} -$onLoad.="\""; -*/ - -echo '<?xml version="1.0" encoding="UTF-8"?>'; -?> -<!DOCTYPE html - PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - <head> - <title>DBpedia Navigator</title> - <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> - <link rel="stylesheet" href="<?php print $path;?>default.css"/> - <link rel="stylesheet" type="text/css" href="<?php print $path;?>treemenu/dhtmlxtree.css"> - <script src="http://maps.google.com/maps?file=api&v=2&key=<?php print $settings->googleMapsKey;?>" - type="text/javascript"></script> - <script src="<?php print $path;?>treemenu/dhtmlxcommon.js"></script> - <script src="<?php print $path;?>treemenu/dhtmlxtree.js"></script> - <script type="text/javascript"> - function showdiv(id){ - document.getElementById(id).style.display='block'; - } - - function hidediv(id) { - document.getElementById(id).style.display='none'; - } - - function loadGoogleMap(Lat,Lng,Label) { - if (document.getElementById("map").style.display=="none"){ - document.getElementById("map").style.display='block'; - if (GBrowserIsCompatible()) { - // Create and Center a Map - var map = new GMap2(document.getElementById("map")); - map.setCenter(new GLatLng(Lat, Lng), 12); - map.addControl(new GLargeMapControl()); - map.addControl(new GMapTypeControl()); - var marker=new GMarker(new GLatLng(Lat, Lng)); - GEvent.addListener(marker, "click", function() { - marker.openInfoWindowHtml(Label); - }); - map.addOverlay(marker); - } - } - else { - document.getElementById("map").style.display='none'; - } - } - - function search_it(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_search.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.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function get_article(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_get_article.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]; - document.getElementById('lastarticles').innerHTML=response[2]; - document.getElementById('Positives').innerHTML=response[3]; - document.getElementById('Negatives').innerHTML=response[4]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function show_results(class, number) - { - var links=document.getElementById('results').getElementsByTagName('p'); - var j=0; - for (var i=0;i<links.length;i++){ - if (links[i].getElementsByTagName('a')[0].className==class||class=='all'){ - if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; - else links[i].style.display='none'; - j++; - } - else links[i].style.display='none'; - } - if (j<number){ - show_results(class,0); - return; - } - - var sitenumbers=document.getElementById('sitenumbers').getElementsByTagName('span'); - for (var i=0;i<sitenumbers.length;i++){ - if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25==number) sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='none'; - else sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='underline'; - if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25>=j) - sitenumbers[i].style.display='none'; - else - sitenumbers[i].style.display='inline'; - } - } - - function toPositive(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_to_positive.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('Positives').innerHTML=response[0]; - document.getElementById('Negatives').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function toNegative(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_to_negative.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('Positives').innerHTML=response[0]; - document.getElementById('Negatives').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function clearPositives() - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_clear_positives.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - document.getElementById('Positives').innerHTML = XhrObj.responseText; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(); - } - - function clearNegatives() - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_clear_negatives.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - document.getElementById('Negatives').innerHTML = XhrObj.responseText; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(); - } - - function removePosInterest(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_remove_pos_interest.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('Positives').innerHTML=response[0]; - document.getElementById('Negatives').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function removeNegInterest(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_remove_neg_interest.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('Positives').innerHTML=response[0]; - document.getElementById('Negatives').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - </script> - </head> - <body> - -<!-- <h1>DBpedia Navigator</h1> --> -<div><table border="0" width="100%"><tr><td width="35%"><img src="<?php print $path;?>images/dbpedia_navigator.png" alt="DBpedia Navigator" style="padding:5px" /></td><td width="50%"><span id="conceptlink"></span></td><td width="15%"><span id="Loading" style="display:none">Server Call... <img src="<?php print $path;?>images/remove.png" onclick="xajax_stopServerCall();return false;" /></span></td></tr></table></div> -<div id="layer" style="display:none"> - <div id="layerContent" style="display:none"></div> -</div> - -<div id="wrapper"> - <div id="leftSidebar"> - - <div class="box"> - <div class="boxtitle">Search DBpedia</div> - <div class="boxcontent" id="search"> - <!-- Search:<br/> --> - <form onSubmit="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;"> - <input type="text" name="label" id="label" /><br/> - <input type="button" value="Article" class="button" onclick="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;" /> <input type="button" value="Search" class="button" onclick="var list=tree.getAllChecked();search_it('label='+document.getElementById('label').value+'&list='+list+'&number=10');return false;" /> - <!-- <input type="button" value="Fulltext" class="button" onclick=""/> --> - </form> - </div> <!-- boxcontent --> - </div> <!-- box --> - - <div class="box" id="SearchResultBox" style="display:none"> - <div class="boxtitle">Search Results</div> - <div class="boxcontent"> - <div id="searchcontent" style="display:block"></div> - </div> <!-- boxcontent --> - </div> <!-- box --> - - <div class="box" id="NavigationBox"> - <div class="boxtitle">Navigate</div> - <div class="boxcontent"> - <div id="treeboxbox_tree" style="height:218px;overflow:auto;"> - </div> - </div> <!-- boxcontent --> - </div> <!-- box --> - <script> - tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0); - tree.setImagePath("<?php print $path;?>images/csh_bluebooks/"); - tree.enableCheckBoxes(1); - tree.setOnClickHandler(doOnClick); - function doOnClick(nodeId){ - var myUrl = tree.getUserData(nodeId,"myurl"); - xajax_getSubjectsFromConcept(myUrl); - } - tree.setXMLAutoLoading("processTreeMenu.php"); - tree.loadXML("processTreeMenu.php?id=0"); - </script> - - - <div class="box" id="credits"> - <p>DBpedia Navigator is powered by ... <br /> - <a href="http://dl-learner.org">DL-Learner</a><br /> - <a href="http//dbpedia.org">DBpedia</a><br/> - <a href="http://virtuoso.openlinksw.com/wiki/main/">OpenLink Virtuoso</a><br /> - ... and implemented by <a href="http://jens-lehmann.org">Jens Lehmann</a> and - Sebastian Knappe at the <a href="http:/aksw.org">AKSW</a> research group (University of Leipzig).</p> - - <a href="http://www.w3.org/2004/OWL/"><img src="<?php print $path;?>images/sw-owl-green.png" alt="OWL logo" /></a> - <a href="http://www.w3.org/2001/sw/DataAccess/"><img src="<?php print $path;?>images/sw-sparql-green.png" alt="SPARQL logo"/></a> - </div> - - </div><!-- END leftSidebar --> - - <div id="content"> - <div class="box"> - <div class="boxtitle" id="ArticleTitle">Welcome</div> - <div class="boxcontent" id="article"> - <div id="articlecontent" style="display:block"> - <br /><br /> - Welcome to the DBpedia Navigator interface! DBpedia Navigator allows you to search DBpedia - and uses the background knowledge in DBpedia to suggest possible interesting navigation - links. - </div> - </div> <!-- boxcontent --> - </div> <!-- box --> - </div><!-- content --> - - <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="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="boxcontent" id="Negatives"> - </div> <!-- boxcontent --> - </div> <!-- box --> - - <div class="box" id="LastArticlesBox" style="display:none"> - <div class="boxtitle">Articles Last Viewed</div> - <div class="boxcontent" id="lastarticles"> - </div> <!-- boxcontent --> - </div> <!-- box --> - - </div><!-- rightSidebar --> - - <!-- <div id="clear"></div> --> - -</div><!-- wrapper --> -<div id="footer"> - <p>Licensed under the GNU General Public License (GPL) 3 as part of the DL-Learner open source - project.<br />Copyright © Jens Lehmann 2007-2008 </p> - <div id="validation"> - <?php - $uri = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; - - echo '<div><a href="http://validator.w3.org/check?uri='.$uri.'"'; - echo '><img src="'.$path.'images/valid-xhtml10.png" alt="valid XHTML 1.0" /></a>'."\n"; - echo '<a href="http://jigsaw.w3.org/css-validator/validator?uri='.$uri.'"'; - echo '><img src="'.$path.'images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; - ?> - </div> - <p><a href='<?php print $path;?>rebuild.php'>rebuild [restart session and redownload WSDL file (for debugging)]</a></p> -</div> - -<div id="todo"> -<b>ToDo:</b> -<ul style="float:left"> - <li>Get learning component fast.</li> - <li>Get local DBpedia SPARQL endpoint working (next DBpedia release expected at the endof January and then every - two months, so it would be nice to have a script based partly automated or at least documented solution for - creating a DBpedia mirror).</li> - <li>Improve stability: Fix sometimes occurring PHP errors and warnings (check PHP error log).</li> - <li>For each result, display a "+" which shows more information about the concept in an overlay box, e.g. its - Description Logic or OWL syntax, its classification accuracy on the examples, and which - examples it classifies (in-)correctly.</li> - <li>Create a small number of test cases (e.g. 3), which can be used to verify that DBpedia Navigator is - working in typical scenarios (in particular cases where concepts with length greater one are learned).</li> - <li>Allow to disable caching functionality (in Settings.php).</li> - <li>Make DBpedia Navigator RESTful, e.g. URLs $base/showArticle/$URL for displaying an article; - $base/search/$phrase for searching; $base/listInstances/$complexClass for listing the instances of - a learned. Maybe session variables (in particuar the selected positive and negative examples) can - also be given, e.g. $base/search/$phrase?positives=[$URL1,$URL2,$URL3]&negatives=[$URL4]. The supported - URI design should be briefly documented (e.g. on a dbpedia.org wiki page). A good URI design allows - easier external access (just give someone a link instead of saying exactly which actions have to be done to - get to a state), simplifies debugging the application, and may be of use for creating further - features.</li> - <li>Improve search functionality [we will probably get feedback from Georgi in February].</li> - <li>[maybe] Display a tag cloud similar to <a href="http://dbpedia.org/search/">DBpedia search</a>.</li> - <li>[maybe] Instead of only allowing a search as entry point to the application, also display - a navigatable class tree.</li> - <li>[if possible] When expensive SPARQL queries or learning problems have been posed, there should be - some way to abandon these if the user has already switched to doing something else. Example: The user - has added 3 positive and 1 negative examples. This is executed as a learning problem, but has no solution (so - DL-Learner would run forever unless we pose some internal time limit). The user adds another negative example a - second later, so instead of letting the previous learning problem run for a long time (and needing much resources), - it should be stopped by DBpedia Navigator.</li> - <li>[if possible] Find an easy way to validate HTML/JS in AJAX applications.</li> - <li>[maybe] Would be interesting to somehow view the Wikipedia article (without the left navigation part, - tabs etc.) as an overlay, because the Wikipedia article will almost always be a human-friendlier - description of an object compared to the extracted one.</li> -</ul> -</div> - - <div class="box" id="ConceptBox" style="position:absolute;top:15px;right:15px;width:18%;opacity:0.90;display:none;z-index:5;"> - <div class="boxtitle">Detailed Concept Information</div> - <div class="boxcontent" id="ConceptInformation"></div> - </div> - - </body> -</html> - \ No newline at end of file Copied: trunk/src/dbpedia-navigator/index.php (from rev 1085, trunk/src/dbpedia-navigator/index-new.php) =================================================================== --- trunk/src/dbpedia-navigator/index.php (rev 0) +++ trunk/src/dbpedia-navigator/index.php 2008-08-15 13:09:35 UTC (rev 1087) @@ -0,0 +1,480 @@ +<?php + +ini_set('error_reporting',E_ALL); +ini_set('max_execution_time',200); +ini_set("soap.wsdl_cache_enabled","1"); + +session_start(); +require_once('DLLearnerConnection.php'); +$sc=new DLLearnerConnection(); +$ids=$sc->getIDs(); +$_SESSION['id']=$ids[0]; +$_SESSION['ksID']=$ids[1]; + +if (isset($_GET['path'])) $path=$_GET['path']; +else $path=""; + +require_once('Settings.php'); +$settings=new Settings(); + +/* +//what happens onLoad +$onLoad="onLoad=\""; +if (isset($_GET['resource'])){ + $onLoad.="xajax_getarticle('".$_GET['resource']."',-1);"; + unset($_GET['resource']); +} +else if (isset($_SESSION['currentArticle'])){ + $onLoad.="xajax_getarticle('',".$_SESSION['currentArticle'].");"; +} +$onLoad.="\""; +*/ + +echo '<?xml version="1.0" encoding="UTF-8"?>'; +?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>DBpedia Navigator</title> + <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> + <link rel="stylesheet" href="<?php print $path;?>default.css"/> + <link rel="stylesheet" type="text/css" href="<?php print $path;?>treemenu/dhtmlxtree.css"> + <script src="http://maps.google.com/maps?file=api&v=2&key=<?php print $settings->googleMapsKey;?>" + type="text/javascript"></script> + <script src="<?php print $path;?>treemenu/dhtmlxcommon.js"></script> + <script src="<?php print $path;?>treemenu/dhtmlxtree.js"></script> + <script type="text/javascript"> + function showdiv(id){ + document.getElementById(id).style.display='block'; + } + + function hidediv(id) { + document.getElementById(id).style.display='none'; + } + + function loadGoogleMap(Lat,Lng,Label) { + if (document.getElementById("map").style.display=="none"){ + document.getElementById("map").style.display='block'; + if (GBrowserIsCompatible()) { + // Create and Center a Map + var map = new GMap2(document.getElementById("map")); + map.setCenter(new GLatLng(Lat, Lng), 12); + map.addControl(new GLargeMapControl()); + map.addControl(new GMapTypeControl()); + var marker=new GMarker(new GLatLng(Lat, Lng)); + GEvent.addListener(marker, "click", function() { + marker.openInfoWindowHtml(Label); + }); + map.addOverlay(marker); + } + } + else { + document.getElementById("map").style.display='none'; + } + } + + function search_it(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_search.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.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + + function get_article(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_get_article.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]; + document.getElementById('lastarticles').innerHTML=response[2]; + document.getElementById('Positives').innerHTML=response[3]; + document.getElementById('Negatives').innerHTML=response[4]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + + function show_results(class, number) + { + var links=document.getElementById('results').getElementsByTagName('p'); + var j=0; + for (var i=0;i<links.length;i++){ + if (links[i].getElementsByTagName('a')[0].className==class||class=='all'){ + if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; + else links[i].style.display='none'; + j++; + } + else links[i].style.display='none'; + } + if (j<number){ + show_results(class,0); + return; + } + + var sitenumbers=document.getElementById('sitenumbers').getElementsByTagName('span'); + for (var i=0;i<sitenumbers.length;i++){ + if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25==number) sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='none'; + else sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='underline'; + if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25>=j) + sitenumbers[i].style.display='none'; + else + sitenumbers[i].style.display='inline'; + } + } + + function toPositive(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_to_positive.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + + function toNegative(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_to_negative.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + + function clearPositives() + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_clear_positives.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + document.getElementById('Positives').innerHTML = XhrObj.responseText; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); + } + + function clearNegatives() + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_clear_negatives.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + document.getElementById('Negatives').innerHTML = XhrObj.responseText; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); + } + + function removePosInterest(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_remove_pos_interest.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + + function removeNegInterest(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_remove_neg_interest.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + </script> + </head> + <body> + +<!-- <h1>DBpedia Navigator</h1> --> +<div><table border="0" width="100%"><tr><td width="35%"><img src="<?php print $path;?>images/dbpedia_navigator.png" alt="DBpedia Navigator" style="padding:5px" /></td><td width="50%"><span id="conceptlink"></span></td><td width="15%"><span id="Loading" style="display:none">Server Call... <img src="<?php print $path;?>images/remove.png" onclick="xajax_stopServerCall();return false;" /></span></td></tr></table></div> +<div id="layer" style="display:none"> + <div id="layerContent" style="display:none"></div> +</div> + +<div id="wrapper"> + <div id="leftSidebar"> + + <div class="box"> + <div class="boxtitle">Search DBpedia</div> + <div class="boxcontent" id="search"> + <!-- Search:<br/> --> + <form onSubmit="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;"> + <input type="text" name="label" id="label" /><br/> + <input type="button" value="Article" class="button" onclick="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;" /> <input type="button" value="Search" class="button" onclick="var list=tree.getAllChecked();search_it('label='+document.getElementById('label').value+'&list='+list+'&number=10');return false;" /> + <!-- <input type="button" value="Fulltext" class="button" onclick=""/> --> + </form> + </div> <!-- boxcontent --> + </div> <!-- box --> + + <div class="box" id="SearchResultBox" style="display:none"> + <div class="boxtitle">Search Results</div> + <div class="boxcontent"> + <div id="searchcontent" style="display:block"></div> + </div> <!-- boxcontent --> + </div> <!-- box --> + + <div class="box" id="NavigationBox"> + <div class="boxtitle">Navigate</div> + <div class="boxcontent"> + <div id="treeboxbox_tree" style="height:218px;overflow:auto;"> + </div> + </div> <!-- boxcontent --> + </div> <!-- box --> + <script> + tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0); + tree.setImagePath("<?php print $path;?>images/csh_bluebooks/"); + tree.enableCheckBoxes(1); + tree.setOnClickHandler(doOnClick); + function doOnClick(nodeId){ + var myUrl = tree.getUserData(nodeId,"myurl"); + xajax_getSubjectsFromConcept(myUrl); + } + tree.setXMLAutoLoading("processTreeMenu.php"); + tree.loadXML("processTreeMenu.php?id=0"); + </script> + + + <div class="box" id="credits"> + <p>DBpedia Navigator is powered by ... <br /> + <a href="http://dl-learner.org">DL-Learner</a><br /> + <a href="http//dbpedia.org">DBpedia</a><br/> + <a href="http://virtuoso.openlinksw.com/wiki/main/">OpenLink Virtuoso</a><br /> + ... and implemented by <a href="http://jens-lehmann.org">Jens Lehmann</a> and + Sebastian Knappe at the <a href="http:/aksw.org">AKSW</a> research group (University of Leipzig).</p> + + <a href="http://www.w3.org/2004/OWL/"><img src="<?php print $path;?>images/sw-owl-green.png" alt="OWL logo" /></a> + <a href="http://www.w3.org/2001/sw/DataAccess/"><img src="<?php print $path;?>images/sw-sparql-green.png" alt="SPARQL logo"/></a> + </div> + + </div><!-- END leftSidebar --> + + <div id="content"> + <div class="box"> + <div class="boxtitle" id="ArticleTitle">Welcome</div> + <div class="boxcontent" id="article"> + <div id="articlecontent" style="display:block"> + <br /><br /> + Welcome to the DBpedia Navigator interface! DBpedia Navigator allows you to search DBpedia + and uses the background knowledge in DBpedia to suggest possible interesting navigation + links. + </div> + </div> <!-- boxcontent --> + </div> <!-- box --> + </div><!-- content --> + + <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="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="boxcontent" id="Negatives"> + </div> <!-- boxcontent --> + </div> <!-- box --> + + <div class="box" id="LastArticlesBox" style="display:none"> + <div class="boxtitle">Articles Last Viewed</div> + <div class="boxcontent" id="lastarticles"> + </div> <!-- boxcontent --> + </div> <!-- box --> + + </div><!-- rightSidebar --> + + <!-- <div id="clear"></div> --> + +</div><!-- wrapper --> +<div id="footer"> + <p>Licensed under the GNU General Public License (GPL) 3 as part of the DL-Learner open source + project.<br />Copyright © Jens Lehmann 2007-2008 </p> + <div id="validation"> + <?php + $uri = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; + + echo '<div><a href="http://validator.w3.org/check?uri='.$uri.'"'; + echo '><img src="'.$path.'images/valid-xhtml10.png" alt="valid XHTML 1.0" /></a>'."\n"; + echo '<a href="http://jigsaw.w3.org/css-validator/validator?uri='.$uri.'"'; + echo '><img src="'.$path.'images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; + ?> + </div> + <p><a href='<?php print $path;?>rebuild.php'>rebuild [restart session and redownload WSDL file (for debugging)]</a></p> +</div> + +<div id="todo"> +<b>ToDo:</b> +<ul style="float:left"> + <li>Get learning component fast.</li> + <li>Get local DBpedia SPARQL endpoint working (next DBpedia release expected at the endof January and then every + two months, so it would be nice to have a script based partly automated or at least documented solution for + creating a DBpedia mirror).</li> + <li>Improve stability: Fix sometimes occurring PHP errors and warnings (check PHP error log).</li> + <li>For each result, display a "+" which shows more information about the concept in an overlay box, e.g. its + Description Logic or OWL syntax, its classification accuracy on the examples, and which + examples it classifies (in-)correctly.</li> + <li>Create a small number of test cases (e.g. 3), which can be used to verify that DBpedia Navigator is + working in typical scenarios (in particular cases where concepts with length greater one are learned).</li> + <li>Allow to disable caching functionality (in Settings.php).</li> + <li>Make DBpedia Navigator RESTful, e.g. URLs $base/showArticle/$URL for displaying an article; + $base/search/$phrase for searching; $base/listInstances/$complexClass for listing the instances of + a learned. Maybe session variables (in particuar the selected positive and negative examples) can + also be given, e.g. $base/search/$phrase?positives=[$URL1,$URL2,$URL3]&negatives=[$URL4]. The supported + URI design should be briefly documented (e.g. on a dbpedia.org wiki page). A good URI design allows + easier external access (just give someone a link instead of saying exactly which actions have to be done to + get to a state), simplifies debugging the application, and may be of use for creating further + features.</li> + <li>Improve search functionality [we will probably get feedback from Georgi in February].</li> + <li>[maybe] Display a tag cloud similar to <a href="http://dbpedia.org/search/">DBpedia search</a>.</li> + <li>[maybe] Instead of only allowing a search as entry point to the application, also display + a navigatable class tree.</li> + <li>[if possible] When expensive SPARQL queries or learning problems have been posed, there should be + some way to abandon these if the user has already switched to doing something else. Example: The user + has added 3 positive and 1 negative examples. This is executed as a learning problem, but has no solution (so + DL-Learner would run forever unless we pose some internal time limit). The user adds another negative example a + second later, so instead of letting the previous learning problem run for a long time (and needing much resources), + it should be stopped by DBpedia Navigator.</li> + <li>[if possible] Find an easy way to validate HTML/JS in AJAX applications.</li> + <li>[maybe] Would be interesting to somehow view the Wikipedia article (without the left navigation part, + tabs etc.) as an overlay, because the Wikipedia article will almost always be a human-friendlier + description of an object compared to the extracted one.</li> +</ul> +</div> + + <div class="box" id="ConceptBox" style="position:absolute;top:15px;right:15px;width:18%;opacity:0.90;display:none;z-index:5;"> + <div class="boxtitle">Detailed Concept Information</div> + <div class="boxcontent" id="ConceptInformation"></div> + </div> + + </body> +</html> + \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-08-15 13:08:40
|
Revision: 1086 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1086&view=rev Author: sknappe Date: 2008-08-15 13:08:36 +0000 (Fri, 15 Aug 2008) Log Message: ----------- renamed old index.php Added Paths: ----------- trunk/src/dbpedia-navigator/index-old.php Removed Paths: ------------- trunk/src/dbpedia-navigator/index.php Copied: trunk/src/dbpedia-navigator/index-old.php (from rev 1061, trunk/src/dbpedia-navigator/index.php) =================================================================== --- trunk/src/dbpedia-navigator/index-old.php (rev 0) +++ trunk/src/dbpedia-navigator/index-old.php 2008-08-15 13:08:36 UTC (rev 1086) @@ -0,0 +1,255 @@ +<?php + +ini_set('error_reporting',E_ALL); +ini_set('max_execution_time',200); +ini_set("soap.wsdl_cache_enabled","1"); + +session_start(); +require_once('DLLearnerConnection.php'); +$sc=new DLLearnerConnection(); +$ids=$sc->getIDs(); +$_SESSION['id']=$ids[0]; +$_SESSION['ksID']=$ids[1]; + +if (isset($_GET['path'])) $path=$_GET['path']; +else $path=""; + +require_once 'Settings.php'; +$settings=new Settings(); + +//what happens onLoad +$onLoad="onLoad=\""; +if (isset($_GET['resource'])){ + $onLoad.="xajax_getarticle('".$_GET['resource']."',-1);"; + unset($_GET['resource']); +} +else if (isset($_SESSION['currentArticle'])){ + $onLoad.="xajax_getarticle('',".$_SESSION['currentArticle'].");"; +} +$onLoad.="\""; + +require("ajax.php"); + +echo '<?xml version="1.0" encoding="UTF-8"?>'; +?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>DBpedia Navigator</title> + <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> + <link rel="stylesheet" href="<?php print $path;?>default.css"/> + <link rel="stylesheet" type="text/css" href="<?php print $path;?>treemenu/dhtmlxtree.css"> + <?php $xajax->printJavascript($path.'xajax/'); ?> + <script src="http://maps.google.com/maps?file=api&v=2&key=<?php print $settings->googleMapsKey;?>" + type="text/javascript"></script> + <script src="<?php print $path;?>treemenu/dhtmlxcommon.js"></script> + <script src="<?php print $path;?>treemenu/dhtmlxtree.js"></script> + <script type="text/javascript"> + showLoading = function() { + xajax.$('Loading').style.display='inline'; + }; + hideLoading = function() { + xajax.$('Loading').style.display = 'none'; + //xajax.$('SearchResultBox').style.display = 'block'; + xajax.$('LastArticlesBox').style.display = 'block'; + }; + + function showdiv(id){ + document.getElementById(id).style.display='block'; + } + + function hidediv(id) { + document.getElementById(id).style.display='none'; + } + + function loadGoogleMap(Lat,Lng,Label) { + if (document.getElementById("map").style.display=="none"){ + document.getElementById("map").style.display='block'; + if (GBrowserIsCompatible()) { + // Create and Center a Map + var map = new GMap2(document.getElementById("map")); + map.setCenter(new GLatLng(Lat, Lng), 12); + map.addControl(new GLargeMapControl()); + map.addControl(new GMapTypeControl()); + var marker=new GMarker(new GLatLng(Lat, Lng)); + GEvent.addListener(marker, "click", function() { + marker.openInfoWindowHtml(Label); + }); + map.addOverlay(marker); + } + } + else { + document.getElementById("map").style.display='none'; + } + } + </script> + </head> + <body <?php print $onLoad;?>> + +<!-- <h1>DBpedia Navigator</h1> --> +<div><table border="0" width="100%"><tr><td width="35%"><img src="<?php print $path;?>images/dbpedia_navigator.png" alt="DBpedia Navigator" style="padding:5px" /></td><td width="50%"><span id="conceptlink"></span></td><td width="15%"><span id="Loading" style="display:none">Server Call... <img src="<?php print $path;?>images/remove.png" onclick="xajax_stopServerCall();return false;" /></span></td></tr></table></div> +<div id="layer" style="display:none"> + <div id="layerContent" style="display:none"></div> +</div> + +<div id="wrapper"> + <div id="leftSidebar"> + + <div class="box"> + <div class="boxtitle">Search DBpedia</div> + <div class="boxcontent" id="search"> + <!-- Search:<br/> --> + <form onSubmit="xajax_getarticle(document.getElementById('label').value,-1);return false;"> + <input type="text" name="label" id="label" /><br/> + <input type="button" value="Article" class="button" onclick="xajax_getarticle(document.getElementById('label').value,-1);return false;" /> <input type="button" value="Search" class="button" onclick="var list=tree.getAllChecked();xajax_getsubjects(document.getElementById('label').value,list);return false;" /> + <!-- <input type="button" value="Fulltext" class="button" onclick=""/> --> + </form> + </div> <!-- boxcontent --> + </div> <!-- box --> + + <div class="box" id="SearchResultBox" style="display:none"> + <div class="boxtitle">Search Results</div> + <div class="boxcontent"> + <div id="searchcontent" style="display:block"></div> + </div> <!-- boxcontent --> + </div> <!-- box --> + + <div class="box" id="NavigationBox"> + <div class="boxtitle">Navigate</div> + <div class="boxcontent"> + <div id="treeboxbox_tree" style="height:218px;overflow:auto;"> + </div> + </div> <!-- boxcontent --> + </div> <!-- box --> + <script> + tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0); + tree.setImagePath("<?php print $path;?>images/csh_bluebooks/"); + tree.enableCheckBoxes(1); + tree.setOnClickHandler(doOnClick); + function doOnClick(nodeId){ + var myUrl = tree.getUserData(nodeId,"myurl"); + xajax_getSubjectsFromConcept(myUrl); + } + tree.setXMLAutoLoading("processTreeMenu.php"); + tree.loadXML("processTreeMenu.php?id=0"); + </script> + + + <div class="box" id="credits"> + <p>DBpedia Navigator is powered by ... <br /> + <a href="http://dl-learner.org">DL-Learner</a><br /> + <a href="http//dbpedia.org">DBpedia</a><br/> + <a href="http://virtuoso.openlinksw.com/wiki/main/">OpenLink Virtuoso</a><br /> + ... and implemented by <a href="http://jens-lehmann.org">Jens Lehmann</a> and + Sebastian Knappe at the <a href="http:/aksw.org">AKSW</a> research group (University of Leipzig).</p> + + <a href="http://www.w3.org/2004/OWL/"><img src="<?php print $path;?>images/sw-owl-green.png" alt="OWL logo" /></a> + <a href="http://www.w3.org/2001/sw/DataAccess/"><img src="<?php print $path;?>images/sw-sparql-green.png" alt="SPARQL logo"/></a> + </div> + + </div><!-- END leftSidebar --> + + <div id="content"> + <div class="box"> + <div class="boxtitle" id="ArticleTitle">Welcome</div> + <div class="boxcontent" id="article"> + <div id="articlecontent" style="display:block"> + <br /><br /> + Welcome to the DBpedia Navigator interface! DBpedia Navigator allows you to search DBpedia + and uses the background knowledge in DBpedia to suggest possible interesting navigation + links. + </div> + </div> <!-- boxcontent --> + </div> <!-- box --> + </div><!-- content --> + + <div id="rightSidebar"> + + <div class="box"> + <div class="boxtitlewithbutton" id="positivesboxtitle">search relevant <img src="<?php print $path;?>images/remove.png" onclick="xajax_clearPositives()" /> </div> + <div class="boxcontent" id="Positives"> + </div> <!-- boxcontent --> + </div> <!-- box --> + + <div class="box"> + <div class="boxtitlewithbutton" id="negativesboxtitle">not relevant <img src="<?php print $path;?>images/remove.png" onclick="xajax_clearNegatives()" /> </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="boxcontent" id="lastarticles"> + </div> <!-- boxcontent --> + </div> <!-- box --> + + </div><!-- rightSidebar --> + + <!-- <div id="clear"></div> --> + +</div><!-- wrapper --> +<div id="footer"> + <p>Licensed under the GNU General Public License (GPL) 3 as part of the DL-Learner open source + project.<br />Copyright © Jens Lehmann 2007-2008 </p> + <div id="validation"> + <?php + $uri = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; + + echo '<div><a href="http://validator.w3.org/check?uri='.$uri.'"'; + echo '><img src="'.$path.'images/valid-xhtml10.png" alt="valid XHTML 1.0" /></a>'."\n"; + echo '<a href="http://jigsaw.w3.org/css-validator/validator?uri='.$uri.'"'; + echo '><img src="'.$path.'images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; + ?> + </div> + <p><a href='<?php print $path;?>rebuild.php'>rebuild [restart session and redownload WSDL file (for debugging)]</a></p> +</div> + +<div id="todo"> +<b>ToDo:</b> +<ul style="float:left"> + <li>Get learning component fast.</li> + <li>Get local DBpedia SPARQL endpoint working (next DBpedia release expected at the endof January and then every + two months, so it would be nice to have a script based partly automated or at least documented solution for + creating a DBpedia mirror).</li> + <li>Improve stability: Fix sometimes occurring PHP errors and warnings (check PHP error log).</li> + <li>For each result, display a "+" which shows more information about the concept in an overlay box, e.g. its + Description Logic or OWL syntax, its classification accuracy on the examples, and which + examples it classifies (in-)correctly.</li> + <li>Create a small number of test cases (e.g. 3), which can be used to verify that DBpedia Navigator is + working in typical scenarios (in particular cases where concepts with length greater one are learned).</li> + <li>Allow to disable caching functionality (in Settings.php).</li> + <li>Make DBpedia Navigator RESTful, e.g. URLs $base/showArticle/$URL for displaying an article; + $base/search/$phrase for searching; $base/listInstances/$complexClass for listing the instances of + a learned. Maybe session variables (in particuar the selected positive and negative examples) can + also be given, e.g. $base/search/$phrase?positives=[$URL1,$URL2,$URL3]&negatives=[$URL4]. The supported + URI design should be briefly documented (e.g. on a dbpedia.org wiki page). A good URI design allows + easier external access (just give someone a link instead of saying exactly which actions have to be done to + get to a state), simplifies debugging the application, and may be of use for creating further + features.</li> + <li>Improve search functionality [we will probably get feedback from Georgi in February].</li> + <li>[maybe] Display a tag cloud similar to <a href="http://dbpedia.org/search/">DBpedia search</a>.</li> + <li>[maybe] Instead of only allowing a search as entry point to the application, also display + a navigatable class tree.</li> + <li>[if possible] When expensive SPARQL queries or learning problems have been posed, there should be + some way to abandon these if the user has already switched to doing something else. Example: The user + has added 3 positive and 1 negative examples. This is executed as a learning problem, but has no solution (so + DL-Learner would run forever unless we pose some internal time limit). The user adds another negative example a + second later, so instead of letting the previous learning problem run for a long time (and needing much resources), + it should be stopped by DBpedia Navigator.</li> + <li>[if possible] Find an easy way to validate HTML/JS in AJAX applications.</li> + <li>[maybe] Would be interesting to somehow view the Wikipedia article (without the left navigation part, + tabs etc.) as an overlay, because the Wikipedia article will almost always be a human-friendlier + description of an object compared to the extracted one.</li> +</ul> +</div> + + <div class="box" id="ConceptBox" style="position:absolute;top:15px;right:15px;width:18%;opacity:0.90;display:none;z-index:5;"> + <div class="boxtitle">Detailed Concept Information</div> + <div class="boxcontent" id="ConceptInformation"></div> + </div> + + </body> +</html> + \ No newline at end of file Deleted: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-08-15 13:06:41 UTC (rev 1085) +++ trunk/src/dbpedia-navigator/index.php 2008-08-15 13:08:36 UTC (rev 1086) @@ -1,255 +0,0 @@ -<?php - -ini_set('error_reporting',E_ALL); -ini_set('max_execution_time',200); -ini_set("soap.wsdl_cache_enabled","1"); - -session_start(); -require_once('DLLearnerConnection.php'); -$sc=new DLLearnerConnection(); -$ids=$sc->getIDs(); -$_SESSION['id']=$ids[0]; -$_SESSION['ksID']=$ids[1]; - -if (isset($_GET['path'])) $path=$_GET['path']; -else $path=""; - -require_once 'Settings.php'; -$settings=new Settings(); - -//what happens onLoad -$onLoad="onLoad=\""; -if (isset($_GET['resource'])){ - $onLoad.="xajax_getarticle('".$_GET['resource']."',-1);"; - unset($_GET['resource']); -} -else if (isset($_SESSION['currentArticle'])){ - $onLoad.="xajax_getarticle('',".$_SESSION['currentArticle'].");"; -} -$onLoad.="\""; - -require("ajax.php"); - -echo '<?xml version="1.0" encoding="UTF-8"?>'; -?> -<!DOCTYPE html - PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - <head> - <title>DBpedia Navigator</title> - <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> - <link rel="stylesheet" href="<?php print $path;?>default.css"/> - <link rel="stylesheet" type="text/css" href="<?php print $path;?>treemenu/dhtmlxtree.css"> - <?php $xajax->printJavascript($path.'xajax/'); ?> - <script src="http://maps.google.com/maps?file=api&v=2&key=<?php print $settings->googleMapsKey;?>" - type="text/javascript"></script> - <script src="<?php print $path;?>treemenu/dhtmlxcommon.js"></script> - <script src="<?php print $path;?>treemenu/dhtmlxtree.js"></script> - <script type="text/javascript"> - showLoading = function() { - xajax.$('Loading').style.display='inline'; - }; - hideLoading = function() { - xajax.$('Loading').style.display = 'none'; - //xajax.$('SearchResultBox').style.display = 'block'; - xajax.$('LastArticlesBox').style.display = 'block'; - }; - - function showdiv(id){ - document.getElementById(id).style.display='block'; - } - - function hidediv(id) { - document.getElementById(id).style.display='none'; - } - - function loadGoogleMap(Lat,Lng,Label) { - if (document.getElementById("map").style.display=="none"){ - document.getElementById("map").style.display='block'; - if (GBrowserIsCompatible()) { - // Create and Center a Map - var map = new GMap2(document.getElementById("map")); - map.setCenter(new GLatLng(Lat, Lng), 12); - map.addControl(new GLargeMapControl()); - map.addControl(new GMapTypeControl()); - var marker=new GMarker(new GLatLng(Lat, Lng)); - GEvent.addListener(marker, "click", function() { - marker.openInfoWindowHtml(Label); - }); - map.addOverlay(marker); - } - } - else { - document.getElementById("map").style.display='none'; - } - } - </script> - </head> - <body <?php print $onLoad;?>> - -<!-- <h1>DBpedia Navigator</h1> --> -<div><table border="0" width="100%"><tr><td width="35%"><img src="<?php print $path;?>images/dbpedia_navigator.png" alt="DBpedia Navigator" style="padding:5px" /></td><td width="50%"><span id="conceptlink"></span></td><td width="15%"><span id="Loading" style="display:none">Server Call... <img src="<?php print $path;?>images/remove.png" onclick="xajax_stopServerCall();return false;" /></span></td></tr></table></div> -<div id="layer" style="display:none"> - <div id="layerContent" style="display:none"></div> -</div> - -<div id="wrapper"> - <div id="leftSidebar"> - - <div class="box"> - <div class="boxtitle">Search DBpedia</div> - <div class="boxcontent" id="search"> - <!-- Search:<br/> --> - <form onSubmit="xajax_getarticle(document.getElementById('label').value,-1);return false;"> - <input type="text" name="label" id="label" /><br/> - <input type="button" value="Article" class="button" onclick="xajax_getarticle(document.getElementById('label').value,-1);return false;" /> <input type="button" value="Search" class="button" onclick="var list=tree.getAllChecked();xajax_getsubjects(document.getElementById('label').value,list);return false;" /> - <!-- <input type="button" value="Fulltext" class="button" onclick=""/> --> - </form> - </div> <!-- boxcontent --> - </div> <!-- box --> - - <div class="box" id="SearchResultBox" style="display:none"> - <div class="boxtitle">Search Results</div> - <div class="boxcontent"> - <div id="searchcontent" style="display:block"></div> - </div> <!-- boxcontent --> - </div> <!-- box --> - - <div class="box" id="NavigationBox"> - <div class="boxtitle">Navigate</div> - <div class="boxcontent"> - <div id="treeboxbox_tree" style="height:218px;overflow:auto;"> - </div> - </div> <!-- boxcontent --> - </div> <!-- box --> - <script> - tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0); - tree.setImagePath("<?php print $path;?>images/csh_bluebooks/"); - tree.enableCheckBoxes(1); - tree.setOnClickHandler(doOnClick); - function doOnClick(nodeId){ - var myUrl = tree.getUserData(nodeId,"myurl"); - xajax_getSubjectsFromConcept(myUrl); - } - tree.setXMLAutoLoading("processTreeMenu.php"); - tree.loadXML("processTreeMenu.php?id=0"); - </script> - - - <div class="box" id="credits"> - <p>DBpedia Navigator is powered by ... <br /> - <a href="http://dl-learner.org">DL-Learner</a><br /> - <a href="http//dbpedia.org">DBpedia</a><br/> - <a href="http://virtuoso.openlinksw.com/wiki/main/">OpenLink Virtuoso</a><br /> - ... and implemented by <a href="http://jens-lehmann.org">Jens Lehmann</a> and - Sebastian Knappe at the <a href="http:/aksw.org">AKSW</a> research group (University of Leipzig).</p> - - <a href="http://www.w3.org/2004/OWL/"><img src="<?php print $path;?>images/sw-owl-green.png" alt="OWL logo" /></a> - <a href="http://www.w3.org/2001/sw/DataAccess/"><img src="<?php print $path;?>images/sw-sparql-green.png" alt="SPARQL logo"/></a> - </div> - - </div><!-- END leftSidebar --> - - <div id="content"> - <div class="box"> - <div class="boxtitle" id="ArticleTitle">Welcome</div> - <div class="boxcontent" id="article"> - <div id="articlecontent" style="display:block"> - <br /><br /> - Welcome to the DBpedia Navigator interface! DBpedia Navigator allows you to search DBpedia - and uses the background knowledge in DBpedia to suggest possible interesting navigation - links. - </div> - </div> <!-- boxcontent --> - </div> <!-- box --> - </div><!-- content --> - - <div id="rightSidebar"> - - <div class="box"> - <div class="boxtitlewithbutton" id="positivesboxtitle">search relevant <img src="<?php print $path;?>images/remove.png" onclick="xajax_clearPositives()" /> </div> - <div class="boxcontent" id="Positives"> - </div> <!-- boxcontent --> - </div> <!-- box --> - - <div class="box"> - <div class="boxtitlewithbutton" id="negativesboxtitle">not relevant <img src="<?php print $path;?>images/remove.png" onclick="xajax_clearNegatives()" /> </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="boxcontent" id="lastarticles"> - </div> <!-- boxcontent --> - </div> <!-- box --> - - </div><!-- rightSidebar --> - - <!-- <div id="clear"></div> --> - -</div><!-- wrapper --> -<div id="footer"> - <p>Licensed under the GNU General Public License (GPL) 3 as part of the DL-Learner open source - project.<br />Copyright © Jens Lehmann 2007-2008 </p> - <div id="validation"> - <?php - $uri = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; - - echo '<div><a href="http://validator.w3.org/check?uri='.$uri.'"'; - echo '><img src="'.$path.'images/valid-xhtml10.png" alt="valid XHTML 1.0" /></a>'."\n"; - echo '<a href="http://jigsaw.w3.org/css-validator/validator?uri='.$uri.'"'; - echo '><img src="'.$path.'images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; - ?> - </div> - <p><a href='<?php print $path;?>rebuild.php'>rebuild [restart session and redownload WSDL file (for debugging)]</a></p> -</div> - -<div id="todo"> -<b>ToDo:</b> -<ul style="float:left"> - <li>Get learning component fast.</li> - <li>Get local DBpedia SPARQL endpoint working (next DBpedia release expected at the endof January and then every - two months, so it would be nice to have a script based partly automated or at least documented solution for - creating a DBpedia mirror).</li> - <li>Improve stability: Fix sometimes occurring PHP errors and warnings (check PHP error log).</li> - <li>For each result, display a "+" which shows more information about the concept in an overlay box, e.g. its - Description Logic or OWL syntax, its classification accuracy on the examples, and which - examples it classifies (in-)correctly.</li> - <li>Create a small number of test cases (e.g. 3), which can be used to verify that DBpedia Navigator is - working in typical scenarios (in particular cases where concepts with length greater one are learned).</li> - <li>Allow to disable caching functionality (in Settings.php).</li> - <li>Make DBpedia Navigator RESTful, e.g. URLs $base/showArticle/$URL for displaying an article; - $base/search/$phrase for searching; $base/listInstances/$complexClass for listing the instances of - a learned. Maybe session variables (in particuar the selected positive and negative examples) can - also be given, e.g. $base/search/$phrase?positives=[$URL1,$URL2,$URL3]&negatives=[$URL4]. The supported - URI design should be briefly documented (e.g. on a dbpedia.org wiki page). A good URI design allows - easier external access (just give someone a link instead of saying exactly which actions have to be done to - get to a state), simplifies debugging the application, and may be of use for creating further - features.</li> - <li>Improve search functionality [we will probably get feedback from Georgi in February].</li> - <li>[maybe] Display a tag cloud similar to <a href="http://dbpedia.org/search/">DBpedia search</a>.</li> - <li>[maybe] Instead of only allowing a search as entry point to the application, also display - a navigatable class tree.</li> - <li>[if possible] When expensive SPARQL queries or learning problems have been posed, there should be - some way to abandon these if the user has already switched to doing something else. Example: The user - has added 3 positive and 1 negative examples. This is executed as a learning problem, but has no solution (so - DL-Learner would run forever unless we pose some internal time limit). The user adds another negative example a - second later, so instead of letting the previous learning problem run for a long time (and needing much resources), - it should be stopped by DBpedia Navigator.</li> - <li>[if possible] Find an easy way to validate HTML/JS in AJAX applications.</li> - <li>[maybe] Would be interesting to somehow view the Wikipedia article (without the left navigation part, - tabs etc.) as an overlay, because the Wikipedia article will almost always be a human-friendlier - description of an object compared to the extracted one.</li> -</ul> -</div> - - <div class="box" id="ConceptBox" style="position:absolute;top:15px;right:15px;width:18%;opacity:0.90;display:none;z-index:5;"> - <div class="boxtitle">Detailed Concept Information</div> - <div class="boxcontent" id="ConceptInformation"></div> - </div> - - </body> -</html> - \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-08-15 13:06:45
|
Revision: 1085 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1085&view=rev Author: sknappe Date: 2008-08-15 13:06:41 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Added all Functions to manage interests list Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/index-new.php Added Paths: ----------- trunk/src/dbpedia-navigator/ajax_clear_negatives.php trunk/src/dbpedia-navigator/ajax_clear_positives.php trunk/src/dbpedia-navigator/ajax_remove_neg_interest.php trunk/src/dbpedia-navigator/ajax_remove_pos_interest.php trunk/src/dbpedia-navigator/ajax_to_negative.php trunk/src/dbpedia-navigator/ajax_to_positive.php Added: trunk/src/dbpedia-navigator/ajax_clear_negatives.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_clear_negatives.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_clear_negatives.php 2008-08-15 13:06:41 UTC (rev 1085) @@ -0,0 +1,6 @@ +<?php + session_start(); + unset($_SESSION['negative']); + + print ""; +?> \ No newline at end of file Added: trunk/src/dbpedia-navigator/ajax_clear_positives.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_clear_positives.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_clear_positives.php 2008-08-15 13:06:41 UTC (rev 1085) @@ -0,0 +1,6 @@ +<?php + session_start(); + unset($_SESSION['positive']); + + print ""; +?> \ 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-15 12:21:00 UTC (rev 1084) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-08-15 13:06:41 UTC (rev 1085) @@ -131,15 +131,15 @@ //Add Positives to Session if (!isset($_SESSION['positive'])){ if ($redirect!=""){ - $array=array($redirect => $redirect); + $array=array($redirect => $artTitle); } - else $array=array("http://dbpedia.org/resource/".str_replace(" ","_",$subject) => "http://dbpedia.org/resource/".str_replace(" ","_",$subject)); + else $array=array($uri => $artTitle); $_SESSION['positive']=$array; } else{ $array=$_SESSION['positive']; - if ($redirect!="") $array[$redirect] = $redirect; - else $array["http://dbpedia.org/resource/".str_replace(" ","_",$subject)]="http://dbpedia.org/resource/".str_replace(" ","_",$subject); + if ($redirect!="") $array[$redirect] = $artTitle; + else $array[$uri]=$artTitle; $_SESSION['positive']=$array; } @@ -166,25 +166,17 @@ } //add Positives and Negatives to Interests - $posInterests=""; - if (isset($_SESSION['positive'])) foreach($_SESSION['positive'] as $pos){ - $posInterests.=urldecode(substr (strrchr ($pos, "/"), 1))." <a href=\"\" onclick=\"xajax_toNegative('".$pos."');return false;\"><img src=\"".$_GET['path']."images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"xajax_removePosInterest('".$pos."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; - } - $negInterests=""; - if (isset($_SESSION['negative'])) foreach($_SESSION['negative'] as $neg){ - $negInterests.=urldecode(substr (strrchr ($neg, "/"), 1))." <a href=\"\" onclick=\"xajax_toPositive('".$neg."');return false;\"><img src=\"".$_GET['path']."images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"xajax_removeNegInterest('".$neg."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; - } - - + $interests=show_Interests($_SESSION); + print $content; print '$$'; print $artTitle; print '$$'; print $lastArticles; print '$$'; - print $posInterests; + print $interests[0]; print '$$'; - print $negInterests; + print $interests[1]; //$objResponse->call('xajax_learnConcept'); ?> \ No newline at end of file Added: trunk/src/dbpedia-navigator/ajax_remove_neg_interest.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_remove_neg_interest.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_remove_neg_interest.php 2008-08-15 13:06:41 UTC (rev 1085) @@ -0,0 +1,15 @@ +<?php + include('helper_functions.php'); + + $subject=$_POST['subject']; + + session_start(); + unset($_SESSION['negative'][$subject]); + + //add Positives and Negatives to Interests + $interests=show_Interests($_SESSION); + + print $interests[0]; + print '$$'; + print $interests[1]; +?> \ No newline at end of file Added: trunk/src/dbpedia-navigator/ajax_remove_pos_interest.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_remove_pos_interest.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_remove_pos_interest.php 2008-08-15 13:06:41 UTC (rev 1085) @@ -0,0 +1,15 @@ +<?php + include('helper_functions.php'); + + $subject=$_POST['subject']; + + session_start(); + unset($_SESSION['positive'][$subject]); + + //add Positives and Negatives to Interests + $interests=show_Interests($_SESSION); + + print $interests[0]; + print '$$'; + print $interests[1]; +?> \ No newline at end of file Added: trunk/src/dbpedia-navigator/ajax_to_negative.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_to_negative.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_to_negative.php 2008-08-15 13:06:41 UTC (rev 1085) @@ -0,0 +1,25 @@ +<?php + include('helper_functions.php'); + + $subject=$_POST['subject']; + $label=$_POST['label']; + + session_start(); + unset($_SESSION['positive'][$subject]); + if (!isset($_SESSION['negative'])){ + $array=array($subject => $label); + $_SESSION['negative']=$array; + } + else{ + $array=$_SESSION['negative']; + $array[$subject]=$label; + $_SESSION['negative']=$array; + } + + //add Positives and Negatives to Interests + $interests=show_Interests($_SESSION); + + print $interests[0]; + print '$$'; + print $interests[1]; +?> \ No newline at end of file Added: trunk/src/dbpedia-navigator/ajax_to_positive.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_to_positive.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_to_positive.php 2008-08-15 13:06:41 UTC (rev 1085) @@ -0,0 +1,25 @@ +<?php + include('helper_functions.php'); + + $subject=$_POST['subject']; + $label=$_POST['label']; + + session_start(); + unset($_SESSION['negative'][$subject]); + if (!isset($_SESSION['positive'])){ + $array=array($subject => $label); + $_SESSION['positive']=$array; + } + else{ + $array=$_SESSION['positive']; + $array[$subject]=$label; + $_SESSION['positive']=$array; + } + + //add Positives and Negatives to Interests + $interests=show_Interests($_SESSION); + + print $interests[0]; + print '$$'; + print $interests[1]; +?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-08-15 12:21:00 UTC (rev 1084) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-08-15 13:06:41 UTC (rev 1085) @@ -176,4 +176,18 @@ } return $string; } + +function show_Interests($sess) +{ + if (isset($sess['positive'])) foreach($sess['positive'] as $name=>$lab){ + $ret[0]=$lab." <a href=\"\" onclick=\"toNegative('subject=".$name."&label=".$lab."');return false;\"><img src=\"".$_GET['path']."images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"removePosInterest('subject=".$name."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; + } + else $ret[0]=""; + if (isset($sess['negative'])) foreach($sess['negative'] as $name=>$lab){ + $ret[1]=$lab." <a href=\"\" onclick=\"toPositive('subject=".$name."&label=".$lab."');return false;\"><img src=\"".$_GET['path']."images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"removeNegInterest('subject=".$name."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; + } + else $ret[1]=""; + + return $ret; +} ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/index-new.php =================================================================== --- trunk/src/dbpedia-navigator/index-new.php 2008-08-15 12:21:00 UTC (rev 1084) +++ trunk/src/dbpedia-navigator/index-new.php 2008-08-15 13:06:41 UTC (rev 1085) @@ -157,6 +157,158 @@ sitenumbers[i].style.display='inline'; } } + + function toPositive(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_to_positive.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + + function toNegative(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_to_negative.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + + function clearPositives() + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_clear_positives.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + document.getElementById('Positives').innerHTML = XhrObj.responseText; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); + } + + function clearNegatives() + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_clear_negatives.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + document.getElementById('Negatives').innerHTML = XhrObj.responseText; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); + } + + function removePosInterest(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_remove_pos_interest.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + + function removeNegInterest(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_remove_neg_interest.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } </script> </head> <body> @@ -241,13 +393,13 @@ <div id="rightSidebar"> <div class="box"> - <div class="boxtitlewithbutton" id="positivesboxtitle">search relevant <img src="<?php print $path;?>images/remove.png" onclick="xajax_clearPositives()" /> </div> + <div class="boxtitlewithbutton" id="positivesboxtitle">search relevant <a href="#"><img src="<?php print $path;?>images/remove.png" onclick="clearPositives()" /></a> </div> <div class="boxcontent" id="Positives"> </div> <!-- boxcontent --> </div> <!-- box --> <div class="box"> - <div class="boxtitlewithbutton" id="negativesboxtitle">not relevant <img src="<?php print $path;?>images/remove.png" onclick="xajax_clearNegatives()" /> </div> + <div class="boxtitlewithbutton" id="negativesboxtitle">not relevant <a href="#"><img src="<?php print $path;?>images/remove.png" onclick="clearNegatives()" /></a> </div> <div class="boxcontent" id="Negatives"> </div> <!-- boxcontent --> </div> <!-- box --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-08-15 12:21:08
|
Revision: 1084 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1084&view=rev Author: kurzum Date: 2008-08-15 12:21:00 +0000 (Fri, 15 Aug 2008) Log Message: ----------- looks like the new structure is working like the old one, next step testing, new features and code improvements Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/aquisitors/LinkedDataTupelAquisitor.java trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitor.java trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitorImproved.java trunk/src/dl-learner/org/dllearner/kb/aquisitors/TupelAquisitor.java trunk/src/dl-learner/org/dllearner/kb/extraction/Configuration.java trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java trunk/src/dl-learner/org/dllearner/scripts/NT2RDF.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java trunk/src/dl-learner/org/dllearner/test/SparqlExtractionTest.java trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitorClasses.java trunk/src/dl-learner/org/dllearner/kb/old/ClassNode.java trunk/src/dl-learner/org/dllearner/kb/old/DBpediaNavigatorCityLocator.java trunk/src/dl-learner/org/dllearner/kb/old/DBpediaNavigatorManipulator.java trunk/src/dl-learner/org/dllearner/kb/old/InstanceNode.java trunk/src/dl-learner/org/dllearner/kb/old/ManipulatorType.java trunk/src/dl-learner/org/dllearner/kb/old/Manipulators.java trunk/src/dl-learner/org/dllearner/kb/old/Node.java trunk/src/dl-learner/org/dllearner/kb/old/OldManipulator.java trunk/src/dl-learner/org/dllearner/kb/old/PropertyNode.java trunk/src/dl-learner/org/dllearner/kb/old/Scrap.java trunk/src/dl-learner/org/dllearner/kb/old/TypedSparqlQuery.java trunk/src/dl-learner/org/dllearner/kb/old/TypedSparqlQueryClasses.java trunk/src/dl-learner/org/dllearner/kb/old/TypedSparqlQueryInterface.java Modified: trunk/src/dl-learner/org/dllearner/kb/aquisitors/LinkedDataTupelAquisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/aquisitors/LinkedDataTupelAquisitor.java 2008-08-15 12:03:42 UTC (rev 1083) +++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/LinkedDataTupelAquisitor.java 2008-08-15 12:21:00 UTC (rev 1084) @@ -24,8 +24,6 @@ import org.apache.log4j.Logger; import org.dllearner.kb.extraction.Configuration; -import org.dllearner.kb.sparql.SPARQLTasks; -import org.dllearner.kb.sparql.SparqlQueryMaker; import org.dllearner.utilities.datastructures.RDFNodeTuple; /** @@ -38,30 +36,21 @@ @SuppressWarnings("unused") private static Logger logger = Logger.getLogger(LinkedDataTupelAquisitor.class); - + @SuppressWarnings("unused") private Configuration configuration; - protected SparqlQueryMaker sparqlQueryMaker; - protected SPARQLTasks sparqlTasks; + - public LinkedDataTupelAquisitor(Configuration Configuration) { - this.configuration = Configuration; - this.sparqlQueryMaker = configuration.getSparqlQueryMaker(); - this.sparqlTasks = configuration.sparqlTasks; + public LinkedDataTupelAquisitor(Configuration configuration) { + this.configuration = configuration; } // standard query get a tupels (p,o) for subject s @Override public SortedSet<RDFNodeTuple> getTupelForResource(URI uri) { + throw new RuntimeException("Not Implemented yet"); - String pred = "predicate"; - String obj = "object"; - // getQuery - String sparqlQueryString = sparqlQueryMaker - .makeSubjectQueryUsingFilters(uri.toString()); - return sparqlTasks.queryAsRDFNodeTuple(sparqlQueryString, pred, obj); - } Modified: trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitor.java 2008-08-15 12:03:42 UTC (rev 1083) +++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitor.java 2008-08-15 12:21:00 UTC (rev 1084) @@ -23,7 +23,6 @@ import java.util.SortedSet; import org.apache.log4j.Logger; -import org.dllearner.kb.extraction.Configuration; import org.dllearner.kb.sparql.SPARQLTasks; import org.dllearner.kb.sparql.SparqlQueryMaker; import org.dllearner.utilities.datastructures.RDFNodeTuple; @@ -39,15 +38,17 @@ @SuppressWarnings("unused") private static Logger logger = Logger.getLogger(SparqlTupelAquisitor.class); - private Configuration configuration; protected SparqlQueryMaker sparqlQueryMaker; protected SPARQLTasks sparqlTasks; + + - public SparqlTupelAquisitor(Configuration Configuration) { - this.configuration = Configuration; - this.sparqlQueryMaker = configuration.getSparqlQueryMaker(); - this.sparqlTasks = configuration.sparqlTasks; + public SparqlTupelAquisitor(SparqlQueryMaker sparqlQueryMaker, SPARQLTasks sparqlTasks) { + + this.sparqlQueryMaker = sparqlQueryMaker; + this.sparqlTasks = sparqlTasks; } + // standard query get a tupels (p,o) for subject s @Override @@ -56,16 +57,25 @@ String pred = "predicate"; String obj = "object"; + String sparqlQueryString = ""; // getQuery - String sparqlQueryString = sparqlQueryMaker - .makeSubjectQueryUsingFilters(uri.toString()); + if (classMode) { + sparqlQueryString = sparqlQueryMaker.makeClassQueryUsingFilters(uri.toString()); + }else { + sparqlQueryString = sparqlQueryMaker.makeSubjectQueryUsingFilters(uri.toString()); + } + return sparqlTasks.queryAsRDFNodeTuple(sparqlQueryString, pred, obj); } + + + + } Deleted: trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitorClasses.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitorClasses.java 2008-08-15 12:03:42 UTC (rev 1083) +++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitorClasses.java 2008-08-15 12:21:00 UTC (rev 1084) @@ -1,61 +0,0 @@ -/** - * Copyright (C) 2007-2008, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.kb.aquisitors; - -import java.net.URI; -import java.util.SortedSet; - -import org.apache.log4j.Logger; -import org.dllearner.kb.extraction.Configuration; -import org.dllearner.utilities.datastructures.RDFNodeTuple; - -/** - * Can execute different queries. - * - * @author Sebastian Hellmann - * - */ -public class SparqlTupelAquisitorClasses extends SparqlTupelAquisitor { - - @SuppressWarnings("unused") - private static Logger logger = Logger.getLogger(SparqlTupelAquisitor.class); - - public SparqlTupelAquisitorClasses(Configuration configuration) { - super(configuration); - } - - /* - * Special TypedSparqlQuery which returns superclasses of classes - * (non-Javadoc) - * - * @see org.dllearner.kb.sparql.TypedSparqlQuery#getTupelForResource(java.net.URI) - */ - @Override - @SuppressWarnings({"unchecked"}) - public SortedSet<RDFNodeTuple> getTupelForResource(URI uri) { - //Set<RDFNodeTuple> s = new TreeSet<RDFNodeTuple>(); - String pred = "predicate"; - String obj = "object"; - // getQuery - String sparqlQueryString = sparqlQueryMaker.makeClassQueryUsingFilters(uri.toString()); - return sparqlTasks.queryAsRDFNodeTuple(sparqlQueryString, pred, obj); - } - -} Modified: trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitorImproved.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitorImproved.java 2008-08-15 12:03:42 UTC (rev 1083) +++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupelAquisitorImproved.java 2008-08-15 12:21:00 UTC (rev 1084) @@ -23,7 +23,6 @@ import java.util.SortedSet; import org.apache.log4j.Logger; -import org.dllearner.kb.extraction.Configuration; import org.dllearner.kb.sparql.SPARQLTasks; import org.dllearner.kb.sparql.SparqlQueryMaker; import org.dllearner.utilities.datastructures.RDFNodeTuple; @@ -34,33 +33,22 @@ * @author Sebastian Hellmann * */ -public class SparqlTupelAquisitorImproved extends TupelAquisitor { +public class SparqlTupelAquisitorImproved extends SparqlTupelAquisitor { @SuppressWarnings("unused") private static Logger logger = Logger.getLogger(SparqlTupelAquisitorImproved.class); - private Configuration configuration; - protected SparqlQueryMaker sparqlQueryMaker; - protected SPARQLTasks sparqlTasks; - public SparqlTupelAquisitorImproved(Configuration Configuration) { - this.configuration = Configuration; - this.sparqlQueryMaker = configuration.getSparqlQueryMaker(); - this.sparqlTasks = configuration.sparqlTasks; + public SparqlTupelAquisitorImproved(SparqlQueryMaker sparqlQueryMaker, SPARQLTasks sparqlTasks) { + super(sparqlQueryMaker, sparqlTasks); + } // standard query get a tupels (p,o) for subject s @Override public SortedSet<RDFNodeTuple> getTupelForResource(URI uri) { - - String pred = "predicate"; - String obj = "object"; - // getQuery - String sparqlQueryString = sparqlQueryMaker - .makeSubjectQueryUsingFilters(uri.toString()); - - return sparqlTasks.queryAsRDFNodeTuple(sparqlQueryString, pred, obj); + throw new RuntimeException("not implemented yet"); } Modified: trunk/src/dl-learner/org/dllearner/kb/aquisitors/TupelAquisitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/aquisitors/TupelAquisitor.java 2008-08-15 12:03:42 UTC (rev 1083) +++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/TupelAquisitor.java 2008-08-15 12:21:00 UTC (rev 1084) @@ -34,8 +34,18 @@ * */ public abstract class TupelAquisitor { + + protected boolean classMode = false; public abstract SortedSet<RDFNodeTuple> getTupelForResource(URI u); + + public void setClassMode(boolean classMode) { + this.classMode = classMode; + } + + public boolean isClassMode() { + return classMode; + } } Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/Configuration.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/Configuration.java 2008-08-15 12:03:42 UTC (rev 1083) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/Configuration.java 2008-08-15 12:21:00 UTC (rev 1084) @@ -19,10 +19,8 @@ */ package org.dllearner.kb.extraction; -import org.dllearner.kb.old.Manipulators; -import org.dllearner.kb.sparql.SPARQLTasks; -import org.dllearner.kb.sparql.SparqlEndpoint; -import org.dllearner.kb.sparql.SparqlQueryMaker; +import org.dllearner.kb.aquisitors.TupelAquisitor; +import org.dllearner.kb.manipulator.Manipulator; /** * Stores all configuration settings. this class collects all configuration @@ -32,78 +30,79 @@ */ public class Configuration { - public SPARQLTasks sparqlTasks; + //public SPARQLTasks sparqlTasks; - private SparqlEndpoint endpoint; - private SparqlQueryMaker sparqlQueryMaker; + //private SparqlEndpoint endpoint; + //private SparqlQueryMaker sparqlQueryMaker; + private Manipulator manipulator; + private TupelAquisitor tupelAquisitor; - private Manipulators manipulator; // the following needs to be moved to // class extraction algorithm or manipulator private int recursiondepth; private boolean getAllSuperClasses = true; private boolean closeAfterRecursion = true; - public int numberOfUncachedSparqlQueries = 0; - public int numberOfCachedSparqlQueries = 0; - public String cacheDir="cache"; + private int breakSuperClassesAfter = 200; - public Configuration(SparqlEndpoint specificSparqlEndpoint, - SparqlQueryMaker sparqlQueryMaker, Manipulators manipulator, - int recursiondepth, boolean getAllSuperClasses, - boolean closeAfterRecursion, String cacheDir) { - this.endpoint = specificSparqlEndpoint; - this.sparqlQueryMaker = sparqlQueryMaker; + + public Configuration( + TupelAquisitor tupelAquisitor, + Manipulator manipulator, + int recursiondepth, + boolean getAllSuperClasses, + boolean closeAfterRecursion, + int breakSuperClassesAfter) { + + this.tupelAquisitor = tupelAquisitor; this.manipulator = manipulator; this.recursiondepth = recursiondepth; this.getAllSuperClasses = getAllSuperClasses; this.closeAfterRecursion = closeAfterRecursion; - this.cacheDir=cacheDir; + this.breakSuperClassesAfter = breakSuperClassesAfter; + } - public Configuration changeQueryType(SparqlQueryMaker sqm) { - // TODO must clone here - return new Configuration(this.endpoint, sqm, this.manipulator, - this.recursiondepth, this.getAllSuperClasses, - this.closeAfterRecursion, this.cacheDir); + public int getBreakSuperClassesAfter() { + return breakSuperClassesAfter; } - public Manipulators getManipulator() { - return this.manipulator; - } - public SparqlEndpoint getSparqlEndpoint() { - return endpoint; + public boolean isCloseAfterRecursion() { + return closeAfterRecursion; } - public SparqlQueryMaker getSparqlQueryMaker() { - return sparqlQueryMaker; - } public boolean isGetAllSuperClasses() { return getAllSuperClasses; } - public boolean isCloseAfterRecursion() { - return closeAfterRecursion; + + public Manipulator getManipulator() { + return manipulator; } + public int getRecursiondepth() { return recursiondepth; } - - public SPARQLTasks getSparqlTasks() { - return sparqlTasks; - } - - /*public void increaseNumberOfuncachedSparqlQueries() { - numberOfUncachedSparqlQueries++; + + public TupelAquisitor getTupelAquisitor() { + return tupelAquisitor; } - public void increaseNumberOfCachedSparqlQueries() { - numberOfCachedSparqlQueries++; + /* + public Configuration changeQueryType(SparqlQueryMaker sqm) { + // TODO must clone here + return new Configuration(this.endpoint, sqm, this.manipulator, + this.recursiondepth, this.getAllSuperClasses, + this.closeAfterRecursion, this.cacheDir); + }*/ + + + } Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java 2008-08-15 12:03:42 UTC (rev 1083) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java 2008-08-15 12:21:00 UTC (rev 1084) @@ -20,16 +20,13 @@ package org.dllearner.kb.extraction; import java.net.URI; -import java.util.HashSet; -import java.util.Vector; +import java.util.ArrayList; +import java.util.List; +import java.util.SortedSet; +import java.util.TreeSet; import org.apache.log4j.Logger; -import org.dllearner.kb.old.ClassNode; -import org.dllearner.kb.old.InstanceNode; -import org.dllearner.kb.old.Manipulators; -import org.dllearner.kb.old.Node; -import org.dllearner.kb.old.TypedSparqlQuery; -import org.dllearner.kb.old.TypedSparqlQueryClasses; +import org.dllearner.kb.aquisitors.TupelAquisitor; /** * This class is used to extract the information . @@ -39,8 +36,8 @@ public class ExtractionAlgorithm { private Configuration configuration; - private Manipulators manipulator; - private int recursionDepth = 1; + //private Manipulators manipulator; + //private int recursionDepth = 1; // private boolean getAllSuperClasses = true; // private boolean closeAfterRecursion = true; private static Logger logger = Logger @@ -48,8 +45,8 @@ public ExtractionAlgorithm(Configuration Configuration) { this.configuration = Configuration; - this.manipulator = Configuration.getManipulator(); - this.recursionDepth = Configuration.getRecursiondepth(); + //this.manipulator = Configuration.getManipulator(); + //this.recursionDepth = Configuration.getRecursiondepth(); // this.getAllSuperClasses = Configuration.isGetAllSuperClasses(); // this.closeAfterRecursion=Configuration.isCloseAfterRecursion(); } @@ -58,10 +55,10 @@ return new InstanceNode(u); } - public Vector<Node> expandAll(URI[] u, TypedSparqlQuery tsp) { - Vector<Node> v = new Vector<Node>(); - for (URI one : u) { - v.add(expandNode(one, tsp)); + public List<Node> expandAll(URI[] uris, TupelAquisitor tupelAquisitor) { + List<Node> v = new ArrayList<Node>(); + for (URI oneURI : uris) { + v.add(expandNode(oneURI, tupelAquisitor)); } return v; } @@ -75,50 +72,52 @@ * @param typedSparqlQuery * @return */ - public Node expandNode(URI uri, TypedSparqlQuery typedSparqlQuery) { + public Node expandNode(URI uri, TupelAquisitor tupelAquisitor) { //System.out.println(uri.toString()); //System.out.println(manipulator); //System.out.println(this.configuration); long time = System.currentTimeMillis(); + Node n = getFirstNode(uri); logger.info(n); - Vector<Node> v = new Vector<Node>(); - v.add(n); - logger.info("StartVector: " + v); + List<Node> initialNodes = new ArrayList<Node>(); + initialNodes.add(n); + logger.info("StartVector: " + initialNodes); // n.expand(tsp, this.Manipulator); // Vector<Node> second= - for (int x = 1; x <= recursionDepth; x++) { + for (int x = 1; x <= configuration.getRecursiondepth(); x++) { - Vector<Node> tmp = new Vector<Node>(); - while (v.size() > 0) { - Node tmpNode = v.remove(0); + List<Node> tmp = new ArrayList<Node>(); + while (!initialNodes.isEmpty()) { + Node tmpNode = initialNodes.remove(0); logger.info("Expanding " + tmpNode); // System.out.println(this.Manipulator); // these are the new not expanded nodes // the others are saved in connection with the original node - Vector<Node> tmpVec = tmpNode.expand(typedSparqlQuery, - manipulator); + List<Node> tmpNodeList = tmpNode.expand(tupelAquisitor, + configuration.getManipulator()); //System.out.println(tmpVec); - tmp.addAll(tmpVec); + tmp.addAll(tmpNodeList); } - v = tmp; - logger.info("Recursion counter: " + x + " with " + v.size() + //CAVE: possible error here + initialNodes = tmp; + logger.info("Recursion counter: " + x + " with " + initialNodes.size() + " Nodes remaining, needed: " + (System.currentTimeMillis() - time) + "ms"); time = System.currentTimeMillis(); } - HashSet<String> hadAlready = new HashSet<String>(); + SortedSet<String> hadAlready = new TreeSet<String>(); //p(configuration.toString()); // gets All Class Nodes and expands them further - if (this.configuration.isGetAllSuperClasses()) { + if (configuration.isGetAllSuperClasses()) { logger.info("Get all superclasses"); // Set<Node> classes = new TreeSet<Node>(); - Vector<Node> classes = new Vector<Node>(); + List<Node> classes = new ArrayList<Node>(); + List<Node> instances = new ArrayList<Node>(); - Vector<Node> instances = new Vector<Node>(); - for (Node one : v) { + for (Node one : initialNodes) { if (one instanceof ClassNode) { classes.add(one); } @@ -128,23 +127,28 @@ } // System.out.println(instances.size()); - TypedSparqlQueryClasses tsqc = new TypedSparqlQueryClasses( - configuration); - if (this.configuration.isCloseAfterRecursion()) { - while (instances.size() > 0) { + //TODO LinkedData incompatibility + //TupelAquisitor tupelAquisitorClasses = configuration.sparqlTupelAquisitorClasses; + //XXX this should be solved in a better way + tupelAquisitor.setClassMode(true); + if (configuration.isCloseAfterRecursion()) { + while (!instances.isEmpty()) { logger.trace("Getting classes for remaining instances: " + instances.size()); Node next = instances.remove(0); logger.trace("Getting classes for: " + next); - classes.addAll(next.expand(tsqc, manipulator)); - if (classes.size() >= Manipulators.breakSuperClassRetrievalAfter) { + classes.addAll(next.expand(tupelAquisitor, configuration.getManipulator())); + if (classes.size() >= configuration.getBreakSuperClassesAfter()) { break; } } } - Vector<Node> tmp = new Vector<Node>(); + //XXX this should be solved in a better way + tupelAquisitor.setClassMode(false); + + List<Node> tmp = new ArrayList<Node>(); int i = 0; - while (classes.size() > 0) { + while (!classes.isEmpty()) { logger.trace("Remaining classes: " + classes.size()); // Iterator<Node> it=classes.iterator(); // Node next =(Node) it.next(); @@ -155,13 +159,13 @@ logger.trace("Getting SuperClass for: " + next); // System.out.println(hadAlready.size()); hadAlready.add(next.getURI().toString()); - tmp = next.expand(typedSparqlQuery, manipulator); + tmp = next.expand(tupelAquisitor, configuration.getManipulator()); classes.addAll(tmp); - tmp = new Vector<Node>(); + tmp = new ArrayList<Node>(); // if(i % 50==0)System.out.println("got "+i+" extra classes, // max: "+manipulator.breakSuperClassRetrievalAfter); i++; - if (i >= Manipulators.breakSuperClassRetrievalAfter) { + if (i >= configuration.getBreakSuperClassesAfter()) { break; } } Added: trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java 2008-08-15 12:21:00 UTC (rev 1084) @@ -0,0 +1,125 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.kb.extraction; + +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.dllearner.kb.aquisitors.TupelAquisitor; +import org.dllearner.kb.manipulator.Manipulator; +import org.dllearner.utilities.datastructures.RDFNodeTuple; +import org.dllearner.utilities.owl.OWLVocabulary; + +/** + * A node in the graph that is an instance. + * + * @author Sebastian Hellmann + * + */ +public class InstanceNode extends Node { + + private SortedSet<ClassNode> classes = new TreeSet<ClassNode>(); + //SortedSet<StringTuple> datatypes = new TreeSet<StringTuple>(); + private SortedSet<PropertyNode> properties = new TreeSet<PropertyNode>(); + + public InstanceNode(URI u) { + super(u); + // this.type = "instance"; + + } + + // expands all directly connected nodes + @Override + public List<Node> expand(TupelAquisitor tupelAquisitor, Manipulator manipulator) { + + SortedSet<RDFNodeTuple> newTuples = tupelAquisitor.getTupelForResource(uri); + // see Manipulator + newTuples = manipulator.manipulate(this, newTuples); + //s=m.check(s, this); + // System.out.println("fffffff"+m); + List<Node> newNodes = new ArrayList<Node>(); + + for (RDFNodeTuple tuple : newTuples) { + //QUALITY: needs proper handling of ressource, could be done one step lower in the onion + if(!tuple.b.toString().startsWith("http:"))continue; + +// basically : if p is rdf:type then o is a class + // else it is an instance + try { + if (tuple.a.toString().equals(OWLVocabulary.RDF_TYPE)) { + ClassNode tmp = new ClassNode(new URI(tuple.b.toString())); + classes.add(tmp); + newNodes.add(tmp); + } else { + InstanceNode tmp = new InstanceNode(new URI(tuple.b.toString())); + properties.add(new PropertyNode(new URI(tuple.a.toString()), this, tmp)); + newNodes.add(tmp); + + } + } catch (Exception e) { + System.out.println("Problem with: " + tuple); + e.printStackTrace(); + } + + + + }//endfor + expanded = true; + return newNodes; + + } + + // gets the types for properties recursively + @Override + public void expandProperties(TupelAquisitor tupelAquisitor, Manipulator manipulator) { + for (PropertyNode one : properties) { + one.expandProperties(tupelAquisitor, manipulator); + } + + } + + @Override + public SortedSet<String> toNTriple() { + SortedSet<String> returnSet = new TreeSet<String>(); + returnSet.add("<" + uri + "><" + OWLVocabulary.RDF_TYPE + "><" + OWLVocabulary.OWL_THING + ">."); + for (ClassNode one : classes) { + returnSet.add("<" + uri + "><" + OWLVocabulary.RDF_TYPE + "><" + one.getURI() + ">."); + returnSet.addAll(one.toNTriple()); + } + for (PropertyNode one : properties) { + returnSet.add("<" + uri + "><" + one.getURI() + "><" + one.getB().getURI() + + ">."); + returnSet.addAll(one.toNTriple()); + returnSet.addAll(one.getB().toNTriple()); + } + + return returnSet; + } + + @Override + public int compareTo(Node n) { + return super.compareTo(n); + // + } + +} Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java 2008-08-15 12:03:42 UTC (rev 1083) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java 2008-08-15 12:21:00 UTC (rev 1084) @@ -25,12 +25,6 @@ import java.util.TreeSet; import org.apache.log4j.Logger; -import org.dllearner.kb.old.Manipulators; -import org.dllearner.kb.old.Node; -import org.dllearner.kb.old.TypedSparqlQuery; -import org.dllearner.kb.sparql.SparqlEndpoint; -import org.dllearner.kb.sparql.SparqlQueryMaker; -import org.dllearner.utilities.statistics.Statistics; /** * An object of this class encapsulates everything. @@ -41,23 +35,17 @@ public class Manager { private Configuration configuration; - private TypedSparqlQuery typedSparqlQuery; private ExtractionAlgorithm extractionAlgorithm; private static Logger logger = Logger .getLogger(Manager.class); - public void useConfiguration(SparqlQueryMaker sparqlQueryMaker, - SparqlEndpoint SparqlEndpoint, Manipulators manipulator, - int recursiondepth, boolean getAllSuperClasses, - boolean closeAfterRecursion, String cacheDir) { + public void useConfiguration(Configuration configuration) { - this.configuration = new Configuration(SparqlEndpoint, sparqlQueryMaker, - manipulator, recursiondepth, getAllSuperClasses, - closeAfterRecursion, cacheDir); + this.configuration = configuration; //System.out.println(this.configuration); - this.typedSparqlQuery = new TypedSparqlQuery(configuration); + this.extractionAlgorithm = new ExtractionAlgorithm(configuration); } @@ -67,20 +55,21 @@ // System.out.println(ExtractionAlgorithm.getFirstNode(uri)); System.out.println("Start extracting"); - Node n = extractionAlgorithm.expandNode(uri, typedSparqlQuery); + Node n = extractionAlgorithm.expandNode(uri, configuration.getTupelAquisitor()); SortedSet<String> s = n.toNTriple(); - String nt = ""; + StringBuffer nt = new StringBuffer(33000); for (String str : s) { - nt += str + "\n"; + nt.append(str + "\n"); } - return nt; + System.out.println("sizeofStringBuffer"+nt.length()); + return nt.toString(); } public String extract(Set<String> instances) { // this.TypedSparqlQuery.query(uri); // System.out.println(ExtractionAlgorithm.getFirstNode(uri)); logger.info("Start extracting"); - SortedSet<String> ret = new TreeSet<String>(); + SortedSet<String> tripleCollector = new TreeSet<String>(); int progress=0; for (String one : instances) { progress++; @@ -89,15 +78,15 @@ //} try { Node n = extractionAlgorithm.expandNode(new URI(one), - typedSparqlQuery); - ret.addAll(n.toNTriple()); + configuration.getTupelAquisitor()); + tripleCollector.addAll(n.toNTriple()); } catch (Exception e) { e.printStackTrace(); } } logger.info("Finished extracting, start conversion"); - StringBuffer nt = new StringBuffer(); - Object[] arr = ret.toArray(); + StringBuffer nt = new StringBuffer(100000); + Object[] arr = tripleCollector.toArray(); for (int i = 0; i < arr.length; i++) { nt.append((String) arr[i] + "\n"); if (i % 1000 == 0) @@ -109,15 +98,15 @@ * ret.remove(tmp); System.out.println(ret.size()); } /*for (String str : * ret) { nt += str + "\n"; } */ - Statistics.addTriples(ret.size()); + logger.info("Ontology String size = " + nt.length()); return nt.toString(); } - public void addPredicateFilter(String str) { +/* public void addPredicateFilter(String str) { this.configuration.getSparqlQueryMaker().addPredicateFilter(str); } - +*/ public Configuration getConfiguration() { return configuration; } Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java 2008-08-15 12:03:42 UTC (rev 1083) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java 2008-08-15 12:21:00 UTC (rev 1084) @@ -24,9 +24,9 @@ import java.util.SortedSet; import org.dllearner.kb.extraction.ClassNode; +import org.dllearner.kb.extraction.InstanceNode; import org.dllearner.kb.extraction.Node; import org.dllearner.kb.manipulator.Rule.Months; -import org.dllearner.kb.old.InstanceNode; import org.dllearner.utilities.datastructures.RDFNodeTuple; import org.dllearner.utilities.owl.OWLVocabulary; @@ -38,24 +38,15 @@ */ public class Manipulator { - List<Rule> rules = new ArrayList<Rule>(); - //List<ReplacementRule> replacementRules = new ArrayList<ReplacementRule>(); - - - //public int breakSuperClassRetrievalAfter = 200; - //public LinkedList<StringTuple> replacePredicate; - //public LinkedList<StringTuple> replaceObject; - - // Set<String> classproperties; - + private List<Rule> rules = new ArrayList<Rule>(); + private Manipulator() { - - //this.replaceObject = replaceObject; - //this.replacePredicate = replacePredicate; - //this.breakSuperClassRetrievalAfter = breakSuperClassRetrievalAfter; - // Set<String> classproperties = new HashSet<String>(); - // classproperties.add(subclass); + } + public Manipulator(List<Rule> rules) { + for (Rule rule : rules) { + addRule(rule); + } } /** @@ -64,51 +55,32 @@ */ public SortedSet<RDFNodeTuple> manipulate( Node node, SortedSet<RDFNodeTuple> tuples) { - for (Months month : Rule.MONTHS) { - tuples = applyRulesOfTheMonth(month, node, tuples); - } - return tuples; - /*SortedSet<RDFNodeTuple> keep = new TreeSet<RDFNodeTuple>(); - - for (RDFNodeTuple currentTuple : tuples) { - currentTuple = manipulateTuple(node.getURI().toString(), currentTuple); - if(keepTuple(node, currentTuple)) { - keep.add(currentTuple); - } - - } - return keep;*/ - } - - public SortedSet<RDFNodeTuple> applyRulesOfTheMonth(Months month, Node subject, SortedSet<RDFNodeTuple> tuples){ for (Rule rule : rules) { - if(rule.month.equals(month)) { - tuples = rule.applyRule(subject, tuples); - } + tuples = rule.applyRule(node, tuples); } return tuples; } + + public static Manipulator getManipulatorByName(String predefinedManipulator) { if (predefinedManipulator.equalsIgnoreCase("DBPEDIA-NAVIGATOR")) { return getDBpediaNavigatorManipulator(); -// return new DBpediaNavigatorManipulator(blankNodeIdentifier, - //breakSuperClassRetrievalAfter, replacePredicate, replaceObject); - + } else if(predefinedManipulator.equalsIgnoreCase("DEFAULT")){ return getDefaultManipulator(); } else { - //QUALITY maybe not the best, should be Default - return new Manipulator(); + //QUALITY maybe not the best, + return getDefaultManipulator(); } } public static Manipulator getDBpediaNavigatorManipulator(){ Manipulator m = new Manipulator(); - m.rules.add(new DBPediaNavigatorCityLocatorRule(Months.JANUARY)); - m.rules.add(new DBpediaNavigatorOtherRule(Months.DECEMBER)); + m.addRule(new DBPediaNavigatorCityLocatorRule(Months.JANUARY)); + m.addRule(new DBpediaNavigatorOtherRule(Months.DECEMBER)); return m; } @@ -137,13 +109,28 @@ private void addDefaultRules(Months month){ - rules.add(new TypeFilterRule(month, OWLVocabulary.RDF_TYPE, OWLVocabulary.OWL_CLASS,ClassNode.class.getCanonicalName() )) ; - rules.add(new TypeFilterRule(month, OWLVocabulary.RDF_TYPE, OWLVocabulary.OWL_THING,InstanceNode.class.getCanonicalName() )) ; - rules.add(new TypeFilterRule(month, "", OWLVocabulary.OWL_CLASS, ClassNode.class.getCanonicalName()) ) ; + addRule(new TypeFilterRule(month, OWLVocabulary.RDF_TYPE, OWLVocabulary.OWL_CLASS,ClassNode.class.getCanonicalName() )) ; + addRule(new TypeFilterRule(month, OWLVocabulary.RDF_TYPE, OWLVocabulary.OWL_THING,InstanceNode.class.getCanonicalName() )) ; + addRule(new TypeFilterRule(month, "", OWLVocabulary.OWL_CLASS, ClassNode.class.getCanonicalName()) ) ; } + public synchronized void addRule(Rule newRule){ + rules.add(newRule); + List<Rule> l = new ArrayList<Rule>(); + + for (Months month : Rule.MONTHS) { + for (Rule rule : rules) { + if(rule.month.equals(month)) { + l.add(rule); + } + } + + } + rules = l; + } + /* private RDFNodeTuple manipulateTuple(String subject, RDFNodeTuple tuple) { Deleted: trunk/src/dl-learner/org/dllearner/kb/old/ClassNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/old/ClassNode.java 2008-08-15 12:03:42 UTC (rev 1083) +++ trunk/src/dl-learner/org/dllearner/kb/old/ClassNode.java 2008-08-15 12:21:00 UTC (rev 1084) @@ -1,117 +0,0 @@ -/** - * Copyright (C) 2007, Sebastian Hellmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.kb.old; - -import java.net.URI; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; -import java.util.SortedSet; -import java.util.TreeSet; -import java.util.Vector; - -import org.dllearner.utilities.datastructures.StringTuple; - -/** - * Is a node in the graph, that is a class. - * - * @author Sebastian Hellmann - */ -public class ClassNode extends Node { - Set<PropertyNode> properties = new HashSet<PropertyNode>(); - - public ClassNode(URI u) { - super(u); - } - - // expands all directly connected nodes - @Override - public Vector<Node> expand(TypedSparqlQueryInterface tsq, Manipulators m) { - - Set<StringTuple> s = tsq.getTupelForResource(this.uri); - // see manipulator - s = m.check(s, this); - Vector<Node> Nodes = new Vector<Node>(); - Iterator<StringTuple> it = s.iterator(); - while (it.hasNext()) { - StringTuple t = (StringTuple) it.next(); - try { - // substitute rdf:type with owl:subclassof - if (t.a.equals(Manipulators.type) || t.a.equals(Manipulators.subclass)) { - ClassNode tmp = new ClassNode(new URI(t.b)); - properties.add(new PropertyNode(new URI(Manipulators.subclass), this, - tmp)); - Nodes.add(tmp); - } else { - // further expansion stops here - // Nodes.add(tmp); is missing on purpose - ClassNode tmp = new ClassNode(new URI(t.b)); - properties.add(new PropertyNode(new URI(t.a), this, tmp)); - // System.out.println(m.blankNodeIdentifier); - // System.out.println("XXXXX"+t.b); - - // if o is a blank node expand further - // TODO this needs a lot more work - if (t.b.startsWith(Manipulators.blankNodeIdentifier)) { - tmp.expand(tsq, m); - System.out.println(Manipulators.blankNodeIdentifier); - System.out.println("XXXXX" + t.b); - } - // Nodes.add(tmp); - } - } catch (Exception e) { - System.out.println(t); - e.printStackTrace(); - } - - } - return Nodes; - } - - // gets the types for properties recursively - @Override - public void expandProperties(TypedSparqlQueryInterface tsq, Manipulators m) { - } - - /* - * (non-Javadoc) - * - * @see org.dllearner.kb.sparql.datastructure.Node#toNTriple() - */ - @Override - public SortedSet<String> toNTriple() { - SortedSet<String> s = new TreeSet<String>(); - s.add("<" + this.uri + "><" + rdftype + "><" + classns + ">."); - - for (PropertyNode one : properties) { - s.add("<" + this.uri + "><" + one.getURI() + "><" - + one.getB().getURI() + ">."); - s.addAll(one.getB().toNTriple()); - } - - return s; - } - - @Override - public int compareTo(Node n) { - return super.compareTo(n); - } - -} Deleted: trunk/src/dl-learner/org/dllearner/kb/old/DBpediaNavigatorCityLocator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/old/DBpediaNavigatorCityLocator.java 2008-08-15 12:03:42 UTC (rev 1083) +++ trunk/src/dl-learner/org/dllearner/kb/old/DBpediaNavigatorCityLocator.java 2008-08-15 12:21:00 UTC (rev 1084) @@ -1,58 +0,0 @@ -package org.dllearner.kb.old; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Set; - -import org.dllearner.utilities.datastructures.StringTuple; - -public class DBpediaNavigatorCityLocator { - - public static String getTypeToCoordinates(float lat, float lng){ - if (lat<71.08&&lat>33.39&&lng>-24.01&&lng<50.8){ - if (lat>50&&lat<52&&lng>12&&lng<13){ - return "http://dbpedia.org/class/custom/City_in_Saxony"; - } - else return "http://dbpedia.org/class/custom/City_in_Europe"; - } - else if (lng>-17.5&&lng<52.04&&lat>-36&&lat<36.6){ - if (lat>21.45&&lat<31.51&&lng>24.7&&lng<37.26){ - return "http://dbpedia.org/class/custom/City_in_Egypt"; - } - else return "http://dbpedia.org/class/custom/City_in_Africa"; - } - else if (((lng>27.4&&lng<180)||(lng<-168.75))&&lat>-11.2){ - return "http://dbpedia.org/class/custom/City_in_Asia"; - } - else if (lng>113.9&&lng<179.65&&lat<-10.8&&lat>-47.04){ - return "http://dbpedia.org/class/custom/City_in_Australia"; - } - else if (lng>-168.4&&lng<-19.7&&lat>6.6){ - return "http://dbpedia.org/class/custom/City_in_North_America"; - } - else if (lng>-81.56&&lng<-34.1&&lat<6.6){ - return "http://dbpedia.org/class/custom/City_in_South_America"; - } - else return "http://dbpedia.org/class/custom/City_in_World"; - } - - public static Set<StringTuple> getTuplesToAdd(String uri){ - String subClass="http://www.w3.org/2000/01/rdf-schema#subClassOf"; - - HashMap<String,String> map=new HashMap<String,String>(); - map.put("http://dbpedia.org/class/custom/City_in_Saxony", "http://dbpedia.org/class/custom/City_in_Europe"); - map.put("http://dbpedia.org/class/custom/City_in_Egypt", "http://dbpedia.org/class/custom/City_in_Africa"); - map.put("http://dbpedia.org/class/custom/City_in_Europe", "http://dbpedia.org/class/yago/City108524735"); - map.put("http://dbpedia.org/class/custom/City_in_Asia", "http://dbpedia.org/class/yago/City108524735"); - map.put("http://dbpedia.org/class/custom/City_in_Australia", "http://dbpedia.org/class/yago/City108524735"); - map.put("http://dbpedia.org/class/custom/City_in_North_America", "http://dbpedia.org/class/yago/City108524735"); - map.put("http://dbpedia.org/class/custom/City_in_South_America", "http://dbpedia.org/class/yago/City108524735"); - map.put("http://dbpedia.org/class/custom/City_in_Africa", "http://dbpedia.org/class/yago/City108524735"); - map.put("http://dbpedia.org/class/custom/City_in_World", "http://dbpedia.org/class/yago/City108524735"); - Set<StringTuple> toAdd = new HashSet<StringTuple>(); - if (map.containsKey(uri)){ - toAdd.add(new StringTuple(subClass,map.get(uri))); - } - return toAdd; - } -} Deleted: trunk/src/dl-learner/org/dllearner/kb/old/DBpediaNavigatorManipulator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/old/DBpediaNavigatorManipulator.java 2008-08-15 12:03:42 UTC (rev 1083) +++ trunk/src/dl-learner/org/dllearner/kb/old/DBpediaNavigatorManipulator.java 2008-08-15 12:21:00 UTC (rev 1084) @@ -1,139 +0,0 @@ -/** - * Copyright (C) 2007, Sebastian Hellmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.kb.old; - -import java.util.Iterator; -import java.util.LinkedList; -import java.util.Set; - -import org.dllearner.utilities.datastructures.StringTuple; - -/** - * Used to manipulate retrieved tupels, identify blanknodes, etc. - * - * @author Sebastian Hellmann - * - */ -public class DBpediaNavigatorManipulator implements Manipulators{ - public final String subclass = "http://www.w3.org/2000/01/rdf-schema#subClassOf"; - public final String type = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"; - final String objectProperty = "http://www.w3.org/2002/07/owl#ObjectProperty"; - final String classns = "http://www.w3.org/2002/07/owl#Class"; - final String thing = "http://www.w3.org/2002/07/owl#Thing"; - - public String blankNodeIdentifier = "bnode"; - public int breakSuperClassRetrievalAfter = 200; - public LinkedList<StringTuple> replacePredicate; - public LinkedList<StringTuple> replaceObject; - - // Set<String> classproperties; - - public DBpediaNavigatorManipulator(String blankNodeIdentifier, - int breakSuperClassRetrievalAfter, - LinkedList<StringTuple> replacePredicate, - LinkedList<StringTuple> replaceObject) { - this.blankNodeIdentifier = blankNodeIdentifier; - this.replaceObject = replaceObject; - this.replacePredicate = replacePredicate; - this.breakSuperClassRetrievalAfter = breakSuperClassRetrievalAfter; - // Set<String> classproperties = new HashSet<String>(); - // classproperties.add(subclass); - - } - - /** - * this checks for consistency and manipulates the tuples, before they get - * triple - * - * @param tuples - * tuples for the node - * @param node - * @return - */ - public Set<StringTuple> check(Set<StringTuple> tuples, Node node) { - //Set<StringTuple> toRemove = new HashSet<StringTuple>(); - Iterator<StringTuple> it = tuples.iterator(); - float lat=0; - float lng=0; - String clas=""; - StringTuple typeTupel=null; - tuples.addAll(DBpediaNavigatorCityLocator.getTuplesToAdd(node.getURI().toString())); - while (it.hasNext()) { - StringTuple t = (StringTuple) it.next(); - - if (t.a.equals("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")){ - clas=t.b; - typeTupel=t; - } - - if (t.a.equals("http://www.w3.org/2003/01/geo/wgs84_pos#lat")) - lat=Float.parseFloat(t.b.substring(0,t.b.indexOf("^^"))); - if (t.a.equals("http://www.w3.org/2003/01/geo/wgs84_pos#long")) - lng=Float.parseFloat(t.b.substring(0,t.b.indexOf("^^"))); - - /*replacePredicate(t); - replaceObject(t); - - - // remove <rdf:type, owl:class> - // this is done to avoid transformation to owl:subclassof - if (t.a.equals(type) && t.b.equals(classns) - && node instanceof ClassNode) { - toRemove.add(t); - } - - // all with type class - if (t.b.equals(classns) && node instanceof ClassNode) { - toRemove.add(t); - } - - // remove all instances with owl:type thing - if (t.a.equals(type) && t.b.equals(thing) - && node instanceof InstanceNode) { - toRemove.add(t); - }*/ - - } - if (clas.equals("http://dbpedia.org/class/yago/City108524735")){ - String newType=DBpediaNavigatorCityLocator.getTypeToCoordinates(lat, lng); - tuples.add(new StringTuple("http://www.w3.org/1999/02/22-rdf-syntax-ns#type",newType)); - tuples.remove(typeTupel); - } - //tuples.removeAll(toRemove); - - return tuples; - } - - /*private void replacePredicate(StringTuple t) { - for (StringTuple rep : replacePredicate) { - if (rep.a.equals(t.a)) { - t.a = rep.b; - } - } - } - - private void replaceObject(StringTuple t) { - for (StringTuple rep : replaceObject) { - if (rep.a.equals(t.a)) { - t.a = rep.b; - } - } - }*/ -} Deleted: trunk/src/dl-learner/org/dllearner/kb/old/InstanceNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/old/InstanceNode.java 2008-08-15 12:03:42 UTC (rev 1083) +++ trunk/src/dl-learner/org/dllearner/kb/old/InstanceNode.java 2008-08-15 12:21:00 UTC (rev 1084) @@ -1,122 +0,0 @@ -/** - * Copyright (C) 2007, Sebastian Hellmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.kb.old; - -import java.net.URI; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; -import java.util.SortedSet; -import java.util.TreeSet; -import java.util.Vector; - -import org.dllearner.utilities.datastructures.StringTuple; - -/** - * A node in the graph that is an instance. - * - * @author Sebastian Hellmann - * - */ -public class InstanceNode extends Node { - - Set<ClassNode> classes = new HashSet<ClassNode>(); - Set<StringTuple> datatypes = new HashSet<StringTuple>(); - Set<PropertyNode> properties = new HashSet<PropertyNode>(); - - public InstanceNode(URI u) { - super(u); - // this.type = "instance"; - - } - - // expands all directly connected nodes - @Override - public Vector<Node> expand(TypedSparqlQueryInterface tsq, Manipulators m) { - - Set<StringTuple> s = tsq.getTupelForResource(uri); - // see Manipulator - s=m.check(s, this); - // System.out.println("fffffff"+m); - Vector<Node> Nodes = new Vector<Node>(); - - Iterator<StringTuple> it = s.iterator(); - while (it.hasNext()) { - StringTuple t = (StringTuple) it.next(); - //QUALITY: needs proper handling of ressource, could be done one step lower in the onion - if(!t.b.startsWith("http:"))continue; - - // basically : if p is rdf:type then o is a class - // else it is an instance - try { - if (t.a.equals(Manipulators.type)) { - ClassNode tmp = new ClassNode(new URI(t.b)); - classes.add(tmp); - Nodes.add(tmp); - } else { - InstanceNode tmp = new InstanceNode(new URI(t.b)); - properties.add(new PropertyNode(new URI(t.a), this, tmp)); - Nodes.add(tmp); - - } - } catch (Exception e) { - System.out.println("Problem with: " + t); - e.printStackTrace(); - } - - } - expanded = true; - return Nodes; - } - - // gets the types for properties recursively - @Override - public void expandProperties(TypedSparqlQueryInterface tsq, Manipulators m) { - for (PropertyNode one : properties) { - one.expandProperties(tsq, m); - } - - } - - @Override - public SortedSet<String> toNTriple() { - SortedSet<String> s = new TreeSet<String>(); - s.add("<" + uri + "><" + rdftype + "><" + thing + ">."); - for (ClassNode one : classes) { - s.add("<" + uri + "><" + rdftype + "><" + one.getURI() + ">."); - s.addAll(one.toNTriple()); - } - for (PropertyNode one : properties) { - s.add("<" + uri + "><" + one.getURI() + "><" + one.getB().getURI() - + ">."); - s.addAll(one.toNTriple()); - s.addAll(one.getB().toNTriple()); - } - - return s; - } - - @Override - public int compareTo(Node n) { - return super.compareTo(n); - // - } - -} Deleted: trunk/src/dl-learner/org/dllearner/kb/old/ManipulatorType.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/old/ManipulatorType.java 2008-08-15 12:03:42 UTC (rev 1083) +++ trunk/src/dl-learner/org/dllearner/kb/old/ManipulatorType.java 2008-08-15 12:21:00 UTC (rev 1084) @@ -1,23 +0,0 @@ -package org.dllearner.kb.old; - -import java.util.LinkedList; - -import org.dllearner.utilities.datastructures.StringTuple; - - -/** - * Used to get the right manipulator - * - * @author Sebastian Knappe - * - */ -public class ManipulatorType { - - public static Manipulators getManipulatorByName(String predefinedManipulator,String blankNodeIdentifier, int breakSuperClassRetrievalAfter, LinkedList<StringTuple> replacePredicate,LinkedList<StringTuple> replaceObject) - { - if (predefinedManipulator.equals("DBPEDIA-NAVIGATOR")) return new DBpediaNavigatorManipulator(blankNodeIdentifier, - breakSuperClassRetrievalAfter, replacePredicate, replaceObject); - else return new OldManipulator(blankNodeIdentifier, - breakSuperClassRetrievalAfter, replacePredicate, replaceObject); - } -} Deleted: trunk/src/dl-learner/org/dllearner/kb/old/Manipulators.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/old/Manipulators.java 2008-08-15 12:03:42 UTC (rev 1083) +++ trunk/src/dl-learner/org/dllearner/kb/old/Manipulators.java 2008-08-15 12:21:00 UTC (rev 1084) @@ -1,15 +0,0 @@ -package org.dllearner.kb.old; - -import java.util.Set; - -import org.dllearner.utilities.datastructures.StringTuple; - -public interface Manipulators { - - public int breakSuperClassRetrievalAfter = 200; - public final String subclass = "http://www.w3.org/2000/01/rdf-schema#subClassOf"; - public final String type = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"; - public String blankNodeIdentifier = "bnode"; - - public Set<StringTuple> check(Set<StringTuple> tuples, Node node); -} Deleted: trunk/src/dl-learner/org/dllearner/kb/old/Node.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/old/Node.java 2008-08-15 12:03:42 UTC (rev 1083) +++ trunk/src/dl-learner/org/dllearner/kb/old/Node.java 2008-08-15 12:21:00 UTC (rev 1084) @@ -1,99 +0,0 @@ -/** - * Copyright (C) 2007, Sebastian Hellmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.kb.old; - -import java.net.URI; -import java.util.SortedSet; -import java.util.Vector; - - - -/** - * Abstract class. defines functions to expand the nodes - * - * @author Sebastian Hellmann - * - */ -public abstract class Node implements Comparable<Node> { - - final String subclass = "http://www.w3.org/2000/01/rdf-schema#subClassOf"; - final String rdftype = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"; - final String objectProperty = "http://www.w3.org/2002/07/owl#ObjectProperty"; - final String classns = "http://www.w3.org/2002/07/owl#Class"; - final String thing = "http://www.w3.org/2002/07/owl#Thing"; - - URI uri; - // protected String type; - protected boolean expanded = false; - - public Node(URI u) { - this.uri = u; - } - - /** - * Nodes are expanded with a certain context, given by the typedSparqlQuery - * and the manipulator - * - * @param typedSparqlQuery - * @param manipulator - * @return Vector<Node> all Nodes that are new because of expansion - */ - public abstract Vector<Node> expand( - TypedSparqlQueryInterface typedSparqlQuery, Manipulators manipulator); - - /** - * gets type defs for properties like rdf:type SymmetricProperties - * - * @param typedSparqlQuery - * @param manipulator - * @return Vector<Node> - */ - public abstract void expandProperties( - TypedSparqlQueryInterface typedSparqlQuery, Manipulators manipulator); - - /** - * output - * - * @return a set of n-triple - */ - public abstract SortedSet<String> toNTriple(); - - @Override - public String toString() { - return "Node: " + uri + ":" + this.getClass().getSimpleName(); - - } - - public URI getURI() { - return uri; - } - - public boolean equals(Node n) { - if (this.uri.equals(n.uri)) - return true; - else - return false; - } - - public int compareTo(Node n) { - return this.uri.toString().compareTo(n.uri.toString()); - } - -} Deleted: trunk/src/dl-learner/org/dllearner/kb/old/OldManipulator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/old/OldManipulator.java 2008-08-15 12:03:42 UTC (rev 1083) +++ trunk/src/dl-learner/org/dllearner/kb/old/OldManipulator.java 2008-08-15 12:21:00 UTC (rev 1084) @@ -1,158 +0,0 @@ -/** - * Copyright (C) 2007, Sebastian Hellmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.kb.old; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.Set; - -import org.dllearner.utilities.datastructures.StringTuple; - -/** - * Used to manipulate retrieved tupels, identify blanknodes, etc. - * - * @author Sebastian Hellmann - * - */ -@Deprecated -public class OldManipulator implements Manipulators{ - public final String subclass = "http://www.w3.org/2000/01/rdf-schema#subClassOf"; - public final String type = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"; - final String objectProperty = "http://www.w3.org/2002/07/owl#ObjectProperty"; - final String classns = "http://www.w3.org/2002/07/owl#Class"; - final String thing = "http://www.w3.org/2002/07/owl#Thing"; - - public String blankNodeIdentifier = "bnode"; - public int breakSuperClassRetrievalAfter = 200; - public LinkedList<StringTuple> replacePredicate; - public LinkedList<StringTuple> replaceObject; - - // Set<String> classproperties; - - public OldManipulator(String blankNodeIdentifier, - int breakSuperClassRetrievalAfter, - LinkedList<StringTuple> replacePredicate, - LinkedList<StringTuple> replaceObject) { - this.blankNodeIdentifier = blankNodeIdentifier; - this.replaceObject = replaceObject; - this.replacePredicate = replacePredicate; - this.breakSuperClassRetrievalAfter = breakSuperClassRetrievalAfter; - // Set<String> classproperties = new HashSet<String>(); - // classproperties.add(subclass); - - } - - /** - * this checks for consistency and manipulates the tuples, before they get - * triple - * - * @param tuples - * tuples for the node - * @param node - * @return - */ - public Set<StringTuple> check(Set<StringTuple> tuples, Node node) { - Set<StringTuple> toRemove = new HashSet<StringTuple>(); - Iterator<StringTuple> it = tuples.iterator(); - while (it.hasNext()) { - StringTuple t = (StringTuple) it.next(); - - //HACK -// if(t.a.equals("http://www.holygoat.co.uk/owl/redwood/0.1/tags/taggedWithTag")) { -// //hackGetLabel(t.b); -// -// } - - // GovTrack hack - // => we convert a string literal to a URI - // => TODO: introduce an option for converting literals for certain - // properties into URIs -// String sp = "http://purl.org/dc/elements/1.1/subject"; -// if(t.a.equals(sp)) { -// System.out.println(t); -// System.exit(0); -// } - - replacePredicate(t); - replaceObject(t); - - - // remove <rdf:type, owl:class> - // this is done to avoid transformation to owl:subclassof - if (t.a.equals(type) && t.b.equals(classns) - && node instanceof ClassNode) { - toRemove.add(t); - } - - // all with type class - if (t.b.equals(classns) && node instanceof ClassNode) { - toRemove.add(t); - } - - // remove all instances with owl:type thing - if (t.a.equals(type) && t.b.equals(thing) - && node instanceof InstanceNode) { - toRemove.add(t); - } - - } - tuples.removeAll(toRemove); - - return tuples; - } - - private void replacePredicate(StringTuple t) { - for (StringTuple rep : replacePredicate) { - if (rep.a.equals(t.a)) { - t.a = rep.b; - } - } - } - - private void replaceObject(StringTuple t) { - for (StringTuple rep : replaceObject) { - if (rep.a.equals(t.a)) { - t.a = rep.b; - } - } - } - - - /*private String hackGetLabel(String resname){ - String query="" + - "SELECT ?o \n" + - "WHERE { \n" + - "<"+resname+"> "+ " <http://www.holygoat.co.uk/owl/redwood/0.1/tags/tagName> ?o " + - "}"; - - System.out.println(query); - //http://dbtune.org/musicbrainz/sparql?query= - //SELECT ?o WHERE { <http://dbtune.org/musicbrainz/resource/tag/1391> <http://www.holygoat.co.uk/owl/redwood/0.1/tags/tagName> ?o } - SparqlQuery s=new SparqlQuery(query,SparqlEndpoint.EndpointMusicbrainz()); - ResultSet rs=s.send(); - while (rs.hasNext()){ - rs.nextBinding(); - } - //System.out.println("AAA"+s.getAsXMLString(s.send()) ); - return ""; - }*/ - -} Deleted: trunk/src/dl-learner/org/dllearner/kb/old/PropertyNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/old/PropertyNode.java 2008-08-15 12:03:42 UTC (rev 1083... [truncated message content] |
From: <sk...@us...> - 2008-08-15 12:03:46
|
Revision: 1083 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1083&view=rev Author: sknappe Date: 2008-08-15 12:03:42 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Added CalculatePageRank to navigator now also categories are put into the database search is now working with tagcloud (when choosing tags you see all articles that are in that category), you can choose how many searchresults you want to have (at the moment 10 or 25 or 50 or 75 or 100) and search results are shown on sites with max 25 searchresults each Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_search.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/index-new.php Added Paths: ----------- trunk/src/dbpedia-navigator/CalculatePageRank.java Copied: trunk/src/dbpedia-navigator/CalculatePageRank.java (from rev 1063, trunk/src/dl-learner/org/dllearner/test/CalculatePageRank.java) =================================================================== --- trunk/src/dbpedia-navigator/CalculatePageRank.java (rev 0) +++ trunk/src/dbpedia-navigator/CalculatePageRank.java 2008-08-15 12:03:42 UTC (rev 1083) @@ -0,0 +1,185 @@ +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_search.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_search.php 2008-08-15 11:43:53 UTC (rev 1082) +++ trunk/src/dbpedia-navigator/ajax_search.php 2008-08-15 12:03:42 UTC (rev 1083) @@ -3,6 +3,7 @@ $label=$_POST['label']; $list=$_POST['list']; + $number=$_POST['number']; session_start(); $id=$_SESSION['id']; $ksID=$_SESSION['ksID']; @@ -15,30 +16,38 @@ //initialise content $content=""; - /*try{ - require_once("DLLearnerConnection.php"); - $sc=new DLLearnerConnection($id,$ksID); - - $subjects=$sc->getSubjects($label,$checkedInstances); - - $content.=getTagCloud($subjects['tagcloud'],$subjects['tagcloudlabel']); - $content.=getResultsTable($subjects['subjects']); - } catch (Exception $e){ - $content=$e->getMessage(); - }*/ + mysql_connect('localhost','navigator','dbpedia'); mysql_select_db("navigator_db"); - $query="SELECT name, label FROM rank WHERE MATCH (label) AGAINST ('$label') ORDER BY number LIMIT 3"; + $query="SELECT name, label, category FROM rank WHERE MATCH (label) AGAINST ('$label') ORDER BY number DESC LIMIT ".$number; $res=mysql_query($query); $names=array(); $labels=array(); + $classes=array(); + $tags=array(); + $catlabels=array(); while ($result=mysql_fetch_array($res)){ $labels[]=$result['label']; $names[]=$result['name']; + if (!isset($result['category'])){ + $result['category']="NoCategory"; + $result2['label']="No Category"; + } + else + { + $query="SELECT label FROM categories WHERE category='".$result['category']."' LIMIT 1"; + $res2=mysql_query($query); + $result2=mysql_fetch_array($res2); + } + $classes[]=$result['category']; + if (!isset($tags[$result['category']])) $tags[$result['category']]=1; + else $tags[$result['category']]++; + if (!isset($catlabels[$result['category']])) $catlabels[$result['category']]=$result2['label']; } - $content.=getResultsTable($names,$labels); + $content.=getTagCloud($tags,$catlabels); + $content.=getResultsTable($names,$labels,$classes,$number); print $content; print '$$'; - print "Searchresult for ".$label; + print "Searchresult for \"".$label."\""; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-08-15 11:43:53 UTC (rev 1082) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-08-15 12:03:42 UTC (rev 1083) @@ -18,12 +18,20 @@ function getTagCloud($tags,$label) { + if (isset($tags['NoCategory'])){ + $nc=true; + unset($tags['NoCategory']); + } + else $nc=false; + $max=max($tags); $min=min($tags); $diff=$max-$min; $distribution=$diff/3; $ret="<p>"; + $ret.='<a style="font-size:xx-large;" href="#" onclick="document.getElementById(\'hidden_class\').value=\'all\';show_results(\'all\',document.getElementById(\'hidden_number\').value);">All</a> '; + if ($nc) $ret.='<a style="font-size:xx-small;" href="#" onclick="document.getElementById(\'hidden_class\').value=\'NoCategory\';show_results(\'NoCategory\',document.getElementById(\'hidden_number\').value);">No Category</a> '; foreach ($tags as $tag=>$count){ if ($count==$min) $style="font-size:xx-small;"; else if ($count==$max) $style="font-size:xx-large;"; @@ -31,40 +39,50 @@ else if ($count>($min+$distribution)) $style="font-size:medium;"; else $style="font-size:small;"; - $tag_with_entities=htmlentities("\"".$tag."\""); - $ret.='<a style="'.$style.'" href="#" onclick="xajax_getSubjectsFromConcept(\''.$tag_with_entities.'\');">'.$label[$tag].'</a>'; + //$tag_with_entities=htmlentities("\"".$tag."\""); + $ret.='<a style="'.$style.'" href="#" onclick="document.getElementById(\'hidden_class\').value=\''.$tag.'\';show_results(\''.$tag.'\',document.getElementById(\'hidden_number\').value);">'.$label[$tag].'</a> '; } - $ret.="</p>"; + $ret.="</p><br/>"; return $ret; } -function getResultsTable($names,$labels) +function getResultsTable($names,$labels,$classes,$number) { - $ret="<p>Your search brought ".count($names)." results.</p><br/>"; + $ret="<p>These are your Searchresults. Show best "; + for ($k=10;$k<125;){ + $ret.="<a href=\"#\" onclick=\"var list=tree.getAllChecked();search_it('label='+document.getElementById('label').value+'&list='+list+'&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"; - while($i*30<count($names)) + $ret.="<div id=\"results\">"; + while($i*25<count($names)) { - $ret.="<div id='results".$i."' style='display:".$display."'>Seite ".($i+1)."<br/><br/>"; - for ($j=0;($j<30)&&(($i*30+$j)<count($names));$j++) + for ($j=0;($j<25)&&(($i*25+$j)<count($names));$j++) { - $name=$names[$i*30+$j]; - $label=$labels[$i*30+$j]; - $ret.=' <a href="" onclick="get_article(\'label='.$name.'&cache=-1\');return false;">'.$label.'</a><br/>'; + $name=$names[$i*25+$j]; + $label=$labels[$i*25+$j]; + $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.="</div>"; $i++; $display="none"; } - $ret.="<br/><p style='width:100%;text-align:center;'>"; + $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.="<a href=\"\" onClick=\"showdiv('results".($k)."');"; - for ($l=0;$l<$i;$l++) - { - if ($l!=$k) $ret.="hidediv('results".$l."');"; - } - $ret.="return false;\">".($k+1)."</a>"; - if ($k!=($i-1)) $ret.=" | "; + $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; Modified: trunk/src/dbpedia-navigator/index-new.php =================================================================== --- trunk/src/dbpedia-navigator/index-new.php 2008-08-15 11:43:53 UTC (rev 1082) +++ trunk/src/dbpedia-navigator/index-new.php 2008-08-15 12:03:42 UTC (rev 1083) @@ -75,7 +75,7 @@ } } - function get_article(param) + function search_it(param) { if (document.all){ //IE @@ -86,7 +86,7 @@ var XhrObj = new XMLHttpRequest(); } - XhrObj.open("POST",'ajax_get_article.php'); + XhrObj.open("POST",'ajax_search.php'); XhrObj.onreadystatechange = function() { @@ -94,9 +94,6 @@ var response = XhrObj.responseText.split('$$'); document.getElementById('articlecontent').innerHTML=response[0]; document.getElementById('ArticleTitle').innerHTML=response[1]; - document.getElementById('lastarticles').innerHTML=response[2]; - document.getElementById('Positives').innerHTML=response[3]; - document.getElementById('Negatives').innerHTML=response[4]; } } @@ -104,7 +101,7 @@ XhrObj.send(param); } - function search(param) + function get_article(param) { if (document.all){ //IE @@ -115,7 +112,7 @@ var XhrObj = new XMLHttpRequest(); } - XhrObj.open("POST",'ajax_search.php'); + XhrObj.open("POST",'ajax_get_article.php'); XhrObj.onreadystatechange = function() { @@ -123,12 +120,43 @@ var response = XhrObj.responseText.split('$$'); document.getElementById('articlecontent').innerHTML=response[0]; document.getElementById('ArticleTitle').innerHTML=response[1]; + document.getElementById('lastarticles').innerHTML=response[2]; + document.getElementById('Positives').innerHTML=response[3]; + document.getElementById('Negatives').innerHTML=response[4]; } } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); XhrObj.send(param); } + + function show_results(class, number) + { + var links=document.getElementById('results').getElementsByTagName('p'); + var j=0; + for (var i=0;i<links.length;i++){ + if (links[i].getElementsByTagName('a')[0].className==class||class=='all'){ + if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; + else links[i].style.display='none'; + j++; + } + else links[i].style.display='none'; + } + if (j<number){ + show_results(class,0); + return; + } + + var sitenumbers=document.getElementById('sitenumbers').getElementsByTagName('span'); + for (var i=0;i<sitenumbers.length;i++){ + if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25==number) sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='none'; + else sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='underline'; + if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25>=j) + sitenumbers[i].style.display='none'; + else + sitenumbers[i].style.display='inline'; + } + } </script> </head> <body> @@ -148,7 +176,7 @@ <!-- Search:<br/> --> <form onSubmit="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;"> <input type="text" name="label" id="label" /><br/> - <input type="button" value="Article" class="button" onclick="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;" /> <input type="button" value="Search" class="button" onclick="var list=tree.getAllChecked();search('label='+document.getElementById('label').value+'&list='+list);return false;" /> + <input type="button" value="Article" class="button" onclick="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;" /> <input type="button" value="Search" class="button" onclick="var list=tree.getAllChecked();search_it('label='+document.getElementById('label').value+'&list='+list+'&number=10');return false;" /> <!-- <input type="button" value="Fulltext" class="button" onclick=""/> --> </form> </div> <!-- boxcontent --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-08-15 11:43:55
|
Revision: 1082 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1082&view=rev Author: sknappe Date: 2008-08-15 11:43:53 +0000 (Fri, 15 Aug 2008) Log Message: ----------- moved CalculatePageRank to dbpedia-navigator Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/test/CalculatePageRank.java Deleted: trunk/src/dl-learner/org/dllearner/test/CalculatePageRank.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/CalculatePageRank.java 2008-08-15 10:49:45 UTC (rev 1081) +++ trunk/src/dl-learner/org/dllearner/test/CalculatePageRank.java 2008-08-15 11:43:53 UTC (rev 1082) @@ -1,127 +0,0 @@ -package org.dllearner.test; - -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 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(); - } - } - - public static void main(String[] args){ - CalculatePageRank cal=new CalculatePageRank(); - //cal.calculateLinks(); - cal.addLabels(); - } -} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-08-15 10:49:49
|
Revision: 1081 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1081&view=rev Author: jenslehmann Date: 2008-08-15 10:49:45 +0000 (Fri, 15 Aug 2008) Log Message: ----------- fixed #1896252 Modified Paths: -------------- trunk/build.xml Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2008-08-15 10:30:38 UTC (rev 1080) +++ trunk/build.xml 2008-08-15 10:49:45 UTC (rev 1081) @@ -110,7 +110,12 @@ <javac destdir="classes_tmp" target="1.5"> <src path="${source_dir}"/> <classpath refid="classpath"/> - </javac> + </javac> + <!-- we also need to copy some images, which should be + included in dllearner.jar --> + <copy toDir="classes_tmp" > + <fileset dir="${source_dir}" includes="**/*.gif"/> + </copy> <mkdir dir="${release_tmp_dir}"/> <mkdir dir="${release_tmp_dir}/lib/"/> <jar jarfile="${release_tmp_dir}/lib/dllearner.jar"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-08-15 10:30:44
|
Revision: 1080 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1080&view=rev Author: jenslehmann Date: 2008-08-15 10:30:38 +0000 (Fri, 15 Aug 2008) Log Message: ----------- - extended build.xml to create startup files for DL-Learner GUI - extended GUI to take a conf file as parameter (which is then loaded) Modified Paths: -------------- trunk/bin/dllearner trunk/bin/dllearner.bat trunk/bin/quickstart trunk/bin/quickstart.bat trunk/bin/ws trunk/bin/ws.bat trunk/build.xml trunk/src/dl-learner/org/dllearner/Info.java trunk/src/dl-learner/org/dllearner/gui/StartGUI.java trunk/src/dl-learner/org/dllearner/test/junit/ELDownTests.java Added Paths: ----------- trunk/bin/gui trunk/bin/gui.bat Modified: trunk/bin/dllearner =================================================================== --- trunk/bin/dllearner 2008-08-15 07:56:49 UTC (rev 1079) +++ trunk/bin/dllearner 2008-08-15 10:30:38 UTC (rev 1080) @@ -1 +1 @@ -java -cp .:./lib/dig1.1-xmlbeans.jar:./lib/fact/FaCT++OWLAPI-v1.1.10+.jar:./lib/jena/antlr-2.7.5.jar:./lib/jena/arq.jar:./lib/jena/commons-logging-1.1.jar:./lib/jena/concurrent.jar:./lib/jena/icu4j_3_4.jar:./lib/jena/iri.jar:./lib/jena/jena.jar:./lib/jena/json.jar:./lib/jena/xercesImpl.jar:./lib/junit-4.4.jar:./lib/log4j.jar:./lib/owlapi/antlr-runtime-3.0.jar:./lib/owlapi/commons-lang-2.2.jar:./lib/owlapi/owlapi-api.jar:./lib/owlapi/owlapi-apibinding.jar:./lib/owlapi/owlapi-change.jar:./lib/owlapi/owlapi-debugging.jar:./lib/owlapi/owlapi-dig1_1.jar:./lib/owlapi/owlapi-functionalparser.jar:./lib/owlapi/owlapi-functionalrenderer.jar:./lib/owlapi/owlapi-impl.jar:./lib/owlapi/owlapi-krssparser.jar:./lib/owlapi/owlapi-mansyntaxparser.jar:./lib/owlapi/owlapi-mansyntaxrenderer.jar:./lib/owlapi/owlapi-metrics.jar:./lib/owlapi/owlapi-oboparser.jar:./lib/owlapi/owlapi-owlxmlparser.jar:./lib/owlapi/owlapi-owlxmlrenderer.jar:./lib/owlapi/owlapi-rdfapi.jar:./lib/owlapi/owlapi-rdfxmlparser.jar:./lib/owlapi/owlapi-rdfxmlrenderer.jar:./lib/owlapi/owlapi-util.jar:./lib/pellet/aterm-java-1.6.jar:./lib/pellet/pellet.jar:./lib/pellet/relaxngDatatype.jar:./lib/pellet/xsdlib.jar:./lib/xbean.jar:./lib/dllearner.jar org.dllearner.cli.Start $@ \ No newline at end of file +java -cp .:./lib/dig1.1-xmlbeans.jar:./lib/fact/FaCTpp-OWLAPI-v1.1.11.jar:./lib/jamon-2.7.jar:./lib/jena/antlr-2.7.5.jar:./lib/jena/arq.jar:./lib/jena/commons-logging-1.1.1.jar:./lib/jena/concurrent.jar:./lib/jena/icu4j_3_4.jar:./lib/jena/iri.jar:./lib/jena/jena.jar:./lib/jena/json.jar:./lib/jena/xercesImpl.jar:./lib/junit-4.4.jar:./lib/log4j.jar:./lib/ore-tool/swingx-0.9.2.jar:./lib/owlapi/owlapi-bin.jar:./lib/pellet/aterm-java-1.6.jar:./lib/pellet/pellet.jar:./lib/pellet/relaxngDatatype.jar:./lib/pellet/xsdlib.jar:./lib/protege/org.protege.editor.core.application.jar:./lib/protege/org.protege.editor.owl.jar:./lib/xbean.jar:./lib/dllearner.jar org.dllearner.cli.Start $@ \ No newline at end of file Modified: trunk/bin/dllearner.bat =================================================================== --- trunk/bin/dllearner.bat 2008-08-15 07:56:49 UTC (rev 1079) +++ trunk/bin/dllearner.bat 2008-08-15 10:30:38 UTC (rev 1080) @@ -1 +1 @@ -java -cp .;.\lib\dig1.1-xmlbeans.jar;.\lib\fact\FaCT++OWLAPI-v1.1.10+.jar;.\lib\jena\antlr-2.7.5.jar;.\lib\jena\arq.jar;.\lib\jena\commons-logging-1.1.jar;.\lib\jena\concurrent.jar;.\lib\jena\icu4j_3_4.jar;.\lib\jena\iri.jar;.\lib\jena\jena.jar;.\lib\jena\json.jar;.\lib\jena\xercesImpl.jar;.\lib\junit-4.4.jar;.\lib\log4j.jar;.\lib\owlapi\antlr-runtime-3.0.jar;.\lib\owlapi\commons-lang-2.2.jar;.\lib\owlapi\owlapi-api.jar;.\lib\owlapi\owlapi-apibinding.jar;.\lib\owlapi\owlapi-change.jar;.\lib\owlapi\owlapi-debugging.jar;.\lib\owlapi\owlapi-dig1_1.jar;.\lib\owlapi\owlapi-functionalparser.jar;.\lib\owlapi\owlapi-functionalrenderer.jar;.\lib\owlapi\owlapi-impl.jar;.\lib\owlapi\owlapi-krssparser.jar;.\lib\owlapi\owlapi-mansyntaxparser.jar;.\lib\owlapi\owlapi-mansyntaxrenderer.jar;.\lib\owlapi\owlapi-metrics.jar;.\lib\owlapi\owlapi-oboparser.jar;.\lib\owlapi\owlapi-owlxmlparser.jar;.\lib\owlapi\owlapi-owlxmlrenderer.jar;.\lib\owlapi\owlapi-rdfapi.jar;.\lib\owlapi\owlapi-rdfxmlparser.jar;.\lib\owlapi\owlapi-rdfxmlrenderer.jar;.\lib\owlapi\owlapi-util.jar;.\lib\pellet\aterm-java-1.6.jar;.\lib\pellet\pellet.jar;.\lib\pellet\relaxngDatatype.jar;.\lib\pellet\xsdlib.jar;.\lib\xbean.jar;.\lib\dllearner.jar org.dllearner.cli.Start %* \ No newline at end of file +java -Xmx1024m -cp .;.\lib\dig1.1-xmlbeans.jar;.\lib\fact\FaCTpp-OWLAPI-v1.1.11.jar;.\lib\jamon-2.7.jar;.\lib\jena\antlr-2.7.5.jar;.\lib\jena\arq.jar;.\lib\jena\commons-logging-1.1.1.jar;.\lib\jena\concurrent.jar;.\lib\jena\icu4j_3_4.jar;.\lib\jena\iri.jar;.\lib\jena\jena.jar;.\lib\jena\json.jar;.\lib\jena\xercesImpl.jar;.\lib\junit-4.4.jar;.\lib\log4j.jar;.\lib\ore-tool\swingx-0.9.2.jar;.\lib\owlapi\owlapi-bin.jar;.\lib\pellet\aterm-java-1.6.jar;.\lib\pellet\pellet.jar;.\lib\pellet\relaxngDatatype.jar;.\lib\pellet\xsdlib.jar;.\lib\protege\org.protege.editor.core.application.jar;.\lib\protege\org.protege.editor.owl.jar;.\lib\xbean.jar;.\lib\dllearner.jar org.dllearner.cli.Start %* \ No newline at end of file Added: trunk/bin/gui =================================================================== --- trunk/bin/gui (rev 0) +++ trunk/bin/gui 2008-08-15 10:30:38 UTC (rev 1080) @@ -0,0 +1 @@ +java -cp .:./lib/dig1.1-xmlbeans.jar:./lib/fact/FaCTpp-OWLAPI-v1.1.11.jar:./lib/jamon-2.7.jar:./lib/jena/antlr-2.7.5.jar:./lib/jena/arq.jar:./lib/jena/commons-logging-1.1.1.jar:./lib/jena/concurrent.jar:./lib/jena/icu4j_3_4.jar:./lib/jena/iri.jar:./lib/jena/jena.jar:./lib/jena/json.jar:./lib/jena/xercesImpl.jar:./lib/junit-4.4.jar:./lib/log4j.jar:./lib/ore-tool/swingx-0.9.2.jar:./lib/owlapi/owlapi-bin.jar:./lib/pellet/aterm-java-1.6.jar:./lib/pellet/pellet.jar:./lib/pellet/relaxngDatatype.jar:./lib/pellet/xsdlib.jar:./lib/protege/org.protege.editor.core.application.jar:./lib/protege/org.protege.editor.owl.jar:./lib/xbean.jar:./lib/dllearner.jar org.dllearner.gui.StartGUI $@ \ No newline at end of file Added: trunk/bin/gui.bat =================================================================== --- trunk/bin/gui.bat (rev 0) +++ trunk/bin/gui.bat 2008-08-15 10:30:38 UTC (rev 1080) @@ -0,0 +1 @@ +java -cp .;.\lib\dig1.1-xmlbeans.jar;.\lib\fact\FaCTpp-OWLAPI-v1.1.11.jar;.\lib\jamon-2.7.jar;.\lib\jena\antlr-2.7.5.jar;.\lib\jena\arq.jar;.\lib\jena\commons-logging-1.1.1.jar;.\lib\jena\concurrent.jar;.\lib\jena\icu4j_3_4.jar;.\lib\jena\iri.jar;.\lib\jena\jena.jar;.\lib\jena\json.jar;.\lib\jena\xercesImpl.jar;.\lib\junit-4.4.jar;.\lib\log4j.jar;.\lib\ore-tool\swingx-0.9.2.jar;.\lib\owlapi\owlapi-bin.jar;.\lib\pellet\aterm-java-1.6.jar;.\lib\pellet\pellet.jar;.\lib\pellet\relaxngDatatype.jar;.\lib\pellet\xsdlib.jar;.\lib\protege\org.protege.editor.core.application.jar;.\lib\protege\org.protege.editor.owl.jar;.\lib\xbean.jar;.\lib\dllearner.jar org.dllearner.gui.StartGUI %* \ No newline at end of file Modified: trunk/bin/quickstart =================================================================== --- trunk/bin/quickstart 2008-08-15 07:56:49 UTC (rev 1079) +++ trunk/bin/quickstart 2008-08-15 10:30:38 UTC (rev 1080) @@ -1 +1 @@ -java -cp .:./lib/dig1.1-xmlbeans.jar:./lib/fact/FaCT++OWLAPI-v1.1.10+.jar:./lib/jena/antlr-2.7.5.jar:./lib/jena/arq.jar:./lib/jena/commons-logging-1.1.jar:./lib/jena/concurrent.jar:./lib/jena/icu4j_3_4.jar:./lib/jena/iri.jar:./lib/jena/jena.jar:./lib/jena/json.jar:./lib/jena/xercesImpl.jar:./lib/junit-4.4.jar:./lib/log4j.jar:./lib/owlapi/antlr-runtime-3.0.jar:./lib/owlapi/commons-lang-2.2.jar:./lib/owlapi/owlapi-api.jar:./lib/owlapi/owlapi-apibinding.jar:./lib/owlapi/owlapi-change.jar:./lib/owlapi/owlapi-debugging.jar:./lib/owlapi/owlapi-dig1_1.jar:./lib/owlapi/owlapi-functionalparser.jar:./lib/owlapi/owlapi-functionalrenderer.jar:./lib/owlapi/owlapi-impl.jar:./lib/owlapi/owlapi-krssparser.jar:./lib/owlapi/owlapi-mansyntaxparser.jar:./lib/owlapi/owlapi-mansyntaxrenderer.jar:./lib/owlapi/owlapi-metrics.jar:./lib/owlapi/owlapi-oboparser.jar:./lib/owlapi/owlapi-owlxmlparser.jar:./lib/owlapi/owlapi-owlxmlrenderer.jar:./lib/owlapi/owlapi-rdfapi.jar:./lib/owlapi/owlapi-rdfxmlparser.jar:./lib/owlapi/owlapi-rdfxmlrenderer.jar:./lib/owlapi/owlapi-util.jar:./lib/pellet/aterm-java-1.6.jar:./lib/pellet/pellet.jar:./lib/pellet/relaxngDatatype.jar:./lib/pellet/xsdlib.jar:./lib/xbean.jar:./lib/dllearner.jar org.dllearner.cli.QuickStart \ No newline at end of file +java -cp .:./lib/dig1.1-xmlbeans.jar:./lib/fact/FaCTpp-OWLAPI-v1.1.11.jar:./lib/jamon-2.7.jar:./lib/jena/antlr-2.7.5.jar:./lib/jena/arq.jar:./lib/jena/commons-logging-1.1.1.jar:./lib/jena/concurrent.jar:./lib/jena/icu4j_3_4.jar:./lib/jena/iri.jar:./lib/jena/jena.jar:./lib/jena/json.jar:./lib/jena/xercesImpl.jar:./lib/junit-4.4.jar:./lib/log4j.jar:./lib/ore-tool/swingx-0.9.2.jar:./lib/owlapi/owlapi-bin.jar:./lib/pellet/aterm-java-1.6.jar:./lib/pellet/pellet.jar:./lib/pellet/relaxngDatatype.jar:./lib/pellet/xsdlib.jar:./lib/protege/org.protege.editor.core.application.jar:./lib/protege/org.protege.editor.owl.jar:./lib/xbean.jar:./lib/dllearner.jar org.dllearner.cli.QuickStart \ No newline at end of file Modified: trunk/bin/quickstart.bat =================================================================== --- trunk/bin/quickstart.bat 2008-08-15 07:56:49 UTC (rev 1079) +++ trunk/bin/quickstart.bat 2008-08-15 10:30:38 UTC (rev 1080) @@ -1 +1 @@ -java -Xmx1024m -cp .;.\lib\dig1.1-xmlbeans.jar;.\lib\fact\FaCT++OWLAPI-v1.1.10+.jar;.\lib\jena\antlr-2.7.5.jar;.\lib\jena\arq.jar;.\lib\jena\commons-logging-1.1.jar;.\lib\jena\concurrent.jar;.\lib\jena\icu4j_3_4.jar;.\lib\jena\iri.jar;.\lib\jena\jena.jar;.\lib\jena\json.jar;.\lib\jena\xercesImpl.jar;.\lib\junit-4.4.jar;.\lib\log4j.jar;.\lib\owlapi\antlr-runtime-3.0.jar;.\lib\owlapi\commons-lang-2.2.jar;.\lib\owlapi\owlapi-api.jar;.\lib\owlapi\owlapi-apibinding.jar;.\lib\owlapi\owlapi-change.jar;.\lib\owlapi\owlapi-debugging.jar;.\lib\owlapi\owlapi-dig1_1.jar;.\lib\owlapi\owlapi-functionalparser.jar;.\lib\owlapi\owlapi-functionalrenderer.jar;.\lib\owlapi\owlapi-impl.jar;.\lib\owlapi\owlapi-krssparser.jar;.\lib\owlapi\owlapi-mansyntaxparser.jar;.\lib\owlapi\owlapi-mansyntaxrenderer.jar;.\lib\owlapi\owlapi-metrics.jar;.\lib\owlapi\owlapi-oboparser.jar;.\lib\owlapi\owlapi-owlxmlparser.jar;.\lib\owlapi\owlapi-owlxmlrenderer.jar;.\lib\owlapi\owlapi-rdfapi.jar;.\lib\owlapi\owlapi-rdfxmlparser.jar;.\lib\owlapi\owlapi-rdfxmlrenderer.jar;.\lib\owlapi\owlapi-util.jar;.\lib\pellet\aterm-java-1.6.jar;.\lib\pellet\pellet.jar;.\lib\pellet\relaxngDatatype.jar;.\lib\pellet\xsdlib.jar;.\lib\xbean.jar;.\lib\dllearner.jar org.dllearner.cli.QuickStart \ No newline at end of file +java -Xmx1024m -cp .;.\lib\dig1.1-xmlbeans.jar;.\lib\fact\FaCTpp-OWLAPI-v1.1.11.jar;.\lib\jamon-2.7.jar;.\lib\jena\antlr-2.7.5.jar;.\lib\jena\arq.jar;.\lib\jena\commons-logging-1.1.1.jar;.\lib\jena\concurrent.jar;.\lib\jena\icu4j_3_4.jar;.\lib\jena\iri.jar;.\lib\jena\jena.jar;.\lib\jena\json.jar;.\lib\jena\xercesImpl.jar;.\lib\junit-4.4.jar;.\lib\log4j.jar;.\lib\ore-tool\swingx-0.9.2.jar;.\lib\owlapi\owlapi-bin.jar;.\lib\pellet\aterm-java-1.6.jar;.\lib\pellet\pellet.jar;.\lib\pellet\relaxngDatatype.jar;.\lib\pellet\xsdlib.jar;.\lib\protege\org.protege.editor.core.application.jar;.\lib\protege\org.protege.editor.owl.jar;.\lib\xbean.jar;.\lib\dllearner.jar org.dllearner.cli.QuickStart \ No newline at end of file Modified: trunk/bin/ws =================================================================== --- trunk/bin/ws 2008-08-15 07:56:49 UTC (rev 1079) +++ trunk/bin/ws 2008-08-15 10:30:38 UTC (rev 1080) @@ -1 +1 @@ -java -cp .:./lib/dig1.1-xmlbeans.jar:./lib/fact/FaCT++OWLAPI-v1.1.10+.jar:./lib/jena/antlr-2.7.5.jar:./lib/jena/arq.jar:./lib/jena/commons-logging-1.1.jar:./lib/jena/concurrent.jar:./lib/jena/icu4j_3_4.jar:./lib/jena/iri.jar:./lib/jena/jena.jar:./lib/jena/json.jar:./lib/jena/xercesImpl.jar:./lib/junit-4.4.jar:./lib/log4j.jar:./lib/owlapi/antlr-runtime-3.0.jar:./lib/owlapi/commons-lang-2.2.jar:./lib/owlapi/owlapi-api.jar:./lib/owlapi/owlapi-apibinding.jar:./lib/owlapi/owlapi-change.jar:./lib/owlapi/owlapi-debugging.jar:./lib/owlapi/owlapi-dig1_1.jar:./lib/owlapi/owlapi-functionalparser.jar:./lib/owlapi/owlapi-functionalrenderer.jar:./lib/owlapi/owlapi-impl.jar:./lib/owlapi/owlapi-krssparser.jar:./lib/owlapi/owlapi-mansyntaxparser.jar:./lib/owlapi/owlapi-mansyntaxrenderer.jar:./lib/owlapi/owlapi-metrics.jar:./lib/owlapi/owlapi-oboparser.jar:./lib/owlapi/owlapi-owlxmlparser.jar:./lib/owlapi/owlapi-owlxmlrenderer.jar:./lib/owlapi/owlapi-rdfapi.jar:./lib/owlapi/owlapi-rdfxmlparser.jar:./lib/owlapi/owlapi-rdfxmlrenderer.jar:./lib/owlapi/owlapi-util.jar:./lib/pellet/aterm-java-1.6.jar:./lib/pellet/pellet.jar:./lib/pellet/relaxngDatatype.jar:./lib/pellet/xsdlib.jar:./lib/xbean.jar:./lib/dllearner.jar org.dllearner.server.DLLearnerWSStart $@ \ No newline at end of file +java -cp .:./lib/dig1.1-xmlbeans.jar:./lib/fact/FaCTpp-OWLAPI-v1.1.11.jar:./lib/jamon-2.7.jar:./lib/jena/antlr-2.7.5.jar:./lib/jena/arq.jar:./lib/jena/commons-logging-1.1.1.jar:./lib/jena/concurrent.jar:./lib/jena/icu4j_3_4.jar:./lib/jena/iri.jar:./lib/jena/jena.jar:./lib/jena/json.jar:./lib/jena/xercesImpl.jar:./lib/junit-4.4.jar:./lib/log4j.jar:./lib/ore-tool/swingx-0.9.2.jar:./lib/owlapi/owlapi-bin.jar:./lib/pellet/aterm-java-1.6.jar:./lib/pellet/pellet.jar:./lib/pellet/relaxngDatatype.jar:./lib/pellet/xsdlib.jar:./lib/protege/org.protege.editor.core.application.jar:./lib/protege/org.protege.editor.owl.jar:./lib/xbean.jar:./lib/dllearner.jar org.dllearner.server.DLLearnerWSStart $@ \ No newline at end of file Modified: trunk/bin/ws.bat =================================================================== --- trunk/bin/ws.bat 2008-08-15 07:56:49 UTC (rev 1079) +++ trunk/bin/ws.bat 2008-08-15 10:30:38 UTC (rev 1080) @@ -1 +1 @@ -java -cp .;.\lib\dig1.1-xmlbeans.jar;.\lib\fact\FaCT++OWLAPI-v1.1.10+.jar;.\lib\jena\antlr-2.7.5.jar;.\lib\jena\arq.jar;.\lib\jena\commons-logging-1.1.jar;.\lib\jena\concurrent.jar;.\lib\jena\icu4j_3_4.jar;.\lib\jena\iri.jar;.\lib\jena\jena.jar;.\lib\jena\json.jar;.\lib\jena\xercesImpl.jar;.\lib\junit-4.4.jar;.\lib\log4j.jar;.\lib\owlapi\antlr-runtime-3.0.jar;.\lib\owlapi\commons-lang-2.2.jar;.\lib\owlapi\owlapi-api.jar;.\lib\owlapi\owlapi-apibinding.jar;.\lib\owlapi\owlapi-change.jar;.\lib\owlapi\owlapi-debugging.jar;.\lib\owlapi\owlapi-dig1_1.jar;.\lib\owlapi\owlapi-functionalparser.jar;.\lib\owlapi\owlapi-functionalrenderer.jar;.\lib\owlapi\owlapi-impl.jar;.\lib\owlapi\owlapi-krssparser.jar;.\lib\owlapi\owlapi-mansyntaxparser.jar;.\lib\owlapi\owlapi-mansyntaxrenderer.jar;.\lib\owlapi\owlapi-metrics.jar;.\lib\owlapi\owlapi-oboparser.jar;.\lib\owlapi\owlapi-owlxmlparser.jar;.\lib\owlapi\owlapi-owlxmlrenderer.jar;.\lib\owlapi\owlapi-rdfapi.jar;.\lib\owlapi\owlapi-rdfxmlparser.jar;.\lib\owlapi\owlapi-rdfxmlrenderer.jar;.\lib\owlapi\owlapi-util.jar;.\lib\pellet\aterm-java-1.6.jar;.\lib\pellet\pellet.jar;.\lib\pellet\relaxngDatatype.jar;.\lib\pellet\xsdlib.jar;.\lib\xbean.jar;.\lib\dllearner.jar org.dllearner.server.DLLearnerWSStart %* \ No newline at end of file +java -cp .;.\lib\dig1.1-xmlbeans.jar;.\lib\fact\FaCTpp-OWLAPI-v1.1.11.jar;.\lib\jamon-2.7.jar;.\lib\jena\antlr-2.7.5.jar;.\lib\jena\arq.jar;.\lib\jena\commons-logging-1.1.1.jar;.\lib\jena\concurrent.jar;.\lib\jena\icu4j_3_4.jar;.\lib\jena\iri.jar;.\lib\jena\jena.jar;.\lib\jena\json.jar;.\lib\jena\xercesImpl.jar;.\lib\junit-4.4.jar;.\lib\log4j.jar;.\lib\ore-tool\swingx-0.9.2.jar;.\lib\owlapi\owlapi-bin.jar;.\lib\pellet\aterm-java-1.6.jar;.\lib\pellet\pellet.jar;.\lib\pellet\relaxngDatatype.jar;.\lib\pellet\xsdlib.jar;.\lib\protege\org.protege.editor.core.application.jar;.\lib\protege\org.protege.editor.owl.jar;.\lib\xbean.jar;.\lib\dllearner.jar org.dllearner.server.DLLearnerWSStart %* \ No newline at end of file Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2008-08-15 07:56:49 UTC (rev 1079) +++ trunk/build.xml 2008-08-15 10:30:38 UTC (rev 1080) @@ -152,11 +152,13 @@ <include name="${version_dir}/dllearner" /> <include name="${version_dir}/quickstart" /> <include name="${version_dir}/ws" /> + <include name="${version_dir}/gui" /> </tarfileset> <tarfileset dir="release/"> <exclude name="${version_dir}/dllearner"/> <exclude name="${version_dir}/quickstart" /> <exclude name="${version_dir}/ws" /> + <exclude name="${version_dir}/gui" /> </tarfileset> </tar> @@ -251,9 +253,11 @@ <echo file="bin/quickstart.bat" message="java -Xmx1024m -cp ${pathStringWin} org.dllearner.cli.QuickStart"/> <echo file="bin/dllearner.bat" message="java -Xmx1024m -cp ${pathStringWin} org.dllearner.cli.Start %*"/> <echo file="bin/ws.bat" message="java -cp ${pathStringWin} org.dllearner.server.DLLearnerWSStart %*"/> + <echo file="bin/gui.bat" message="java -cp ${pathStringWin} org.dllearner.gui.StartGUI %*"/> <echo file="bin/quickstart" message="java -cp ${pathStringUnix} org.dllearner.cli.QuickStart"/> <echo file="bin/dllearner" message="java -cp ${pathStringUnix} org.dllearner.cli.Start $@"/> <echo file="bin/ws" message="java -cp ${pathStringUnix} org.dllearner.server.DLLearnerWSStart $@"/> + <echo file="bin/gui" message="java -cp ${pathStringUnix} org.dllearner.gui.StartGUI $@"/> </target> <!-- generate Javadoc --> Modified: trunk/src/dl-learner/org/dllearner/Info.java =================================================================== --- trunk/src/dl-learner/org/dllearner/Info.java 2008-08-15 07:56:49 UTC (rev 1079) +++ trunk/src/dl-learner/org/dllearner/Info.java 2008-08-15 10:30:38 UTC (rev 1080) @@ -3,6 +3,6 @@ package org.dllearner; public class Info { - public static final String build = "2008-08-01"; + public static final String build = "2008-08-15"; } \ No newline at end of file Modified: trunk/src/dl-learner/org/dllearner/gui/StartGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-08-15 07:56:49 UTC (rev 1079) +++ trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-08-15 10:30:38 UTC (rev 1080) @@ -64,6 +64,10 @@ private JMenuItem saveItem = new JMenuItem("Save As Config"); public StartGUI() { + this(null); + } + + public StartGUI(File file) { this.setTitle("DL-Learner"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLocationByPlatform(true); @@ -103,6 +107,11 @@ init(); } }); + + if(file != null) { + configLoad.openFile(file); + configLoad.startParser(); + } } public void init() { @@ -122,7 +131,11 @@ logger.addAppender(consoleAppender); logger.setLevel(Level.INFO); - new StartGUI(); + File file = null; + if(args.length > 0) + file = new File(args[args.length - 1]); + + new StartGUI(file); } public void actionPerformed(ActionEvent e) { Modified: trunk/src/dl-learner/org/dllearner/test/junit/ELDownTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/ELDownTests.java 2008-08-15 07:56:49 UTC (rev 1079) +++ trunk/src/dl-learner/org/dllearner/test/junit/ELDownTests.java 2008-08-15 10:30:38 UTC (rev 1080) @@ -116,10 +116,10 @@ // number of refinements has to be correct and each produced // refinement must be in the set of desired refinements -// assertTrue(refinements.size() == desired.size()); + assertTrue(refinements.size() == desired.size()); for(Description refinement : refinements) { System.out.println(refinement); -// assertTrue(desired.contains(refinement)); + assertTrue(desired.contains(refinement)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-08-15 07:56:51
|
Revision: 1079 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1079&view=rev Author: jenslehmann Date: 2008-08-15 07:56:49 +0000 (Fri, 15 Aug 2008) Log Message: ----------- improved tree <-> concept converters in both directions Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown.java trunk/src/dl-learner/org/dllearner/test/junit/ELDownTests.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-08-14 19:12:46 UTC (rev 1078) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-08-15 07:56:49 UTC (rev 1079) @@ -165,7 +165,7 @@ /** * This method transform the tree to an EL description. The * node labels are transformed to an {@link Intersection} - * of {@link NamedClass}. Each edges is transformed to an + * of {@link NamedClass}. Each edge is transformed to an * {@link ObjectSomeRestriction}, where the property is the edge * label and the child description the subtree the edge points * to. Edges are also added to the intersection. If the intersection @@ -173,8 +173,21 @@ * @return The description corresponding to this EL description tree. */ public Description transformToDescription() { - if(label.size()==0 && edges.size()==0) { + int nrOfElements = label.size() + edges.size(); + // leaf labeled with \emptyset stands for owl:Thing + if(nrOfElements == 0) { return new Thing(); + // we want to avoid intersections with only 1 element, so in this + // case we return either the NamedClass or ObjectSomeRestriction directly + } else if(nrOfElements == 1) { + if(label.size()==1) { + return label.first(); + } else { + ELDescriptionEdge edge = edges.get(0); + Description child = edge.getTree().transformToDescription(); + return new ObjectSomeRestriction(edge.getLabel(),child); + } + // return an intersection of labels and edges } else { Intersection is = new Intersection(); for(NamedClass nc : label) { Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-08-14 19:12:46 UTC (rev 1078) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-08-15 07:56:49 UTC (rev 1079) @@ -34,73 +34,77 @@ import org.dllearner.core.owl.UnsupportedLanguageException; /** - * Represents an EL description tree. Unlike {@link ELDescriptionNode}, - * this is a tree-wide structure, i.e. it does not implement the tree - * structure itself, but is used to store information about the tree. + * Represents an EL description tree. Unlike {@link ELDescriptionNode}, this is + * a tree-wide structure, i.e. it does not implement the tree structure itself, + * but is used to store information about the tree. * * @author Jens Lehmann - * + * */ public class ELDescriptionTree implements Cloneable { // to simplify equivalence checks and minimisation, we // attach a simulation relation to the description tree -// private Simulation simulation; - + // private Simulation simulation; + private int maxLevel = 1; - - protected ELDescriptionNode rootNode; - - private Map<Integer,Set<ELDescriptionNode>> levelNodeMapping = new HashMap<Integer,Set<ELDescriptionNode>>(); - + + protected ELDescriptionNode rootNode; + + private Map<Integer, Set<ELDescriptionNode>> levelNodeMapping = new HashMap<Integer, Set<ELDescriptionNode>>(); + public ELDescriptionTree() { - + } - + /** - * Constructs an EL description tree from an EL description. - * @param description A description + * Constructs an EL description tree from an EL description. + * + * @param description + * A description */ public ELDescriptionTree(Description description) { // construct root node and recursively build the tree rootNode = new ELDescriptionNode(this); constructTree(description, rootNode); - } + } private void constructTree(Description description, ELDescriptionNode node) { - if(description instanceof NamedClass) { - node.extendLabel((NamedClass)description); - } else if(description instanceof ObjectSomeRestriction) { - ObjectProperty op = (ObjectProperty) ((ObjectSomeRestriction)description).getRole(); + if (description instanceof NamedClass) { + node.extendLabel((NamedClass) description); + } else if (description instanceof ObjectSomeRestriction) { + ObjectProperty op = (ObjectProperty) ((ObjectSomeRestriction) description).getRole(); ELDescriptionNode newNode = new ELDescriptionNode(node, op, new TreeSet<NamedClass>()); constructTree(description.getChild(0), newNode); - } else if(description instanceof Thing) { + } else if (description instanceof Thing) { // nothing needs to be done as an empty set is owl:Thing - } else if(description instanceof Intersection) { + } else if (description instanceof Intersection) { // loop through all elements of the intersection - for(Description child : description.getChildren()) { - if(child instanceof NamedClass) { - node.extendLabel((NamedClass)child); - } else if(child instanceof ObjectSomeRestriction) { - ObjectProperty op = (ObjectProperty) ((ObjectSomeRestriction)child).getRole(); - ELDescriptionNode newNode = new ELDescriptionNode(node, op, new TreeSet<NamedClass>()); - constructTree(child, newNode); + for (Description child : description.getChildren()) { + if (child instanceof NamedClass) { + node.extendLabel((NamedClass) child); + } else if (child instanceof ObjectSomeRestriction) { + ObjectProperty op = (ObjectProperty) ((ObjectSomeRestriction) child).getRole(); + ELDescriptionNode newNode = new ELDescriptionNode(node, op, + new TreeSet<NamedClass>()); + constructTree(child.getChild(0), newNode); } else { - throw new UnsupportedLanguageException(description + " specifically " + child , "EL"); + throw new UnsupportedLanguageException(description + " specifically " + child, + "EL"); } } } else { throw new UnsupportedLanguageException(description.toString(), "EL"); } } - + /** - * Gets the nodes on a specific level of the tree. - * This information is cached here for performance - * reasons. - * @param level The level (distance from root node). - * @return The set of all nodes on the specified level within - * this tree. + * Gets the nodes on a specific level of the tree. This information is + * cached here for performance reasons. + * + * @param level + * The level (distance from root node). + * @return The set of all nodes on the specified level within this tree. */ public Set<ELDescriptionNode> getNodesOnLevel(int level) { return levelNodeMapping.get(level); @@ -109,16 +113,19 @@ public Description transformToDescription() { return rootNode.transformToDescription(); } - + /** - * Internal method for updating the level node mapping. - * It is called when a new node is added to the tree. - * @param node The new node. - * @param level Level of the new node. + * Internal method for updating the level node mapping. It is called when a + * new node is added to the tree. + * + * @param node + * The new node. + * @param level + * Level of the new node. */ protected void addNodeToLevel(ELDescriptionNode node, int level) { - if(level <= maxLevel) { - levelNodeMapping.get(level).add(node); + if (level <= maxLevel) { + levelNodeMapping.get(level).add(node); } else if (level == maxLevel + 1) { Set<ELDescriptionNode> set = new HashSet<ELDescriptionNode>(); set.add(node); @@ -128,7 +135,7 @@ throw new RuntimeException("Inconsistent EL description tree structure."); } } - + /** * @return the maxLevel */ @@ -142,45 +149,45 @@ public ELDescriptionNode getRootNode() { return rootNode; } - - /** - * Gets the node at the given position. The list is processed - * as follows: Starting with the root node, the first element i of - * list is read and the i-th child of root node is selected. This - * node is set as current node and the next element j of the list - * is read and the j-th child of the i-th child of the root node - * selected etc. - * @return The node at the specified position. - */ - public ELDescriptionNode getNode(int[] position) { - ELDescriptionNode currentNode = rootNode; - for(int i=0; i<position.length; i++) { - currentNode = currentNode.getEdges().get(position[i]).getTree(); - } - return currentNode; - } - + + /** + * Gets the node at the given position. The list is processed as follows: + * Starting with the root node, the first element i of list is read and the + * i-th child of root node is selected. This node is set as current node and + * the next element j of the list is read and the j-th child of the i-th + * child of the root node selected etc. + * + * @return The node at the specified position. + */ + public ELDescriptionNode getNode(int[] position) { + ELDescriptionNode currentNode = rootNode; + for (int i = 0; i < position.length; i++) { + currentNode = currentNode.getEdges().get(position[i]).getTree(); + } + return currentNode; + } + @Override public ELDescriptionTree clone() { // create a new reference tree ELDescriptionTree treeClone = new ELDescriptionTree(); // create a root node attached to this reference tree - ELDescriptionNode rootNodeClone = new ELDescriptionNode(treeClone, new TreeSet<NamedClass>(rootNode.getLabel())); + ELDescriptionNode rootNodeClone = new ELDescriptionNode(treeClone, new TreeSet<NamedClass>( + rootNode.getLabel())); cloneRecursively(rootNode, rootNodeClone); return treeClone; } - + // we read from the original structure and write to the new structure private void cloneRecursively(ELDescriptionNode node, ELDescriptionNode nodeClone) { // loop through all edges and clone the subtrees - for(ELDescriptionEdge edge : node.getEdges()) { - ELDescriptionNode tmp = new ELDescriptionNode(nodeClone, edge.getLabel(), new TreeSet<NamedClass>(edge.getTree().getLabel())); - // TODO if we want to avoid recomputing simulation information, a special protected ELDescriptionNode - // constructor should be created + for (ELDescriptionEdge edge : node.getEdges()) { + ELDescriptionNode tmp = new ELDescriptionNode(nodeClone, edge.getLabel(), + new TreeSet<NamedClass>(edge.getTree().getLabel())); cloneRecursively(edge.getTree(), tmp); - } + } } - + @Override public String toString() { return rootNode.toString(); Modified: trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown.java =================================================================== --- trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown.java 2008-08-14 19:12:46 UTC (rev 1078) +++ trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown.java 2008-08-15 07:56:49 UTC (rev 1079) @@ -143,6 +143,8 @@ clonedNode.extendLabel(nc); refinements.add(clonedTree); } + + // option 2: label refinement // loop through all classes in label for(NamedClass nc : node.getLabel()) { @@ -152,8 +154,16 @@ // clone operation ELDescriptionTree clonedTree = tree.clone(); ELDescriptionNode clonedNode = clonedTree.getNode(position); + +// System.out.println("tree: " + tree); +// System.out.println("cloned tree: " + clonedTree); +// System.out.println("node: " + node); +// System.out.println("cloned unmodified: " + clonedNode); + // create refinements by replacing class clonedNode.replaceInLabel(nc, (NamedClass) moreSpecial); + +// System.out.println("cloned modified: " + clonedNode); refinements.add(clonedTree); } } @@ -205,6 +215,7 @@ refinements.addAll(refine(tree, edge.getTree(), range, minimize)); } + return refinements; } @@ -221,6 +232,9 @@ ObjectProperty op = edge.getLabel(); // find all more special properties for(ObjectProperty op2 : rs.getMoreSpecialRoles(op)) { + // TODO we need to check whether the range of this property is disjoint + // with the current child node; + // not implemented, because disjointness checks can only be done on descriptions // clone operation ELDescriptionTree clonedTree = tree.clone(); // find cloned edge and replace its label Modified: trunk/src/dl-learner/org/dllearner/test/junit/ELDownTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/ELDownTests.java 2008-08-14 19:12:46 UTC (rev 1078) +++ trunk/src/dl-learner/org/dllearner/test/junit/ELDownTests.java 2008-08-15 07:56:49 UTC (rev 1079) @@ -108,6 +108,7 @@ // eliminate conjunctions nested in other conjunctions ConceptTransformation.cleanConcept(tmp); desired.add(tmp); + System.out.println("desired: " + tmp); } // perform refinement and compare solutions @@ -115,9 +116,10 @@ // number of refinements has to be correct and each produced // refinement must be in the set of desired refinements - assertTrue(refinements.size() == desired.size()); +// assertTrue(refinements.size() == desired.size()); for(Description refinement : refinements) { - assertTrue(desired.contains(refinement)); + System.out.println(refinement); +// assertTrue(desired.contains(refinement)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-08-14 19:12:52
|
Revision: 1078 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1078&view=rev Author: jenslehmann Date: 2008-08-14 19:12:46 +0000 (Thu, 14 Aug 2008) Log Message: ----------- - more unit tests for EL refinement operator - comparator for EL description trees - some bug fixes Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java trunk/src/dl-learner/org/dllearner/core/owl/KB.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyDomainAxiom.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyRangeAxiom.java trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown.java trunk/src/dl-learner/org/dllearner/test/junit/ELDescriptionTreeTests.java trunk/src/dl-learner/org/dllearner/test/junit/ELDownTests.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNodeComparator.java trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTreeComparator.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-08-14 18:09:20 UTC (rev 1077) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-08-14 19:12:46 UTC (rev 1078) @@ -19,8 +19,10 @@ */ package org.dllearner.algorithms.el; +import java.util.ArrayList; import java.util.LinkedList; import java.util.List; +import java.util.NavigableSet; import java.util.SortedSet; import java.util.TreeSet; @@ -47,12 +49,13 @@ * @author Jens Lehmann * */ +@SuppressWarnings("unused") public class ELDescriptionNode { // the reference tree for storing values, must not be null private ELDescriptionTree tree; - private SortedSet<NamedClass> label; + private NavigableSet<NamedClass> label; private List<ELDescriptionEdge> edges; @@ -62,6 +65,14 @@ // null indicates that this node is a root node private ELDescriptionNode parent = null; + // simulation information (list or set?) + private List<ELDescriptionNode> in = new ArrayList<ELDescriptionNode>(); + private List<ELDescriptionNode> inSC1 = new ArrayList<ELDescriptionNode>(); + private List<ELDescriptionNode> inSC2 = new ArrayList<ELDescriptionNode>(); + private List<ELDescriptionNode> out = new ArrayList<ELDescriptionNode>(); + private List<ELDescriptionNode> outSC1 = new ArrayList<ELDescriptionNode>(); + private List<ELDescriptionNode> outSC2 = new ArrayList<ELDescriptionNode>(); + /** * Constructs an EL description tree with empty root label. */ @@ -73,15 +84,17 @@ * Constructs an EL description tree given its root label. * @param label Label of the root node. */ - public ELDescriptionNode(ELDescriptionTree tree, SortedSet<NamedClass> label) { + public ELDescriptionNode(ELDescriptionTree tree, NavigableSet<NamedClass> label) { this.label = label; this.edges = new LinkedList<ELDescriptionEdge>(); this.tree = tree; level = 1; parent = null; + // this is the root node of the overall tree + tree.rootNode = this; } - public ELDescriptionNode(ELDescriptionNode parentNode, ObjectProperty parentProperty, SortedSet<NamedClass> label) { + public ELDescriptionNode(ELDescriptionNode parentNode, ObjectProperty parentProperty, NavigableSet<NamedClass> label) { this.label = label; this.edges = new LinkedList<ELDescriptionEdge>(); parent = parentNode; @@ -185,11 +198,11 @@ * @return The position number of this node within the tree as described above. */ public int[] getCurrentPosition() { - int[] position = new int[level]; + int[] position = new int[level-1]; ELDescriptionNode root = this; while(root.parent != null) { - position[root.level-1] = getChildNumber(); - root = parent; + position[root.level-2] = getChildNumber(); + root = root.parent; } return position; } @@ -229,7 +242,7 @@ * but use the provided methods instead! * @return The label of root node of this subtree. */ - public SortedSet<NamedClass> getLabel() { + public NavigableSet<NamedClass> getLabel() { return label; } @@ -243,11 +256,29 @@ } /** - * Gets the level (distance from root) of this node. + * Gets the level (distance from root) of this node. The root node + * has level 1. * @return The level of the (root node of) this subtree in the overall tree. */ public int getLevel() { return level; } + @Override + public String toString() { + return toString(0); + } + + private String toString(int indent) { + String indentString = ""; + for(int i=0; i<indent; i++) + indentString += " "; + + String str = indentString + label.toString() + "\n"; + for(ELDescriptionEdge edge : edges) { + str += indentString + "-- " + edge.getLabel() + " -->\n"; + str += edge.getTree().toString(indent + 2); + } + return str; + } } Added: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNodeComparator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNodeComparator.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNodeComparator.java 2008-08-14 19:12:46 UTC (rev 1078) @@ -0,0 +1,94 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.algorithms.el; + +import java.util.Comparator; +import java.util.Iterator; + +import org.dllearner.core.owl.NamedClass; +import org.dllearner.core.owl.ObjectProperty; + +/** + * Compares two EL description trees. It is a lexicographic order + * according to the following criteria: + * - number of children + * - size of label + * - string comparison for each class in the label + * - recursive call on each child (first compare edge label, then child node) + * + * @author Jens Lehmann + * + */ +public class ELDescriptionNodeComparator implements Comparator<ELDescriptionNode> { + + /* (non-Javadoc) + * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) + */ + @Override + public int compare(ELDescriptionNode node1, ELDescriptionNode node2) { + int nrOfChildren1 = node1.getEdges().size(); + int nrOfChildren2 = node2.getEdges().size(); + if(nrOfChildren1 > nrOfChildren2) { + return 1; + } else if(nrOfChildren1 < nrOfChildren2) { + return -1; + } else { + int labelSize1 = node1.getLabel().size(); + int labelSize2 = node2.getLabel().size(); + if(labelSize1 > labelSize2) { + return 1; + } else if(labelSize1 < labelSize2) { + return -1; + } else { + // navigate through both labels + Iterator<NamedClass> it1 = node1.getLabel().descendingIterator(); + Iterator<NamedClass> it2 = node2.getLabel().descendingIterator(); + while(it1.hasNext()) { + NamedClass nc1 = it1.next(); + NamedClass nc2 = it2.next(); + int compare = nc1.getName().compareTo(nc2.getName()); + if(compare != 0) + return compare; + } + + // recursively compare all edges + for(int i=0; i<nrOfChildren1; i++) { + // compare by edge name + ObjectProperty op1 = node1.getEdges().get(i).getLabel(); + ObjectProperty op2 = node2.getEdges().get(i).getLabel(); + int compare = op1.getName().compareTo(op2.getName()); + if(compare != 0) + return compare; + + // compare child nodes + ELDescriptionNode child1 = node1.getEdges().get(i).getTree(); + ELDescriptionNode child2 = node2.getEdges().get(i).getTree(); + int compare2 = compare(child1, child2); + if(compare2 != 0) + return compare2; + } + + // trees are identical + return 0; + } + } + } + +} Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-08-14 18:09:20 UTC (rev 1077) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-08-14 19:12:46 UTC (rev 1078) @@ -26,7 +26,11 @@ import java.util.TreeSet; import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.Intersection; import org.dllearner.core.owl.NamedClass; +import org.dllearner.core.owl.ObjectProperty; +import org.dllearner.core.owl.ObjectSomeRestriction; +import org.dllearner.core.owl.Thing; import org.dllearner.core.owl.UnsupportedLanguageException; /** @@ -45,7 +49,7 @@ private int maxLevel = 1; - private ELDescriptionNode rootNode; + protected ELDescriptionNode rootNode; private Map<Integer,Set<ELDescriptionNode>> levelNodeMapping = new HashMap<Integer,Set<ELDescriptionNode>>(); @@ -58,11 +62,38 @@ * @param description A description */ public ELDescriptionTree(Description description) { - // TODO not implemented - // throw an exception if the description is not in EL - throw new UnsupportedLanguageException(description.toString(), "EL"); + // construct root node and recursively build the tree + rootNode = new ELDescriptionNode(this); + constructTree(description, rootNode); } + private void constructTree(Description description, ELDescriptionNode node) { + if(description instanceof NamedClass) { + node.extendLabel((NamedClass)description); + } else if(description instanceof ObjectSomeRestriction) { + ObjectProperty op = (ObjectProperty) ((ObjectSomeRestriction)description).getRole(); + ELDescriptionNode newNode = new ELDescriptionNode(node, op, new TreeSet<NamedClass>()); + constructTree(description.getChild(0), newNode); + } else if(description instanceof Thing) { + // nothing needs to be done as an empty set is owl:Thing + } else if(description instanceof Intersection) { + // loop through all elements of the intersection + for(Description child : description.getChildren()) { + if(child instanceof NamedClass) { + node.extendLabel((NamedClass)child); + } else if(child instanceof ObjectSomeRestriction) { + ObjectProperty op = (ObjectProperty) ((ObjectSomeRestriction)child).getRole(); + ELDescriptionNode newNode = new ELDescriptionNode(node, op, new TreeSet<NamedClass>()); + constructTree(child, newNode); + } else { + throw new UnsupportedLanguageException(description + " specifically " + child , "EL"); + } + } + } else { + throw new UnsupportedLanguageException(description.toString(), "EL"); + } + } + /** * Gets the nodes on a specific level of the tree. * This information is cached here for performance @@ -144,8 +175,14 @@ // loop through all edges and clone the subtrees for(ELDescriptionEdge edge : node.getEdges()) { ELDescriptionNode tmp = new ELDescriptionNode(nodeClone, edge.getLabel(), new TreeSet<NamedClass>(edge.getTree().getLabel())); + // TODO if we want to avoid recomputing simulation information, a special protected ELDescriptionNode + // constructor should be created cloneRecursively(edge.getTree(), tmp); } } + @Override + public String toString() { + return rootNode.toString(); + } } Added: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTreeComparator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTreeComparator.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTreeComparator.java 2008-08-14 19:12:46 UTC (rev 1078) @@ -0,0 +1,49 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.algorithms.el; + +import java.util.Comparator; + +/** + * Compares two EL description trees by calling {@link ELDescriptionNodeComparator} + * on their root nodes. + * + * @author Jens Lehmann + * + */ +public class ELDescriptionTreeComparator implements Comparator<ELDescriptionTree> { + + private ELDescriptionNodeComparator nodeComp; + + public ELDescriptionTreeComparator() { + nodeComp = new ELDescriptionNodeComparator(); + } + + /* (non-Javadoc) + * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) + */ + @Override + public int compare(ELDescriptionTree tree1, ELDescriptionTree tree2) { + ELDescriptionNode node1 = tree1.getRootNode(); + ELDescriptionNode node2 = tree2.getRootNode(); + return nodeComp.compare(node1, node2); + } + +} Modified: trunk/src/dl-learner/org/dllearner/core/owl/KB.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/KB.java 2008-08-14 18:09:20 UTC (rev 1077) +++ trunk/src/dl-learner/org/dllearner/core/owl/KB.java 2008-08-14 19:12:46 UTC (rev 1078) @@ -205,15 +205,15 @@ public String toKBSyntaxString(String baseURI, Map<String,String> prefixes) { StringBuffer strbuff = new StringBuffer(); - strbuff.append("TBox["+tbox.size()+"]:\n"); + strbuff.append("// TBox["+tbox.size()+"]:\n"); for(Axiom a : tbox) - strbuff.append(" " + a.toString(baseURI, prefixes)+"\n"); - strbuff.append("\nRBox["+rbox.size()+"]:\n"); + strbuff.append(" " + a.toKBSyntaxString(baseURI, prefixes)+"\n"); + strbuff.append("\n// RBox["+rbox.size()+"]:\n"); for(Axiom a : rbox) - strbuff.append(" " + a.toString(baseURI, prefixes)+"\n"); - strbuff.append("\nABox["+abox.size()+"]:\n"); + strbuff.append(" " + a.toKBSyntaxString(baseURI, prefixes)+"\n"); + strbuff.append("\n// ABox["+abox.size()+"]:\n"); for(Axiom a : abox) - strbuff.append(" " + a.toString(baseURI, prefixes)+"\n"); + strbuff.append(" " + a.toKBSyntaxString(baseURI, prefixes)+"\n"); return strbuff.toString(); } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyDomainAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyDomainAxiom.java 2008-08-14 18:09:20 UTC (rev 1077) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyDomainAxiom.java 2008-08-14 19:12:46 UTC (rev 1078) @@ -55,8 +55,7 @@ public String toKBSyntaxString(String baseURI, Map<String, String> prefixes) { - // TODO Auto-generated method stub - return null; + return "OPDOMAIN(" + property.toKBSyntaxString(baseURI, prefixes) + ") = " + domain.toKBSyntaxString(baseURI, prefixes); } @Override Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyRangeAxiom.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyRangeAxiom.java 2008-08-14 18:09:20 UTC (rev 1077) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyRangeAxiom.java 2008-08-14 19:12:46 UTC (rev 1078) @@ -48,8 +48,7 @@ } public String toKBSyntaxString(String baseURI, Map<String, String> prefixes) { - // TODO Auto-generated method stub - return null; + return "OPRANGE(" + property.toKBSyntaxString(baseURI, prefixes) + ") = " + range.toKBSyntaxString(baseURI, prefixes); } @Override Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-08-14 18:09:20 UTC (rev 1077) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-08-14 19:12:46 UTC (rev 1078) @@ -160,12 +160,8 @@ @Override public void init() throws ComponentInitException { rc = new OWLAPIReasoner(sources); - //TODO make it nice - - rc.setReasonerType(reasonerType); rc.init(); - try { atomicConcepts = rc.getAtomicConcepts(); Modified: trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown.java =================================================================== --- trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown.java 2008-08-14 18:09:20 UTC (rev 1077) +++ trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown.java 2008-08-14 19:12:46 UTC (rev 1078) @@ -84,6 +84,7 @@ private Utility utility; public ELDown(ReasoningService rs) { + this.rs = rs; utility = new Utility(rs); subsumptionHierarchy = rs.getSubsumptionHierarchy(); opHierarchy = rs.getRoleHierarchy(); @@ -105,6 +106,7 @@ // the tree (not yet implemented) ELDescriptionTree tree = new ELDescriptionTree(concept); Set<ELDescriptionTree> refinementTrees = refine(tree); +// System.out.println("Refinements finished."); Set<Description> refinements = new HashSet<Description>(); for(ELDescriptionTree refinementTree : refinementTrees) { refinements.add(refinementTree.transformToDescription()); @@ -129,7 +131,7 @@ Set<ELDescriptionTree> refinements = new HashSet<ELDescriptionTree>(); // the position of the node within the tree (needed for getting // the corresponding node in a cloned tree) - int[] position = node.getCurrentPosition(); + int[] position = node.getCurrentPosition(); // option 1: label extension Set<NamedClass> candidates = utility.getClassCandidates(index, node.getLabel()); @@ -191,17 +193,18 @@ } } } - + // option 4: edge refinement refinements.addAll(refineEdges(tree, node, position)); - + // option 5: child refinement for(ELDescriptionEdge edge : node.getEdges()) { // recursive call on child node and property range as index Description range = rs.getRange(edge.getLabel()); +// System.out.println(tree + "\nrecurse to:\n" + edge.getTree()); refinements.addAll(refine(tree, edge.getTree(), range, minimize)); } - + return refinements; } Modified: trunk/src/dl-learner/org/dllearner/test/junit/ELDescriptionTreeTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/ELDescriptionTreeTests.java 2008-08-14 18:09:20 UTC (rev 1077) +++ trunk/src/dl-learner/org/dllearner/test/junit/ELDescriptionTreeTests.java 2008-08-14 19:12:46 UTC (rev 1078) @@ -25,10 +25,15 @@ import org.dllearner.algorithms.el.ELDescriptionNode; import org.dllearner.algorithms.el.ELDescriptionTree; +import org.dllearner.algorithms.el.ELDescriptionTreeComparator; import org.dllearner.algorithms.el.Simulation; import org.dllearner.algorithms.el.TreeTuple; +import org.dllearner.core.owl.Description; import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.ObjectProperty; +import org.dllearner.parser.KBParser; +import org.dllearner.parser.ParseException; +import org.dllearner.utilities.owl.ConceptTransformation; import org.junit.Test; /** @@ -58,4 +63,14 @@ assertTrue(tree1.getMaxLevel() == 2); } + @Test + public void cloneTest() throws ParseException { + Description d = KBParser.parseConcept("(male AND (human AND EXISTS hasChild.(female AND EXISTS hasChild.male)))"); + ConceptTransformation.cleanConcept(d); + ELDescriptionTree tree = new ELDescriptionTree(d); + ELDescriptionTree treeCloned = tree.clone(); + ELDescriptionTreeComparator comparator = new ELDescriptionTreeComparator(); + assertTrue(comparator.compare(tree, treeCloned) == 0); + } + } Modified: trunk/src/dl-learner/org/dllearner/test/junit/ELDownTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/ELDownTests.java 2008-08-14 18:09:20 UTC (rev 1077) +++ trunk/src/dl-learner/org/dllearner/test/junit/ELDownTests.java 2008-08-14 19:12:46 UTC (rev 1078) @@ -23,6 +23,7 @@ import java.util.SortedSet; import java.util.TreeSet; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.ReasonerComponent; import org.dllearner.core.ReasoningService; @@ -53,44 +54,52 @@ * * @throws ParseException Thrown if concept syntax does not correspond * to current KB syntax. + * @throws ComponentInitException */ @Test - public void refinementTest() throws ParseException { + public void refinementTest() throws ParseException, ComponentInitException { ComponentManager cm = ComponentManager.getInstance(); // background knowledge String kbString = ""; - kbString += "OP_DOMAIN(hasChild) = human."; - kbString += "OP_RANGE(hasChild) = human."; - kbString += "OP_DOMAIN(hasPet) = human."; - kbString += "OP_RANGE(hasPet) = animal."; - kbString += "Subrole(hasChild, has)."; - kbString += "Subrole(hasPet, has)."; - kbString += "bird SUB animal."; - kbString += "cat SUB animal."; - kbString += "cat SUB animal."; + kbString += "OPDOMAIN(hasChild) = human.\n"; + kbString += "OPRANGE(hasChild) = human.\n"; + kbString += "OPDOMAIN(hasPet) = human.\n"; + kbString += "OPRANGE(hasPet) = animal.\n"; + kbString += "Subrole(hasChild, has).\n"; + kbString += "Subrole(hasPet, has).\n"; + kbString += "bird SUB animal.\n"; + kbString += "cat SUB animal.\n"; + kbString += "(human AND animal) = BOTTOM.\n"; KB kb = KBParser.parseKBFile(kbString); // input description - Description input = KBParser.parseConcept("human AND EXISTS has.animal"); + Description input = KBParser.parseConcept("(human AND EXISTS has.animal)"); // create reasoner KBFile source = new KBFile(kb); ReasonerComponent rc = cm.reasoner(FastInstanceChecker.class, source); ReasoningService rs = cm.reasoningService(rc); + source.init(); + rc.init(); + // TODO there shouldn't be a need to call this explicitly! + // (otherwise we get a NullPointerException, because the hierarchy is not created) + rs.prepareSubsumptionHierarchy(); + rs.prepareRoleHierarchy(); + ELDown operator = new ELDown(rs); // desired refinements as strings Set<String> desiredString = new TreeSet<String>(); - desiredString.add("human AND EXISTS hasPet.animal"); - desiredString.add("human AND EXISTS has.bird"); - desiredString.add("human AND EXISTS has.cat"); - desiredString.add("(human AND EXISTS hasPet.TOP) AND EXISTS has.animal"); - desiredString.add("(human AND EXISTS hasChild.TOP) AND EXISTS has.animal"); - desiredString.add("(human AND EXISTS hasPet.TOP) AND EXISTS has.animal"); - desiredString.add("(human AND EXISTS has.person) AND EXISTS has.animal"); - desiredString.add("(human AND EXISTS has.EXISTS has.TOP) AND EXISTS has.animal"); - desiredString.add("human AND EXISTS has.(animal AND EXISTS has.TOP)"); + desiredString.add("(human AND EXISTS hasPet.animal)"); + desiredString.add("(human AND EXISTS has.bird)"); + desiredString.add("(human AND EXISTS has.cat)"); + desiredString.add("((human AND EXISTS hasPet.TOP) AND EXISTS has.animal)"); + desiredString.add("((human AND EXISTS hasChild.TOP) AND EXISTS has.animal)"); + desiredString.add("((human AND EXISTS hasPet.TOP) AND EXISTS has.animal)"); + desiredString.add("((human AND EXISTS has.person) AND EXISTS has.animal)"); + desiredString.add("((human AND EXISTS has.EXISTS has.TOP) AND EXISTS has.animal)"); + desiredString.add("(human AND EXISTS has.(animal AND EXISTS has.TOP))"); ConceptComparator cc = new ConceptComparator(); SortedSet<Description> desired = new TreeSet<Description>(cc); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-08-14 18:09:25
|
Revision: 1077 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1077&view=rev Author: kurzum Date: 2008-08-14 18:09:20 +0000 (Thu, 14 Aug 2008) Log Message: ----------- more movements Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/manipulator/DBPediaNavigatorCityLocatorRule.java trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorOtherRule.java trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java trunk/src/dl-learner/org/dllearner/kb/manipulator/Rule.java trunk/src/dl-learner/org/dllearner/kb/manipulator/SimpleObjectFilterRule.java trunk/src/dl-learner/org/dllearner/kb/manipulator/SimplePredicateFilterRule.java trunk/src/dl-learner/org/dllearner/kb/manipulator/TypeFilterRule.java trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java Added: trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java 2008-08-14 18:09:20 UTC (rev 1077) @@ -0,0 +1,117 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.kb.extraction; + +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.dllearner.kb.aquisitors.TupelAquisitor; +import org.dllearner.kb.manipulator.Manipulator; +import org.dllearner.utilities.datastructures.RDFNodeTuple; +import org.dllearner.utilities.owl.OWLVocabulary; + +/** + * Is a node in the graph, that is a class. + * + * @author Sebastian Hellmann + */ +public class ClassNode extends Node { + SortedSet<PropertyNode> properties = new TreeSet<PropertyNode>(); + + public ClassNode(URI u) { + super(u); + } + + // expands all directly connected nodes + @Override + public List<Node> expand(TupelAquisitor tupelAquisitor, Manipulator manipulator) { + + SortedSet<RDFNodeTuple> newTuples = tupelAquisitor.getTupelForResource(this.uri); + // see manipulator + newTuples = manipulator.manipulate(this, newTuples); + + List<Node> newNodes = new ArrayList<Node>(); + for (RDFNodeTuple tuple : newTuples) { + try { + String property = tuple.a.toString(); + // substitute rdf:type with owl:subclassof + if (property.equals(OWLVocabulary.RDF_TYPE) || property.equals(OWLVocabulary.RDFS_SUBCLASS_OF)) { + ClassNode tmp = new ClassNode(new URI(tuple.b.toString())); + properties.add(new PropertyNode(new URI( OWLVocabulary.RDFS_SUBCLASS_OF), this, + tmp)); + newNodes.add(tmp); + } else { + // further expansion stops here + // Nodes.add(tmp); is missing on purpose + ClassNode tmp = new ClassNode(new URI(tuple.b.toString())); + properties.add(new PropertyNode(new URI(tuple.a.toString()), this, tmp)); + // System.out.println(m.blankNodeIdentifier); + // System.out.println("XXXXX"+t.b); + + // if o is a blank node expand further + // TODO this needs a lot more work + + // Nodes.add(tmp); + } + + + + + } catch (Exception e) { + System.out.println("ClassNode"); + e.printStackTrace(); + } + } + return newNodes; + } + + // gets the types for properties recursively + @Override + public void expandProperties(TupelAquisitor tupelAquisitor, Manipulator manipulator) { + } + + /* + * (non-Javadoc) + * + * @see org.dllearner.kb.sparql.datastructure.Node#toNTriple() + */ + @Override + public SortedSet<String> toNTriple() { + SortedSet<String> s = new TreeSet<String>(); + s.add("<" + this.uri + "><" + OWLVocabulary.RDF_TYPE + "><" + OWLVocabulary.OWL_CLASS + ">."); + + for (PropertyNode one : properties) { + s.add("<" + this.uri + "><" + one.getURI() + "><" + + one.getB().getURI() + ">."); + s.addAll(one.getB().toNTriple()); + } + + return s; + } + + @Override + public int compareTo(Node n) { + return super.compareTo(n); + } + +} Added: trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java 2008-08-14 18:09:20 UTC (rev 1077) @@ -0,0 +1,98 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.kb.extraction; + +import java.net.URI; +import java.util.List; +import java.util.SortedSet; + +import org.dllearner.kb.aquisitors.TupelAquisitor; +import org.dllearner.kb.manipulator.Manipulator; + + + +/** + * Abstract class. defines functions to expand the nodes + * + * @author Sebastian Hellmann + * + */ +public abstract class Node implements Comparable<Node> { + + + + protected URI uri; + // protected String type; + protected boolean expanded = false; + + public Node(URI uri) { + this.uri = uri; + } + + /** + * Nodes are expanded with a certain context, given by the typedSparqlQuery + * and the manipulator + * + * @param typedSparqlQuery + * @param manipulator + * @return Vector<Node> all Nodes that are new because of expansion + */ + public abstract List<Node> expand( + TupelAquisitor TupelAquisitor, Manipulator manipulator); + + /** + * gets type defs for properties like rdf:type SymmetricProperties + * + * @param typedSparqlQuery + * @param manipulator + * @return Vector<Node> + */ + public abstract void expandProperties( + TupelAquisitor TupelAquisitor, Manipulator manipulator); + + /** + * output + * + * @return a set of n-triple + */ + public abstract SortedSet<String> toNTriple(); + + @Override + public String toString() { + return "Node: " + uri + ":" + this.getClass().getSimpleName(); + + } + + public URI getURI() { + return uri; + } + + public boolean equals(Node n) { + if (this.uri.equals(n.uri)) + return true; + else + return false; + } + + public int compareTo(Node n) { + return this.uri.toString().compareTo(n.uri.toString()); + } + +} Added: trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java 2008-08-14 18:09:20 UTC (rev 1077) @@ -0,0 +1,116 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.kb.extraction; + +import java.net.URI; +import java.util.List; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.dllearner.kb.aquisitors.TupelAquisitor; +import org.dllearner.kb.manipulator.Manipulator; +import org.dllearner.utilities.datastructures.RDFNodeTuple; +import org.dllearner.utilities.owl.OWLVocabulary; + +/** + * Property node, has connection to a and b part + * + * @author Sebastian Hellmann + * + */ + +public class PropertyNode extends Node { + + // the a and b part of a property + private Node a; + private Node b; + // specialtypes like owl:symmetricproperty + private SortedSet<String> specialTypes; + + public PropertyNode(URI uri, Node a, Node b) { + super(uri); + // this.type = "property"; + this.a = a; + this.b = b; + this.specialTypes = new TreeSet<String>(); + } + + // Property Nodes are normally not expanded, + // this function is never called + @Override + public List<Node> expand(TupelAquisitor tupelAquisitor, Manipulator manipulator) { + return null; + } + + // gets the types for properties recursively + @Override + public void expandProperties(TupelAquisitor tupelAquisitor, Manipulator manipulator) { + b.expandProperties(tupelAquisitor, manipulator); + SortedSet<RDFNodeTuple> newTypes = tupelAquisitor.getTupelForResource(uri); + for (RDFNodeTuple tuple : newTypes) { + try { + if (tuple.a.equals(OWLVocabulary.RDF_TYPE)) { + specialTypes.add(tuple.b.toString()); + } + } catch (Exception e) { + System.out.println(tuple); + e.printStackTrace(); + } + } + + } + + public Node getA() { + return a; + } + + public Node getB() { + return b; + } + + @Override + public SortedSet<String> toNTriple() { + SortedSet<String> s = new TreeSet<String>(); + s.add("<" + uri + "><" + OWLVocabulary.RDF_TYPE + "><" + + OWLVocabulary.OWL_OBJECTPROPERTY + ">."); + for (String one : specialTypes) { + s.add("<" + uri + "><" + OWLVocabulary.RDF_TYPE + "><" + + one + ">."); + } + + return s; + } + + //TODO check + @Override + public boolean equals(Node n) { + if (this.uri.equals(n.uri)) { + return true; + }else { + return false; + } + } + + @Override + public int compareTo(Node n) { + return super.compareTo(n); + } + +} Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/DBPediaNavigatorCityLocatorRule.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/DBPediaNavigatorCityLocatorRule.java 2008-08-14 17:35:50 UTC (rev 1076) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/DBPediaNavigatorCityLocatorRule.java 2008-08-14 18:09:20 UTC (rev 1077) @@ -4,7 +4,7 @@ import java.util.Map; import java.util.SortedSet; -import org.dllearner.kb.old.Node; +import org.dllearner.kb.extraction.Node; import org.dllearner.utilities.datastructures.RDFNodeTuple; import org.dllearner.utilities.owl.OWLVocabulary; Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorOtherRule.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorOtherRule.java 2008-08-14 17:35:50 UTC (rev 1076) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorOtherRule.java 2008-08-14 18:09:20 UTC (rev 1077) @@ -21,8 +21,8 @@ import java.util.SortedSet; -import org.dllearner.kb.old.DBpediaNavigatorCityLocator; -import org.dllearner.kb.old.Node; + +import org.dllearner.kb.extraction.Node; import org.dllearner.utilities.datastructures.RDFNodeTuple; import org.dllearner.utilities.owl.OWLVocabulary; @@ -62,7 +62,7 @@ } if (clazz.toString().equals("http://dbpedia.org/class/yago/City108524735")){ - String newType=DBpediaNavigatorCityLocator.getTypeToCoordinates(lat, lng); + String newType = getTypeToCoordinates(lat, lng); tuples.add(new RDFNodeTuple(new ResourceImpl(OWLVocabulary.RDF_TYPE),new ResourceImpl(newType))); //tuples.add(new StringTuple("http://www.w3.org/1999/02/22-rdf-syntax-ns#type",newType)); tuples.remove(typeTuple); Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java 2008-08-14 17:35:50 UTC (rev 1076) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java 2008-08-14 18:09:20 UTC (rev 1077) @@ -23,10 +23,10 @@ import java.util.List; import java.util.SortedSet; +import org.dllearner.kb.extraction.ClassNode; +import org.dllearner.kb.extraction.Node; import org.dllearner.kb.manipulator.Rule.Months; -import org.dllearner.kb.old.ClassNode; import org.dllearner.kb.old.InstanceNode; -import org.dllearner.kb.old.Node; import org.dllearner.utilities.datastructures.RDFNodeTuple; import org.dllearner.utilities.owl.OWLVocabulary; Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/Rule.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/Rule.java 2008-08-14 17:35:50 UTC (rev 1076) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/Rule.java 2008-08-14 18:09:20 UTC (rev 1077) @@ -5,7 +5,7 @@ import java.util.List; import java.util.SortedSet; -import org.dllearner.kb.old.Node; +import org.dllearner.kb.extraction.Node; import org.dllearner.utilities.datastructures.RDFNodeTuple; public abstract class Rule { Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/SimpleObjectFilterRule.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/SimpleObjectFilterRule.java 2008-08-14 17:35:50 UTC (rev 1076) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/SimpleObjectFilterRule.java 2008-08-14 18:09:20 UTC (rev 1077) @@ -3,7 +3,7 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.dllearner.kb.old.Node; +import org.dllearner.kb.extraction.Node; import org.dllearner.utilities.datastructures.RDFNodeTuple; public class SimpleObjectFilterRule extends Rule{ Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/SimplePredicateFilterRule.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/SimplePredicateFilterRule.java 2008-08-14 17:35:50 UTC (rev 1076) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/SimplePredicateFilterRule.java 2008-08-14 18:09:20 UTC (rev 1077) @@ -3,7 +3,7 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.dllearner.kb.old.Node; +import org.dllearner.kb.extraction.Node; import org.dllearner.utilities.datastructures.RDFNodeTuple; public class SimplePredicateFilterRule extends Rule{ Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/TypeFilterRule.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/TypeFilterRule.java 2008-08-14 17:35:50 UTC (rev 1076) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/TypeFilterRule.java 2008-08-14 18:09:20 UTC (rev 1077) @@ -3,7 +3,7 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.dllearner.kb.old.Node; +import org.dllearner.kb.extraction.Node; import org.dllearner.utilities.datastructures.RDFNodeTuple; public class TypeFilterRule extends Rule{ Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java 2008-08-14 17:35:50 UTC (rev 1076) +++ trunk/src/dl-learner/org/dllearner/utilities/owl/OWLVocabulary.java 2008-08-14 18:09:20 UTC (rev 1077) @@ -12,6 +12,7 @@ public static final String OWL_CLASS = "http://www.w3.org/2002/07/owl#Class"; public static final String OWL_THING = "http://www.w3.org/2002/07/owl#Thing"; + // public static final String RDF_TYPE = ""; // public static final String RDF_TYPE = ""; // public static final String RDF_TYPE = ""; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-08-14 17:35:57
|
Revision: 1076 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1076&view=rev Author: kurzum Date: 2008-08-14 17:35:50 +0000 (Thu, 14 Aug 2008) Log Message: ----------- more movements Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java trunk/src/dl-learner/org/dllearner/kb/manipulator/DBPediaNavigatorCityLocatorRule.java trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorOtherRule.java trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java trunk/src/dl-learner/org/dllearner/kb/manipulator/Rule.java trunk/src/dl-learner/org/dllearner/kb/manipulator/SimpleObjectFilterRule.java trunk/src/dl-learner/org/dllearner/kb/manipulator/SimplePredicateFilterRule.java trunk/src/dl-learner/org/dllearner/kb/manipulator/TypeFilterRule.java trunk/src/dl-learner/org/dllearner/kb/old/DBpediaNavigatorManipulator.java trunk/src/dl-learner/org/dllearner/kb/old/Manipulators.java trunk/src/dl-learner/org/dllearner/kb/old/OldManipulator.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/kb/old/ClassNode.java trunk/src/dl-learner/org/dllearner/kb/old/InstanceNode.java trunk/src/dl-learner/org/dllearner/kb/old/Node.java trunk/src/dl-learner/org/dllearner/kb/old/PropertyNode.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java Deleted: trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java 2008-08-14 17:33:24 UTC (rev 1075) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java 2008-08-14 17:35:50 UTC (rev 1076) @@ -1,119 +0,0 @@ -/** - * Copyright (C) 2007, Sebastian Hellmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.kb.extraction; - -import java.net.URI; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; -import java.util.SortedSet; -import java.util.TreeSet; -import java.util.Vector; - -import org.dllearner.kb.old.Manipulators; -import org.dllearner.kb.old.TypedSparqlQueryInterface; -import org.dllearner.utilities.datastructures.StringTuple; - -/** - * Is a node in the graph, that is a class. - * - * @author Sebastian Hellmann - */ -public class ClassNode extends Node { - Set<PropertyNode> properties = new HashSet<PropertyNode>(); - - public ClassNode(URI u) { - super(u); - } - - // expands all directly connected nodes - @Override - public Vector<Node> expand(TypedSparqlQueryInterface tsq, Manipulators m) { - - Set<StringTuple> s = tsq.getTupelForResource(this.uri); - // see manipulator - s = m.check(s, this); - Vector<Node> Nodes = new Vector<Node>(); - Iterator<StringTuple> it = s.iterator(); - while (it.hasNext()) { - StringTuple t = (StringTuple) it.next(); - try { - // substitute rdf:type with owl:subclassof - if (t.a.equals(Manipulators.type) || t.a.equals(Manipulators.subclass)) { - ClassNode tmp = new ClassNode(new URI(t.b)); - properties.add(new PropertyNode(new URI(Manipulators.subclass), this, - tmp)); - Nodes.add(tmp); - } else { - // further expansion stops here - // Nodes.add(tmp); is missing on purpose - ClassNode tmp = new ClassNode(new URI(t.b)); - properties.add(new PropertyNode(new URI(t.a), this, tmp)); - // System.out.println(m.blankNodeIdentifier); - // System.out.println("XXXXX"+t.b); - - // if o is a blank node expand further - // TODO this needs a lot more work - if (t.b.startsWith(Manipulators.blankNodeIdentifier)) { - tmp.expand(tsq, m); - System.out.println(Manipulators.blankNodeIdentifier); - System.out.println("XXXXX" + t.b); - } - // Nodes.add(tmp); - } - } catch (Exception e) { - System.out.println(t); - e.printStackTrace(); - } - - } - return Nodes; - } - - // gets the types for properties recursively - @Override - public void expandProperties(TypedSparqlQueryInterface tsq, Manipulators m) { - } - - /* - * (non-Javadoc) - * - * @see org.dllearner.kb.sparql.datastructure.Node#toNTriple() - */ - @Override - public SortedSet<String> toNTriple() { - SortedSet<String> s = new TreeSet<String>(); - s.add("<" + this.uri + "><" + rdftype + "><" + classns + ">."); - - for (PropertyNode one : properties) { - s.add("<" + this.uri + "><" + one.getURI() + "><" - + one.getB().getURI() + ">."); - s.addAll(one.getB().toNTriple()); - } - - return s; - } - - @Override - public int compareTo(Node n) { - return super.compareTo(n); - } - -} Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java 2008-08-14 17:33:24 UTC (rev 1075) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/ExtractionAlgorithm.java 2008-08-14 17:35:50 UTC (rev 1076) @@ -24,7 +24,10 @@ import java.util.Vector; import org.apache.log4j.Logger; +import org.dllearner.kb.old.ClassNode; +import org.dllearner.kb.old.InstanceNode; import org.dllearner.kb.old.Manipulators; +import org.dllearner.kb.old.Node; import org.dllearner.kb.old.TypedSparqlQuery; import org.dllearner.kb.old.TypedSparqlQueryClasses; Deleted: trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java 2008-08-14 17:33:24 UTC (rev 1075) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java 2008-08-14 17:35:50 UTC (rev 1076) @@ -1,124 +0,0 @@ -/** - * Copyright (C) 2007, Sebastian Hellmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.kb.extraction; - -import java.net.URI; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; -import java.util.SortedSet; -import java.util.TreeSet; -import java.util.Vector; - -import org.dllearner.kb.old.Manipulators; -import org.dllearner.kb.old.TypedSparqlQueryInterface; -import org.dllearner.utilities.datastructures.StringTuple; - -/** - * A node in the graph that is an instance. - * - * @author Sebastian Hellmann - * - */ -public class InstanceNode extends Node { - - Set<ClassNode> classes = new HashSet<ClassNode>(); - Set<StringTuple> datatypes = new HashSet<StringTuple>(); - Set<PropertyNode> properties = new HashSet<PropertyNode>(); - - public InstanceNode(URI u) { - super(u); - // this.type = "instance"; - - } - - // expands all directly connected nodes - @Override - public Vector<Node> expand(TypedSparqlQueryInterface tsq, Manipulators m) { - - Set<StringTuple> s = tsq.getTupelForResource(uri); - // see Manipulator - s=m.check(s, this); - // System.out.println("fffffff"+m); - Vector<Node> Nodes = new Vector<Node>(); - - Iterator<StringTuple> it = s.iterator(); - while (it.hasNext()) { - StringTuple t = (StringTuple) it.next(); - //QUALITY: needs proper handling of ressource, could be done one step lower in the onion - if(!t.b.startsWith("http:"))continue; - - // basically : if p is rdf:type then o is a class - // else it is an instance - try { - if (t.a.equals(Manipulators.type)) { - ClassNode tmp = new ClassNode(new URI(t.b)); - classes.add(tmp); - Nodes.add(tmp); - } else { - InstanceNode tmp = new InstanceNode(new URI(t.b)); - properties.add(new PropertyNode(new URI(t.a), this, tmp)); - Nodes.add(tmp); - - } - } catch (Exception e) { - System.out.println("Problem with: " + t); - e.printStackTrace(); - } - - } - expanded = true; - return Nodes; - } - - // gets the types for properties recursively - @Override - public void expandProperties(TypedSparqlQueryInterface tsq, Manipulators m) { - for (PropertyNode one : properties) { - one.expandProperties(tsq, m); - } - - } - - @Override - public SortedSet<String> toNTriple() { - SortedSet<String> s = new TreeSet<String>(); - s.add("<" + uri + "><" + rdftype + "><" + thing + ">."); - for (ClassNode one : classes) { - s.add("<" + uri + "><" + rdftype + "><" + one.getURI() + ">."); - s.addAll(one.toNTriple()); - } - for (PropertyNode one : properties) { - s.add("<" + uri + "><" + one.getURI() + "><" + one.getB().getURI() - + ">."); - s.addAll(one.toNTriple()); - s.addAll(one.getB().toNTriple()); - } - - return s; - } - - @Override - public int compareTo(Node n) { - return super.compareTo(n); - // - } - -} Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java 2008-08-14 17:33:24 UTC (rev 1075) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java 2008-08-14 17:35:50 UTC (rev 1076) @@ -26,6 +26,7 @@ import org.apache.log4j.Logger; import org.dllearner.kb.old.Manipulators; +import org.dllearner.kb.old.Node; import org.dllearner.kb.old.TypedSparqlQuery; import org.dllearner.kb.sparql.SparqlEndpoint; import org.dllearner.kb.sparql.SparqlQueryMaker; Deleted: trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java 2008-08-14 17:33:24 UTC (rev 1075) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java 2008-08-14 17:35:50 UTC (rev 1076) @@ -1,101 +0,0 @@ -/** - * Copyright (C) 2007, Sebastian Hellmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.kb.extraction; - -import java.net.URI; -import java.util.SortedSet; -import java.util.Vector; - -import org.dllearner.kb.old.Manipulators; -import org.dllearner.kb.old.TypedSparqlQueryInterface; - - -/** - * Abstract class. defines functions to expand the nodes - * - * @author Sebastian Hellmann - * - */ -public abstract class Node implements Comparable<Node> { - - final String subclass = "http://www.w3.org/2000/01/rdf-schema#subClassOf"; - final String rdftype = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"; - final String objectProperty = "http://www.w3.org/2002/07/owl#ObjectProperty"; - final String classns = "http://www.w3.org/2002/07/owl#Class"; - final String thing = "http://www.w3.org/2002/07/owl#Thing"; - - URI uri; - // protected String type; - protected boolean expanded = false; - - public Node(URI u) { - this.uri = u; - } - - /** - * Nodes are expanded with a certain context, given by the typedSparqlQuery - * and the manipulator - * - * @param typedSparqlQuery - * @param manipulator - * @return Vector<Node> all Nodes that are new because of expansion - */ - public abstract Vector<Node> expand( - TypedSparqlQueryInterface typedSparqlQuery, Manipulators manipulator); - - /** - * gets type defs for properties like rdf:type SymmetricProperties - * - * @param typedSparqlQuery - * @param manipulator - * @return Vector<Node> - */ - public abstract void expandProperties( - TypedSparqlQueryInterface typedSparqlQuery, Manipulators manipulator); - - /** - * output - * - * @return a set of n-triple - */ - public abstract SortedSet<String> toNTriple(); - - @Override - public String toString() { - return "Node: " + uri + ":" + this.getClass().getSimpleName(); - - } - - public URI getURI() { - return uri; - } - - public boolean equals(Node n) { - if (this.uri.equals(n.uri)) - return true; - else - return false; - } - - public int compareTo(Node n) { - return this.uri.toString().compareTo(n.uri.toString()); - } - -} Deleted: trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java 2008-08-14 17:33:24 UTC (rev 1075) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java 2008-08-14 17:35:50 UTC (rev 1076) @@ -1,123 +0,0 @@ -/** - * Copyright (C) 2007, Sebastian Hellmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.kb.extraction; - -import java.net.URI; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; -import java.util.SortedSet; -import java.util.TreeSet; -import java.util.Vector; - -import org.dllearner.kb.old.Manipulators; -import org.dllearner.kb.old.TypedSparqlQueryInterface; -import org.dllearner.utilities.datastructures.StringTuple; - -/** - * Property node, has connection to a and b part - * - * @author Sebastian Hellmann - * - */ - -public class PropertyNode extends Node { - - // the a and b part of a property - private Node a; - private Node b; - // specialtypes like owl:symmetricproperty - private Set<String> specialTypes; - - public PropertyNode(URI u, Node a, Node b) { - super(u); - // this.type = "property"; - this.a = a; - this.b = b; - this.specialTypes = new HashSet<String>(); - } - - // Property Nodes are normally not expanded, - // this function is never called - @Override - public Vector<Node> expand(TypedSparqlQueryInterface tsq, Manipulators m) { - return null; - } - - // gets the types for properties recursively - @Override - public void expandProperties(TypedSparqlQueryInterface tsq, Manipulators m) { - b.expandProperties(tsq, m); - Set<StringTuple> s = tsq.getTupelForResource(uri); - - Iterator<StringTuple> it = s.iterator(); - while (it.hasNext()) { - StringTuple t = (StringTuple) it.next(); - try { - if (t.a.equals(Manipulators.type)) { - specialTypes.add(t.b); - } - } catch (Exception e) { - System.out.println(t); - e.printStackTrace(); - } - - } - - } - - public Node getA() { - return a; - } - - public Node getB() { - return b; - } - - @Override - public SortedSet<String> toNTriple() { - SortedSet<String> s = new TreeSet<String>(); - s.add("<" + uri + "><" - + "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + "><" - + "http://www.w3.org/2002/07/owl#ObjectProperty" + ">."); - for (String one : specialTypes) { - s.add("<" + uri + "><" - + "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + "><" - + one + ">."); - - } - - return s; - } - - @Override - public boolean equals(Node n) { - if (this.uri.equals(n.uri)) - return true; - else - return false; - } - - @Override - public int compareTo(Node n) { - return super.compareTo(n); - } - -} Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/DBPediaNavigatorCityLocatorRule.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/DBPediaNavigatorCityLocatorRule.java 2008-08-14 17:33:24 UTC (rev 1075) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/DBPediaNavigatorCityLocatorRule.java 2008-08-14 17:35:50 UTC (rev 1076) @@ -4,7 +4,7 @@ import java.util.Map; import java.util.SortedSet; -import org.dllearner.kb.extraction.Node; +import org.dllearner.kb.old.Node; import org.dllearner.utilities.datastructures.RDFNodeTuple; import org.dllearner.utilities.owl.OWLVocabulary; Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorOtherRule.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorOtherRule.java 2008-08-14 17:33:24 UTC (rev 1075) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/DBpediaNavigatorOtherRule.java 2008-08-14 17:35:50 UTC (rev 1076) @@ -21,8 +21,8 @@ import java.util.SortedSet; -import org.dllearner.kb.extraction.Node; import org.dllearner.kb.old.DBpediaNavigatorCityLocator; +import org.dllearner.kb.old.Node; import org.dllearner.utilities.datastructures.RDFNodeTuple; import org.dllearner.utilities.owl.OWLVocabulary; Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java 2008-08-14 17:33:24 UTC (rev 1075) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/Manipulator.java 2008-08-14 17:35:50 UTC (rev 1076) @@ -23,10 +23,10 @@ import java.util.List; import java.util.SortedSet; -import org.dllearner.kb.extraction.ClassNode; -import org.dllearner.kb.extraction.InstanceNode; -import org.dllearner.kb.extraction.Node; import org.dllearner.kb.manipulator.Rule.Months; +import org.dllearner.kb.old.ClassNode; +import org.dllearner.kb.old.InstanceNode; +import org.dllearner.kb.old.Node; import org.dllearner.utilities.datastructures.RDFNodeTuple; import org.dllearner.utilities.owl.OWLVocabulary; Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/Rule.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/Rule.java 2008-08-14 17:33:24 UTC (rev 1075) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/Rule.java 2008-08-14 17:35:50 UTC (rev 1076) @@ -5,7 +5,7 @@ import java.util.List; import java.util.SortedSet; -import org.dllearner.kb.extraction.Node; +import org.dllearner.kb.old.Node; import org.dllearner.utilities.datastructures.RDFNodeTuple; public abstract class Rule { Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/SimpleObjectFilterRule.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/SimpleObjectFilterRule.java 2008-08-14 17:33:24 UTC (rev 1075) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/SimpleObjectFilterRule.java 2008-08-14 17:35:50 UTC (rev 1076) @@ -3,7 +3,7 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.dllearner.kb.extraction.Node; +import org.dllearner.kb.old.Node; import org.dllearner.utilities.datastructures.RDFNodeTuple; public class SimpleObjectFilterRule extends Rule{ Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/SimplePredicateFilterRule.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/SimplePredicateFilterRule.java 2008-08-14 17:33:24 UTC (rev 1075) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/SimplePredicateFilterRule.java 2008-08-14 17:35:50 UTC (rev 1076) @@ -3,7 +3,7 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.dllearner.kb.extraction.Node; +import org.dllearner.kb.old.Node; import org.dllearner.utilities.datastructures.RDFNodeTuple; public class SimplePredicateFilterRule extends Rule{ Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/TypeFilterRule.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/TypeFilterRule.java 2008-08-14 17:33:24 UTC (rev 1075) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/TypeFilterRule.java 2008-08-14 17:35:50 UTC (rev 1076) @@ -3,7 +3,7 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.dllearner.kb.extraction.Node; +import org.dllearner.kb.old.Node; import org.dllearner.utilities.datastructures.RDFNodeTuple; public class TypeFilterRule extends Rule{ Copied: trunk/src/dl-learner/org/dllearner/kb/old/ClassNode.java (from rev 1075, trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/old/ClassNode.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/old/ClassNode.java 2008-08-14 17:35:50 UTC (rev 1076) @@ -0,0 +1,117 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.kb.old; + +import java.net.URI; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; +import java.util.Vector; + +import org.dllearner.utilities.datastructures.StringTuple; + +/** + * Is a node in the graph, that is a class. + * + * @author Sebastian Hellmann + */ +public class ClassNode extends Node { + Set<PropertyNode> properties = new HashSet<PropertyNode>(); + + public ClassNode(URI u) { + super(u); + } + + // expands all directly connected nodes + @Override + public Vector<Node> expand(TypedSparqlQueryInterface tsq, Manipulators m) { + + Set<StringTuple> s = tsq.getTupelForResource(this.uri); + // see manipulator + s = m.check(s, this); + Vector<Node> Nodes = new Vector<Node>(); + Iterator<StringTuple> it = s.iterator(); + while (it.hasNext()) { + StringTuple t = (StringTuple) it.next(); + try { + // substitute rdf:type with owl:subclassof + if (t.a.equals(Manipulators.type) || t.a.equals(Manipulators.subclass)) { + ClassNode tmp = new ClassNode(new URI(t.b)); + properties.add(new PropertyNode(new URI(Manipulators.subclass), this, + tmp)); + Nodes.add(tmp); + } else { + // further expansion stops here + // Nodes.add(tmp); is missing on purpose + ClassNode tmp = new ClassNode(new URI(t.b)); + properties.add(new PropertyNode(new URI(t.a), this, tmp)); + // System.out.println(m.blankNodeIdentifier); + // System.out.println("XXXXX"+t.b); + + // if o is a blank node expand further + // TODO this needs a lot more work + if (t.b.startsWith(Manipulators.blankNodeIdentifier)) { + tmp.expand(tsq, m); + System.out.println(Manipulators.blankNodeIdentifier); + System.out.println("XXXXX" + t.b); + } + // Nodes.add(tmp); + } + } catch (Exception e) { + System.out.println(t); + e.printStackTrace(); + } + + } + return Nodes; + } + + // gets the types for properties recursively + @Override + public void expandProperties(TypedSparqlQueryInterface tsq, Manipulators m) { + } + + /* + * (non-Javadoc) + * + * @see org.dllearner.kb.sparql.datastructure.Node#toNTriple() + */ + @Override + public SortedSet<String> toNTriple() { + SortedSet<String> s = new TreeSet<String>(); + s.add("<" + this.uri + "><" + rdftype + "><" + classns + ">."); + + for (PropertyNode one : properties) { + s.add("<" + this.uri + "><" + one.getURI() + "><" + + one.getB().getURI() + ">."); + s.addAll(one.getB().toNTriple()); + } + + return s; + } + + @Override + public int compareTo(Node n) { + return super.compareTo(n); + } + +} Property changes on: trunk/src/dl-learner/org/dllearner/kb/old/ClassNode.java ___________________________________________________________________ Added: svn:mergeinfo + Modified: trunk/src/dl-learner/org/dllearner/kb/old/DBpediaNavigatorManipulator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/old/DBpediaNavigatorManipulator.java 2008-08-14 17:33:24 UTC (rev 1075) +++ trunk/src/dl-learner/org/dllearner/kb/old/DBpediaNavigatorManipulator.java 2008-08-14 17:35:50 UTC (rev 1076) @@ -23,7 +23,6 @@ import java.util.LinkedList; import java.util.Set; -import org.dllearner.kb.extraction.Node; import org.dllearner.utilities.datastructures.StringTuple; /** Copied: trunk/src/dl-learner/org/dllearner/kb/old/InstanceNode.java (from rev 1075, trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/old/InstanceNode.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/old/InstanceNode.java 2008-08-14 17:35:50 UTC (rev 1076) @@ -0,0 +1,122 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.kb.old; + +import java.net.URI; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; +import java.util.Vector; + +import org.dllearner.utilities.datastructures.StringTuple; + +/** + * A node in the graph that is an instance. + * + * @author Sebastian Hellmann + * + */ +public class InstanceNode extends Node { + + Set<ClassNode> classes = new HashSet<ClassNode>(); + Set<StringTuple> datatypes = new HashSet<StringTuple>(); + Set<PropertyNode> properties = new HashSet<PropertyNode>(); + + public InstanceNode(URI u) { + super(u); + // this.type = "instance"; + + } + + // expands all directly connected nodes + @Override + public Vector<Node> expand(TypedSparqlQueryInterface tsq, Manipulators m) { + + Set<StringTuple> s = tsq.getTupelForResource(uri); + // see Manipulator + s=m.check(s, this); + // System.out.println("fffffff"+m); + Vector<Node> Nodes = new Vector<Node>(); + + Iterator<StringTuple> it = s.iterator(); + while (it.hasNext()) { + StringTuple t = (StringTuple) it.next(); + //QUALITY: needs proper handling of ressource, could be done one step lower in the onion + if(!t.b.startsWith("http:"))continue; + + // basically : if p is rdf:type then o is a class + // else it is an instance + try { + if (t.a.equals(Manipulators.type)) { + ClassNode tmp = new ClassNode(new URI(t.b)); + classes.add(tmp); + Nodes.add(tmp); + } else { + InstanceNode tmp = new InstanceNode(new URI(t.b)); + properties.add(new PropertyNode(new URI(t.a), this, tmp)); + Nodes.add(tmp); + + } + } catch (Exception e) { + System.out.println("Problem with: " + t); + e.printStackTrace(); + } + + } + expanded = true; + return Nodes; + } + + // gets the types for properties recursively + @Override + public void expandProperties(TypedSparqlQueryInterface tsq, Manipulators m) { + for (PropertyNode one : properties) { + one.expandProperties(tsq, m); + } + + } + + @Override + public SortedSet<String> toNTriple() { + SortedSet<String> s = new TreeSet<String>(); + s.add("<" + uri + "><" + rdftype + "><" + thing + ">."); + for (ClassNode one : classes) { + s.add("<" + uri + "><" + rdftype + "><" + one.getURI() + ">."); + s.addAll(one.toNTriple()); + } + for (PropertyNode one : properties) { + s.add("<" + uri + "><" + one.getURI() + "><" + one.getB().getURI() + + ">."); + s.addAll(one.toNTriple()); + s.addAll(one.getB().toNTriple()); + } + + return s; + } + + @Override + public int compareTo(Node n) { + return super.compareTo(n); + // + } + +} Property changes on: trunk/src/dl-learner/org/dllearner/kb/old/InstanceNode.java ___________________________________________________________________ Added: svn:mergeinfo + Modified: trunk/src/dl-learner/org/dllearner/kb/old/Manipulators.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/old/Manipulators.java 2008-08-14 17:33:24 UTC (rev 1075) +++ trunk/src/dl-learner/org/dllearner/kb/old/Manipulators.java 2008-08-14 17:35:50 UTC (rev 1076) @@ -2,7 +2,6 @@ import java.util.Set; -import org.dllearner.kb.extraction.Node; import org.dllearner.utilities.datastructures.StringTuple; public interface Manipulators { Copied: trunk/src/dl-learner/org/dllearner/kb/old/Node.java (from rev 1075, trunk/src/dl-learner/org/dllearner/kb/extraction/Node.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/old/Node.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/old/Node.java 2008-08-14 17:35:50 UTC (rev 1076) @@ -0,0 +1,99 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.kb.old; + +import java.net.URI; +import java.util.SortedSet; +import java.util.Vector; + + + +/** + * Abstract class. defines functions to expand the nodes + * + * @author Sebastian Hellmann + * + */ +public abstract class Node implements Comparable<Node> { + + final String subclass = "http://www.w3.org/2000/01/rdf-schema#subClassOf"; + final String rdftype = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"; + final String objectProperty = "http://www.w3.org/2002/07/owl#ObjectProperty"; + final String classns = "http://www.w3.org/2002/07/owl#Class"; + final String thing = "http://www.w3.org/2002/07/owl#Thing"; + + URI uri; + // protected String type; + protected boolean expanded = false; + + public Node(URI u) { + this.uri = u; + } + + /** + * Nodes are expanded with a certain context, given by the typedSparqlQuery + * and the manipulator + * + * @param typedSparqlQuery + * @param manipulator + * @return Vector<Node> all Nodes that are new because of expansion + */ + public abstract Vector<Node> expand( + TypedSparqlQueryInterface typedSparqlQuery, Manipulators manipulator); + + /** + * gets type defs for properties like rdf:type SymmetricProperties + * + * @param typedSparqlQuery + * @param manipulator + * @return Vector<Node> + */ + public abstract void expandProperties( + TypedSparqlQueryInterface typedSparqlQuery, Manipulators manipulator); + + /** + * output + * + * @return a set of n-triple + */ + public abstract SortedSet<String> toNTriple(); + + @Override + public String toString() { + return "Node: " + uri + ":" + this.getClass().getSimpleName(); + + } + + public URI getURI() { + return uri; + } + + public boolean equals(Node n) { + if (this.uri.equals(n.uri)) + return true; + else + return false; + } + + public int compareTo(Node n) { + return this.uri.toString().compareTo(n.uri.toString()); + } + +} Modified: trunk/src/dl-learner/org/dllearner/kb/old/OldManipulator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/old/OldManipulator.java 2008-08-14 17:33:24 UTC (rev 1075) +++ trunk/src/dl-learner/org/dllearner/kb/old/OldManipulator.java 2008-08-14 17:35:50 UTC (rev 1076) @@ -24,9 +24,6 @@ import java.util.LinkedList; import java.util.Set; -import org.dllearner.kb.extraction.ClassNode; -import org.dllearner.kb.extraction.InstanceNode; -import org.dllearner.kb.extraction.Node; import org.dllearner.utilities.datastructures.StringTuple; /** Copied: trunk/src/dl-learner/org/dllearner/kb/old/PropertyNode.java (from rev 1075, trunk/src/dl-learner/org/dllearner/kb/extraction/PropertyNode.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/old/PropertyNode.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/old/PropertyNode.java 2008-08-14 17:35:50 UTC (rev 1076) @@ -0,0 +1,121 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.kb.old; + +import java.net.URI; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; +import java.util.Vector; + +import org.dllearner.utilities.datastructures.StringTuple; + +/** + * Property node, has connection to a and b part + * + * @author Sebastian Hellmann + * + */ + +public class PropertyNode extends Node { + + // the a and b part of a property + private Node a; + private Node b; + // specialtypes like owl:symmetricproperty + private Set<String> specialTypes; + + public PropertyNode(URI u, Node a, Node b) { + super(u); + // this.type = "property"; + this.a = a; + this.b = b; + this.specialTypes = new HashSet<String>(); + } + + // Property Nodes are normally not expanded, + // this function is never called + @Override + public Vector<Node> expand(TypedSparqlQueryInterface tsq, Manipulators m) { + return null; + } + + // gets the types for properties recursively + @Override + public void expandProperties(TypedSparqlQueryInterface tsq, Manipulators m) { + b.expandProperties(tsq, m); + Set<StringTuple> s = tsq.getTupelForResource(uri); + + Iterator<StringTuple> it = s.iterator(); + while (it.hasNext()) { + StringTuple t = (StringTuple) it.next(); + try { + if (t.a.equals(Manipulators.type)) { + specialTypes.add(t.b); + } + } catch (Exception e) { + System.out.println(t); + e.printStackTrace(); + } + + } + + } + + public Node getA() { + return a; + } + + public Node getB() { + return b; + } + + @Override + public SortedSet<String> toNTriple() { + SortedSet<String> s = new TreeSet<String>(); + s.add("<" + uri + "><" + + "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + "><" + + "http://www.w3.org/2002/07/owl#ObjectProperty" + ">."); + for (String one : specialTypes) { + s.add("<" + uri + "><" + + "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + "><" + + one + ">."); + + } + + return s; + } + + @Override + public boolean equals(Node n) { + if (this.uri.equals(n.uri)) + return true; + else + return false; + } + + @Override + public int compareTo(Node n) { + return super.compareTo(n); + } + +} Property changes on: trunk/src/dl-learner/org/dllearner/kb/old/PropertyNode.java ___________________________________________________________________ Added: svn:mergeinfo + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |