OBA#

OBA derives the API from an OWL ontology, turning each class into a collection and an instance operation. It builds JSON-LD at request time, frames it with the generated context, then strips @context, so consumers see plain JSON. It binds a single endpoint, so it answers from OpenCitations Meta only.

from helper import call

A simple request#

Looking up a DOI returns the article resource from OpenCitations Meta.

call("http://localhost:8087/v1.0.0/articles?label=10.1007/s11192-022-04367-w")
curl 'http://localhost:8087/v1.0.0/articles?label=10.1007/s11192-022-04367-w' 
# 200 OK

{
  "embodiment": [
    {
      "id": "https://w3id.org/oc/meta/re/061201764703",
      "type": [
        "http://purl.org/spar/fabio/Manifestation"
      ]
    }
  ],
  "hasIdentifier": [
    {
      "id": "https://w3id.org/oc/meta/id/061202156316",
      "type": [
        "http://purl.org/spar/datacite/Identifier"
      ]
    },
    {
      "id": "https://w3id.org/oc/meta/id/06640462627",
      "type": [
        "http://purl.org/spar/datacite/Identifier"
      ]
    }
  ],
  "id": "https://w3id.org/oc/meta/br/061202127149",
  "isDocumentContextFor": [
    {
      "id": "https://w3id.org/oc/meta/ar/061209588721",
      "type": [
        "http://purl.org/spar/pro/RoleInTime"
      ]
    },
    {
      "id": "https://w3id.org/oc/meta/ar/061209588722",
      "type": [
        "http://purl.org/spar/pro/RoleInTime"
      ]
    },
    {
      "id": "https://w3id.org/oc/meta/ar/061209588723",
      "type": [
... (61 more lines)

The join#

No join. OBA binds a single endpoint, so it cannot reach OpenCitations Index to add the reference count.

Output#

JSON.

Pagination#

call("http://localhost:8087/v1.0.0/journalarticles?page=1&per_page=2", show_headers=True)
curl -i 'http://localhost:8087/v1.0.0/journalarticles?page=1&per_page=2' 

# 200 OK
# Content-Type: application/json

[
  {
    "embodiment": [
      {
        "id": "https://w3id.org/oc/meta/re/061502433548",
        "type": [
          "http://purl.org/spar/fabio/Manifestation"
        ]
      }
    ],
    "hasIdentifier": [
      {
        "id": "https://w3id.org/oc/meta/id/061503082479",
        "type": [
          "http://purl.org/spar/datacite/Identifier"
        ]
      },
      {
        "id": "https://w3id.org/oc/meta/id/06710333841",
        "type": [
          "http://purl.org/spar/datacite/Identifier"
        ]
      }
    ],
    "id": "https://w3id.org/oc/meta/br/061503302001",
    "isDocumentContextFor": [
      {
        "id": "https://w3id.org/oc/meta/ar/0615013406315",
        "type": [
          "http://purl.org/spar/pro/RoleInTime"
        ]
      },
      {
        "id": "https://w3id.org/oc/meta/ar/0615013406316",
        "type": [
          "http://purl.org/spar/pro/RoleInTime"
        ]
      }
    ],
    "partOf": [
... (96 more lines)

Versioning#

The version is carried in the base path (/v1.0.0), derived from oba/config.yaml.

API description#

OpenAPI 3.0.

call("http://localhost:8087/v1.0.0/openapi.json")
curl http://localhost:8087/v1.0.0/openapi.json 

# 200 OK

{
  "components": {
    "schemas": {
      "JournalArticle": {
        "description": "Description not available",
        "example": {
          "value": {
            "id": "some_id"
          }
        },
        "properties": {
          "description": {
            "description": "small description",
            "items": {
              "type": "string"
            },
            "nullable": true,
            "type": "array"
          },
          "id": {
            "description": "identifier",
            "nullable": false,
            "type": "string"
          },
          "label": {
            "description": "short description of the resource",
            "items": {
              "type": "string"
            },
            "nullable": true,
            "type": "array"
          },
          "publicationDate": {
            "description": "Description not available",
            "items": {
              "type": "string"
            },
            "nullable": true,
            "type": "array"
          },
... (222 more lines)

Authentication#

With write paths enabled, only the write methods carry a Bearer requirement; reads stay open. OBA verifies credentials against Firebase, the only provider.