How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a...
-
Upload
dorothy-chandler -
Category
Documents
-
view
216 -
download
0
Transcript of How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a...
![Page 1: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/1.jpg)
How to reuse knowledge from a Semantic MediaWiki in your own
applications and websites(in lack of a shorter title)
TutorialDenny Vrandečić, Markus Krötzsch
{denny, mak}@aifb.uni-karlsruhe.de AIFB, University of Karlsruhe
![Page 2: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/2.jpg)
Agenda
• What’s this Semantic Web stuff, anyway?
• Wow, cool, but why should I use it?
• Ah, I see, but how do I use it?
• Neat! May I try?
• Err… do you have time for questions?
![Page 3: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/3.jpg)
What’s this Semantic Web stuff?
![Page 4: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/4.jpg)
It’s about cool web resources
![Page 5: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/5.jpg)
![Page 6: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/6.jpg)
![Page 7: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/7.jpg)
![Page 8: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/8.jpg)
![Page 9: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/9.jpg)
![Page 10: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/10.jpg)
![Page 11: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/11.jpg)
![Page 12: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/12.jpg)
How does the data integrate?
![Page 13: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/13.jpg)
It’s easy!
• Write a spider• Screengrab the text• Mine the information with regexps• Do this for every different page• Combine the data in your app• Rewrite when page layout changes• Test with different pages• Hope that it usually works
![Page 14: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/14.jpg)
That’s easy?
No, but it’s the only way
Besides the Semantic Web
![Page 15: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/15.jpg)
The Semantic Web
• Data format standard: RDF
• RDF describes graphs
• A web of data
![Page 16: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/16.jpg)
![Page 17: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/17.jpg)
The Semantic Web
• Data format standard: RDF
• RDF describes graphs
• A web of data
• RDF is for databases what HTML is to Hypertext
• Global interoperability of the data
![Page 18: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/18.jpg)
![Page 19: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/19.jpg)
So, what about MediaWiki?
• Semantic MediaWiki extension
• Grab sf.net/projects/semediawiki
• Install it (easy)
• Or go to ontoworld.org
![Page 20: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/20.jpg)
![Page 21: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/21.jpg)
![Page 22: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/22.jpg)
Angola Africalocated in
Zambia
located in
borders
Country Continent
![Page 23: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/23.jpg)
http://wiki.ontoworld.org/index.php/_Angolahttp://wiki.ontoworld.org/index.php/_Africa
http://wiki.ontoworld.org/index.php/_Relation-3ALocated_in
http://wiki.ontoworld.org/index.php/_Zambia
http://w
iki.ontoworld
.org/index.p
hp/_Relation-3ALoca
ted_in
http://wiki.ontow
orld.org/index.php/_Relation-3A
Borders
http://wiki.ontoworld.org/index.php/_Category-3ACountry
http://wiki.ontoworld.org/index.php/_Category-3AContinent
![Page 24: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/24.jpg)
http://wiki.ontoworld.org/index.php/_Angolahttp://wiki.ontoworld.org/index.php/_Africa
http://wiki.ontoworld.org/index.php/_Relation-3ALocated_in
http://wiki.ontoworld.org/index.php/_Zambia
http://w
iki.ontoworld
.org/index.p
hp/_Relation-3ALoca
ted_in
http://wiki.ontow
orld.org/index.php/_Relation-3A
Borders
http://wiki.ontoworld.org/index.php/_Category-3ACountry
http://wiki.ontoworld.org/index.php/_Category-3AContinent
Angola
http://www.w3.org/2000/01/rdf-schema#label
Africa
Located in
Zambia
Country
Borders
Continent
![Page 25: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/25.jpg)
![Page 26: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/26.jpg)
And this is easy!
import SemanticMediaWiki
ow = SemanticMediaWiki.SMW("http://ontoworld.org/index.php/Special:ExportRDF/","http://wiki.ontoworld.org/index.php/_")
country = ow.load("Angola")print countryprint country.located_in
bordered = country.borders
print len(bordered)for b in bordered: print b
![Page 27: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/27.jpg)
So, this is only for Python?• No, RDF is an open standard (W3C)
• Perl
• Pike
• Prolog
• Ruby
• .Net / Mono
• PHP
• Java
• JavaScript
• C
• C++
• Haskell
• Common Lisp
![Page 28: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/28.jpg)
SPARQL : RDF Query LangPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>PREFIX thing: <http://wiki.ontoworld.org/index.php/_>PREFIX relation: <http://wiki.ontoworld.org/index.php/_Relation-3A>
SELECT ?labelWHERE { thing:Angola relation:Located_in ?c . ?c rdfs:label ?label}
![Page 29: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/29.jpg)
http://wiki.ontoworld.org/index.php/_Angolahttp://wiki.ontoworld.org/index.php/_Africa
http://wiki.ontoworld.org/index.php/_Relation-3ALocated_in
http://wiki.ontoworld.org/index.php/_Zambia
http://w
iki.ontoworld
.org/index.p
hp/_Relation-3ALoca
ted_in
http://wiki.ontow
orld.org/index.php/_Relation-3A
Borders
http://wiki.ontoworld.org/index.php/_Category-3ACountry
http://wiki.ontoworld.org/index.php/_Category-3AContinent
Angola
http://www.w3.org/2000/01/rdf-schema#label
Africa
Located in
Zambia
Country
Borders
Continent
![Page 30: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/30.jpg)
<html> <body> Angola is in <?php define("RDFAPI_INCLUDE_DIR", "path/api/"); include(RDFAPI_INCLUDE_DIR . "RDFAPI.php");
$model = ModelFactory::getDefaultModel(); $model->load("full URI/ExportRDF/Angola"); $result = $model->sparqlQuery('SPARQL'); $value = $result[0]['?label']; echo $value->getLabel(); ?> </body></html>
![Page 31: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/31.jpg)
Off the shelf tools
• Lots of tools use RDF
• To visualize, browse, explore, query…
• Usually Open Source
• Can be used to learn how to program
• Demo of Longwell
![Page 32: How to reuse knowledge from a Semantic MediaWiki in your own applications and websites (in lack of a shorter title) Tutorial Denny Vrandečić, Markus Krötzsch.](https://reader036.fdocuments.net/reader036/viewer/2022062804/56649f1f5503460f94c36b53/html5/thumbnails/32.jpg)
Let’s play!Python:• Get RDFLib from rdflib.net• Ask me for SMW lib
PHP:• Get RAP from
www.wiwiss.fu-berlin.de/suhl/bizer/rdfapi
Times for question!