-
Notifications
You must be signed in to change notification settings - Fork 0
/
component-citation.sparql
56 lines (44 loc) · 1.89 KB
/
component-citation.sparql
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
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX fx: <http://sparql.xyz/facade-x/ns/>
PREFIX xyz: <http://sparql.xyz/facade-x/data/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX schema: <https://schema.org/>
PREFIX fabio: <http://purl.org/spar/fabio/>
PREFIX frapo: <http://purl.org/cerif/frapo/>
SELECT ?component ?doi ?apa ?bibtex
WHERE {
SERVICE <x-sparql-anything:> {
SERVICE <x-sparql-anything:> {
# --> Step 1. extract the YAML fontmatter from files with component annotations
fx:properties fx:location ?_componentFile .
[] a xyz:YamlFrontMatter ; fx:anySlot ?yaml
}
BIND ( ?yaml as ?content ) .
#--> Step 2. parse the YAML content
fx:properties fx:content ?content ;
fx:triplifier "io.github.sparqlanything.yaml.YAMLTriplifier" ; fx:blank-nodes "false" ; fx:yaml.allow-duplicate-keys true.
{ # Components:
# Id
?x xyz:component-id ?component .
?x xyz:doi ?doi .
}
}
### curl -LH "Accept: text/x-bibliography; style=apa" https://doi.org/10.1126/science.169.3946.635
BIND ( IF(fx:String.startsWith(?doi, "http"), ?doi, CONCAT("https://doi.org/", ?doi)) AS ?doiLink ) .
OPTIONAL{
SERVICE SILENT <x-sparql-anything:> {
fx:properties fx:location ?doiLink ;
fx:http.header.accept "text/x-bibliography; style=apa" ;
fx:media-type "text/plain" .
[] rdf:_1 ?apa
}}
OPTIONAL{
SERVICE SILENT <x-sparql-anything:> {
fx:properties fx:location ?doiLink ;
fx:http.header.accept "text/x-bibliography; style=bibtex" ;
fx:media-type "text/plain" .
[] rdf:_1 ?bibtex
}
}
}