mirror of
https://github.com/almet/notmyidea.git
synced 2025-04-28 19:42:37 +02:00
61 lines
No EOL
3.7 KiB
HTML
61 lines
No EOL
3.7 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
|
<link rel="stylesheet" href="./theme/css/main.css" type="text/css" media="screen" charset="utf-8">
|
|
<link href="./feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="Alexis' log ATOM Feed" />
|
|
<title>Alexis Métaireau</title>
|
|
</head>
|
|
<body>
|
|
<div id="top">
|
|
<p class="author"><a href="./about.html">Alexis Métaireau</a>'s thoughs</p>
|
|
<ul class="links">
|
|
<li><a href=".">↵ </a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="content clear">
|
|
<h1>Using dbpedia to get languages influences</h1>
|
|
<p class="date">Published on Tue 16 August 2011</p>
|
|
<p>While browsing the Python's wikipedia page, I found information about the languages
|
|
influenced by python, and the languages that influenced python itself.</p>
|
|
<p>Well, that's kind of interesting to know which languages influenced others,
|
|
it could even be more interesting to have an overview of the connexion between
|
|
them, keeping python as the main focus.</p>
|
|
<p>This information is available on the wikipedia page, but not in a really
|
|
exploitable format. Hopefully, this information is provided into the
|
|
information box present on the majority of wikipedia pages. And… guess what?
|
|
there is project with the goal to scrap and index all this information in
|
|
a more queriable way, using the semantic web technologies.</p>
|
|
<p>Well, you may have guessed it, the project in question in dbpedia, and exposes
|
|
information in the form of RDF triples, which are way more easy to work with
|
|
than simple HTML.</p>
|
|
<p>For instance, let's take the page about python:
|
|
<a class="reference external" href="http://dbpedia.org/page/Python_%28programming_language%29">http://dbpedia.org/page/Python_%28programming_language%29</a></p>
|
|
<p>The interesting properties here are "Influenced" and "InfluencedBy", which
|
|
allows us to get a list of languages. Unfortunately, they are not really using
|
|
all the power of the Semantic Web here, and the list is actually a string with
|
|
coma separated values in it.</p>
|
|
<p>Anyway, we can use a simple rule: All wikipedia pages of programming languages
|
|
are either named after the name of the language itself, or suffixed with "(
|
|
programming language)", which is the case for python.</p>
|
|
<p>So I've built <a class="reference external" href="https://github.com/ametaireau/experiments/blob/master/influences/get_influences.py">a tiny script to extract the information from dbpedia</a> and transform them into a shiny graph using graphviz.</p>
|
|
<p>After a nice:</p>
|
|
<pre class="literal-block">
|
|
$ python get_influences.py python dot | dot -Tpng > influences.png
|
|
</pre>
|
|
<p>The result is the following graph (<a class="reference external" href="http://files.lolnet.org/alexis/influences.png">see it directly here</a>)</p>
|
|
<img alt="http://files.lolnet.org/alexis/influences.png" src="http://files.lolnet.org/alexis/influences.png" style="width: 800px;" />
|
|
<p>While reading this diagram, keep in mind that it is a) not listing all the
|
|
languages and b) keeping a python perspective.</p>
|
|
<p>This means that you can trust the scheme by following the arrows from python to
|
|
something and from something to python, it is not trying to get the matching
|
|
between all the languages at the same time to keep stuff readable.</p>
|
|
<p>It would certainly be possible to have all the connections between all
|
|
languages (and the resulting script would be easier) to do so, but the resulting
|
|
graph would probably be way less readable.</p>
|
|
<p>You can find the script <a class="reference external" href="https://github.com/ametaireau/experiments">on my github account</a>. Feel free to adapt it for
|
|
whatever you want if you feel hackish.</p>
|
|
|
|
</div>
|
|
</body>
|
|
</html> |