/node-ezs-istex

Using ezs to query ISTEX API

Primary LanguageJavaScript

ISTEX statements for ezs

This package cannot be used alone. EZS has to be installed.

Usage

var ezs = require('ezs');
ezs.use(require('ezs-istex'));

Statements

Table of Contents

ISTEXFetch

Take Object with id and returns the document's metadata

Parameters

  • data
  • feed
  • source string Field to use to fetch documents (optional, default "id")
  • target string
  • id string ISTEX Identifier of a document (optional, default data.id)
  • sid string User-agent identifier (optional, default "ezs-istex")

Returns Array<Object>

ISTEXParseDotCorpus

Parse a .corpus file content, and returns an object containing queries and ids.

Parameters

  • data
  • feed

Returns Object

ISTEXResult

  • See: ISTEXScroll

Take Object containing results of ISTEX API, and returns hits value (documents). This should be placed after ISTEXScroll.

Parameters

  • data
  • feed
  • source string (optional, default data)
  • target string (optional, default feed)

Returns Array<Object>

ISTEXSave

  • See: ISTEXFetch

Take and Object with ISTEX id and save the document's file. Warning: to access fulltext, you have to give a token parameter. ISTEXFetch produces the stream you need to save the file.

Parameters

  • data
  • feed
  • directory string path where to save the PDFs (optional, default currentworkingdirectory)
  • typology string typology of the document to save (optional, default "fulltext")
  • format string format of the files to save (optional, default "pdf")
  • sid string User-agent identifier (optional, default "ezs-istex")
  • token string? authentication token (see documentation)

Returns Array

ISTEXScroll

  • See: ISTEXSearch

Take an Object containing URLs to the ISTEX API, and returns results.

Parameters

Returns Stream

ISTEXSearch

Take Object containing a query and outputs URLs to use with ISTEXScroll. Optionally, you can put the query in the query parameter.

Parameters

  • data
  • feed
  • source string property to treat (optional, default "query")
  • target string property used in the result
  • query string ISTEX query
  • sid string User-agent identifier (optional, default "ezs-istex")
  • maxPage number maximum number of pages to get from the API
  • size number size of each page of results (optional, default 2000)
  • duration string maximum duration between two request to the API (optional, default "30s")
  • field Array<string> fields to output (optional, default ["doi"])

Returns Stream

ISTEXTriplify

  • See: ISTEXResult
  • See: OBJFlatten (from ezs-basics)

Take Object containing flatten hits from ISTEXResult.

Parameters

  • data
  • feed
  • property Object path to uri for the properties to output (property and uri separated by ->) (optional, default [])
  • source string the root of the keys (ex: istex/) (optional, default "")

Examples

data: {
'author/0/name': 'Geoffrey Strickland',
'author/0/affiliations/0': 'University of Reading',
'host/issn/0': '0047-2441',
'host/eissn/0': '1740-2379',
'title': 'Maupassant, Zola, Jules Vallès and the Paris Commune of 1871',
'publicationDate': '1983',
'doi/0': '10.1177/004724418301305203',
'id': 'F6CB7249E90BD96D5F7E3C4E80CC1C3FEE4FF483',
'score': 1 }
.pipe(ezs('ISTEXTriplify', {
   property: [
     'doi/0 -> http://purl.org/ontology/bibo/doi',
     'language -> http://purl.org/dc/terms/language',
     'author/\\d+/name -> http://purl.org/dc/terms/creator',
     'author/\\d+/affiliations -> https://data.istex.fr/ontology/istex#affiliation',
   ],
 ));
<https://data.istex.fr/document/F6CB7249E90BD96D5F7E3C4E80CC1C3FEE4FF483>
    a <http://purl.org/ontology/bibo/Document> ;
      "10.1002/zaac.19936190205" ;
    <https://data.istex.fr/ontology/istex#idIstex> "F6CB7249E90BD96D5F7E3C4E80CC1C3FEE4FF483" ;
    <http://purl.org/dc/terms/creator> "Geoffrey Strickland" ;
    <https://data.istex.fr/ontology/istex#affiliation> "University of Reading" ;

Returns string

ISTEX

Take an array and returns matching documents for every value of the array

Parameters

  • data
  • feed
  • query (string | Array<string>) ISTEX query (or queries) (optional, default data.query||[])
  • id (string | Array<string>) ISTEX id (or ids) (optional, default data.id||[])
  • maxPage number maximum number of pages to get
  • size number size of each page of results
  • duration string maximum duration between two requests (ex: "30s")
  • field Array<Object> fields to output

Returns Array<Object>

ISTEXRemoveIf

Remove triples which properties are given (remove) if other given property has the given value.

Parameters

  • if string "property = value"

Examples

<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> <https://data.istex.fr/ontology/istex#idIstex> "2FF3F5B1477986B9C617BB75CA3333DBEE99EB05" .
<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> a <http://purl.org/ontology/bibo/Document> .
<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> <host/genre> "journal" .
<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> <https://data.istex.fr/fake#journalTitle> "Linguistic Typology" .
<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> <https://data.istex.fr/fake#bookTitle> "Linguistic Typology" .
<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> <https://data.istex.fr/fake#seriesTitle> "Linguistic Typology" .
[ISTEXRemoveIf]
if = <host/genre> = "journal"
remove = <https://data.istex.fr/fake#bookTitle>
remove = <https://data.istex.fr/fake#seriesTitle>
remove = <host/genre>
<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> <https://data.istex.fr/ontology/istex#idIstex> "2FF3F5B1477986B9C617BB75CA3333DBEE99EB05" .
<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> a <http://purl.org/ontology/bibo/Document> .
<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> <https://data.istex.fr/fake#journalTitle> "Linguistic Typology" .

ISTEXRemoveVerb

Unconditionnaly remove triples which verb is given.

Parameters

  • verb string "<https://data.istex.fr/ontology/istex#idIstex>"

Examples

<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> <https://data.istex.fr/ontology/istex#idIstex> "2FF3F5B1477986B9C617BB75CA3333DBEE99EB05" .
<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> a <http://purl.org/ontology/bibo/Document> .
<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> <host/genre> "journal" .
<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> <https://data.istex.fr/fake#journalTitle> "Linguistic Typology" .
[ISTEXRemoveIf]
verb = <host/genre>
<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> <https://data.istex.fr/ontology/istex#idIstex> "2FF3F5B1477986B9C617BB75CA3333DBEE99EB05" .
<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> a <http://purl.org/ontology/bibo/Document> .
<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> <https://data.istex.fr/fake#journalTitle> "Linguistic Typology" .

ISTEXUniq

Remove duplicates triples within a single document's set of triples (same subject).

Assume that every triple of a document (except the first one) follows another triple of the same document.

Examples

<https://api.istex.fr/ark:/67375/NVC-JMPZTKTT-R> <http://purl.org/dc/terms/creator> "S Corbett" .
<https://api.istex.fr/ark:/67375/NVC-JMPZTKTT-R> <https://data.istex.fr/ontology/istex#affiliation> "Department of Public Health, University of Sydney, Australia." .
<https://api.istex.fr/ark:/67375/NVC-JMPZTKTT-R> <https://data.istex.fr/ontology/istex#affiliation> "Department of Public Health, University of Sydney, Australia." .
<https://api.istex.fr/ark:/67375/NVC-JMPZTKTT-R> <https://data.istex.fr/ontology/istex#affiliation> "Department of Public Health, University of Sydney, Australia." .
[ISTEXUniq]
<https://api.istex.fr/ark:/67375/NVC-JMPZTKTT-R> <http://purl.org/dc/terms/creator> "S Corbett" .
<https://api.istex.fr/ark:/67375/NVC-JMPZTKTT-R> <https://data.istex.fr/ontology/istex#affiliation> "Department of Public Health, University of Sydney, Australia." .