Skip to content

Instantly share code, notes, and snippets.

@ncarboni
ncarboni / convert_geonames.py
Created May 26, 2020
Convert geonames RDF to usable format
View convert_geonames.py
# script modified from https://github.com/rhasan/sw/blob/master/genames/convert2ntriples.py
# This script will take genames rdf dump available here http://download.geonames.org/all-geonames-rdf.zip
# and convert each triples to N-Triple seralization.
# The dump has one rdf document per toponym on every line of the file.
# The produced N-Triples will be written in geonames.nt file. The final geonames.nt file is approximately 13.21GB
#!/usr/bin/python
import rdflib
fo = open("geonames.nt", "wb")
View authorityname_loc.ttl
@prefix ns0: <http://www.loc.gov/mads/rdf/v1#> .
@prefix ns1: <http://id.loc.gov/vocabulary/identifiers/> .
@prefix ns2: <http://id.loc.gov/ontologies/RecordInfo#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ns3: <http://id.loc.gov/ontologies/bflc/> .
<http://id.loc.gov/authorities/names/n50069453>
a <http://www.loc.gov/mads/rdf/v1#CorporateName>, <http://www.loc.gov/mads/rdf/v1#Authority> ;
@ncarboni
ncarboni / viaf_sameness.nt
Created Mar 25, 2020
VIAF encoding sameness
View viaf_sameness.nt
<http://viaf.org/viaf/122650373> <http://schema.org/sameAs> <http://www.wikidata.org/entity/Q19596483> .
<http://viaf.org/viaf/122650373> <http://schema.org/sameAs> <http://viaf.org/viaf/122650373> .
View bnf_encoding_sameness.nt
<http://data.bnf.fr/ark:/12148/cb11896729n> <http://www.w3.org/2002/07/owl#sameAs> <http://wikidata.org/entity/Q7192019> .
<http://data.bnf.fr/ark:/12148/cb11896729n> <http://xmlns.com/foaf/0.1/focus> <http://data.bnf.fr/ark:/12148/cb11896729n#about> .
<http://data.bnf.fr/ark:/12148/cb11896729n#about> <http://www.w3.org/2002/07/owl#sameAs> <http://data.bnf.fr/ark:/12148/cb11896729n#foaf:Person> .
<http://data.bnf.fr/ark:/12148/cb11896729n#about> <http://www.w3.org/2002/07/owl#sameAs> <http://viaf.org/viaf/44296876> .
<http://data.bnf.fr/ark:/12148/cb11896729n#about> <http://www.w3.org/2002/07/owl#sameAs> <http://www.idref.fr/026787431/id> .
View bnf_encoding_labels.nt
<http://data.bnf.fr/ark:/12148/cb11896729n> <http://xmlns.com/foaf/0.1/focus> <http://data.bnf.fr/ark:/12148/cb11896729n#about> .
<http://data.bnf.fr/ark:/12148/cb11896729n#about> <http://xmlns.com/foaf/0.1/familyName> "Choffard" .
<http://data.bnf.fr/ark:/12148/cb11896729n#about> <http://xmlns.com/foaf/0.1/gender> "male" .
<http://data.bnf.fr/ark:/12148/cb11896729n#about> <http://xmlns.com/foaf/0.1/givenName> "Pierre-Philippe" .
<http://data.bnf.fr/ark:/12148/cb11896729n#about> <http://xmlns.com/foaf/0.1/name> "Pierre-Philippe Choffard" .
@ncarboni
ncarboni / gnd_biblio_sameness.ttl
Created Mar 19, 2020
GND bibliographic work encoding sameness
View gnd_biblio_sameness.ttl
<https://d-nb.info/gnd/4001191-4>
owl:sameAs <http://viaf.org/viaf/182731512>, <http://id.loc.gov/rwo/agents/n90685273> .
@ncarboni
ncarboni / gnd_biblio_labels.ttl
Created Mar 19, 2020
GND Bibliographic Work labels
View gnd_biblio_labels.ttl
<https://d-nb.info/gnd/4001191-4>
gndo:variantNameForTheWork "La bataille d'Aliscans", "Chanson d'Aliscans";
gndo:preferredNameForTheWork "Aliscans" .
View gnd_entityfacts_json-ld.json
{
"@context": "https://hub.culturegraph.org/entityfacts/context/v1/entityfacts.jsonld",
"@type": "place",
"@id": "https://d-nb.info/gnd/4050471-2",
"location": {
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": ["12.483900", "41.894739"]
}
@ncarboni
ncarboni / labels_gnd.ttl
Created Mar 19, 2020
Labels GND converted
View labels_gnd.ttl
<https://d-nb.info/gnd/118540238>
a <https://d-nb.info/standards/elementset/gnd#Person> ;
gnd:forename "Johann Wolfgang"^^xsd:string ;
gnd:preferredName "Johann Wolfgang von Goethe"^^xsd:string ;
gnd:prefix "von"^^xsd:string ;
gnd:surname "Goethe"^^xsd:string ;
gnd:variantName "Johann Wolfgang Goethe"^^xsd:string, "Johan Wolfgang von Goethe"^^xsd:string, "Johan Wolphgang Goethe"^^xsd:string, "Johan W. von Goethe"^^xsd:string, "Joh. Wolfg. v. Goethe"^^xsd:string, "J. Wolfgang Goethe"^^xsd:string, "J. W. v. Goethe"^^xsd:string, "J. W. Goethe"^^xsd:string, "Jan Wolfgang Goethe"^^xsd:string, "Jean Wolfgang von Goethe"^^xsd:string, "Juan Wolfgang von Goethe"^^xsd:string, "Juan Wolfgang Goethe"^^xsd:string, "Juan W. Goethe"^^xsd:string, "João Wolfgang von Goethe"^^xsd:string, "Iohann Wolfgang Goethe"^^xsd:string, "Iohan Wolphgang Goethe"^^xsd:string, "Ioannes W. Goethe"^^xsd:string, "I. W. Goethe"^^xsd:string, "Wolfgango Goethe"^^xsd:string, "Wolfango Goethe"^^xsd:string, "W. von Goethe"^^xsd:string, "V
View label_gnd_json_ld.json
{
"@context": "https://hub.culturegraph.org/entityfacts/context/v1/entityfacts.jsonld",
"@id": "https://d-nb.info/gnd/118540238",
"preferredName": "Johann Wolfgang von Goethe",
"surname": "Goethe",
"prefix": "von",
"forename": "Johann Wolfgang",
"@type": "person",
"variantName": ["Johann Wolfgang Goethe", "Johan Wolfgang von Goethe", "Johan Wolphgang Goethe", "Johan W. von Goethe", "Joh. Wolfg. v. Goethe", "J. Wolfgang Goethe", "J. W. v. Goethe", "J. W. Goethe", "Jan Wolfgang Goethe", "Jean Wolfgang von Goethe", "Juan Wolfgang von Goethe", "Juan Wolfgang Goethe", "Juan W. Goethe", "João Wolfgang von Goethe", "Iohann Wolfgang Goethe", "Iohan Wolphgang Goethe", "Ioannes W. Goethe", "I. W. Goethe", "Wolfgango Goethe", "Wolfango Goethe", "W. von Goethe", "Volfgango Goethe", "Volfango Goethe", "Giov. L. Goethe", "G. L. Goethe", "Goethe", "Johann Wolfgang Von Goethe", "Goethius", "Johann W. êvonë Göthe", "Jan Wolfgang Göthe", "Jan Wolfang Göthe", "J. W. von Göthe", "Giov. Volfango Göthe", "Göthe", "Iogann V
You can’t perform that action at this time.