-
Notifications
You must be signed in to change notification settings - Fork 1
/
get-orgorg-nanopubs.rq
73 lines (71 loc) · 2.36 KB
/
get-orgorg-nanopubs.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
#+ summary: Get all simple organism-organism relation nanopublications
#+ 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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix nt: <https://w3id.org/np/o/ntemplate/>
prefix biodiv: <https://w3id.org/kpxl/biodiv/terms/>
prefix biolink: <https://w3id.org/biolink/vocab/>
select distinct ?np ?subj ?rel ?obj ?label ?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 {
?association a biolink:OrganismToOrganismAssociation .
?association biolink:predicate ?rel .
?association biolink:subject ?subj .
?association biolink:object ?obj .
?subj a ?subjtaxon .
?obj a ?objtaxon .
?subjtaxon biodiv:hasTaxonName ?subjname .
?objtaxon biodiv:hasTaxonName ?objname .
}
graph ?i {
?np dct:creator ?__creator_iri .
}
optional { graph ?i { ?subjname nt:hasLabelFromApi ?subjnameLabel } }
optional { graph ?i { ?objname nt:hasLabelFromApi ?objnameLabel } }
graph <http://purl.org/np/RAodaWZBY-yDEtl9reYazBfI-YVD5L4zPh8RrVFS0kbEo#assertion> {
?rel rdfs:label ?rellabel .
}
bind(coalesce(replace(str(?subjnameLabel), " - .*", ""), replace(str(?subjname), "^.*/([^/]*)$", "$1")) as ?subjx)
bind(coalesce(replace(str(?objnameLabel), " - .*", ""), replace(str(?objname), "^.*/([^/]*)$", "$1")) as ?objx)
bind(concat(?subjx, " ", ?rellabel, " ", ?objx) as ?label)
bind(replace(str(?rellabel), " - .*", "") as ?relx)
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 {
?somebody npx:retracts ?np .
}
}
}
order by desc(?date)