A Ruby Gem for the European Patent Office API (OPS)

One of the biggest sources of open data is the patent literature. The patent related data reveals a significant body of information related to the innovation activities worldwide. The European Patent Office (EPO) is responsible for all patenting activities with pan-European scope and its databases integrate a significant body of patenting related information worldwide. For accessing this data the EPO provides an API to this data which is called Open Patent Services (OPS). We developed and released as Open Source a Ruby Gems which allows you to conveniently access the EPO API in all your Ruby applications.

Open Patent Services (OPS) is a web service which provides access to the EPO’s raw data via a standardised XML interface. It does this using RESTful architecture.

The OPS API is free of charge for up to 2.5 GB of data per week. The only precondition is the registration of an account with the EPO (in our experience the EPO does not allow more than one free account per company). If you need to download more than the free 2.5 GB of data a fee of currently 64€ per GB applies.

For developers used to such simple and convenient APIs as twitter’s the XML based OPS is very hard to grasp. The documentation feels very “enterprisy” and complex. For example instead of an easy to navigate and searchable online documentation such as twitter’s the EPO documentation is provided as an 142 page PDF (probably supposed to be printed out).

As directly interacting with XML responses does not feel very ruby-ish we started to implement more and more wrapper classes to help us access the OPS-API from our applications. After having used these for some time now we decided to give back to the community by open sourcing them as the epo-ops ruby gem (please read the full documentation there).

So to start using EPO patent data in your application simply install the gem and start up a ruby console.

$ gem install epo-ops -v 0.3.0
$ irb

You can then easily retrieve a patent application and it’s bibliographic data. The gem provides convenient wrappers – for instance to access a patents applicants or agents.

> require 'epo_ops'
> patent_application = EpoOps::PatentApplication.find("EP14731659")

We thereby provide wrapper classes which
> patent_application.title
> patent_application.classifications
=> ["B29C47/10", "B29C47/68", "B29C47/92", "B29C45/00", "B01D46/24"]
> patent_application.applicants.first.name
=> "Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V."

The epo-ops gem also includes several workarounds to cope with limitations of the OPS-API. For instance the maximum number of search results is limited to 100 per query and any offset to 2.000.  Thus to retrieve all patents for a query which returns more than 2.000 results the query has to be broken up into smaller result sets. Our gem automatically does this by using IPC classes (and sub classes) if necessary.

To extensively use the OPS-API you should register for a free OPS account as the limits for unauthenticated access are quite low. Then simply configure the gem using the provided credentials.

The gem’s code and links to further resources can be found on github. Please do provide feedback. Pull requests are very welcome.