-
Notifications
You must be signed in to change notification settings - Fork 2
/
v1.hf
82 lines (79 loc) · 4.41 KB
/
v1.hf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#url /api
#type api
#base http://localhost:8000
#title REST API for BCite
#description This document describe the REST API for accessing the data stored according to the OpenCitations Data Model (OCDM) for the BCite tool.
#version Version 1.0.0
#contacts [[email protected]](mailto:[email protected])
#license This document is licensed with a [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/legalcode), while the REST API itself has been created using [RAMOSE](https://github.com/opencitations/ramose), the *Restful API Manager Over SPARQL Endpoints* created by [Silvio Peroni](https://orcid.org/0000-0003-0530-4305), which is licensed with an [ISC license](https://opensource.org/licenses/ISC).
#endpoint http://localhost:9999/blazegraph/sparql
#addon script/api/bciteapi
#url /citing/{timestamp}/{json}
#type operation
#timestamp str([0-9]+\.[0-9]+)
#json str(.+)
#preprocess create_br(timestamp, json)
#method get
#description This operation returns the id of the citing paper as it has been stored in the OpenCitations Corpus local instance. Note that the `create_br` function used for creating the OC bibliographic resource of the citing entity will substitute the "json" part with the URL of the article in consideration.
#call /citing/1234567/%7B%22doi%22%3A%2210.1108%2Fjd-12-2013-0166%22%7D
#output_json [
{
"id": "br/1"
}
]
#field_type str(id)
#sparql PREFIX fabio: <http://purl.org/spar/fabio/>
SELECT ?id
WHERE {
BIND (<[[json]]> AS ?br) .
?br a fabio:Expression .
BIND (strafter(str(?br), "/corpus/") AS ?id) .
}
LIMIT 1
#url /reference/{timestamp}/{citing}/{style}/{reference}
#type operation
#timestamp str([0-9]+\.[0-9]+)
#citing str(br/[0-9]+)
#style str([A-z]+)
#reference str(.+)
#preprocess call_crossref(timestamp,citing,style,reference)
#method get
#description This operation returns the id of the cited paper as it has been stored in the OpenCitations Corpus local instance. Note that the `call_crossref` function used for creating the OC bibliographic resource of the cited entity will substitute the "reference" part with the URL of the cited article. Note that before calling Crossref, the function tries to obtain the cited article by its DOI, if it is specified in the reference text, by looking directly in the OCC local instance.
#call /reference/1234567/br/1/chicago/Peroni%2C%20S.%2C%20Shotton%2C%20D.%20(2012).%20FaBiO%20and%20CiTO%3A%20ontologies%20for%20describing%20bibliographic%20resources%20and%20citations.%20In%20Journal%20of%20Web%20Semantics%3A%20Science%2C%20Services%20and%20Agents%20on%20the%20World%20Wide%20Web%2C%2017%20(December%202012)%3A%2033-43.%20Amsterdam%2C%20The%20Netherlands%3A%20Elsevier.%20DOI%3A%2010.1016%2Fj.websem.2012.08.001
#output_json [
{
"id": "br/10"
}
]
#field_type str(id) str(reference)
#sparql PREFIX fabio: <http://purl.org/spar/fabio/>
PREFIX biro: <http://purl.org/spar/biro/>
PREFIX c4o: <http://purl.org/spar/c4o/>
PREFIX frbr: <http://purl.org/vocab/frbr/core#>
SELECT ?id ?reference
WHERE {
BIND (<[[reference]]> AS ?br) .
<http://localhost:8000/corpus/[[citing]]> frbr:part [
c4o:hasContent ?reference ;
biro:references ?br
]
BIND (strafter(str(?br), "/corpus/") AS ?id) .
}
LIMIT 1
#url /store/{timestamp}/{accept}/{citing}/{cited}/{reference}
#type operation
#timestamp str([0-9]+\.[0-9]+)
#accept str(.+)
#citing str(br/[0-9]+)
#cited str(br/[0-9]+)
#reference str(.+)
#method get
#preprocess fix_reference(timestamp,accept,citing,cited,reference)
#description This operation returns the number of new entities added in the OpenCitations Corpus local instance. Note that the `fix_reference` function used for storing correctly the OC bibliographic resource of the cited entity will substitute the "timestamp" part with the "yyyy-mm-ddThh:mm:ss" string of the creation date.
#call /store/1234567/false/br/1/br/10/Peroni%2C%20S.%2C%20Shotton%2C%20D.%20(2012).%20FaBiO%20and%20CiTO%3A%20ontologies%20for%20describing%20bibliographic%20resources%20and%20citations.%20In%20Journal%20of%20Web%20Semantics%3A%20Science%2C%20Services%20and%20Agents%20on%20the%20World%20Wide%20Web%2C%2017%20(December%202012)%3A%2033-43.%20Amsterdam%2C%20The%20Netherlands%3A%20Elsevier.%20DOI%3A%2010.1016%2Fj.websem.2012.08.001
#output_json []
#field_type int(n)
#sparql PREFIX prov: <https://www.w3.org/ns/prov#>
SELECT (count(?en) as ?n) {
?en ^prov:specializationOf/prov:generatedAtTime "[[timestamp]]"
}