UNPKG

11.2 kBMarkdownView Raw
1# ISTEX statements for ezs
2
3This package cannot be used alone. EZS has to be installed.
4
5## Usage
6
7```js
8var ezs = require('ezs');
9ezs.use(require('ezs-istex'));
10```
11
12## Statements
13
14<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
15
16#### Table of Contents
17
18- [ISTEXFetch](#istexfetch)
19 - [Parameters](#parameters)
20- [ISTEXParseDotCorpus](#istexparsedotcorpus)
21 - [Parameters](#parameters-1)
22- [ISTEXResult](#istexresult)
23 - [Parameters](#parameters-2)
24- [ISTEXSave](#istexsave)
25 - [Parameters](#parameters-3)
26- [ISTEXScroll](#istexscroll)
27 - [Parameters](#parameters-4)
28- [ISTEXSearch](#istexsearch)
29 - [Parameters](#parameters-5)
30- [ISTEXTriplify](#istextriplify)
31 - [Parameters](#parameters-6)
32 - [Examples](#examples)
33- [ISTEX](#istex)
34 - [Parameters](#parameters-7)
35- [remove-if](#remove-if)
36 - [Parameters](#parameters-8)
37 - [Examples](#examples-1)
38
39### ISTEXFetch
40
41Take `Object` with `id` and returns the document's metadata
42
43#### Parameters
44
45- `data`
46- `feed`
47- `source` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Field to use to fetch documents (optional, default `"id"`)
48- `target` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
49- `id` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** ISTEX Identifier of a document (optional, default `data.id`)
50- `sid` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User-agent identifier (optional, default `"ezs-istex"`)
51
52Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>**
53
54### ISTEXParseDotCorpus
55
56Parse a `.corpus` file content, and returns an object containing queries and
57ids.
58
59#### Parameters
60
61- `data`
62- `feed`
63
64Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
65
66### ISTEXResult
67
68- **See: ISTEXScroll**
69
70Take `Object` containing results of ISTEX API, and returns `hits` value (documents).
71This should be placed after ISTEXScroll.
72
73#### Parameters
74
75- `data`
76- `feed`
77- `source` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** (optional, default `data`)
78- `target` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** (optional, default `feed`)
79
80Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>**
81
82### ISTEXSave
83
84- **See: ISTEXFetch**
85
86Take and Object with ISTEX `id` and save the document's file.
87Warning: to access fulltext, you have to give a `token` parameter.
88ISTEXFetch produces the stream you need to save the file.
89
90#### Parameters
91
92- `data`
93- `feed`
94- `directory` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** path where to save the PDFs (optional, default `currentworkingdirectory`)
95- `typology` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** typology of the document to save (optional, default `"fulltext"`)
96- `format` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** format of the files to save (optional, default `"pdf"`)
97- `sid` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User-agent identifier (optional, default `"ezs-istex"`)
98- `token` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** authentication token (see [documentation](https://doc.istex.fr/api/access/fede.html#acc%C3%A8s-programmatique-via-un-token-didentification))
99
100Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)**
101
102### ISTEXScroll
103
104- **See: ISTEXSearch**
105
106Take an `Object` containing URLs to the ISTEX API, and returns results.
107
108#### Parameters
109
110- `data`
111- `feed`
112- `source` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
113- `target` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
114
115Returns **[Stream](https://nodejs.org/api/stream.html)**
116
117### ISTEXSearch
118
119Take `Object` containing a query and outputs URLs to use with ISTEXScroll.
120Optionally, you can put the query in the `query` parameter.
121
122#### Parameters
123
124- `data`
125- `feed`
126- `source` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** property to treat (optional, default `"query"`)
127- `target` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** property used in the result
128- `query` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** ISTEX query
129- `sid` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User-agent identifier (optional, default `"ezs-istex"`)
130- `maxPage` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** maximum number of pages to get from the API
131- `size` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** size of each page of results (optional, default `2000`)
132- `duration` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** maximum duration between two request to the API (optional, default `"30s"`)
133- `field` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** fields to output (optional, default `["doi"]`)
134
135Returns **[Stream](https://nodejs.org/api/stream.html)**
136
137### ISTEXTriplify
138
139- **See: ISTEXResult**
140- **See: OBJFlatten (from ezs-basics)**
141
142Take `Object` containing flatten hits from ISTEXResult.
143
144#### Parameters
145
146- `data`
147- `feed`
148- `property` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** path to uri for the properties to output (property and uri separated by `->`) (optional, default `[]`)
149- `source` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the root of the keys (ex: `istex/`) (optional, default `""`)
150
151#### Examples
152
153```javascript
154data: {
155'author/0/name': 'Geoffrey Strickland',
156'author/0/affiliations/0': 'University of Reading',
157'host/issn/0': '0047-2441',
158'host/eissn/0': '1740-2379',
159'title': 'Maupassant, Zola, Jules Vallès and the Paris Commune of 1871',
160'publicationDate': '1983',
161'doi/0': '10.1177/004724418301305203',
162'id': 'F6CB7249E90BD96D5F7E3C4E80CC1C3FEE4FF483',
163'score': 1 }
164```
165
166```javascript
167.pipe(ezs('ISTEXTriplify', {
168 property: [
169 'doi/0 -> http://purl.org/ontology/bibo/doi',
170 'language -> http://purl.org/dc/terms/language',
171 'author/\\d+/name -> http://purl.org/dc/terms/creator',
172 'author/\\d+/affiliations -> https://data.istex.fr/ontology/istex#affiliation',
173 ],
174 ));
175```
176
177```javascript
178<https://data.istex.fr/document/F6CB7249E90BD96D5F7E3C4E80CC1C3FEE4FF483>
179 a <http://purl.org/ontology/bibo/Document> ;
180 "10.1002/zaac.19936190205" ;
181 <https://data.istex.fr/ontology/istex#idIstex> "F6CB7249E90BD96D5F7E3C4E80CC1C3FEE4FF483" ;
182 <http://purl.org/dc/terms/creator> "Geoffrey Strickland" ;
183 <https://data.istex.fr/ontology/istex#affiliation> "University of Reading" ;
184```
185
186Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
187
188### ISTEX
189
190Take an array and returns matching documents for every value of the array
191
192#### Parameters
193
194- `data`
195- `feed`
196- `query` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>)** ISTEX query (or queries) (optional, default `data.query||[]`)
197- `id` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>)** ISTEX id (or ids) (optional, default `data.id||[]`)
198- `maxPage` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** maximum number of pages to get
199- `size` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** size of each page of results
200- `duration` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** maximum duration between two requests (ex: "30s")
201- `field` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** fields to output
202
203Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>**
204
205### remove-if
206
207Remove triples which properties are given (`remove`) if other given `property`
208has the given `value`.
209
210#### Parameters
211
212- `if` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** "property = value"
213
214#### Examples
215
216```javascript
217<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> <https://data.istex.fr/ontology/istex#idIstex> "2FF3F5B1477986B9C617BB75CA3333DBEE99EB05" .
218<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> a <http://purl.org/ontology/bibo/Document> .
219<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> <host/genre> "journal" .
220<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> <https://data.istex.fr/fake#journalTitle> "Linguistic Typology" .
221<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> <https://data.istex.fr/fake#bookTitle> "Linguistic Typology" .
222<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> <https://data.istex.fr/fake#seriesTitle> "Linguistic Typology" .
223```
224
225```javascript
226[ISTEXRemoveIf]
227if = <host/genre> = "journal"
228remove = <https://data.istex.fr/fake#bookTitle>
229remove = <https://data.istex.fr/fake#seriesTitle>
230remove = <host/genre>
231```
232
233```javascript
234<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> <https://data.istex.fr/ontology/istex#idIstex> "2FF3F5B1477986B9C617BB75CA3333DBEE99EB05" .
235<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> a <http://purl.org/ontology/bibo/Document> .
236<https://api.istex.fr/ark:/67375/QT4-D0J6VN6K-K> <https://data.istex.fr/fake#journalTitle> "Linguistic Typology" .
237```