Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nichtich/wikidata-graphs
Experimenting with graphs from Wikidata content
https://github.com/nichtich/wikidata-graphs
Last synced: 5 days ago
JSON representation
Experimenting with graphs from Wikidata content
- Host: GitHub
- URL: https://github.com/nichtich/wikidata-graphs
- Owner: nichtich
- License: gpl-3.0
- Created: 2016-04-10T19:02:22.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-04-10T19:06:57.000Z (over 8 years ago)
- Last Synced: 2024-10-30T16:24:32.370Z (about 2 months ago)
- Language: Perl
- Size: 841 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Experiment with creation of Graphs from Wikidata content
Choose a property, e.g. [P184](http://www.wikidata.org/entity/P184) that
connects PhD student and supervisor.Query all edges and node labels with [wdq](https://metacpan.org/pod/distribution/App-wdq/script/wdq):
wdq --label a,b --ids --format ldjson '?a wdt:P184 ?b' > P184.ldjson
You may want/neet to add option `--language en` to select English or choose
another language.Now generate a DOT file for GraphViz:
./ldjson2dot.pl < P184.ldjson > P184.dot
with this script
```perl
#!/usr/bin/perl
use v5.14;
use JSON;
my %node;
binmode(STDOUT,':utf8');
say "digraph {";
say " node[shape=point]";
while (<>) {
my $edge = decode_json($_);
foreach (grep { !$node{$edge->{$_}} } qw(a b)) {
# say $edge->{$_}, '[label="', $edge->{$_.'Label'}, '"]';
}
say $edge->{a}, ' -> ', $edge->{b};
}
say "}";
```Finally generate a SVG file and hope it makes sense (this may take some time depending on size of the graph):
sfdp -Tsvg P184.dot -o P184.svg
Here is an image of my first result, a graph with 4409 edges:
![](P184-small.png)
Now switch to some more sophisticated network analysis software...