-
Notifications
You must be signed in to change notification settings - Fork 0
/
get-nanopub-summary.rq
51 lines (49 loc) · 1.96 KB
/
get-nanopub-summary.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
#+ summary: Get a human-readable summary for a given nanopublication.
#+ method: GET
#+ pagination: 1000
#+ endpoint: https://query.knowledgepixels.com/repo/full
#+ 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#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix nt: <https://w3id.org/np/o/ntemplate/>
prefix pav: <http://purl.org/pav/>
prefix bibo: <http://purl.org/ontology/bibo/>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
select distinct ?np (coalesce(?signer, min(?creator)) as ?user) (group_concat(distinct ?creator; separator=' ') as ?creators) (group_concat(distinct ?author; separator=' ') as ?authors) (coalesce(?firstAuthor, min(?author), min(?creator)) as ?mainAuthor) (if(count(distinct ?author)>0,count(distinct ?author),count(distinct ?creator)) as ?authorCount) ?thing ?label ?date where {
graph npa:graph {
bind(replace(str(?_np_iri), "^.*[^a-zA-Z0-9-_](RA[a-zA-Z0-9-_]{43})$", "$1") as ?ac)
?np npa:artifactCode ?ac .
optional {<x:> <x:> ?_np_iri} # for grlc to pick up the placeholder
?np npa:hasHeadGraph ?h .
?np dct:created ?date .
?np npa:hasValidSignatureForPublicKey ?pubkey .
?np rdfs:label ?label .
?np np:hasPublicationInfo ?i .
?np dct:creator ?creator .
optional { ?np npx:signedBy ?signer . }
optional { ?np npx:introduces ?thing . }
}
optional {
graph ?i { ?np pav:authoredBy ?author . }
}
optional {
graph ?i {
?np bibo:authorList ?authorList .
?authorList ?hasElement ?author .
filter(strstarts(str(?hasElement), str(rdf:_)))
}
}
optional {
graph ?i {
?np bibo:authorList ?authorList .
?authorList rdf:_1 ?firstAuthor .
}
}
}
group by ?np ?signer ?thing ?label ?date ?firstAuthor
order by ?creator