Dublin Core to BIBFRAME Map

With Dublin Core being one of the most widespread metadata vocabularies in use, creating an RDF mapping between Dublin Core and BIBFRAME was relatively straight-forward and is available as an XML mapping dc-to-bf.ttl rules file. But for this example, we are going to illustrate a rather common occurrence of a person creating metadata in a spreadsheet with the column names being the Dulin Core field name and each row being the metadata for an object.

Here is a sample of small spreadsheet with ten rows with the first row being the field names. We will first import the standard Python csv module and using the DictReader class instance for our sample.

>>> import csv
>>> dc_reader = csv.DictReader(open("/Path/to/dc/data/dc-sample.csv"))

As spreadsheets do not have a set structure, most of the time you'll have to create a new RML rules file for the record load. For this example, we will use an older RML rules file for an early Denver Public Library's CSV file called dpl-csv.ttl. Since this custom RML file is a standard mapping, it isn't included the bibcat module distribution, therefore, when we create the CSVRowProcessor instance, we'll need to include the full path and name of this RML file.

>>> dc_processor = processor.CSVRowProcessor(

After extract the first row in the spreadsheet and minting a new instance IRI, we will run the RML mapping to convert to row to BIBFRAME 2.0 RDF:

>>> row_one = next(dc_reader)
>>> import uuid
>>> instance_iri = "https://www.denverlibrary.org/{}".format(uuid.uuid1())
>>> instance_iri
>>> dc_processor.run(row_one,

Printing the CSVRowProcessor.output RDF graph results in:

>>> print(dc_processor.output.serialize(format='turtle').decode())
@prefix bf: <http://id.loc.gov/ontologies/bibframe/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://cdm16079.contentdm.oclc.org:80/cdm/ref/collection/p15330coll22/id/68544> a bf:Item ; bf:AccessPolicy <http://rightsstatements.org/vocab/CNE/1.0/> ; bf:generationProcess [ a bf:GenerationProcess ; bf:generationDate "2017-11-10T03:58:51.243583" ; rdf:value "Generated by BIBCAT version 1.18.1 from KnowledgeLinks.io"^^xsd:string ] ; bf:heldBy <https://www.denverlibrary.org/> ; bf:itemOf <https://www.denverlibrary.org/57154f74-c5cb-11e7-9f30-ac87a3129ce6> .

<https://www.denverlibrary.org/57154f74-c5cb-11e7-9f30-ac87a3129ce6> a bf:Instance ; bf:extent [ a bf:Extent ; rdf:value "1 copy photonegative ; 15 x 11 cm. (5 3/4 x 4 1/4 in.); 1 photonegative : glass ; 26 x 21 cm. (10 x 8 in.); 1 photoprint ; 24 x 18 cm. (9 1/4 x 7 in.)"^^xsd:string ] ; bf:generationProcess [ a bf:GenerationProcess ; bf:generationDate "2017-11-10T03:58:51.243583" ; rdf:value "Generated by BIBCAT version 1.18.1 from KnowledgeLinks.io"^^xsd:string ] ; bf:identifiedBy [ a bf:oclc ; rdf:value "34837596"^^xsd:string ], [ a bf:Local ; rdf:value "B-529"^^xsd:string ] ; bf:instanceOf <https://www.denverlibrary.org/57154f74-c5cb-11e7-9f30-ac87a3129ce6#Work> ; bf:media [ a bf:Media ; rdf:value "Photograph"^^xsd:string ] ; bf:note [ a bf:Note ; bf:noteType "admin"@en ] ; bf:summary [ a bf:Summary ; rdf:value "Major John M. Burke, head and shoulders studio portrait, wearing hat, suit jacket and vest; Wild West promoter and Indian Agent."^^xsd:string ] ; bf:title [ a bf:Title ; bf:mainTitle "Major John Burke, bust"^^xsd:string ] .

<https://www.denverlibrary.org/57154f74-c5cb-11e7-9f30-ac87a3129ce6#Work> a bf:Work ; bf:contribution [ a bf:Contribution ; bf:agent [ a bf:Agent ; rdf:value "Barry, D. F. (David Francis), 1854-1934" ] ; bf:role relators:cre ] ; bf:originDate "12/23/2010" .

Now that we have seen three workflows to produce BIBFRAME RDF triples from different data sources, now we will shift from mapping data sources to BIBFRAME to the other function of RML mapping and that is to map from BIBFRAME 2.0 to other RDF-based

Original contented Copyrighted © 2017 by Jeremy Nelson and KnowledgeLinks under Creative Commons License, Source code repository licensed under the Apache 2 and available on Github.