SlideShare a Scribd company logo
SEMANTIC RESULT FORMATS  AUTOMATICALLY TRANSFORMING STRUCTURED DATA INTO USEFUL OUTPUT FORMATS Frank Dengler (Karlsruhe Institute of Technology) Hans-Jörg Happel (FZI Research Center for IT) Wikimania 2010, Gdansk (Poland) July, 10th, 2010 Free for usage and distribution under similar conditions (does not inclue  images) http://creativecommons.org/licenses/by-sa/2.0/ v1.0 09.07.2010 © Frank Dengler, Hans-Jörg Happel, KIT/FZI http://www.slideshare.net/hhappel/2010-0710semanticresultformats-v4b
Agenda ,[object Object],[object Object],[object Object],[object Object],Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
Motivation: „Show all bakeries open after midnight“ Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
Motivation: „Show all events in the Wiki by date“ Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
Semantic MediaWiki (SMW) Distilled ,[object Object],[object Object],== Conference Archive (this year) == For a full archive of conferences [[Conferences/Archive|click here]]. {{#ask:[[Category:Conference]] [[Start date::>{{CURRENTYEAR}}]] |?Location |?Start date |?End date |format=broadtable |sort=Start date |order=desc |limit=50 }} Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
Semantic Result Formats (SRF) ,[object Object],[object Object],[object Object],[object Object],Maps and Semantic Maps Talk by Jeroen De Dauw Later this afternoon@ 04:30 PM Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
SRF Distilled {{#ask:[[Category:Conference]] |?Location |?Start date |?End date | format=myresultformat }} MyResultPrinter.php (do magic here…) Query results <table width=&quot;100%&quot; id=&quot;querytable5&quot; class=&quot;smwtable&quot;> <tbody><tr> <td><a title=&quot;Velocity 2010&quot; href=&quot;/Velocity_2010&quot;>Velocity 2010</a></td> <td><a title=&quot;Santa Clara, CA&quot; href=&quot;/Santa_Clara,_CA&quot;>Santa Clara, CA</a></td> <td>22 June 2010</td> <td>24 June 2010 23:59:00</td> </tr> <tr> <td><a title=&quot;RailsConf 2010&quot; href=&quot;/RailsConf_2010&quot;>RailsConf 2010</a></td> <td><a title=&quot;Baltimore, MD&quot; href=&quot;/Baltimore,_MD&quot;>Baltimore, MD</a></td> <td>7 June 2010</td> <td>10 June 2010 23:59:00</td> </tr> ... HTML Code Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
SRF Overview Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) Type / Included in SMW Core Extension:SRF Custom Extension List Table/Broadtable List/ol/ul Category Outline Graphing Graph Googlebar/-pie Ploticus Process SMW+ (2D/3D-bar, line chart) UMLClass Time-based Timeline Eventline Calendar Further presentations Exhibit Gallery Semantic Maps Export RSS CSV JSON iCalendar vCard Bibtex Other Count Template Embedded Debug Math
Eventline Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) {{#ask: [[Category:Conference]] |?Start date |?Location |sort=Start date |order=desc |format=timeline |timelineposition=today |timelinebands=DAY,MONTH, YEAR |limit=5000 }}
Timeline Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) http://www.techpresentations.org/Conferences {{#ask: [[Category:Conference]] |?Start date |?End date |?Location |sort=Start date |order=desc |format=timeline |timelineposition=today |timelinebands=DAY,MONTH, YEAR |limit=5000 }}
Calendar format Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) http://discoursedb.org/wiki/Opinion_calendar {{#ask: [[Category:Items]] [[Was published on::>{{#calendarstartdate:}}]] [[Was published on::<{{#calendarenddate:}}]] |? Was published on |limit=200 |format=calendar }}
Pie chart {{#ask:[[Category:Country]]  [[located in::North America]] [[population::+]] |?population |format=googlepie }} Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
Bar chart {{#ask:[[Category:Country]]  [[located in::North America]] [[population::+]] |?population |format=googlebar }} Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
Graph Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) {{#ask: [[Category:Person]] | ?has child  | ?knows | format=graph | graphcolor=Yes | graphlink=Yes | graphlegend=Yes | graphlabel=No | graphsize=10,10 | rankdir=TB }}
Process diagram Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) {{#ask: [[Category:Process Step]]  [[Category:{{PAGENAME}}]]  | ?has OrSuccessor=hasorsuccessor  | ?has Successor=hassuccessor  | ?hascontruesuccessor  | ?hasconfalsesuccessor | ?has Condition=hascondition  | ?has Role=hasrole  | ?uses Resource=usesresource | ?has Status=hasstatus | format=process | graphsize=12,12 | graphvalidation=no | showroles=yes | showstatus=yes | showresources=yes }}
UML diagram Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) {{#ask: [[Category:UML Class]] | ?has attribute | ?has method | ?UML association | ?inherits from | ?has stereotype | format=umlclass }}
BibTex - export Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) @Inproceedings{dengler2010cmwsm, address = &quot;Gdansk, Poland&quot;,  author = &quot;Frank Dengler and Hans-J{o}rg Happel&quot;,  booktitle = &quot;Proceedings of the 6th International Symposium on Wikis and Open Collaboration&quot;,  month = &quot;Juli&quot;,  publisher = &quot;ACM&quot;,  title = &quot;Collaborative Modeling with Semantic MediaWiki&quot;,  year = &quot;2010&quot;,  } {{#ask: [[{{BASEPAGENAME}}]] | ?author | ?title | ?booktitle | ?year | ?edition | ?volume | ?number | ?series | ?pages | ?address | ?month | ?organization | ?publisher | ?note | ?bibtype=type | format=bibtex }}
iCalender export Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) BEGIN:VCALENDAR PRODID:-//SMW Project//Semantic Result Formats VERSION:2.0 METHOD:PUBLISH X-WR-CALNAME:Special:Ask/-5B-5BISWC2008-5D-5D/-3FStart-20date=start/format=icalendar/limit=20 BEGIN:VEVENT SUMMARY:ISWC2008 URL:http://semanticweb.org/wiki/ISWC2008 UID:http://semanticweb.org/wiki/ISWC2008 DTSTART:20081026 DTSTAMP:20090428T135015 SEQUENCE:44833 END:VEVENT END:VCALENDAR {{#ask: [[Category:Person]] | ?startdate = start  | ?enddate = end  | ?location  | format=icalendar }}
vCard export Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) BEGIN:VCARD VERSION:3.0 N;CHARSET=UTF-8:Krötzsch;Markus;;; FN;CHARSET=UTF-8:Markus Krötzsch CLASS:PUBLIC ORG;CHARSET=UTF-8:AIFB; EMAIL;TYPE=internet:mak@aifb.uni-karlsruhe.de TEL;TYPE=WORK:+49-721-608-7362 SOURCE;CHARSET=UTF-8:http://semanticweb.org/wiki/User:Markus_Kr%C3%B6tzsch PRODID:-////Semantic MediaWiki REV:20091113101319 URL:http://korrekt.org UID:http://semanticweb.org/wiki/User:Markus_Kr%C3%B6tzsch END:VCARD {{#ask: [[Category:Person]]  | ?firstname  | ?lastname  | ?url = homepage  | format=vcard }}
Outline Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) {{#ask:[[Category:Items]] |? Was published by |? Was written by |? Addresses topic |format=outline |outlineproperties=Was published by, Was written by |sort=Was published by }}
Gallery Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) {{#ask: [[Category:Photos]]  | ?caption  | format=gallery }}
Exhibit Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) {{#ask: [[Category:Beer]]  | ?brewed by  | ?beer type=Beer | ?brewed in city  | ?brewed in state  | ?brewed in country | ?Image URL  | ?Brewed Coordinate  | format=exhibit  | views=tiles,tabular, map  | facets=search,Brewed in Country | limit=100  | mainlabel=Beer Name  | height=600px | sort=brewed in country,Beer Type | lens=beer2 }}
INSIDE SEMANTIC RESULT FORMATS MyResultPrinter.php (do magic here…) Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
Implementing SRF result printers: core workflow ,[object Object],[object Object],[object Object],[object Object],[object Object],Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
Configuring Semantic Result Formats ,[object Object],[object Object],[object Object],[object Object],# Semantic Result Formats Extension must be included before! # ... $smwgResultFormats['myprinter'] = 'SRFMyPrinter'; $wgAutoloadClasses['SRFMyPrinter'] = $IP .    '/extensions/SemanticResultFormats/MyPrinter/SRF_MyPrinter.php'; Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
Printers need to extend SMWResultPrinter ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
getResultText($res, $outputmode) ,[object Object],1)  $res  is a  SMWQueryResult  which contains all rows. $res  getNext() will return an  array of  SWM_ResultArrays representing one row 2) One row is an  array of   SWM_ResultArray  objects.  Each SMW_ResultArray repre-sents one column of the row. 3) One column in one particular row is a  SMW_ResultArrayObject  ( $s ).  $s  getNextObject()  will retrieve an array of content items  representing the values in the cell  (alternatively, you may use “ foreach ($s  getContent() as $value) ”).    Calling  $s->getPrintRequest()-> getLabel()  will return a  String with the column head  (e.g. “Located in” in this case)   Usually, this will only be one array element, but it can be more (as in the example here). Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
getResultText($res, $outputmode) Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) $row = $res->getNext(); // iterate rows in query result set while ($row != fale){ // iterate columns in row foreach ($row as $field) {  $columnTitle = $field->getPrintRequest(); //  e.g. „Located in“ // iterate all values in column foreach ($field->getContent() as $value){  $val = $value->getShortWikiText();  //  e.g. „Baden-Würrtemberg“ } } $row = $res->getNext(); }
readParameters($params, $outputmode) ,[object Object],[object Object],[object Object],[object Object],Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) {{#ask:[[Category:Conference]] |?Location |?Start date |?End date |param1=value1 |param2=value2 }}
HANDS-ON EXAMPLE Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
Create a new Result Printer to label links to wiki pages ,[object Object],[object Object],[object Object],[object Object],Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
Create new php file  SRF_MyPrinter.php   Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) <?php /** * @note AUTOLOADED */ if( !defined( 'MEDIAWIKI' ) ) { die( 'Not an entry point.' ); } class  SRFMyPrinter  extends SMWResultPrinter { $m_outputtype=''; protected function readParameters($params, $outputmode) { SMWResultPrinter::readParameters($params,$outputmode); } protected function getResultText($res, $outputmode) { $result = ''; return $result; } }
Method readParameters() ,[object Object],[object Object],Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) protected function readParameters($params, $outputmode) { SMWResultPrinter::readParameters($params,$outputmode); if (array_key_exists('outputtype', $this->m_params)) { $this->m_outputtype = trim($this->m_params['outputtype']); } } {{#ask:[[Category:Conference]] |?Location |?Start date |?End date |format=myresultformat | outputtype=upper  }}
Method getResultText() Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) protected function getResultText($res, $outputmode) { $result = ''; $this->isHTML = true; $row = $res->getNext(); while ( $row !== false ) { $wikipage = $row[0]->getResultSubject(); // get the object $subject = $wikipage->getLongWikiText(); $label=''; foreach ($row as $field) { $req = $field->getPrintRequest(); if ( (strtolower($req->getLabel()) == &quot;haslabel&quot;) ) { $value = current($field->getContent()); //save only the first if ($value !== false) $label = $value->getShortWikiText(); } } if ($label==&quot;&quot;) $label = $subject; $result .= '<a href=&quot;'. $wikipage->getTitle()->getFullURL(); if ($this->m_outputtype=='upper') $label = strtoupper($label); $result .= '&quot;>' . $label . '</a>, ’; $row = $res->getNext(); } if (strlen($result)>2) $result = substr($result, 0, -2); return $result; }
Method getResultText() - in detail ,[object Object],[object Object],Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) protected function getResultText($res, $outputmode) { $result = ''; $this->isHTML = true; $row = $res->getNext(); while ( $row !== false ) { $wikipage = $row[0]->getResultSubject(); // get the object $subject = $wikipage->getLongWikiText(); $label=''; foreach ($row as $field) { $req = $field->getPrintRequest(); if ( (strtolower($req->getLabel()) == &quot;haslabel&quot;) ) { $value = current($field->getContent()); //save only the first if ($value !== false) $label = $value->getShortWikiText(); } } if ($label==&quot;&quot;) $label = $subject; $result .= '<a href=&quot;'. $wikipage->getTitle()->getFullURL(); if ($this->m_outputtype=='upper') $label = strtoupper($label); $result .= '&quot;>' . $label . '</a>, ’; $row = $res->getNext(); } if (strlen($result)>2) $result = substr($result, 0, -2); return $result; }
Method getResultText() – in detail ,[object Object],Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) protected function getResultText($res, $outputmode) { … $row = $res->getNext(); while ( $row !== false ) { $wikipage = $row[0]->getResultSubject(); // get the object $subject = $wikipage->getLongWikiText(); … } … $row = $res->getNext(); } … }
Method getResultText() – in detail ,[object Object],[object Object],Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) protected function getResultText($res, $outputmode) { … $row = $res->getNext(); while ( $row !== false ) { $wikipage = $row[0]->getResultSubject(); // get the object $subject = $wikipage->getLongWikiText(); … } … $row = $res->getNext(); } … }
Method getResultText() – in detail ,[object Object],Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) protected function getResultText($res, $outputmode) { … while ( $row !== false ) { … foreach ($row as $field) { $req = $field->getPrintRequest(); if ( (strtolower($req->getLabel()) == &quot;haslabel&quot;) ) { $value = current($field->getContent()); //save only the first if ($value !== false) $label = $value->getShortWikiText(); } } … } … }
Method getResultText() – in detail ,[object Object],Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) protected function getResultText($res, $outputmode) { … while ( $row !== false ) { … foreach ($row as $field) { $req = $field->getPrintRequest(); if ( (strtolower($req->getLabel()) == &quot;haslabel&quot;) ) { $value = current($field->getContent()); //save only the first if ($value !== false) $label = $value->getShortWikiText(); } } … } … }
Method getResultText() – in detail ,[object Object],Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) protected function getResultText($res, $outputmode) { … while ( $row !== false ) { … foreach ($row as $field) { $req = $field->getPrintRequest(); if ( (strtolower($req->getLabel()) == &quot;haslabel&quot;) ) { $value = current($field->getContent()); //save only the first if ($value !== false) $label = $value->getShortWikiText(); } } … } … } // get all values (comma separated) foreach ($field->getContent() as $value) { $label .= ($label?',':'') . $value->getShortWikiText(); }
Method getResultText() ,[object Object],Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) protected function getResultText($res, $outputmode) { … while ( $row !== false ) { … foreach ($row as $field) { … } if ($label==&quot;&quot;) $label = $subject; $result .= '<a href=&quot;'. $wikipage->getTitle()->getFullURL(); if ($this->m_outputtype=='upper') $label = strtoupper($label); $result .= '&quot;>' . $label . '</a>, ’; … } if (strlen($result)>2) $result = substr($result, 0, -2); return $result; }
Method getResultText() ,[object Object],Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) protected function getResultText($res, $outputmode) { … while ( $row !== false ) { … foreach ($row as $field) { … } if ($label==&quot;&quot;) $label = $subject; $result .= '<a href=&quot;'. $wikipage->getTitle()->getFullURL(); if ($this->m_outputtype=='upper') $label = strtoupper($label); $result .= '&quot;>' . $label . '</a>, ’; … } if (strlen($result)>2) $result =  substr($result, 0, -2); return $result; }
Method getResultText() ,[object Object],Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) protected function getResultText($res, $outputmode) { … while ( $row !== false ) { … foreach ($row as $field) { … } if ($label==&quot;&quot;) $label = $subject; $result .= '<a href=&quot;'. $wikipage->getTitle()->getFullURL(); if ($this->m_outputtype=='upper') $label = strtoupper($label); $result .= '&quot;>' . $label . '</a>, ’; … } if (strlen($result)>2) $result = substr($result, 0, -2); return $result; }
Method getResultText() ,[object Object],[object Object],Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) protected function getResultText($res, $outputmode) { … while ( $row !== false ) { … foreach ($row as $field) { … } if ($label==&quot;&quot;) $label = $subject; $result .= '<a href=&quot;'. $wikipage->getTitle()->getFullURL(); if ($this->m_outputtype=='upper') $label = strtoupper($label); $result .= '&quot;>' . $label . '</a>, ’; … } if (strlen($result)>2) $result = substr($result, 0, -2); return $result; }
Method getResultText() Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) protected function getResultText($res, $outputmode) { $result = ''; $this->isHTML = true; $row = $res->getNext(); while ( $row !== false ) { $wikipage = $row[0]->getResultSubject(); // get the object $subject = $wikipage->getLongWikiText(); $label=''; foreach ($row as $field) { $req = $field->getPrintRequest(); if ( (strtolower($req->getLabel()) == &quot;haslabel&quot;) ) { $value = current($field->getContent()); //save only the first if ($value !== false) $label = $value->getShortWikiText(); } } if ($label==&quot;&quot;) $label = $subject; $result .= '<a href=&quot;'. $wikipage->getTitle()->getFullURL(); if ($this->m_outputtype=='upper') $label = strtoupper($label); $result .= '&quot;>' . $label . '</a>, ’; $row = $res->getNext(); } if (strlen($result)>2) $result = substr($result, 0, -2); return $result; }
Configure in LocalSettings.php  ,[object Object],[object Object],[object Object],[object Object],# Semantic Result Formats Extension must be included before! # ... $smwgResultFormats['myprinter'] = 'SRFMyPrinter'; $wgAutoloadClasses['SRFMyPrinter'] = $IP .    '/extensions/SemanticResultFormats/MyPrinter/SRF_MyPrinter.php'; Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
Use your new  Result Printer {{#ask:[[Category:Conference]] |?has label |format=myresultformat |outputtype=upper  }} Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
Resources ,[object Object],[object Object],[object Object],[object Object],Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
Summary ,[object Object],[object Object],Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) Maps and Semantic Maps Talk by Jeroen De Dauw Later this afternoon@ 04:30 PM Frank Dengler [email_address] www.aifb.kit.edu
SRF_MyPrinter.php (for copy/paste) Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) <?php/** * Print query results in interactive timelines. * @author Frank Dengler * @author Hans-Joerg Happel * @file * @ingroup SemanticResultFormats *//** * Result printer for labeling links to wiki pages. * @ingroup SemanticResultFormats */if( !defined( 'MEDIAWIKI' ) ) {  die( 'Not an entry point.' );}class SRFMyPrinter extends SMWResultPrinter {  protected $m_outputtype='';  protected function readParameters($params, $outputmode) {  SMWResultPrinter::readParameters($params,$outputmode);  if (array_key_exists('outputtype', $this->m_params)) {  $this->m_outputtype = trim($this->m_params['outputtype']);  }  }  protected function getResultText($res, $outputmode) {  $result = '';  $this->isHTML = true;   $row = $res->getNext();  while ( $row !== false ) {  $wikipage = $row[0]->getResultSubject(); // get the object  $subject = $wikipage->getLongWikiText();  $label='';  foreach ($row as $field) {  $req = $field->getPrintRequest();  if ( (strtolower($req->getLabel()) == &quot;haslabel&quot;) ) {  $value = current($field->getContent()); //save only the first  if ($value !== false) $label = $value->getShortWikiText();  }  }  if ($label==&quot;&quot;) $label = $subject;  $result .= '<a href=&quot;'. $wikipage->getTitle()->getFullURL();  if ($this->m_outputtype=='upper') $label = strtoupper($label);  $result .= '&quot;>' . $label . '</a>, ';  $row = $res->getNext();  }  if (strlen($result)>2) substr($result, 0, -2);  return $result;  }}

More Related Content

What's hot

LOD2 Webinar Series Classification and Quality Analysis with DL Learner and ORE
LOD2 Webinar Series Classification and Quality Analysis with DL Learner and ORELOD2 Webinar Series Classification and Quality Analysis with DL Learner and ORE
LOD2 Webinar Series Classification and Quality Analysis with DL Learner and ORE
LOD2 Creating Knowledge out of Interlinked Data
 
LOD2 Webinar Series: 3rd relase of the Stack
LOD2 Webinar Series: 3rd relase of the StackLOD2 Webinar Series: 3rd relase of the Stack
LOD2 Webinar Series: 3rd relase of the Stack
LOD2 Creating Knowledge out of Interlinked Data
 
Registration / Certification Interoperability Architecture (overlay peer-review)
Registration / Certification Interoperability Architecture (overlay peer-review)Registration / Certification Interoperability Architecture (overlay peer-review)
Registration / Certification Interoperability Architecture (overlay peer-review)
Herbert Van de Sompel
 
Linked data life cycles
Linked data life cyclesLinked data life cycles
Linked data life cycles
Michael Hausenblas
 
Linked Open Projects (DCMI Library Community)
Linked Open Projects (DCMI Library Community)Linked Open Projects (DCMI Library Community)
Linked Open Projects (DCMI Library Community)
Kai Eckert
 
Linked Open (Geo)Data and the Distributed Ontology Language – a perfect match
Linked Open (Geo)Data and the Distributed Ontology Language – a perfect matchLinked Open (Geo)Data and the Distributed Ontology Language – a perfect match
Linked Open (Geo)Data and the Distributed Ontology Language – a perfect match
Christoph Lange
 

What's hot (7)

LOD2 Webinar Series Classification and Quality Analysis with DL Learner and ORE
LOD2 Webinar Series Classification and Quality Analysis with DL Learner and ORELOD2 Webinar Series Classification and Quality Analysis with DL Learner and ORE
LOD2 Webinar Series Classification and Quality Analysis with DL Learner and ORE
 
LOD2 Webinar Series: 3rd relase of the Stack
LOD2 Webinar Series: 3rd relase of the StackLOD2 Webinar Series: 3rd relase of the Stack
LOD2 Webinar Series: 3rd relase of the Stack
 
Registration / Certification Interoperability Architecture (overlay peer-review)
Registration / Certification Interoperability Architecture (overlay peer-review)Registration / Certification Interoperability Architecture (overlay peer-review)
Registration / Certification Interoperability Architecture (overlay peer-review)
 
LOD2 Webinar: SIREn
LOD2 Webinar: SIREnLOD2 Webinar: SIREn
LOD2 Webinar: SIREn
 
Linked data life cycles
Linked data life cyclesLinked data life cycles
Linked data life cycles
 
Linked Open Projects (DCMI Library Community)
Linked Open Projects (DCMI Library Community)Linked Open Projects (DCMI Library Community)
Linked Open Projects (DCMI Library Community)
 
Linked Open (Geo)Data and the Distributed Ontology Language – a perfect match
Linked Open (Geo)Data and the Distributed Ontology Language – a perfect matchLinked Open (Geo)Data and the Distributed Ontology Language – a perfect match
Linked Open (Geo)Data and the Distributed Ontology Language – a perfect match
 

Viewers also liked

Semantic Need: Guiding Metadata Annotations by Questions People #ask
Semantic Need: Guiding Metadata Annotations by Questions People #askSemantic Need: Guiding Metadata Annotations by Questions People #ask
Semantic Need: Guiding Metadata Annotations by Questions People #ask
Hans-Joerg Happel
 
Woogle4MediaWiki - From Searchers to Contributors
Woogle4MediaWiki - From Searchers to ContributorsWoogle4MediaWiki - From Searchers to Contributors
Woogle4MediaWiki - From Searchers to Contributors
Hans-Joerg Happel
 
Semantic Need : Semantics from the People!
Semantic Need: Semantics from the People!Semantic Need: Semantics from the People!
Semantic Need : Semantics from the People!Hans-Joerg Happel
 
Social Search and Need-driven Knowledge Sharing in Wikis with Woogle
Social Search and Need-driven Knowledge Sharing in Wikis with WoogleSocial Search and Need-driven Knowledge Sharing in Wikis with Woogle
Social Search and Need-driven Knowledge Sharing in Wikis with Woogle
Hans-Joerg Happel
 
What do you want to contribute today (INSEMTIVES)
What do you want to contribute today (INSEMTIVES)What do you want to contribute today (INSEMTIVES)
What do you want to contribute today (INSEMTIVES)Hans-Joerg Happel
 
Woogle4MediaWiki: An Extension to Improve Search and to Guide Contributions
Woogle4MediaWiki: An Extension to Improve Search and to Guide ContributionsWoogle4MediaWiki: An Extension to Improve Search and to Guide Contributions
Woogle4MediaWiki: An Extension to Improve Search and to Guide ContributionsHans-Joerg Happel
 
Wissensmanagement 3.0 Bedarfsorientierter Wissensaustausch mit Social Softwar...
Wissensmanagement 3.0 Bedarfsorientierter Wissensaustausch mit Social Softwar...Wissensmanagement 3.0 Bedarfsorientierter Wissensaustausch mit Social Softwar...
Wissensmanagement 3.0 Bedarfsorientierter Wissensaustausch mit Social Softwar...Hans-Joerg Happel
 

Viewers also liked (7)

Semantic Need: Guiding Metadata Annotations by Questions People #ask
Semantic Need: Guiding Metadata Annotations by Questions People #askSemantic Need: Guiding Metadata Annotations by Questions People #ask
Semantic Need: Guiding Metadata Annotations by Questions People #ask
 
Woogle4MediaWiki - From Searchers to Contributors
Woogle4MediaWiki - From Searchers to ContributorsWoogle4MediaWiki - From Searchers to Contributors
Woogle4MediaWiki - From Searchers to Contributors
 
Semantic Need : Semantics from the People!
Semantic Need: Semantics from the People!Semantic Need: Semantics from the People!
Semantic Need : Semantics from the People!
 
Social Search and Need-driven Knowledge Sharing in Wikis with Woogle
Social Search and Need-driven Knowledge Sharing in Wikis with WoogleSocial Search and Need-driven Knowledge Sharing in Wikis with Woogle
Social Search and Need-driven Knowledge Sharing in Wikis with Woogle
 
What do you want to contribute today (INSEMTIVES)
What do you want to contribute today (INSEMTIVES)What do you want to contribute today (INSEMTIVES)
What do you want to contribute today (INSEMTIVES)
 
Woogle4MediaWiki: An Extension to Improve Search and to Guide Contributions
Woogle4MediaWiki: An Extension to Improve Search and to Guide ContributionsWoogle4MediaWiki: An Extension to Improve Search and to Guide Contributions
Woogle4MediaWiki: An Extension to Improve Search and to Guide Contributions
 
Wissensmanagement 3.0 Bedarfsorientierter Wissensaustausch mit Social Softwar...
Wissensmanagement 3.0 Bedarfsorientierter Wissensaustausch mit Social Softwar...Wissensmanagement 3.0 Bedarfsorientierter Wissensaustausch mit Social Softwar...
Wissensmanagement 3.0 Bedarfsorientierter Wissensaustausch mit Social Softwar...
 

Similar to Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats

Building Workflow Applications Through the Web
Building Workflow Applications Through the WebBuilding Workflow Applications Through the Web
Building Workflow Applications Through the Web
T. Kim Nguyen
 
CORE final workshop introduction
CORE final workshop introductionCORE final workshop introduction
CORE final workshop introduction
Carlo Vaccari
 
Open event (Drupalcamp Sunderland 2015)
Open event (Drupalcamp Sunderland 2015)Open event (Drupalcamp Sunderland 2015)
Open event (Drupalcamp Sunderland 2015)
Jorge López-Lago
 
Demonstration on extending_the_pageview_feature_to_page_section_based_present...
Demonstration on extending_the_pageview_feature_to_page_section_based_present...Demonstration on extending_the_pageview_feature_to_page_section_based_present...
Demonstration on extending_the_pageview_feature_to_page_section_based_present...
Fajar Purnama
 
Collaboration Portal for Researchers
Collaboration Portal for ResearchersCollaboration Portal for Researchers
Collaboration Portal for ResearchersFatemeh Khast Khoda
 
Using Social Networking & Other Free Software
Using Social Networking & Other Free SoftwareUsing Social Networking & Other Free Software
Using Social Networking & Other Free Software
capelladoc
 
Accessibility, Automation and Metadata
Accessibility, Automation and MetadataAccessibility, Automation and Metadata
Accessibility, Automation and Metadata
lisbk
 
TXDHC OpenRefine Training
TXDHC OpenRefine TrainingTXDHC OpenRefine Training
TXDHC OpenRefine Training
Liz Grumbach
 
UnifiedViews: Towards ETL Tool for Simple yet Powerful RDF Data Management.
UnifiedViews: Towards ETL Tool for Simple yet Powerful RDF Data Management.UnifiedViews: Towards ETL Tool for Simple yet Powerful RDF Data Management.
UnifiedViews: Towards ETL Tool for Simple yet Powerful RDF Data Management.
tomasknap
 
OSCON 2013: Using Cascalog to build an app with City of Palo Alto Open Data
OSCON 2013: Using Cascalog to build an app with City of Palo Alto Open DataOSCON 2013: Using Cascalog to build an app with City of Palo Alto Open Data
OSCON 2013: Using Cascalog to build an app with City of Palo Alto Open Data
Paco Nathan
 
Using Cascalog to build an app with City of Palo Alto Open Data
Using Cascalog to build an app with City of Palo Alto Open DataUsing Cascalog to build an app with City of Palo Alto Open Data
Using Cascalog to build an app with City of Palo Alto Open Data
OSCON Byrum
 
Consuming open and linked data with open source tools
Consuming open and linked data with open source toolsConsuming open and linked data with open source tools
Consuming open and linked data with open source tools
Joanne Cook
 
Information Intermediaries
Information IntermediariesInformation Intermediaries
Information Intermediaries
Dave Reynolds
 
PowerPoint
PowerPointPowerPoint
PowerPointVideoguy
 
Towards a Linked Data Publishing Methodology
Towards a Linked Data Publishing MethodologyTowards a Linked Data Publishing Methodology
Towards a Linked Data Publishing Methodology
Danube University Krems, Centre for E-Governance
 
IMS Learning Tools Interoperability @ UCLA
IMS Learning Tools Interoperability @ UCLAIMS Learning Tools Interoperability @ UCLA
IMS Learning Tools Interoperability @ UCLA
Charles Severance
 
Data.dcs: Converting Legacy Data into Linked Data
Data.dcs: Converting Legacy Data into Linked DataData.dcs: Converting Legacy Data into Linked Data
Data.dcs: Converting Legacy Data into Linked DataMatthew Rowe
 
Better Hackathon 2020 - Fraunhofer IAIS - Semantic geo-clustering with SANSA
Better Hackathon 2020 - Fraunhofer IAIS - Semantic geo-clustering with SANSABetter Hackathon 2020 - Fraunhofer IAIS - Semantic geo-clustering with SANSA
Better Hackathon 2020 - Fraunhofer IAIS - Semantic geo-clustering with SANSA
PRBETTER
 
Solid The Hague – June 28th, 2019
Solid The Hague – June 28th, 2019 Solid The Hague – June 28th, 2019
Solid The Hague – June 28th, 2019
Platform Linked Data Netherlands (PLDN)
 

Similar to Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats (20)

Building Workflow Applications Through the Web
Building Workflow Applications Through the WebBuilding Workflow Applications Through the Web
Building Workflow Applications Through the Web
 
CORE final workshop introduction
CORE final workshop introductionCORE final workshop introduction
CORE final workshop introduction
 
Open event (Drupalcamp Sunderland 2015)
Open event (Drupalcamp Sunderland 2015)Open event (Drupalcamp Sunderland 2015)
Open event (Drupalcamp Sunderland 2015)
 
Demonstration on extending_the_pageview_feature_to_page_section_based_present...
Demonstration on extending_the_pageview_feature_to_page_section_based_present...Demonstration on extending_the_pageview_feature_to_page_section_based_present...
Demonstration on extending_the_pageview_feature_to_page_section_based_present...
 
Collaboration Portal for Researchers
Collaboration Portal for ResearchersCollaboration Portal for Researchers
Collaboration Portal for Researchers
 
Using Social Networking & Other Free Software
Using Social Networking & Other Free SoftwareUsing Social Networking & Other Free Software
Using Social Networking & Other Free Software
 
Accessibility, Automation and Metadata
Accessibility, Automation and MetadataAccessibility, Automation and Metadata
Accessibility, Automation and Metadata
 
TXDHC OpenRefine Training
TXDHC OpenRefine TrainingTXDHC OpenRefine Training
TXDHC OpenRefine Training
 
UnifiedViews: Towards ETL Tool for Simple yet Powerful RDF Data Management.
UnifiedViews: Towards ETL Tool for Simple yet Powerful RDF Data Management.UnifiedViews: Towards ETL Tool for Simple yet Powerful RDF Data Management.
UnifiedViews: Towards ETL Tool for Simple yet Powerful RDF Data Management.
 
cv_filustek_en_08
cv_filustek_en_08cv_filustek_en_08
cv_filustek_en_08
 
OSCON 2013: Using Cascalog to build an app with City of Palo Alto Open Data
OSCON 2013: Using Cascalog to build an app with City of Palo Alto Open DataOSCON 2013: Using Cascalog to build an app with City of Palo Alto Open Data
OSCON 2013: Using Cascalog to build an app with City of Palo Alto Open Data
 
Using Cascalog to build an app with City of Palo Alto Open Data
Using Cascalog to build an app with City of Palo Alto Open DataUsing Cascalog to build an app with City of Palo Alto Open Data
Using Cascalog to build an app with City of Palo Alto Open Data
 
Consuming open and linked data with open source tools
Consuming open and linked data with open source toolsConsuming open and linked data with open source tools
Consuming open and linked data with open source tools
 
Information Intermediaries
Information IntermediariesInformation Intermediaries
Information Intermediaries
 
PowerPoint
PowerPointPowerPoint
PowerPoint
 
Towards a Linked Data Publishing Methodology
Towards a Linked Data Publishing MethodologyTowards a Linked Data Publishing Methodology
Towards a Linked Data Publishing Methodology
 
IMS Learning Tools Interoperability @ UCLA
IMS Learning Tools Interoperability @ UCLAIMS Learning Tools Interoperability @ UCLA
IMS Learning Tools Interoperability @ UCLA
 
Data.dcs: Converting Legacy Data into Linked Data
Data.dcs: Converting Legacy Data into Linked DataData.dcs: Converting Legacy Data into Linked Data
Data.dcs: Converting Legacy Data into Linked Data
 
Better Hackathon 2020 - Fraunhofer IAIS - Semantic geo-clustering with SANSA
Better Hackathon 2020 - Fraunhofer IAIS - Semantic geo-clustering with SANSABetter Hackathon 2020 - Fraunhofer IAIS - Semantic geo-clustering with SANSA
Better Hackathon 2020 - Fraunhofer IAIS - Semantic geo-clustering with SANSA
 
Solid The Hague – June 28th, 2019
Solid The Hague – June 28th, 2019 Solid The Hague – June 28th, 2019
Solid The Hague – June 28th, 2019
 

More from Hans-Joerg Happel

AIFB Graduiertenkolloquium - Bedarfsgetriebener Wissensaustausch
AIFB Graduiertenkolloquium - Bedarfsgetriebener WissensaustauschAIFB Graduiertenkolloquium - Bedarfsgetriebener Wissensaustausch
AIFB Graduiertenkolloquium - Bedarfsgetriebener Wissensaustausch
Hans-Joerg Happel
 
Woogle4MediaWiki - Social search and knowledge sharing for MediaWiki
Woogle4MediaWiki - Social search and knowledge sharing for MediaWikiWoogle4MediaWiki - Social search and knowledge sharing for MediaWiki
Woogle4MediaWiki - Social search and knowledge sharing for MediaWiki
Hans-Joerg Happel
 
When Users Becom Collaborators: Towards Continuous and Context-Aware User Input
When Users Becom Collaborators: Towards Continuous and Context-Aware User InputWhen Users Becom Collaborators: Towards Continuous and Context-Aware User Input
When Users Becom Collaborators: Towards Continuous and Context-Aware User Input
Hans-Joerg Happel
 
Towards Need-driven Knowledge Sharing in Distributed Teams
Towards Need-driven Knowledge Sharing in Distributed TeamsTowards Need-driven Knowledge Sharing in Distributed Teams
Towards Need-driven Knowledge Sharing in Distributed Teams
Hans-Joerg Happel
 
2009 06 18 Atlassian User Conference Duesseldorf Romberg Happel Mit Wiquila S...
2009 06 18 Atlassian User Conference Duesseldorf Romberg Happel Mit Wiquila S...2009 06 18 Atlassian User Conference Duesseldorf Romberg Happel Mit Wiquila S...
2009 06 18 Atlassian User Conference Duesseldorf Romberg Happel Mit Wiquila S...Hans-Joerg Happel
 
Woogle -- On Why and How to Marry Wikis with Enterprise Search
Woogle -- On Why and How to Marry Wikis with Enterprise SearchWoogle -- On Why and How to Marry Wikis with Enterprise Search
Woogle -- On Why and How to Marry Wikis with Enterprise Search
Hans-Joerg Happel
 
Supporting Software Development Teams with a Semantic Process- and Artifact-o...
Supporting Software Development Teams with a Semantic Process- and Artifact-o...Supporting Software Development Teams with a Semantic Process- and Artifact-o...
Supporting Software Development Teams with a Semantic Process- and Artifact-o...
Hans-Joerg Happel
 
Enabling Social Network Analysis in Distributed Collaborative Software Develo...
Enabling Social Network Analysis in Distributed Collaborative Software Develo...Enabling Social Network Analysis in Distributed Collaborative Software Develo...
Enabling Social Network Analysis in Distributed Collaborative Software Develo...
Hans-Joerg Happel
 
Playful Cleverness Revisited: Open-source Game Development as a Method for Te...
Playful Cleverness Revisited: Open-source Game Development as a Method for Te...Playful Cleverness Revisited: Open-source Game Development as a Method for Te...
Playful Cleverness Revisited: Open-source Game Development as a Method for Te...
Hans-Joerg Happel
 
Web 2.0 artifacts in SME-networks
Web 2.0 artifacts in SME-networksWeb 2.0 artifacts in SME-networks
Web 2.0 artifacts in SME-networks
Hans-Joerg Happel
 
Einführung Wissenschaftliches Arbeiten in der angewandten Informatik
Einführung Wissenschaftliches Arbeiten in der angewandten InformatikEinführung Wissenschaftliches Arbeiten in der angewandten Informatik
Einführung Wissenschaftliches Arbeiten in der angewandten InformatikHans-Joerg Happel
 

More from Hans-Joerg Happel (11)

AIFB Graduiertenkolloquium - Bedarfsgetriebener Wissensaustausch
AIFB Graduiertenkolloquium - Bedarfsgetriebener WissensaustauschAIFB Graduiertenkolloquium - Bedarfsgetriebener Wissensaustausch
AIFB Graduiertenkolloquium - Bedarfsgetriebener Wissensaustausch
 
Woogle4MediaWiki - Social search and knowledge sharing for MediaWiki
Woogle4MediaWiki - Social search and knowledge sharing for MediaWikiWoogle4MediaWiki - Social search and knowledge sharing for MediaWiki
Woogle4MediaWiki - Social search and knowledge sharing for MediaWiki
 
When Users Becom Collaborators: Towards Continuous and Context-Aware User Input
When Users Becom Collaborators: Towards Continuous and Context-Aware User InputWhen Users Becom Collaborators: Towards Continuous and Context-Aware User Input
When Users Becom Collaborators: Towards Continuous and Context-Aware User Input
 
Towards Need-driven Knowledge Sharing in Distributed Teams
Towards Need-driven Knowledge Sharing in Distributed TeamsTowards Need-driven Knowledge Sharing in Distributed Teams
Towards Need-driven Knowledge Sharing in Distributed Teams
 
2009 06 18 Atlassian User Conference Duesseldorf Romberg Happel Mit Wiquila S...
2009 06 18 Atlassian User Conference Duesseldorf Romberg Happel Mit Wiquila S...2009 06 18 Atlassian User Conference Duesseldorf Romberg Happel Mit Wiquila S...
2009 06 18 Atlassian User Conference Duesseldorf Romberg Happel Mit Wiquila S...
 
Woogle -- On Why and How to Marry Wikis with Enterprise Search
Woogle -- On Why and How to Marry Wikis with Enterprise SearchWoogle -- On Why and How to Marry Wikis with Enterprise Search
Woogle -- On Why and How to Marry Wikis with Enterprise Search
 
Supporting Software Development Teams with a Semantic Process- and Artifact-o...
Supporting Software Development Teams with a Semantic Process- and Artifact-o...Supporting Software Development Teams with a Semantic Process- and Artifact-o...
Supporting Software Development Teams with a Semantic Process- and Artifact-o...
 
Enabling Social Network Analysis in Distributed Collaborative Software Develo...
Enabling Social Network Analysis in Distributed Collaborative Software Develo...Enabling Social Network Analysis in Distributed Collaborative Software Develo...
Enabling Social Network Analysis in Distributed Collaborative Software Develo...
 
Playful Cleverness Revisited: Open-source Game Development as a Method for Te...
Playful Cleverness Revisited: Open-source Game Development as a Method for Te...Playful Cleverness Revisited: Open-source Game Development as a Method for Te...
Playful Cleverness Revisited: Open-source Game Development as a Method for Te...
 
Web 2.0 artifacts in SME-networks
Web 2.0 artifacts in SME-networksWeb 2.0 artifacts in SME-networks
Web 2.0 artifacts in SME-networks
 
Einführung Wissenschaftliches Arbeiten in der angewandten Informatik
Einführung Wissenschaftliches Arbeiten in der angewandten InformatikEinführung Wissenschaftliches Arbeiten in der angewandten Informatik
Einführung Wissenschaftliches Arbeiten in der angewandten Informatik
 

Recently uploaded

FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
Jen Stirrup
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 

Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats

  • 1. SEMANTIC RESULT FORMATS AUTOMATICALLY TRANSFORMING STRUCTURED DATA INTO USEFUL OUTPUT FORMATS Frank Dengler (Karlsruhe Institute of Technology) Hans-Jörg Happel (FZI Research Center for IT) Wikimania 2010, Gdansk (Poland) July, 10th, 2010 Free for usage and distribution under similar conditions (does not inclue images) http://creativecommons.org/licenses/by-sa/2.0/ v1.0 09.07.2010 © Frank Dengler, Hans-Jörg Happel, KIT/FZI http://www.slideshare.net/hhappel/2010-0710semanticresultformats-v4b
  • 2.
  • 3. Motivation: „Show all bakeries open after midnight“ Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
  • 4. Motivation: „Show all events in the Wiki by date“ Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
  • 5.
  • 6.
  • 7. SRF Distilled {{#ask:[[Category:Conference]] |?Location |?Start date |?End date | format=myresultformat }} MyResultPrinter.php (do magic here…) Query results <table width=&quot;100%&quot; id=&quot;querytable5&quot; class=&quot;smwtable&quot;> <tbody><tr> <td><a title=&quot;Velocity 2010&quot; href=&quot;/Velocity_2010&quot;>Velocity 2010</a></td> <td><a title=&quot;Santa Clara, CA&quot; href=&quot;/Santa_Clara,_CA&quot;>Santa Clara, CA</a></td> <td>22 June 2010</td> <td>24 June 2010 23:59:00</td> </tr> <tr> <td><a title=&quot;RailsConf 2010&quot; href=&quot;/RailsConf_2010&quot;>RailsConf 2010</a></td> <td><a title=&quot;Baltimore, MD&quot; href=&quot;/Baltimore,_MD&quot;>Baltimore, MD</a></td> <td>7 June 2010</td> <td>10 June 2010 23:59:00</td> </tr> ... HTML Code Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
  • 8. SRF Overview Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) Type / Included in SMW Core Extension:SRF Custom Extension List Table/Broadtable List/ol/ul Category Outline Graphing Graph Googlebar/-pie Ploticus Process SMW+ (2D/3D-bar, line chart) UMLClass Time-based Timeline Eventline Calendar Further presentations Exhibit Gallery Semantic Maps Export RSS CSV JSON iCalendar vCard Bibtex Other Count Template Embedded Debug Math
  • 9. Eventline Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) {{#ask: [[Category:Conference]] |?Start date |?Location |sort=Start date |order=desc |format=timeline |timelineposition=today |timelinebands=DAY,MONTH, YEAR |limit=5000 }}
  • 10. Timeline Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) http://www.techpresentations.org/Conferences {{#ask: [[Category:Conference]] |?Start date |?End date |?Location |sort=Start date |order=desc |format=timeline |timelineposition=today |timelinebands=DAY,MONTH, YEAR |limit=5000 }}
  • 11. Calendar format Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) http://discoursedb.org/wiki/Opinion_calendar {{#ask: [[Category:Items]] [[Was published on::>{{#calendarstartdate:}}]] [[Was published on::<{{#calendarenddate:}}]] |? Was published on |limit=200 |format=calendar }}
  • 12. Pie chart {{#ask:[[Category:Country]] [[located in::North America]] [[population::+]] |?population |format=googlepie }} Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
  • 13. Bar chart {{#ask:[[Category:Country]] [[located in::North America]] [[population::+]] |?population |format=googlebar }} Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
  • 14. Graph Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) {{#ask: [[Category:Person]] | ?has child | ?knows | format=graph | graphcolor=Yes | graphlink=Yes | graphlegend=Yes | graphlabel=No | graphsize=10,10 | rankdir=TB }}
  • 15. Process diagram Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) {{#ask: [[Category:Process Step]] [[Category:{{PAGENAME}}]] | ?has OrSuccessor=hasorsuccessor | ?has Successor=hassuccessor | ?hascontruesuccessor | ?hasconfalsesuccessor | ?has Condition=hascondition | ?has Role=hasrole | ?uses Resource=usesresource | ?has Status=hasstatus | format=process | graphsize=12,12 | graphvalidation=no | showroles=yes | showstatus=yes | showresources=yes }}
  • 16. UML diagram Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) {{#ask: [[Category:UML Class]] | ?has attribute | ?has method | ?UML association | ?inherits from | ?has stereotype | format=umlclass }}
  • 17. BibTex - export Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) @Inproceedings{dengler2010cmwsm, address = &quot;Gdansk, Poland&quot;, author = &quot;Frank Dengler and Hans-J{o}rg Happel&quot;, booktitle = &quot;Proceedings of the 6th International Symposium on Wikis and Open Collaboration&quot;, month = &quot;Juli&quot;, publisher = &quot;ACM&quot;, title = &quot;Collaborative Modeling with Semantic MediaWiki&quot;, year = &quot;2010&quot;, } {{#ask: [[{{BASEPAGENAME}}]] | ?author | ?title | ?booktitle | ?year | ?edition | ?volume | ?number | ?series | ?pages | ?address | ?month | ?organization | ?publisher | ?note | ?bibtype=type | format=bibtex }}
  • 18. iCalender export Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) BEGIN:VCALENDAR PRODID:-//SMW Project//Semantic Result Formats VERSION:2.0 METHOD:PUBLISH X-WR-CALNAME:Special:Ask/-5B-5BISWC2008-5D-5D/-3FStart-20date=start/format=icalendar/limit=20 BEGIN:VEVENT SUMMARY:ISWC2008 URL:http://semanticweb.org/wiki/ISWC2008 UID:http://semanticweb.org/wiki/ISWC2008 DTSTART:20081026 DTSTAMP:20090428T135015 SEQUENCE:44833 END:VEVENT END:VCALENDAR {{#ask: [[Category:Person]] | ?startdate = start | ?enddate = end | ?location | format=icalendar }}
  • 19. vCard export Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) BEGIN:VCARD VERSION:3.0 N;CHARSET=UTF-8:Krötzsch;Markus;;; FN;CHARSET=UTF-8:Markus Krötzsch CLASS:PUBLIC ORG;CHARSET=UTF-8:AIFB; EMAIL;TYPE=internet:mak@aifb.uni-karlsruhe.de TEL;TYPE=WORK:+49-721-608-7362 SOURCE;CHARSET=UTF-8:http://semanticweb.org/wiki/User:Markus_Kr%C3%B6tzsch PRODID:-////Semantic MediaWiki REV:20091113101319 URL:http://korrekt.org UID:http://semanticweb.org/wiki/User:Markus_Kr%C3%B6tzsch END:VCARD {{#ask: [[Category:Person]] | ?firstname | ?lastname | ?url = homepage | format=vcard }}
  • 20. Outline Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) {{#ask:[[Category:Items]] |? Was published by |? Was written by |? Addresses topic |format=outline |outlineproperties=Was published by, Was written by |sort=Was published by }}
  • 21. Gallery Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) {{#ask: [[Category:Photos]] | ?caption | format=gallery }}
  • 22. Exhibit Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) {{#ask: [[Category:Beer]] | ?brewed by | ?beer type=Beer | ?brewed in city | ?brewed in state | ?brewed in country | ?Image URL | ?Brewed Coordinate | format=exhibit | views=tiles,tabular, map | facets=search,Brewed in Country | limit=100 | mainlabel=Beer Name | height=600px | sort=brewed in country,Beer Type | lens=beer2 }}
  • 23. INSIDE SEMANTIC RESULT FORMATS MyResultPrinter.php (do magic here…) Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
  • 24.
  • 25.
  • 26.
  • 27.
  • 28. getResultText($res, $outputmode) Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) $row = $res->getNext(); // iterate rows in query result set while ($row != fale){ // iterate columns in row foreach ($row as $field) { $columnTitle = $field->getPrintRequest(); // e.g. „Located in“ // iterate all values in column foreach ($field->getContent() as $value){ $val = $value->getShortWikiText(); // e.g. „Baden-Würrtemberg“ } } $row = $res->getNext(); }
  • 29.
  • 30. HANDS-ON EXAMPLE Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
  • 31.
  • 32. Create new php file SRF_MyPrinter.php Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) <?php /** * @note AUTOLOADED */ if( !defined( 'MEDIAWIKI' ) ) { die( 'Not an entry point.' ); } class SRFMyPrinter extends SMWResultPrinter { $m_outputtype=''; protected function readParameters($params, $outputmode) { SMWResultPrinter::readParameters($params,$outputmode); } protected function getResultText($res, $outputmode) { $result = ''; return $result; } }
  • 33.
  • 34. Method getResultText() Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) protected function getResultText($res, $outputmode) { $result = ''; $this->isHTML = true; $row = $res->getNext(); while ( $row !== false ) { $wikipage = $row[0]->getResultSubject(); // get the object $subject = $wikipage->getLongWikiText(); $label=''; foreach ($row as $field) { $req = $field->getPrintRequest(); if ( (strtolower($req->getLabel()) == &quot;haslabel&quot;) ) { $value = current($field->getContent()); //save only the first if ($value !== false) $label = $value->getShortWikiText(); } } if ($label==&quot;&quot;) $label = $subject; $result .= '<a href=&quot;'. $wikipage->getTitle()->getFullURL(); if ($this->m_outputtype=='upper') $label = strtoupper($label); $result .= '&quot;>' . $label . '</a>, ’; $row = $res->getNext(); } if (strlen($result)>2) $result = substr($result, 0, -2); return $result; }
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45. Method getResultText() Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) protected function getResultText($res, $outputmode) { $result = ''; $this->isHTML = true; $row = $res->getNext(); while ( $row !== false ) { $wikipage = $row[0]->getResultSubject(); // get the object $subject = $wikipage->getLongWikiText(); $label=''; foreach ($row as $field) { $req = $field->getPrintRequest(); if ( (strtolower($req->getLabel()) == &quot;haslabel&quot;) ) { $value = current($field->getContent()); //save only the first if ($value !== false) $label = $value->getShortWikiText(); } } if ($label==&quot;&quot;) $label = $subject; $result .= '<a href=&quot;'. $wikipage->getTitle()->getFullURL(); if ($this->m_outputtype=='upper') $label = strtoupper($label); $result .= '&quot;>' . $label . '</a>, ’; $row = $res->getNext(); } if (strlen($result)>2) $result = substr($result, 0, -2); return $result; }
  • 46.
  • 47. Use your new Result Printer {{#ask:[[Category:Conference]] |?has label |format=myresultformat |outputtype=upper }} Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland)
  • 48.
  • 49.
  • 50. SRF_MyPrinter.php (for copy/paste) Semantic Result Formats: Automatically Transforming Structured Data into useful Output Formats / Tutorial @ Wikimania 2010 in Gdansk (Poland) <?php/** * Print query results in interactive timelines. * @author Frank Dengler * @author Hans-Joerg Happel * @file * @ingroup SemanticResultFormats *//** * Result printer for labeling links to wiki pages. * @ingroup SemanticResultFormats */if( !defined( 'MEDIAWIKI' ) ) { die( 'Not an entry point.' );}class SRFMyPrinter extends SMWResultPrinter { protected $m_outputtype=''; protected function readParameters($params, $outputmode) { SMWResultPrinter::readParameters($params,$outputmode); if (array_key_exists('outputtype', $this->m_params)) { $this->m_outputtype = trim($this->m_params['outputtype']); } } protected function getResultText($res, $outputmode) { $result = ''; $this->isHTML = true; $row = $res->getNext(); while ( $row !== false ) { $wikipage = $row[0]->getResultSubject(); // get the object $subject = $wikipage->getLongWikiText(); $label=''; foreach ($row as $field) { $req = $field->getPrintRequest(); if ( (strtolower($req->getLabel()) == &quot;haslabel&quot;) ) { $value = current($field->getContent()); //save only the first if ($value !== false) $label = $value->getShortWikiText(); } } if ($label==&quot;&quot;) $label = $subject; $result .= '<a href=&quot;'. $wikipage->getTitle()->getFullURL(); if ($this->m_outputtype=='upper') $label = strtoupper($label); $result .= '&quot;>' . $label . '</a>, '; $row = $res->getNext(); } if (strlen($result)>2) substr($result, 0, -2); return $result; }}

Editor's Notes

  1. http://www.bluewater-info.net/wiki_/Main_Page
  2. http://www.techpresentations.org/Conferences
  3. http://www.techpresentations.org/AI_Mashup_Challenge_2010
  4. As a pie chart
  5. As a bar chart.
  6. http://www.mediawiki.org/wiki/Extension:Semantic_Result_Formats
  7. http://semantic-mediawiki.org/doc/classSMWResultPrinter.html http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter.php?revision=66966&amp;view=markup
  8. http://www.mediawiki.org/wiki/Extension:Semantic_Result_Formats
  9. http://www.mediawiki.org/wiki/Extension:Semantic_Result_Formats