RDF Mapping Language (RML)

RDF Mapping Language or RML is a specification for creating rules or mappings between different input data sources like XML, JSON, CSV, Relational Databases, and even other RDF triplestores through SPARQL to RDF triples.

RML itself is constructed using RDF so knowing how to write RDF (Turtle is usually easier to write and comprehend for RML maps) allows you to create mappings between the input data and your target RDF.

Source: http://rml.io/

Each rule is a TriplesMap class that contains

  • A logicalSource predicate containing what type of input data source.
  • A subjectMap predicate that allows you to assign a subject IRI or blank node and to make a RDF Class assignment
  • One or more predicateObjectMap that allow to assign a predicate to the subject using a number of different methods for matching data from the input as a RDF object.

The bibcat.rml.processor submodule has a base RML Processor Processor

>>> import bibcat.rml.processor as processor
INFO:rdflib:RDFLib Version: 4.2.2
>>> processor.Processor
<class 'bibcat.rml.processor.Processor'>

This class is extended for specific kinds of data sub-classes like CSVRowProcessor for common-separated values data inputs such as spreadsheets

>>> processor.CSVRowProcessor
<class 'bibcat.rml.processor.CSVRowProcessor'>

A JSONProcessor for JSON data sources,

>>> processor.JSONProcessor
<class 'bibcat.rml.processor.JSONProcessor'>

A SPARQLProcessor for mapping RDF triples to RDF triples,

>>> processor.SPARQLProcessor
<class 'bibcat.rml.processor.SPARQLProcessor'>

And a XMLProcessor.

>>> processor.XMLProcessor
<class 'bibcat.rml.processor.XMLProcessor'>

In the first example will take the BIBFRAME RDF produced by the marc2bibframe2, create an instance of the SPARQLProcessor class to demonstrate the use of the RML Processor.

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.