-
Notifications
You must be signed in to change notification settings - Fork 0
/
get-nanopubs-for-paper.rq
75 lines (73 loc) · 2.38 KB
/
get-nanopubs-for-paper.rq
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
#+ summary: Get the nanopublications referring to a given paper.
#+ method: GET
#+ pagination: 1000
#+ endpoint_in_url: False
prefix np: <http://www.nanopub.org/nschema#>
prefix npa: <http://purl.org/nanopub/admin/>
prefix npx: <http://purl.org/nanopub/x/>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix dct: <http://purl.org/dc/terms/>
prefix oa: <http://www.w3.org/ns/oa#>
select distinct ?np ?user ?type ?subj ?subjLabel ?rel ?relLabel ?text ?selection ?date where {
graph npa:graph {
?np npa:hasHeadGraph ?h .
?np dct:created ?date .
?np npa:hasValidSignatureForPublicKey ?pubkey .
}
graph ?h {
?np np:hasAssertion ?a .
?np np:hasPublicationInfo ?i.
}
graph ?a {
?subj ?rel ?_paper_iri .
}
optional { ?a rdfs:comment ?textPre . bind(str(?textPre) as ?text) }
optional { graph <http://purl.org/np/RA6d0qLmlRdXd-ubre83LxP22auJdJjXGzaW3W3qH4Neo#assertion> {
?rel rdfs:label ?relLabelPre .
bind("cito" as ?typePre)
} }
optional { graph ?a {
?annotation oa:hasTarget ?annotationtarget ;
oa:hasBody ?annotationbody .
?annotationbody rdf:value ?annotationtext .
?annotationtarget oa:hasSource ?_paper_iri ;
oa:hasSelector ?annotationSelector .
optional { ?annotationSelector oa:prefix ?annotatedprefix . }
?annotationSelector oa:exact ?annotatedtext .
optional { ?annotationSelector oa:suffix ?annotatedsuffix . }
bind("oa" as ?typePre)
bind(str(?annotationtext) as ?text)
bind(concat(?annotatedprefix, "<h>", ?annotatedtext, "</h>", ?annotatedsuffix) as ?selection)
} }
bind(replace(str(?subj), '^.*?([a-zA-Z0-9\\-\\_]+)$', '$1') as ?subjLabel).
bind(coalesce(str(?relLabelPre), replace(str(?rel), '^.*?([a-zA-Z0-9\\-\\_]+)$', '$1')) as ?relLabel).
bind(coalesce(?typePre, "other") as ?type).
graph ?i {
?np dct:creator ?user .
}
filter not exists {
graph npa:graph {
?newversion npa:hasHeadGraph ?nh .
?newversion npa:hasValidSignatureForPublicKey ?pubkey .
}
graph ?nh {
?newversion np:hasPublicationInfo ?ni .
}
graph ?ni {
?newversion npx:supersedes ?np .
}
}
filter not exists {
graph npa:graph {
?retraction npa:hasHeadGraph ?rh .
?retraction npa:hasValidSignatureForPublicKey ?pubkey .
}
graph ?rh {
?retraction np:hasAssertion ?ra .
}
graph ?ra {
?person npx:retracts ?np .
}
}
}
order by desc(?date)