sub:assertion {
sub:get-fdo-by-id dct:description "This query returns the FDO info for a given FDO identifier" ;
dct:license <
http://www.apache.org/licenses/LICENSE-2.0> ;
a <
https://w3id.org/kpxl/grlc/grlc-query> ;
rdfs:label "Get FDO by ID" ;
<
https://w3id.org/kpxl/grlc/endpoint> <
https://w3id.org/np/l/nanopub-query-1.1/repo/type/f82fa5e467e6ba40c5d14402c3590f2ad8ed9a13e982133ab26ef1a889b34ebd> ;
<
https://w3id.org/kpxl/grlc/sparql> """prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix dct: <http://purl.org/dc/terms/>
prefix np: <http://www.nanopub.org/nschema#>
prefix npa: <http://purl.org/nanopub/admin/>
prefix npx: <http://purl.org/nanopub/x/>
select ?np ?label ?fdo ?creator ?date where {
bind(if(strstarts(?_fdoid, \"https://\") || strstarts(?_fdoid, \"http://\"), iri(?_fdoid), iri(concat(\"https://hdl.handle.net/\", str(?_fdoid)))) as ?fdo)
graph npa:graph {
?np npa:hasValidSignatureForPublicKey ?pubkey .
filter not exists { ?npx npx:invalidates ?np ; npa:hasValidSignatureForPublicKey ?pubkey . }
?np dct:created ?date .
?np npx:hasNanopubType <https://w3id.org/fdof/ontology#FAIRDigitalObject> .
?np npx:introduces ?fdo .
optional { ?np rdfs:label ?label }
optional { ?np npx:signedBy ?creator }
}
optional {
graph npa:graph {
?np_first npa:hasSubIri ?fdo .
bind(true as ?isSubIri)
}
}
optional {
filter(bound(?isSubIri))
graph npa:graph {
?np_first npa:hasValidSignatureForPublicKey ?pubkey .
}
graph npa:networkGraph {
?np npx:supersedes* ?np_first .
}
bind(true as ?isValidSubIri)
}
bind(if(bound(?isSubIri) && ?isSubIri, bound(?isValidSubIri) && ?isValidSubIri, true) as ?valid)
filter(?valid)
} order by desc(?date)""" .
}