#!/bin/sh
ST=/media/bigone/25TB/www/downloads.dbpedia.org/databus/archive/tmp/sort
mkdir de.dbpedia.org
cd de.dbpedia.org
wget http://downloads.dbpedia.org/2016-10/core-i18n/de/disambiguations_de.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/de/external_links_de.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/de/geo_coordinates_mappingbased_de.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/de/geo_coordinates_de.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/de/homepages_de.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/de/images_de.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/de/instance_types_transitive_de.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/de/instance_types_de.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/de/labels_de.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/de/long_abstracts_de.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/de/mappingbased_literals_de.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/de/mappingbased_objects_de.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/de/persondata_de.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/de/pnd_de.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/de/short_abstracts_de.ttl.bz2
lbzip2 -dc *.bz2 | sed 's|wikidata.dbpedia.org/ontology|dbpedia.org/ontology|' | rapper -i ntriples -o ntriples -O - - file 2>rapper-report.txt | sort -u -T $ST > de.dbpedia.org-concat.nt
lbzip2 --compress -1  de.dbpedia.org-concat.nt
rm *.ttl.bz2

cd ..
mkdir en.dbpedia.org
cd en.dbpedia.org
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/disambiguations_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/external_links_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/genders_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/geo_coordinates_mappingbased_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/geo_coordinates_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/homepages_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/images_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/instance_types_transitive_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/instance_types_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/labels_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/long_abstracts_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/mappingbased_literals_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/mappingbased_objects_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/persondata_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/pnd_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/short_abstracts_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/topical_concepts_en.ttl.bz2
lbzip2 -dc *.bz2 | sed 's|wikidata.dbpedia.org/ontology|dbpedia.org/ontology|' | rapper -i ntriples -o ntriples -O - - file 2>rapper-report.txt | sort -u -T $ST >  en.dbpedia.org-concat.nt
lbzip2 --compress -1  en.dbpedia.org-concat.nt
rm *.ttl.bz2

cd ..
mkdir fr.dbpedia.org
cd fr.dbpedia.org
wget http://downloads.dbpedia.org/2016-10/core-i18n/fr/disambiguations_fr.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/fr/external_links_fr.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/fr/french_population_fr.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/fr/geo_coordinates_mappingbased_fr.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/fr/geo_coordinates_fr.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/fr/homepages_fr.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/fr/images_fr.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/fr/instance_types_transitive_fr.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/fr/instance_types_fr.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/fr/labels_fr.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/fr/long_abstracts_fr.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/fr/mappingbased_literals_fr.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/fr/mappingbased_objects_fr.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/fr/persondata_fr.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/fr/pnd_fr.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/fr/short_abstracts_fr.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/fr/topical_concepts_fr.ttl.bz2
lbzip2 -dc *.bz2 | sed 's|wikidata.dbpedia.org/ontology|dbpedia.org/ontology|' | rapper -i ntriples -o ntriples -O - - file 2>rapper-report.txt | sort -u -T $ST > fr.dbpedia.org-concat.nt
lbzip2 --compress -1  fr.dbpedia.org-concat.nt
rm *.ttl.bz2


cd ..
mkdir nl.dbpedia.org
cd nl.dbpedia.org
wget http://downloads.dbpedia.org/2016-10/core-i18n/nl/disambiguations_nl.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/nl/external_links_nl.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/nl/geo_coordinates_mappingbased_nl.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/nl/geo_coordinates_nl.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/nl/images_nl.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/nl/instance_types_transitive_nl.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/nl/instance_types_nl.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/nl/labels_nl.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/nl/long_abstracts_nl.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/nl/mappingbased_literals_nl.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/nl/mappingbased_objects_nl.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/nl/persondata_nl.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/nl/short_abstracts_nl.ttl.bz2
lbzip2 -dc *.bz2 | sed 's|wikidata.dbpedia.org/ontology|dbpedia.org/ontology|' | rapper -i ntriples -o ntriples -O - - file 2>rapper-report.txt | sort -u -T $ST  > nl.dbpedia.org-concat.nt
lbzip2 --compress -1  nl.dbpedia.org-concat.nt
rm *.ttl.bz2

cd ..
mkdir sv.dbpedia.org
cd sv.dbpedia.org
wget http://downloads.dbpedia.org/2016-10/core-i18n/sv/external_links_sv.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/sv/geo_coordinates_sv.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/sv/instance_types_transitive_sv.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/sv/instance_types_sv.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/sv/labels_sv.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/sv/long_abstracts_sv.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/sv/mappingbased_literals_sv.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/sv/mappingbased_objects_sv.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/sv/short_abstracts_sv.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/sv/specific_mappingbased_properties_sv.ttl.bz2
lbzip2 -dc *.bz2 | sed 's|wikidata.dbpedia.org/ontology|dbpedia.org/ontology|' | rapper -i ntriples -o ntriples -O - - file 2>rapper-report.txt | sort -u -T $ST  > sv.dbpedia.org-concat.nt
lbzip2 --compress -1  sv.dbpedia.org-concat.nt
rm *.ttl.bz2

cd ..
mkdir wikidata.dbpedia.org
cd wikidata.dbpedia.org
wget http://78.46.100.7/wikidata/20180320/wikidatawiki-geo-coordinates.ttl.bz2
wget http://78.46.100.7/wikidata/20180320/wikidatawiki-instance-types.ttl.bz2
wget http://78.46.100.7/wikidata/20180320/wikidatawiki-instance-types-transitive.ttl.bz2
wget http://78.46.100.7/wikidata/20180320/wikidatawiki-labels.ttl.bz2
wget http://78.46.100.7/wikidata/20180320/wikidatawiki-mappingbased-literals.ttl.bz2
wget http://78.46.100.7/wikidata/20180320/wikidatawiki-mappingbased-objects-uncleaned-redirected.ttl.bz2
wget http://78.46.100.7/wikidata/20180320/wikidatawiki-sameas-external.ttl.bz2
wget http://78.46.100.7/wikidata/20180320/wikidatawiki-sameas-all-wikis.ttl.bz2

lbzip2 -dc *.bz2 | sed 's|wikidata.dbpedia.org/ontology|dbpedia.org/ontology|;s|wikidata.dbpedia.org/resource/Q|www.wikidata.org/entity/Q|g' | rapper -i ntriples -o ntriples -O - - file 2>rapper-report.txt | sort -u -T $ST >  wikidata.dbpedia.org-concat.nt
lbzip2 --compress -1  wikidata.dbpedia.org-concat.nt
rm *.ttl.bz2

