Aller au contenu

omnilab/cod Référence de l’API

Étage
Fournisseur · Omnilab
Version
1.x
Suite de conformité
non branchée
Vérifié en réel
Son README ne le dit pas
Licence
MIT
composer require omnilab/cod:1.x-dev

Lue dans les fichiers PHP du paquet au commit 36e7eeb7d9dd : ses espaces de noms, classes, interfaces et énumérations, leurs constantes, propriétés et méthodes publiques avec leur PHPDoc, et les options que prennent ses fabriques. Rien n’en est exécuté.

Omnilab\Cod

  • CodSource class

    The Crystallography Open Database (Vilnius University), an open-access collection of crystal structures of organic, inorganic, metal-organic compounds and minerals: a structure by its COD id ("1000000", "cod:9008565", its page or its CIF's address) - its names, formula, unit cell (lengths, angles, volume with their uncertainties), space group (Hermann-Mauguin, Hall, number), Z, temperature and pressure, radiation, R factors, its publication (title, authors, journal, year, pages, DOI) and its flags; the entry it duplicates as a related thing; its CIF as a file (cif(), outside the contract: an Entity holds no asset; open() reads it) -; a search of the entries' metadata by text.

    7 methods · 2 constants

  • CodSourceFactory class

    The Crystallography Open Database: crystal structures by COD id, their cell, space group and publication, their CIF; a search - no key needed.

    2 options

Omnilab\Cod

CodSource class

final class CodSource extends HttpSource CodSource.php:37

The Crystallography Open Database (Vilnius University), an open-access collection of crystal structures of organic, inorganic, metal-organic compounds and minerals: a structure by its COD id ("1000000", "cod:9008565", its page or its CIF's address) - its names, formula, unit cell (lengths, angles, volume with their uncertainties), space group (Hermann-Mauguin, Hall, number), Z, temperature and pressure, radiation, R factors, its publication (title, authors, journal, year, pages, DOI) and its flags; the entry it duplicates as a related thing; its CIF as a file (cif(), outside the contract: an Entity holds no asset; open() reads it) -; a search of the entries' metadata by text.

One call an entry; a search page two (the ids that match, then their rows). No key, no published rate; the data are in the public domain (CC0), "users should acknowledge the original authors".

const BASE_URI = 'https://www.crystallography.net/cod/'
const MAX_LIMIT = 100

The most entries a search page holds.

CodSource::__construct()

public function __construct(HttpClientInterface $http, string $baseUri = self::BASE_URI, array $headers = [], float $throttle = 0.0)

CodSource::getName()

public function getName(): string

CodSource::capabilities()

public function capabilities(): array

CodSource::entity()

public function entity(Identifier|string $id): ?Entity

A structure by its COD id ("1000000", "cod:1000000", its page, its CIF's address); another base's identifier is refused before any call; null when COD has no such entry.

public function search(Query $query): Page

The entries whose metadata hold the text (a compound's or a mineral's name, an author, a title's words), the duplicates and erroneous ones left out as COD does, in COD's order (by id); a domain other than chemistry answers nothing. Two calls a page: the ids that match (all of them, cut here), then the page's rows.

CodSource::cif()

public function cif(Identifier|string $id): Asset

The CIF of a structure, as a file to download (outside the contract: an Entity holds no asset). Makes no call.

CodSource::open()

public function open(Asset|string $file): ResponseInterface

A COD file read - a CIF (cif(), or its address), a structure's reflection data (".hkl") - streamed, not read; an address of another site is refused before any call.

CodSourceFactory class

final class CodSourceFactory extends SourceFactory CodSourceFactory.php:19

The Crystallography Open Database: crystal structures by COD id, their cell, space group and publication, their CIF; a search - no key needed.

options: mailto: 'support@glitchr.io' # in the User-Agent throttle: 0.5 # seconds between two calls: COD publishes no rate, and answered 403 to eight calls in ten seconds base_uri: 'https://www.crystallography.net/cod/' # or a mirror's

Options

OptionDefault
throttle0.5
base_uriCodSource::BASE_URI