sub:assertion {
sub:get-instances dct:description "This query returns the instances assigned to the given class." ;
dct:license <
http://www.apache.org/licenses/LICENSE-2.0> ;
a <
https://w3id.org/kpxl/grlc/grlc-query> ;
rdfs:label "Get instances for class" ;
<
https://w3id.org/kpxl/grlc/endpoint> <
https://w3id.org/np/l/nanopub-query-1.1/repo/full> ;
<
https://w3id.org/kpxl/grlc/sparql> """prefix dct: <http://purl.org/dc/terms/>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix np: <http://www.nanopub.org/nschema#>
prefix npa: <http://purl.org/nanopub/admin/>
prefix npx: <http://purl.org/nanopub/x/>
prefix nt: <https://w3id.org/np/o/ntemplate/>
select ?instance ?instanceLabel ?np ?npLabel ?date ?pubkey where {
graph ?g {
?instance a ?_class_iri .
}
graph npa:graph {
?np npa:hasValidSignatureForPublicKey ?pubkey .
filter not exists { ?npx npx:invalidates ?np ; npa:hasValidSignatureForPublicKey ?pubkey . }
?np npa:hasGraph ?g .
?np np:hasPublicationInfo ?i .
?np dct:created ?date .
optional { ?np rdfs:label ?npLabel . }
}
optional { graph ?g { ?instance rdfs:label ?instanceLabel1 . } }
optional { graph ?g { ?instance dct:title ?instanceLabel2 . } }
optional { graph ?i { ?instance rdfs:label ?instanceLabel3 . } }
optional { graph ?i { ?instance nt:hasLabelFromApi ?instanceLabel4 . } }
bind(coalesce(?instanceLabel1, ?instanceLabel2, ?instanceLabel3, ?instanceLabel4) as ?instanceLabel)
} limit 1000""" .
}