Skip to content

Commit

Permalink
api uni inde
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanhb committed Sep 8, 2023
1 parent 73b1773 commit 61fdef5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
33 changes: 28 additions & 5 deletions index_v1.hf
Original file line number Diff line number Diff line change
Expand Up @@ -411,27 +411,50 @@ WHERE {
?oci cito:hasCitedEntity ?cited .
}

#url /citation-count-uniindex/{doi}
#type operation
#doi str(10\..+)
#preprocess lower(doi) --> get_omid_of_doi(doi)
#method get
#description This operation retrieves the number of outgoing citations f>

The field returned by this operation is:

* *count*: the number of outgoing citations from the input bibliographic>
#call /citation-count-uniindex/10.1142/9789812701527_0009
#field_type int(count)
#output_json [
{
"count": "32"
}
]
#sparql PREFIX cito: <http://purl.org/spar/cito/>
SELECT (count(?citing) as ?count)
WHERE {
?oci cito:hasCitedEntity <https://w3id.org/oc/meta/br/[[doi]]> .
?oci cito:hasCitingEntity ?citing .
}

#url /reference-count-uniindex/{doi}
#type operation
#doi str(10\..+)
#preprocess lower(doi) --> get_omid_of_doi(doi)
#method get
#description This operation retrieves the number of outgoing citations from the bibliographic entity identified by the input DOI.
#description This operation retrieves the number of outgoing citations f>

The field returned by this operation is:

* *count*: the number of outgoing citations from the input bibliographic entity.
#call /reference-count/10.1016/j.websem.2012.08.001
* *count*: the number of outgoing citations from the input bibliographic>
#call /reference-count-uniindex/10.1186/1756-8722-6-59
#field_type int(count)
#output_json [
{
"count": "13"
"count": "75"
}
]
#sparql PREFIX cito: <http://purl.org/spar/cito/>
SELECT (count(?cited) as ?count)
WHERE {
?oci cito:hasCitingEntity <https://w3id.org/oc/meta/[[doi]]> .
?oci cito:hasCitingEntity <https://w3id.org/oc/meta/br/[[doi]]> .
?oci cito:hasCitedEntity ?cited .
}
9 changes: 4 additions & 5 deletions indexapi_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,22 +99,21 @@ def split_dois(s):

def get_omid_of_doi(s):
api = "https://test.opencitations.net/meta/api/v1/metadata/doi:%s"
return "br/12345"
try:
r = get(api % s,
headers={"User-Agent": "INDEX REST API (via OpenCitations - http://opencitations.net; mailto:[email protected])"}, timeout=60)
headers={"User-Agent": "INDEX REST API (via OpenCitation>
if r.status_code == 200:
json_res = loads(r.text)
if len(json_res) > 0:
#take the one and only result given back by META
body = json_res[0]
matches = findall(r'omid:br/[\dA-Za-z/]+', body["id"])
if matches:
return matches[0].replace("omid:","")
return matches[0].replace("omid:br/",""),

except Exception as e:
return ""
return ""
return "",
return "",


def metadata(res, *args):
Expand Down

0 comments on commit 61fdef5

Please sign in to comment.