From: <sk...@us...> - 2008-09-23 08:30:58
|
Revision: 1239 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1239&view=rev Author: sknappe Date: 2008-09-23 08:30:47 +0000 (Tue, 23 Sep 2008) Log Message: ----------- some design changes Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/helper_functions.php Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-22 17:17:49 UTC (rev 1238) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-23 08:30:47 UTC (rev 1239) @@ -81,11 +81,22 @@ $content.=', <img src="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/>'; + if (isset($triples['http://www.w3.org/2002/07/owl#sameAs'])){ + $content.='<br/><hr><h4>Same as</h4><br/>'; + $content.='<ul>'; + foreach ($triples['http://www.w3.org/2002/07/owl#sameAs'] as $same){ + if ($same['type']=="uri") + $content .= '<li><a href="'.$same['value'].'" target="_blank">'.urldecode($same['value']).'</a></li>'; + else $content.= '<li>'.urldecode($same['value']).'</li>'; + } + $content.='</ul>'; + } + $content.='<br/><hr><h4>YAGO Classes</h4><br/>'; + // display a list of classes if(isset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'])) - $content .= '<p>Yago classes: '.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; + $content .= '<p>'.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; //skos-subjects //not used, because one class systems, YAGO, is enough @@ -96,7 +107,8 @@ $content .= '</ul></p>'; }*/ - //not used at the moment + //references not used at the moment because some urls cause problems with + //the xml parser that recognizes html entities, where no entities are /*if(isset($triples['http://dbpedia.org/property/reference'])) { $content .= '<p>references: <ul>'; foreach($triples['http://dbpedia.org/property/reference'] as $reference) @@ -117,13 +129,35 @@ } //display only one birthdate - $birthdates=array("http://dbpedia.org/property/dateOfBirth","http://dbpedia.org/property/birth"); + $birthdates=array("http://dbpedia.org/property/dateOfBirth","http://dbpedia.org/property/birth","http://dbpedia.org/property/birthDate"); $date=false; foreach ($birthdates as $dates){ - if ($date) unset($triples[$dates]); - if (isset($triples[$dates])&&!$date) $date=true; + if ($date){ + unset($triples[$dates]); + continue; + } + if (isset($triples[$dates])&&$triples[$dates][0]['type']!='uri') $date=true; + else unset($triples[$dates]); } + //display only one deathdate + $deathdates=array("http://dbpedia.org/property/death","http://dbpedia.org/property/dateOfDeath","http://dbpedia.org/property/deathDate"); + $date=false; + foreach ($deathdates as $dates){ + if ($date){ + unset($triples[$dates]); + continue; + } + if (isset($triples[$dates])&&$triples[$dates][0]['type']!='uri') $date=true; + else unset($triples[$dates]); + } + + //display a small characteristics of a person, if at least the birth date is given + if ($date){ + $information=array(); + } + + //display foreign wiki pages $languages=array('Deutsch'=>'http://dbpedia.org/property/wikipage-de' ,'Espa%C3%B1ol'=>'http://dbpedia.org/property/wikipage-es' @@ -153,6 +187,7 @@ // filter out uninteresting properties and properties which // have already been displayed + unset($triples['http://www.w3.org/2002/07/owl#sameAs']); unset($triples['http://xmlns.com/foaf/0.1/page']); unset($triples['http://xmlns.com/foaf/0.1/depiction']); unset($triples['http://dbpedia.org/property/abstract']); @@ -173,8 +208,25 @@ unset($triples['http://dbpedia.org/property/latDeg']); unset($triples['http://dbpedia.org/property/lonMin']); unset($triples['http://www.georss.org/georss/point']); + unset($triples['http://dbpedia.org/property/audioProperty']); + unset($triples['http://dbpedia.org/property/wikiPageUsesTemplate']); + unset($triples['http://dbpedia.org/property/relatedInstance']); + unset($triples['http://dbpedia.org/property/boxWidth']); + unset($triples['http://dbpedia.org/property/pp']); + unset($triples['http://dbpedia.org/property/caption']); + unset($triples['http://dbpedia.org/property/s']); + unset($triples['http://dbpedia.org/property/lifetimeProperty']); + unset($triples['http://dbpedia.org/property/imagesize']); + unset($triples['http://dbpedia.org/property/id']); + unset($triples['http://dbpedia.org/property/issue']); + if ($triples['http://dbpedia.org/property/hips'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/hips']); + if ($triples['http://dbpedia.org/property/weight'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/weight']); + if ($triples['http://dbpedia.org/property/waist'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/waist']); + if ($triples['http://dbpedia.org/property/height'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/height']); + unset($triples['http://www.geonames.org/ontology#featureCode']); + unset($triples['http://www.geonames.org/ontology#featureClass']); + unset($triples['http://dbpedia.org/property/dmozProperty']); - if (count($triples)>0){ $content.='<br/><hr><h4>Remaining Triples</h4><br/>'; Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-09-22 17:17:49 UTC (rev 1238) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-09-23 08:30:47 UTC (rev 1239) @@ -13,7 +13,7 @@ //add the uri $subject="http://dbpedia.org/resource/".$subject; - return $subject; + return urldecode($subject); } function getTagCloud($tags,$label) @@ -232,7 +232,7 @@ foreach($object as $element) { if ($element['type']=="uri"){ if (strpos($element['value'],"http://dbpedia.org/resource/")===0&&substr_count($element['value'],"/")==4&&strpos($element['value'],"Template:")!=28){ - $label=substr($element['value'],28); + $label=str_replace('_',' ',substr($element['value'],28)); $table .= '<li><a href="#" onclick="get_article(\'label='.$element['value'].'&cache=-1\');return false;">'.urldecode($label).'</a></li>'; } else $table .= '<li><a href="'.$element['value'].'" target="_blank">'.urldecode($element['value']).'</a></li>'; @@ -290,10 +290,12 @@ $string="<ul>"; for($i=0; $i<count($ar); $i++) { + $yagoPrefix = 'http://dbpedia.org/class/yago/'; + if(substr($ar[$i]['value'],0,30)!=$yagoPrefix) continue; $query="SELECT label FROM categories WHERE category='".$ar[$i]['value']."' LIMIT 1"; $res=$databaseConnection->query($query); $result=$databaseConnection->nextEntry($res); - if ($ar[$i]['value']!="http://xmlns.com/foaf/0.1/Person") $string .= '<li>' . formatClass($ar[$i]['value'],$result['label']).'</li>'; + $string .= '<li>' . formatClass($ar[$i]['value'],$result['label']).'</li>'; } return $string."</ul>"; } @@ -301,17 +303,7 @@ // format a class nicely, i.e. link to it and possibly display // it in a better way function formatClass($className,$label) { - $yagoPrefix = 'http://dbpedia.org/class/yago/'; - if(substr($className,0,30)==$yagoPrefix) { - return $label.' <a href="#" onclick="getSubjectsFromCategory(\'category='.$className.'&number=10\');">→ search Instances</a> <a href="#" onclick="get_class(\'class='.$className.'&cache=-1\');">→ show Class in Hierarchy</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.'" target="_blank">'.$className.'</a>'; - } else { - return $className; - } + return $label.' <a href="#" onclick="getSubjectsFromCategory(\'category='.$className.'&number=10\');">→ search Instances</a> <a href="#" onclick="get_class(\'class='.$className.'&cache=-1\');">→ show Class in Hierarchy</a>'; } function arrayToCommaSseparatedList($ar) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |