Skip to content
nichtich edited this page Oct 15, 2014 · 1 revision

The module Catmandu::Importer::RDF provides methods to read from both RDF files and HTTP-URIs (Linked Open Data).

catmandu convert RDF --file rdfdump.ttl to JSON
catmandu convert RDF --url http://d-nb.info/1001703464 to YAML

The RDF importer first convert an RDF graph into an aREF data structure. The following example shows an excerpt of an RDF graph in aREF that describes a publication with URI http://dx.doi.org/10.2474/trol.7.147:

catmandu convert RDF --url http://dx.doi.org/10.2474/trol.7.147 to YAML:

The data structure is shown in YAML format for better readability:

---
_url: http://dx.doi.org/10.2474/trol.7.147
http://dx.doi.org/10.2474/trol.7.147:
  dct_title:
  - Frictional Coefficient under Banana Skin@
  dct_creator:
  - <http://id.crossref.org/contributor/daichi-uchijima-y2ol1uygjx72>
  - <http://id.crossref.org/contributor/kensei-tanaka-y2ol1uygjx72>
  - <http://id.crossref.org/contributor/kiyoshi-mabuchi-y2ol1uygjx72>
  - <http://id.crossref.org/contributor/rina-sakai-y2ol1uygjx72>
  dct_date:
  - 2012^xs_gYear
  dct_isPartOf:
  - <http://id.crossref.org/issn/1881-2198>
http://id.crossref.org/contributor/daichi-uchijima-y2ol1uygjx72:
  a:
  foaf_name:
  - Daichi Uchijima@
http://id.crossref.org/issn/1881-2198:
  a:
  - bibo_Journal
  bibo_issn:
  - 1881-2198@
  dct_title:
  - Tribology Online@

Parts of this RDF graph can be accessed directly, but using the fix function aref_query is more convenient. For instance this maps the title (expressed in Dublin Core ontology) of the central RDF resource to the title field:

aref_query(query:dct_title, field:title)
Clone this wiki locally