sub:assertion {
sub:get-fer-pref-ids dct:description "This query returns the preferred IDs of FAIR-Enabling Resources (FERs), including the references to previous nanopublications with older term definitions." ;
dct:license <
http://www.apache.org/licenses/LICENSE-2.0> ;
a <
https://w3id.org/kpxl/grlc/grlc-query> ;
rdfs:label "Get FER preferred IDs" ;
<
https://w3id.org/kpxl/grlc/endpoint> <
https://w3id.org/np/l/nanopub-query-1.1/repo/type/3ef5b11551ebc44e34f4bca614b387204447656ce195314532769ca7b20143fe> ;
<
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/>
prefix fip: <https://w3id.org/fair/fip/terms/>
select distinct ?resource_pref_id ?res ?reslabel ?res_np_date ?resourcetype ?res_np ?np_pre ?pubkey_hash ?np_pre_pubkey_hash where {
graph npa:graph {
?res_np npa:hasValidSignatureForPublicKey ?pubkey .
filter not exists { ?npx npx:invalidates ?res_np ; npa:hasValidSignatureForPublicKey ?pubkey . }
bind(sha256(?pubkey) as ?pubkey_hash) ## workaround due to https://github.com/knowledgepixels/nanopub-query/issues/14
?res_np npx:hasNanopubType fip:FAIR-Enabling-Resource .
?res_np (npx:introduces|npx:describes) ?resource_pref_id .
bind(replace(str(?resource_pref_id), \"^.*?(#|/)([^/#]*/?[^/#]*)/?$\", \"$2\") as ?res)
?res_np dct:created ?res_np_date .
?res_np rdfs:label ?reslabel .
bind( exists { ?res_np npx:hasNanopubType fip:Available-FAIR-Enabling-Resource } as ?available_resource )
bind( exists { ?res_np npx:hasNanopubType fip:FAIR-Enabling-Resource-to-be-Developed } as ?tobedeveloped_resource )
bind(if(?available_resource, fip:Available-FAIR-Enabling-Resource,
if(?tobedeveloped_resource, fip:FAIR-Enabling-Resource-to-be-Developed,
fip:FAIR-Enabling-Resource
)
) as ?resourcetype )
}
optional { select * { graph npa:networkGraph {
?res_np npx:supersedes* ?np_pre_x .
} } }
bind(coalesce(?np_pre_x, ?res_np) as ?np_pre)
bind(concat(str(?np_pre), \" \", ?pubkey_hash) as ?np_pre_pubkey_hash)
} order by ?resource_pref_id ?res_np""" .
}