Skip to content

A library for converting MARC records to Linked Data Graphs and vice versa.

License

Notifications You must be signed in to change notification settings

folio-org/lib-linked-data-marc4ld

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lib-linked-data-marc4ld

Copyright (C) 2024 The Open Library Foundation

This software is distributed under the terms of the Apache License, Version 2.0. See the file "LICENSE" for more information.

This software uses a copyleft (LGPL-2.1-or-later) licensed software library: marc4j

Purpose

Lib-linked-data-marc4ld is a Java library designed for converting MARC records to Linked Data Graphs and vice versa.

Compiling

mvn clean install

Using the library

Convert MARC Bibliographic record to Linked Data Graph

import org.folio.ld.dictionary.model.Resource;
import org.folio.marc4ld.service.marc2ld.bib.MarcBib2ldMapper;
import org.springframework.stereotype.Service;

@Service
public class YourService {

  private final MarcBib2ldMapper mapper;

  public YourService(MarcBib2ldMapper mapper) {
    this.mapper = mapper;
  }

  public void yourMethod(String marcJson) {
    Resource resource = mapper.fromMarcJson(marcJson);
    // ...
    // ...
  }
}

Convert MARC Authority record to Linked Data Graph

import org.folio.ld.dictionary.model.Resource;
import org.folio.marc4ld.service.marc2ld.authority.MarcAuthority2ldMapper;
import org.springframework.stereotype.Service;

@Service
public class YourService {

  private final MarcAuthority2ldMapper mapper;

  public YourService(MarcAuthority2ldMapper mapper) {
    this.mapper = mapper;
  }

  public void yourMethod(String marcJson) {
    Resource resource = mapper.fromMarcJson(marcJson);
    // ...
    // ...
  }
}

Convert Linked Data Graph to MARC record

import org.folio.ld.dictionary.model.Resource;
import org.folio.marc4ld.service.ld2marc.Ld2MarcMapper;
import org.springframework.stereotype.Service;

@Service
public class YourService {
  private final Ld2MarcMapper mapper;

  public YourService(Ld2MarcMapper mapper) {
    this.mapper = mapper;
  }

  public void yourMethod(Resource resource) {
    String marcJson = mapper.toMarcJson(resource);
    // ...
    // ...
  }
}

Dependencies

Download and configuration

The built artifacts for this module are available. See configuration for repository access.

About

A library for converting MARC records to Linked Data Graphs and vice versa.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages