framework-api-client

Client for CDLI framework API

https://github.com/cdli-gh/framework-api-client

Science Score: 52.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
    Organization cdli-gh has institutional domain (cdli.ucla.edu)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (8.0%) to scientific vocabulary

Keywords from Contributors

interactive ecosystem-modeling mesh interpretability profiles distribution sequences generic projection standardization
Last synced: 7 months ago · JSON representation ·

Repository

Client for CDLI framework API

Basic Info
  • Host: GitHub
  • Owner: cdli-gh
  • License: mit
  • Language: JavaScript
  • Default Branch: master
  • Size: 466 KB
Statistics
  • Stars: 1
  • Watchers: 4
  • Forks: 5
  • Open Issues: 5
  • Releases: 0
Created over 5 years ago · Last pushed 12 months ago
Metadata Files
Readme License Citation

README.md

Framework API Client

Client for CDLI framework API.

Install

A prerequisite for this client is Node.JS and a package manager like npm, which usually comes with it.

npm install -g cdli-api-client

Or install it locally into an existing project:

npm install cdli-api-client

Alternatively, the command can be run with npx:

npx cdli-api-client --help

Getting started

Right now, the client supports two basic operations:

  • exporting parts of the database as linked data (or specifically N-Triples). The parts that can be chosen are the types of entities in the catalogue, such as artifacts, materials, proveniences, inscriptions and periods.
  • searching artifacts in the database.

Command-Line Interface

cdli [command]

Commands:
  cdli export  Export catalog and text data
  cdli search  Export catalog and text data

Options:
  --version          Show version number                               [boolean]
  --host, -h         Host URL to use for API calls
                                       [string] [default: "https://cdli.earth/"]
  --format, -f       File format
                  [choices: "ndjson", "csv", "tsv", "ntriples", "bibtex", "atf"]
  --output-file, -o  Output file (outputs to stdout by default)
  --help             Show help                                         [boolean]

Export

cdli export

Export catalog and text data

Options:
      --version      Show version number                               [boolean]
  -h, --host         Host URL to use for API calls
                                       [string] [default: "https://cdli.earth/"]
  -f, --format       File format
           [choices: "ndjson", "csv", "tsv", "ntriples", "ttl", "bibtex", "atf"]
  -o, --output-file  Output file (outputs to stdout by default)
      --help         Show help                                         [boolean]
  -e, --entities     Which types of entities to fetch
  [array] [choices: "abbreviations", "archives", "artifacts", "artifact-assets",
                          "artifacts-external-resources", "artifacts-materials",
      "entities-external-resources", "entities-names", "authors", "collections",
        "dynasties", "external-resources", "genres", "inscriptions", "journals",
   "languages", "locations", "materials", "material-aspects", "material-colors",
       "periods", "places", "proveniences", "publications", "regions", "rulers"]
                                                                   [default: []]
  -i, --index        Which index(es) to fetch              [array] [default: []]

So to export place-related entities from a locally-running framework instance you could do this:

cdli export \
  --host http://localhost:2354/ \
  --entities archives proveniences regions \
  --output-file places.nt

Fetching all artifacts from the live server could look like this:

cdli export \
  --host https://cdli.earth/ \
  --entities artifacts \
  --format csv \
  --output-file artifacts.csv

Export all linked data:

cdli export \
  --host https://cdli.earth/ \
  --entities abbreviations archives artifacts artifact-assets \
    artifacts-external-resources artifacts-materials authors collections \
    dynasties entities-external-resources entities-names external-resources \
    genres inscriptions journals languages locations materials material-aspects \
    material-colors periods places proveniences publications regions rulers \
  --format ntriples \
  --output-file all.nt

Search

cdli search

Search artifacts in the catalog

Simple search:
  -q, --query                Search query                                [array]
      --queryCategory, --qc  Search category
        [array] [choices: "keyword", "publication", "collection", "provenience",
                               "period", "transliteration", "translation", "id"]
      --queryOperator, --qo  Search operator      [array] [choices: "AND", "OR"]

Advanced search:
      --advancedField, --af  Search field                                [array]
      --advancedQuery, --aq  Search query                                [array]

Filter:
      --filterField, --fk  Filter by field                               [array]
      --filterValue, --fv  Filter by value                               [array]

Options:
      --version      Show version number                               [boolean]
  -h, --host         Host URL to use for API calls
                         [string] [default: "https://cdli.earth/"]
  -f, --format       File format
                  [choices: "ndjson", "csv", "tsv", "ntriples", "bibtex", "atf"]
  -o, --output-file  Output file (outputs to stdout by default)
      --help         Show help                                         [boolean]

Example:

cdli search -q holland --fk genre --fv "Official or display" -f tsv

Programming Interface

```js const CDLI = require('cdli-api-client')

const client = new CDLI.Client('http://localhost:2354/')

// process logging client.on('log', msg => process.stderr.write(msg))

client.export(['archives', 'proveniences', 'regions' ], 'places.nt') .then(entities => { for (const { status, reason } of entities) { if (status === 'rejected') { console.error(reason) } } }) ```

Owner

  • Name: CDLI
  • Login: cdli-gh
  • Kind: organization
  • Email: cdli@orinst.ox.ac.uk
  • Location: Los Angeles, Oxford, Berlin

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Willighagen"
  given-names: "Lars"
  orcid: "https://orcid.org/0000-0002-4751-4637"
title: "CDLI Framework API Client"
version: 0.0.2
date-released: 2022-11-10
url: "https://github.com/cdli-gh/framework-api-client"

GitHub Events

Total
  • Issues event: 1
  • Watch event: 1
  • Issue comment event: 11
  • Push event: 3
  • Pull request event: 1
  • Fork event: 1
  • Create event: 2
Last Year
  • Issues event: 1
  • Watch event: 1
  • Issue comment event: 11
  • Push event: 3
  • Pull request event: 1
  • Fork event: 1
  • Create event: 2

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 66
  • Total Committers: 4
  • Avg Commits per committer: 16.5
  • Development Distribution Score (DDS): 0.106
Past Year
  • Commits: 31
  • Committers: 2
  • Avg Commits per committer: 15.5
  • Development Distribution Score (DDS): 0.065
Top Committers
Name Email Commits
Lars Willighagen l****n@g****m 59
dependabot[bot] 4****] 3
Emilie Page-Perron e****p@i****t 3
khoidt e****d@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 8
  • Total pull requests: 8
  • Average time to close issues: about 1 year
  • Average time to close pull requests: 10 days
  • Total issue authors: 3
  • Total pull request authors: 4
  • Average comments per issue: 2.38
  • Average comments per pull request: 0.63
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 5
Past Year
  • Issues: 3
  • Pull requests: 1
  • Average time to close issues: 11 days
  • Average time to close pull requests: N/A
  • Issue authors: 3
  • Pull request authors: 1
  • Average comments per issue: 3.33
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • larsgw (5)
  • stinney (2)
  • epageperron (1)
Pull Request Authors
  • dependabot[bot] (5)
  • jainaryan04 (2)
  • withgaurav (1)
  • epageperron (1)
Top Labels
Issue Labels
enhancement (5)
Pull Request Labels
dependencies (5)

Dependencies

package-lock.json npm
  • 194 dependencies
package.json npm
  • eslint ^7.32.0 development
  • eslint-config-standard ^16.0.3 development
  • form-data ^4.0.0
  • node-fetch ^2.6.1
  • parse-link-header ^2.0.0
  • yargs ^17.3.1