Skip to content

stevebrun/Bibliotek

Repository files navigation

Bibliotek

A Swift and Objective-C library for communicating with library databases using the Z39.50 protocol, powered by YAZ.

Usage Example

import Bibliotek

Connect to the Library of Congress's VOYAGER database.

let connection = try! Connection(host: "z3950.loc.gov", port: 7090, database: "VOYAGER")

Create a request to find books with some ISBN number.

let request = FetchRequest(keywords: ["9780385527880"], scope: .isbn)

Submit the request to a connection to receive results.

let records = try! connection.fetchRecords(request: request)

With a record, you can access information about the title, author, subject, and more.

extension FieldPath {
    static let isbn13 = FieldPath(tag: "020", code: "a")
    static let locCallNumber = FieldPath(tag: "050")
    static let dccNumber = FieldPath(tag: "082", code: "a")
    static let titleStatement = FieldPath(tag: "245")
}

record.content(with: .isbn13)
record.content(with: .locCallNumber)
record.content(with: .dccNumber)
record.content(with: .titleStatement)

Instructions

Clone the repository and all its submodules to your local machine.

    git clone https://github.com/stevebrun/Bibliotek.git

Xcode will download and build the YAZ source code as needed when building the libyaz target. The Bibliotek target depends on libyaz, so this will happen automatically when building Bibliotek.

References

Z39.50 Endpoints

Official Specifications from the Library of Congress

OCLC Documents

Cataloger's Reference Shelf

YAZ Documentation from IndexData

Other Specifications

Other Sources

About

A Swift and Objective-C library for interacting with libraries using the Z39.50 protocol.

Resources

License

Stars

Watchers

Forks

Packages

No packages published